Class: Eastrails::Commands::Init
- Includes:
- ThorExt
- Defined in:
- lib/eastrails/commands/init.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Methods inherited from Generator
Constructor Details
This class inherits a constructor from Eastrails::Commands::Base
Instance Method Details
#execute ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/eastrails/commands/init.rb', line 6 def execute params = parameter.args[1..-1] app_name = params.first rvm_cmd = "rvm use 1.9.3@#{app_name} --create" eastrails_bin = File.($0, Dir.pwd) addon_name = if params[1] && !params[1].start_with?("-") params.slice!(1) end theme = multiple_choice( "Please choose a theme: \n", [["Default", "default"], ["Kickstarter", "kickstarter"]] ) say_wizard "rails new #{app_name}" run_in_shell %{ #{rvm_cmd} gem install rails rails new #{app_name} } run_in_shell %{ cd #{app_name} git init git add -A git commit -m 'Initialization' } remove_file "#{app_name}/public/index.html" remove_file "#{app_name}/app/views/layouts/application.html.erb" directory("default/views", "#{app_name}/app/views") directory("default/controllers", "#{app_name}/app/controllers") copy_file("default/stylesheets/application-theme-#{theme}.css.scss", "#{app_name}/app/assets/stylesheets/application-theme.css.scss") run_in_shell %{ cd #{app_name} git add -A git commit -m 'Make root point to welcome#index' } uncomment_lines "#{app_name}/config/routes.rb", /root (:to|to:)/ if addon_name run_in_shell %{ cd #{app_name} #{rvm_cmd} #{eastrails_bin} add #{addon_name} } end create_file "#{params.first}/.rvmrc" do rvm_cmd + "\n" end end |