diff options
Diffstat (limited to 'railties/lib/rails/tasks')
| -rw-r--r-- | railties/lib/rails/tasks/annotations.rake | 4 | ||||
| -rw-r--r-- | railties/lib/rails/tasks/documentation.rake | 47 | ||||
| -rw-r--r-- | railties/lib/rails/tasks/framework.rake | 18 | ||||
| -rw-r--r-- | railties/lib/rails/tasks/misc.rake | 10 | ||||
| -rw-r--r-- | railties/lib/rails/tasks/tmp.rake | 10 |
5 files changed, 60 insertions, 29 deletions
diff --git a/railties/lib/rails/tasks/annotations.rake b/railties/lib/rails/tasks/annotations.rake index 10a9311b2d..9067b03d00 100644 --- a/railties/lib/rails/tasks/annotations.rake +++ b/railties/lib/rails/tasks/annotations.rake @@ -1,13 +1,13 @@ require 'rails/source_annotation_extractor' -desc "Enumerate all annotations" +desc "Enumerate all annotations (use notes:optimize, :fixme, :todo for focus)" task :notes do SourceAnnotationExtractor.enumerate "OPTIMIZE|FIXME|TODO", :tag => true end namespace :notes do ["OPTIMIZE", "FIXME", "TODO"].each do |annotation| - desc "Enumerate all #{annotation} annotations" + # desc "Enumerate all #{annotation} annotations" task annotation.downcase.intern do SourceAnnotationExtractor.enumerate annotation end diff --git a/railties/lib/rails/tasks/documentation.rake b/railties/lib/rails/tasks/documentation.rake index 19d1fd2354..492f05e3cc 100644 --- a/railties/lib/rails/tasks/documentation.rake +++ b/railties/lib/rails/tasks/documentation.rake @@ -1,13 +1,43 @@ require 'rake/rdoctask' +# Monkey-patch to remove redoc'ing and clobber descriptions to cut down on rake -T noise +class RDocTaskWithoutDescriptions < Rake::RDocTask + def define + task rdoc_task_name + + task rerdoc_task_name => [clobber_task_name, rdoc_task_name] + + task clobber_task_name do + rm_r rdoc_dir rescue nil + end + + task :clobber => [clobber_task_name] + + directory @rdoc_dir + task rdoc_task_name => [rdoc_target] + file rdoc_target => @rdoc_files + [Rake.application.rakefile] do + rm_r @rdoc_dir rescue nil + @before_running_rdoc.call if @before_running_rdoc + args = option_list + @rdoc_files + if @external + argstring = args.join(' ') + sh %{ruby -Ivendor vendor/rd #{argstring}} + else + require 'rdoc/rdoc' + RDoc::RDoc.new.document(args) + end + end + self + end +end + namespace :doc do def gem_path(gem_name) path = $LOAD_PATH.grep(/#{gem_name}[\w.-]*\/lib$/).first yield File.dirname(path) if path end - desc "Generate documentation for the application. Set custom template with TEMPLATE=/path/to/rdoc/template.rb or title with TITLE=\"Custom Title\"" - Rake::RDocTask.new("app") { |rdoc| + RDocTaskWithoutDescriptions.new("app") { |rdoc| rdoc.rdoc_dir = 'doc/app' rdoc.template = ENV['template'] if ENV['template'] rdoc.title = ENV['title'] || "Rails Application Documentation" @@ -17,9 +47,10 @@ namespace :doc do rdoc.rdoc_files.include('app/**/*.rb') rdoc.rdoc_files.include('lib/**/*.rb') } + Rake::Task['doc:app'].comment = "Generate docs for the app -- also availble doc:rails, doc:guides, doc:plugins (options: TEMPLATE=/rdoc-template.rb, TITLE=\"Custom Title\")" - desc 'Generate documentation for the Rails framework.' - Rake::RDocTask.new("rails") { |rdoc| + # desc 'Generate documentation for the Rails framework.' + RDocTaskWithoutDescriptions.new("rails") { |rdoc| rdoc.rdoc_dir = 'doc/api' rdoc.template = "#{ENV['template']}.rb" if ENV['template'] rdoc.title = "Rails Framework Documentation" @@ -71,15 +102,15 @@ namespace :doc do plugins = FileList['vendor/plugins/**'].collect { |plugin| File.basename(plugin) } - desc "Generate documentation for all installed plugins" + # desc "Generate documentation for all installed plugins" task :plugins => plugins.collect { |plugin| "doc:plugins:#{plugin}" } - desc "Remove plugin documentation" + # desc "Remove plugin documentation" task :clobber_plugins do rm_rf 'doc/plugins' rescue nil end - desc "Generate Rails guides" + # desc "Generate Rails Guides" task :guides do # FIXME: Reaching outside lib directory is a bad idea require File.expand_path('../../../../guides/rails_guides', __FILE__) @@ -89,7 +120,7 @@ namespace :doc do namespace :plugins do # Define doc tasks for each plugin plugins.each do |plugin| - desc "Generate documentation for the #{plugin} plugin" + # desc "Generate documentation for the #{plugin} plugin" task(plugin => :environment) do plugin_base = "vendor/plugins/#{plugin}" options = [] diff --git a/railties/lib/rails/tasks/framework.rake b/railties/lib/rails/tasks/framework.rake index ac510eee2e..e7bd0c38dc 100644 --- a/railties/lib/rails/tasks/framework.rake +++ b/railties/lib/rails/tasks/framework.rake @@ -1,22 +1,22 @@ namespace :rails do namespace :freeze do - desc "The rails:freeze:gems is deprecated, please use bundle install instead" + # desc "The rails:freeze:gems is deprecated, please use bundle install instead" task :gems do abort "The rails:freeze:gems is deprecated, please use bundle install instead" end - desc 'The freeze:edge command has been deprecated, specify the path setting in your app Gemfile instead and bundle install' + # desc 'The freeze:edge command has been deprecated, specify the path setting in your app Gemfile instead and bundle install' task :edge do abort 'The freeze:edge command has been deprecated, specify the path setting in your app Gemfile instead and bundle install' end end - desc 'The unfreeze command has been deprecated, please use bundler commands instead' + # desc 'The unfreeze command has been deprecated, please use bundler commands instead' task :unfreeze do abort 'The unfreeze command has been deprecated, please use bundler commands instead' end - desc "Update both configs, scripts and public/javascripts from Rails" + desc "Update both configs and public/javascripts from Rails (or use just update:javascripts or update:configs)" task :update => [ "update:configs", "update:javascripts", "update:scripts", "update:application_controller" ] desc "Applies the template supplied by LOCATION=/path/to/template" @@ -31,7 +31,7 @@ namespace :rails do end namespace :templates do - desc "Copy all the templates from rails to the application directory for customization. Already existing local copies will be overwritten" + # desc "Copy all the templates from rails to the application directory for customization. Already existing local copies will be overwritten" task :copy do generators_lib = File.expand_path("../../generators", __FILE__) project_templates = "#{Rails.root}/lib/templates" @@ -69,23 +69,23 @@ namespace :rails do end end - desc "Update config/boot.rb from your current rails install" + # desc "Update config/boot.rb from your current rails install" task :configs do invoke_from_app_generator :create_boot_file invoke_from_app_generator :create_config_files end - desc "Update Prototype javascripts from your current rails install" + # desc "Update Prototype javascripts from your current rails install" task :javascripts do invoke_from_app_generator :create_prototype_files end - desc "Adds new scripts to the application script/ directory" + # desc "Adds new scripts to the application script/ directory" task :scripts do invoke_from_app_generator :create_script_files end - desc "Rename application.rb to application_controller.rb" + # desc "Rename application.rb to application_controller.rb" task :application_controller do old_style = Rails.root + '/app/controllers/application.rb' new_style = Rails.root + '/app/controllers/application_controller.rb' diff --git a/railties/lib/rails/tasks/misc.rake b/railties/lib/rails/tasks/misc.rake index 0926707a04..c6c22d83bf 100644 --- a/railties/lib/rails/tasks/misc.rake +++ b/railties/lib/rails/tasks/misc.rake @@ -7,30 +7,30 @@ task :rails_env do end end -desc 'Generate a crytographically secure secret key. This is typically used to generate a secret for cookie sessions.' +desc 'Generate a crytographically secure secret key (this is typically used to generate a secret for cookie sessions).' task :secret do require 'active_support/secure_random' puts ActiveSupport::SecureRandom.hex(64) end -desc 'Explain the current environment' +desc 'List versions of all Rails frameworks and the environment' task :about do puts Rails::Info end namespace :time do namespace :zones do - desc 'Displays names of all time zones recognized by the Rails TimeZone class, grouped by offset. Results can be filtered with optional OFFSET parameter, e.g., OFFSET=-6' + desc 'Displays all time zones, also available: time:zones:us, time:zones:local -- filter with OFFSET parameter, e.g., OFFSET=-6' task :all do build_time_zone_list(:all) end - desc 'Displays names of US time zones recognized by the Rails TimeZone class, grouped by offset. Results can be filtered with optional OFFSET parameter, e.g., OFFSET=-6' + # desc 'Displays names of US time zones recognized by the Rails TimeZone class, grouped by offset. Results can be filtered with optional OFFSET parameter, e.g., OFFSET=-6' task :us do build_time_zone_list(:us_zones) end - desc 'Displays names of time zones recognized by the Rails TimeZone class with the same offset as the system local time' + # desc 'Displays names of time zones recognized by the Rails TimeZone class with the same offset as the system local time' task :local do require 'active_support' require 'active_support/time' diff --git a/railties/lib/rails/tasks/tmp.rake b/railties/lib/rails/tasks/tmp.rake index fea15058bb..3ee5452475 100644 --- a/railties/lib/rails/tasks/tmp.rake +++ b/railties/lib/rails/tasks/tmp.rake @@ -1,5 +1,5 @@ namespace :tmp do - desc "Clear session, cache, and socket files from tmp/" + desc "Clear session, cache, and socket files from tmp/ (narrow w/ tmp:sessions:clear, tmp:cache:clear, tmp:sockets:clear)" task :clear => [ "tmp:sessions:clear", "tmp:cache:clear", "tmp:sockets:clear"] desc "Creates tmp directories for sessions, cache, sockets, and pids" @@ -8,28 +8,28 @@ namespace :tmp do end namespace :sessions do - desc "Clears all files in tmp/sessions" + # desc "Clears all files in tmp/sessions" task :clear do FileUtils.rm(Dir['tmp/sessions/[^.]*']) end end namespace :cache do - desc "Clears all files and directories in tmp/cache" + # desc "Clears all files and directories in tmp/cache" task :clear do FileUtils.rm_rf(Dir['tmp/cache/[^.]*']) end end namespace :sockets do - desc "Clears all files in tmp/sockets" + # desc "Clears all files in tmp/sockets" task :clear do FileUtils.rm(Dir['tmp/sockets/[^.]*']) end end namespace :pids do - desc "Clears all files in tmp/pids" + # desc "Clears all files in tmp/pids" task :clear do FileUtils.rm(Dir['tmp/pids/[^.]*']) end |
