2006-02-26 23:38:39 -05:00
|
|
|
namespace :rails do
|
|
|
|
namespace :freeze do
|
2010-02-03 02:31:57 -05:00
|
|
|
desc "The rails:freeze:gems is deprecated, please use bundle install instead"
|
2006-02-26 23:38:39 -05:00
|
|
|
task :gems do
|
2010-02-03 02:31:57 -05:00
|
|
|
puts "The rails:freeze:gems is deprecated, please use bundle install instead"
|
2006-02-26 23:38:39 -05:00
|
|
|
end
|
2005-10-15 11:00:15 -04:00
|
|
|
|
2010-02-03 02:31:57 -05:00
|
|
|
desc 'The freeze:edge command has been deprecated, specify the path setting in your app Gemfile instead and bundle install'
|
2006-02-26 23:38:39 -05:00
|
|
|
task :edge do
|
2010-02-03 02:31:57 -05:00
|
|
|
puts 'The freeze:edge command has been deprecated, specify the path setting in your app Gemfile instead and bundle install'
|
2006-02-26 23:38:39 -05:00
|
|
|
end
|
2005-10-15 11:00:15 -04:00
|
|
|
end
|
|
|
|
|
2010-02-03 02:31:57 -05:00
|
|
|
desc 'The unfreeze command has been deprecated, please use bundler commands instead'
|
2006-02-26 23:38:39 -05:00
|
|
|
task :unfreeze do
|
2010-02-03 02:31:57 -05:00
|
|
|
puts 'The unfreeze command has been deprecated, please use bundler commands instead'
|
2006-02-26 23:38:39 -05:00
|
|
|
end
|
|
|
|
|
2006-04-07 14:21:52 -04:00
|
|
|
desc "Update both configs, scripts and public/javascripts from Rails"
|
2009-07-16 05:17:19 -04:00
|
|
|
task :update => [ "update:configs", "update:javascripts", "update:scripts", "update:application_controller" ]
|
2005-11-07 13:09:31 -05:00
|
|
|
|
2008-12-06 21:40:23 -05:00
|
|
|
desc "Applies the template supplied by LOCATION=/path/to/template"
|
|
|
|
task :template do
|
2009-04-20 12:01:32 -04:00
|
|
|
template = ENV["LOCATION"]
|
|
|
|
template = File.expand_path(template) if template !~ %r{\A[A-Za-z][A-Za-z0-9+\-\.]*://}
|
2009-07-16 05:17:19 -04:00
|
|
|
|
2010-01-16 14:35:39 -05:00
|
|
|
require 'rails/generators'
|
2010-01-18 12:22:55 -05:00
|
|
|
require 'generators/rails/app/app_generator'
|
2010-01-16 14:35:39 -05:00
|
|
|
generator = Rails::Generators::AppGenerator.new [ Rails.root ], {}, :destination_root => Rails.root
|
2009-07-16 05:17:19 -04:00
|
|
|
generator.apply template, :verbose => false
|
2008-12-06 21:40:23 -05:00
|
|
|
end
|
|
|
|
|
2006-02-26 23:38:39 -05:00
|
|
|
namespace :update do
|
2009-07-16 05:17:19 -04:00
|
|
|
def invoke_from_app_generator(method)
|
2009-12-01 16:18:14 -05:00
|
|
|
require 'rails/generators'
|
2010-01-18 12:22:55 -05:00
|
|
|
require 'generators/rails/app/app_generator'
|
2006-02-26 23:38:39 -05:00
|
|
|
|
2009-07-16 05:17:19 -04:00
|
|
|
generator = Rails::Generators::AppGenerator.new ["rails"], { :with_dispatchers => true },
|
2009-10-16 15:49:39 -04:00
|
|
|
:destination_root => Rails.root
|
2009-07-16 05:17:19 -04:00
|
|
|
generator.invoke(method)
|
2005-11-07 13:09:31 -05:00
|
|
|
end
|
2006-04-07 14:21:52 -04:00
|
|
|
|
2009-12-01 16:27:59 -05:00
|
|
|
desc "Update config/boot.rb from your current rails install"
|
|
|
|
task :configs do
|
|
|
|
invoke_from_app_generator :create_boot_file
|
2009-12-01 16:37:12 -05:00
|
|
|
invoke_from_app_generator :create_config_files
|
2009-12-01 16:27:59 -05:00
|
|
|
end
|
|
|
|
|
2009-07-16 05:17:19 -04:00
|
|
|
desc "Update Prototype javascripts from your current rails install"
|
|
|
|
task :javascripts do
|
|
|
|
invoke_from_app_generator :create_prototype_files
|
|
|
|
end
|
|
|
|
|
2010-02-03 02:31:57 -05:00
|
|
|
desc "Adds new scripts to the application script/ directory"
|
2009-07-16 05:17:19 -04:00
|
|
|
task :scripts do
|
|
|
|
invoke_from_app_generator :create_script_files
|
|
|
|
end
|
|
|
|
|
2008-11-23 07:39:30 -05:00
|
|
|
desc "Rename application.rb to application_controller.rb"
|
|
|
|
task :application_controller do
|
2009-10-16 15:49:39 -04:00
|
|
|
old_style = Rails.root + '/app/controllers/application.rb'
|
|
|
|
new_style = Rails.root + '/app/controllers/application_controller.rb'
|
2008-11-23 07:39:30 -05:00
|
|
|
if File.exists?(old_style) && !File.exists?(new_style)
|
|
|
|
FileUtils.mv(old_style, new_style)
|
|
|
|
puts "#{old_style} has been renamed to #{new_style}, update your SCM as necessary"
|
|
|
|
end
|
|
|
|
end
|
2005-11-07 13:09:31 -05:00
|
|
|
end
|
2006-03-13 13:45:40 -05:00
|
|
|
end
|