lib/spree_cmd/installer.rb in spree_cmd-1.1.6 vs lib/spree_cmd/installer.rb in spree_cmd-1.2.0.rc1
- old
+ new
@@ -22,10 +22,13 @@
class_option :git, :type => :string, :desc => 'Spree gem git url'
class_option :ref, :type => :string, :desc => 'Spree gem git ref'
class_option :branch, :type => :string, :desc => 'Spree gem git branch'
class_option :tag, :type => :string, :desc => 'Spree gem git tag'
+ class_option :precompile_assets, :type => :boolean, :default => true,
+ :desc => 'Precompile spree assets to public/assets'
+
def verify_rails
unless rails_project?
say "#{@app_path} is not a rails project."
exit 1
end
@@ -58,10 +61,11 @@
end
end
def ask_questions
@install_default_gateways = ask_with_default('Would you like to install the default gateways?')
+ @install_default_auth = ask_with_default('Would you like to install the default authentication system?')
if options[:skip_install_data]
@run_migrations = false
@load_seed_data = false
@load_sample_data = false
@@ -74,44 +78,52 @@
@load_seed_data = false
@load_sample_data = false
end
end
- if @load_seed_data
- @admin_email = ask_string('Admin Email', 'spree@example.com', /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i)
- @admin_password = ask_string('Admin Password', 'spree123', /^\S{5,32}$/)
- end
+ @precompile_assets = options[:precompile_assets] && ask_with_default('Would you like to precompile assets?')
end
def add_gems
- inside @app_path do
+ inside @app_path do
gem :spree, @spree_gem_options
if @install_default_gateways
gem :spree_usa_epay
gem :spree_skrill
end
+ if @install_default_auth
+ gem :spree_auth_devise, :git => "git://github.com/radar/spree_auth_devise"
+ end
+
run 'bundle install', :capture => true
end
end
def initialize_spree
spree_options = []
spree_options << "--migrate=#{@run_migrations}"
spree_options << "--seed=#{@load_seed_data}"
spree_options << "--sample=#{@load_sample_data}"
spree_options << "--auto_accept" if options[:auto_accept]
- spree_options << "--admin_email=#{@admin_email}" if @admin_email
- spree_options << "--admin_password=#{@admin_password}" if @admin_password
inside @app_path do
run "rails generate spree:install #{spree_options.join(' ')}", :verbose => false
end
end
+ def precompile_assets
+ if @precompile_assets
+ say_status :precompiling, 'assets'
+ inside @app_path do
+ run 'bundle exec rake assets:precompile', :verbose => false
+ end
+ end
+ end
+
private
def gem(name, gem_options={})
say_status :gemfile, name
parts = ["'#{name}'"]
@@ -167,18 +179,12 @@
def windows?
%r{msdos|mswin|djgpp|mingw} === RbConfig::CONFIG['host_os']
end
def image_magick_installed?
- cmd = 'identify -version'
- if RUBY_PLATFORM =~ /mswin/ #windows
- cmd += " >nul"
- else
- cmd += " >/dev/null"
- end
# true if command executed succesfully
# false for non zero exit status
# nil if command execution fails
- system(cmd)
+ system('identify -version')
end
end
end