Class: SpreeCmd::Installer
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- SpreeCmd::Installer
- Includes:
- Thor::Actions
- Defined in:
- lib/spree_cmd/installer.rb
Instance Method Summary collapse
- #add_gems ⇒ Object
- #ask_questions ⇒ Object
- #initialize_spree ⇒ Object
- #prepare_options ⇒ Object
- #verify_image_magick ⇒ Object
- #verify_rails ⇒ Object
Instance Method Details
#add_gems ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/spree_cmd/installer.rb', line 92 def add_gems inside @app_path do gem :spree, @spree_gem_options if @install_default_gateways && @spree_gem_options[:branch] gem :spree_gateway, github: 'spree/spree_gateway', branch: @spree_gem_options[:branch] elsif @install_default_gateways gem :spree_gateway, github: 'spree/spree_gateway', branch: '2-4-stable' end if @install_default_auth && @spree_gem_options[:branch] gem :spree_auth_devise, github: 'spree/spree_auth_devise', branch: @spree_gem_options[:branch] elsif @install_default_auth gem :spree_auth_devise, github: 'spree/spree_auth_devise', branch: '2-4-stable' end run 'bundle install', :capture => true end end |
#ask_questions ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/spree_cmd/installer.rb', line 63 def ask_questions @install_default_gateways = ask_with_default('Would you like to install the default gateways? (Recommended)') @install_default_auth = ask_with_default('Would you like to install the default authentication system?') if @install_default_auth @user_class = "Spree::User" else @user_class = ask("What is the name of the class representing users within your application? [User]") if @user_class.blank? @user_class = "User" end end if [:skip_install_data] @run_migrations = false @load_seed_data = false @load_sample_data = false else @run_migrations = ask_with_default('Would you like to run the migrations?') if @run_migrations @load_seed_data = ask_with_default('Would you like to load the seed data?') @load_sample_data = ask_with_default('Would you like to load the sample data?') else @load_seed_data = false @load_sample_data = false end end end |
#initialize_spree ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/spree_cmd/installer.rb', line 113 def initialize_spree = [] << "--migrate=#{@run_migrations}" << "--seed=#{@load_seed_data}" << "--sample=#{@load_sample_data}" << "--user_class=#{@user_class}" << "--auto_accept" if [:auto_accept] inside @app_path do run "rails generate spree:install #{.join(' ')}", :verbose => false end end |
#prepare_options ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/spree_cmd/installer.rb', line 42 def @spree_gem_options = {} if [:edge] || [:branch] @spree_gem_options[:git] = 'https://github.com/spree/spree.git' elsif [:path] @spree_gem_options[:path] = [:path] elsif [:git] @spree_gem_options[:git] = [:git] @spree_gem_options[:ref] = [:ref] if [:ref] @spree_gem_options[:tag] = [:tag] if [:tag] elsif [:version] @spree_gem_options[:version] = [:version] else version = Gem.loaded_specs['spree_cmd'].version @spree_gem_options[:version] = version.to_s end @spree_gem_options[:branch] = [:branch] if [:branch] end |
#verify_image_magick ⇒ Object
35 36 37 38 39 40 |
# File 'lib/spree_cmd/installer.rb', line 35 def verify_image_magick unless image_magick_installed? say "Image magick must be installed." exit 1 end end |
#verify_rails ⇒ Object
28 29 30 31 32 33 |
# File 'lib/spree_cmd/installer.rb', line 28 def verify_rails unless rails_project? say "#{@app_path} is not a rails project." exit 1 end end |