Skip to content

Instantly share code, notes, and snippets.

@kyanny
Created July 1, 2011 11:43
Show Gist options
  • Save kyanny/1058373 to your computer and use it in GitHub Desktop.
Save kyanny/1058373 to your computer and use it in GitHub Desktop.
Rakefile2
task :default => :test
task :environment do
require(File.join(RAILS_ROOT, 'config', 'environment'))
end
require 'rails_generator/secret_key_generator'
desc 'Generate a crytographically secure secret key. This is typically used to generate a secret for cookie sessions. Pass a unique identifier to the generator using ID="some unique identifier" for greater security.'
task :secret do
puts Rails::SecretKeyGenerator.new(ENV['ID']).generate_secret
end
$VERBOSE = nil
# Load Rails rakefile extensions
Dir["#{File.dirname(__FILE__)}/*.rake"].each { |ext| load ext }
# Load any custom rakefile extensions
Dir["#{RAILS_ROOT}/lib/tasks/**/*.rake"].sort.each { |ext| load ext }
Dir["#{RAILS_ROOT}/vendor/plugins/*/**/tasks/**/*.rake"].sort.each { |ext| load ext }
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
require 'tasks/rails'
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
require(File.join(File.dirname(__FILE__), 'config', 'boot'))
require 'rake'
require 'rake/testtask'
require 'rake/rdoctask'
$:.each do |load_path|
rails_task_loader_file = 'tasks/rails.rb'
rails_task_loader_path = File.expand_path(File.join(load_path, rails_task_loader_file))
if File.exist?(rails_task_loader_path)
rails_task_dir_path = File.dirname(rails_task_loader_path)
rails_task_environment = File.join(rails_task_dir_path, 'misc.rake')
load rails_task_environment
end
end
# Load any custom rakefile extensions
Dir["#{RAILS_ROOT}/lib/tasks/**/*.rake"].sort.each { |ext| load ext }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment