Class: Locomotive::Cmd::Installer
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Locomotive::Cmd::Installer
- Includes:
- Thor::Actions
- Defined in:
- lib/locomotive_cmd/installer.rb
Instance Method Summary collapse
-
#ask_user_if_heroku_and_the_rest ⇒ Object
HEROKU PART ####.
- #create_rails_app ⇒ Object
- #generate_options_hash ⇒ Object
- #heroku ⇒ Object
- #initialize_locomotive ⇒ Object
-
#multi_site ⇒ Object
MULTI SITE PART ###.
- #replace_gemfile ⇒ Object
-
#send_to_heroku ⇒ Object
PUSH TO HEROKU ###.
- #set_gems ⇒ Object
- #show_readme ⇒ Object
- #verify_rails ⇒ Object
Instance Method Details
#ask_user_if_heroku_and_the_rest ⇒ Object
HEROKU PART ####
65 66 67 68 69 70 |
# File 'lib/locomotive_cmd/installer.rb', line 65 def ask_user_if_heroku_and_the_rest @opts.heroku = yes?("Deploy to heroku?", :yellow) if @opts.heroku end end |
#create_rails_app ⇒ Object
32 33 34 35 36 37 |
# File 'lib/locomotive_cmd/installer.rb', line 32 def create_rails_app say :create, @app_path if @opts.verbose rails_cmd = "rails new #{@app_path} --skip-active-record --skip-test-unit --skip-javascript --skip-bundle" run_silently rails_cmd say 'Create Rails app: Done', :green end |
#generate_options_hash ⇒ Object
25 26 27 28 29 30 |
# File 'lib/locomotive_cmd/installer.rb', line 25 def @opts = OpenStruct.new @opts.version = [:version] @opts.verbose = [:verbose] @opts.app_name = [:app_name] end |
#heroku ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/locomotive_cmd/installer.rb', line 72 def heroku if @opts.heroku insert_ruby_version_in_gemfile install_bundler_pre set_gems_for_heroku bundle_install configure_locomotive_for_heroku edit_locomotive_config_file precompiling_assets end end |
#initialize_locomotive ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/locomotive_cmd/installer.rb', line 53 def initialize_locomotive say_status :locomotive, :initialize if @opts.verbose inside @app_path do run_silently "rails generate locomotive:install" end say 'Adding Locomotive: Done', :green end |
#multi_site ⇒ Object
MULTI SITE PART ###
88 89 90 91 92 93 94 95 96 |
# File 'lib/locomotive_cmd/installer.rb', line 88 def multi_site @opts.multi_site = yes?('Will you use the multi-site feature?', :yellow) if @opts.multi_site @opts.domain_name = ask('What is your base domain name for the multi sites?', :yellow) set_domain_name_in_locomotive add_domains_to_heroku_if_needed say "Don't forget for local dev to edit /ect/hosts or use Pow according to : http://doc.locomotivecms.com/guides/multisites", :green end end |
#replace_gemfile ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/locomotive_cmd/installer.rb', line 39 def replace_gemfile inside @app_path do remove_file 'Gemfile', verbose: @opts.verbose end gemfile = 'Gemfile' template 'Gemfile', "#{@app_path}/Gemfile", verbose: @opts.verbose end |
#send_to_heroku ⇒ Object
PUSH TO HEROKU ###
102 103 104 105 106 |
# File 'lib/locomotive_cmd/installer.rb', line 102 def send_to_heroku if @opts.heroku launch_it end end |
#set_gems ⇒ Object
48 49 50 51 |
# File 'lib/locomotive_cmd/installer.rb', line 48 def set_gems set_gems_from_config_group 'gems' bundle_install end |
#show_readme ⇒ Object
108 109 110 |
# File 'lib/locomotive_cmd/installer.rb', line 108 def show_readme puts File.read(find_in_source_paths('README')) unless @opts.verbose end |
#verify_rails ⇒ Object
18 19 20 21 22 23 |
# File 'lib/locomotive_cmd/installer.rb', line 18 def verify_rails if existing_project? say "#{@app_path} exists already" exit 1 end end |