Sha256: 63810d5b6950491f6124ffd3c244eea7a6a39429d2b46a9d6f8c424c5290573d
Contents?: true
Size: 1.77 KB
Versions: 2
Compression:
Stored size: 1.77 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_required_gems inject_into_file 'Gemfile', "\ngem 'yaml_db'", :after => "gem 'blazing'" end 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 config.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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
shoestrap-0.4.1 | lib/generators/shoestrap/deployment_generator.rb |
shoestrap-0.4.0 | lib/generators/shoestrap/deployment_generator.rb |