lib/spree_cmd/installer.rb in spree_cmd-2.3.13 vs lib/spree_cmd/installer.rb in spree_cmd-2.4.0.rc1
- old
+ new
@@ -40,39 +40,40 @@
end
def prepare_options
@spree_gem_options = {}
- if options[:edge]
+ if options[:edge] || options[:branch]
@spree_gem_options[:git] = 'https://github.com/spree/spree.git'
elsif options[:path]
@spree_gem_options[:path] = options[:path]
elsif options[:git]
@spree_gem_options[:git] = options[:git]
@spree_gem_options[:ref] = options[:ref] if options[:ref]
- @spree_gem_options[:branch] = options[:branch] if options[:branch]
@spree_gem_options[:tag] = options[:tag] if options[:tag]
elsif options[:version]
@spree_gem_options[:version] = options[:version]
else
version = Gem.loaded_specs['spree_cmd'].version
@spree_gem_options[:version] = version.to_s
end
+
+ @spree_gem_options[:branch] = options[:branch] if options[:branch]
end
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
+ end
if options[:skip_install_data]
@run_migrations = false
@load_seed_data = false
@load_sample_data = false
@@ -91,16 +92,20 @@
def add_gems
inside @app_path do
gem :spree, @spree_gem_options
- if @install_default_gateways
- gem :spree_gateway, :git => "https://github.com/spree/spree_gateway.git", :branch => "2-3-stable"
+ 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'
end
- if @install_default_auth
- gem :spree_auth_devise, :git => "https://github.com/spree/spree_auth_devise.git", :branch => "2-3-stable"
+ 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'
end
run 'bundle install', :capture => true
end
end
@@ -122,10 +127,10 @@
def gem(name, gem_options={})
say_status :gemfile, name
parts = ["'#{name}'"]
parts << ["'#{gem_options.delete(:version)}'"] if gem_options[:version]
- gem_options.each { |key, value| parts << ":#{key} => '#{value}'" }
+ gem_options.each { |key, value| parts << "#{key}: '#{value}'" }
append_file 'Gemfile', "\ngem #{parts.join(', ')}", :verbose => false
end
def ask_with_default(message, default = 'yes')
return true if options[:auto_accept]