Class: Frame::Generators::SecretGenerator
- Includes:
- Rails::Generators::Migration
- Defined in:
- lib/generators/frame/secret/secret_generator.rb
Instance Method Summary collapse
-
#create_database ⇒ Object
def opt puts options.force end.
- #create_rake_file ⇒ Object
- #create_secret_token ⇒ Object
Methods inherited from Base
Instance Method Details
#create_database ⇒ Object
def opt
puts .force
end
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/generators/frame/secret/secret_generator.rb', line 17 def create_database config = YAML.load_file(File.(File.join(File.dirname(__FILE__), 'templates', 'database.yml'))) ['development','test','production'].each do |i| config["#{i}"]["database"] = Rails.application.class.parent_name.downcase config["#{i}"]["username"] = "#{Rails.application.class.parent_name.downcase}admin" end create_file 'config/database.yml', YAML.dump(config) end |
#create_rake_file ⇒ Object
33 34 35 36 37 |
# File 'lib/generators/frame/secret/secret_generator.rb', line 33 def create_rake_file #@title = Rails.application.class.parent_name.downcase template('Rakefile') gsub_file 'Rakefile', /Rails\.application\.class\.parent_name\:\:Application\.load_tasks/, "#{Rails.application.class.parent_name}::Application.load_tasks" end |
#create_secret_token ⇒ Object
28 29 30 31 |
# File 'lib/generators/frame/secret/secret_generator.rb', line 28 def create_secret_token secret = `rake secret`.rstrip initializer("secret_token.rb", "#{Rails.application.class.parent_name}::Application.config.secret_token = '#{secret}'") end |