Sha256: 6bd6b70ac7d7aa1e1d73aea7a4df5afe2d2c253ac343dc8622899b074a8b5fe5
Contents?: true
Size: 1.67 KB
Versions: 1
Compression:
Stored size: 1.67 KB
Contents
require 'rails/generators' require 'pathname' module Shoestrap class DeploymentGenerator < Rails::Generators::Base source_root File.expand_path('../templates/deployment', __FILE__) # TODO: enable js runtime in Gemfile def add_unicorn_config copy_file 'unicorn.rb', 'config/unicorn.rb' end def add_database_config template 'database.yml.erb', 'config/database.yml', :force => true end def add_deployment_task inject_into_file 'Rakefile', "\nrequire 'shoestrap/tasks/rails'\n", :after => 'Application.load_tasks' remove_file 'lib/tasks/deployment.rake' end def add_airbrake_config copy_file 'airbrake.rb', 'config/initializers/airbrake.rb' end def add_app_name inject_into_file 'config/application.rb', "\n Rails.configuration.app_name = '#{app_name}'\n", :after => 'class Application < Rails::Application' end private def app_name @app_name ||= ask("What is this app's name?") # prevent screwing up deployment scripts by mistaking # app identifier with app name ;-) @app_name.gsub!('_production', '') @app_name.gsub!('_staging', '') @app_name end def db_credentials_production '<%= begin IO.read("#{ENV[\'HOME\']}/.config/' + app_name + '_production/db") rescue "" end %>' end def db_credentials_staging '<%= begin IO.read("#{ENV[\'HOME\']}/.config/' + app_name + '_staging/db") rescue "" end %>' end def restart_unicorn_command '#{ENV[\'HOME\']}/unicorn.sh upgrade ' + app_name + '_#{ENV[\'RAILS_ENV\']}' end def restart_monit_command 'monit -g ' + app_name + '_#{ENV[\'RAILS_ENV\']} monitor' end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
shoestrap-0.3.0.pre | lib/generators/shoestrap/deployment_generator.rb |