spree_cmd 1.1.1 → 1.1.2.rc1

Sign up to get free protection for your applications and to get access to all the features.
@@ -51,7 +51,7 @@ module SpreeCmd
51
51
  end
52
52
 
53
53
  def spree_version
54
- '1.1.1'
54
+ '1.1.2.rc1'
55
55
  end
56
56
 
57
57
  def use_prefix(prefix)
@@ -1,3 +1,5 @@
1
+ require 'rbconfig'
2
+
1
3
  module SpreeCmd
2
4
 
3
5
  class Installer < Thor::Group
@@ -26,9 +28,16 @@ module SpreeCmd
26
28
  :desc => 'Precompile spree assets to public/assets'
27
29
 
28
30
  def verify_rails
29
- unless is_rails_project?
31
+ unless rails_project?
30
32
  say "#{@app_path} is not a rails project."
31
- exit(1)
33
+ exit 1
34
+ end
35
+ end
36
+
37
+ def verify_image_magick
38
+ unless image_magick_installed?
39
+ say "Image magick must be installed."
40
+ exit 1
32
41
  end
33
42
  end
34
43
 
@@ -71,7 +80,7 @@ module SpreeCmd
71
80
  @admin_email = ask_string('Admin Email', 'spree@example.com', /^([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})$/i)
72
81
  @admin_password = ask_string('Admin Password', 'spree123', /^\S{5,32}$/)
73
82
  end
74
- @precompile_assets = options[:precompile_assets] ? ask_with_default('Would you like to precompile assets?') : false
83
+ @precompile_assets = options[:precompile_assets] && ask_with_default('Would you like to precompile assets?')
75
84
  end
76
85
 
77
86
  def add_gems
@@ -139,7 +148,7 @@ module SpreeCmd
139
148
  until valid
140
149
  response = ask "#{message} [#{default}]"
141
150
  response = default if response.empty?
142
- valid = (response =~ valid_regex)
151
+ valid = (valid_regex === response)
143
152
  end
144
153
  response
145
154
  end
@@ -148,17 +157,32 @@ module SpreeCmd
148
157
  say :create, @app_path
149
158
 
150
159
  rails_cmd = "rails new #{@app_path} --skip-bundle"
151
- if options[:template]
152
- rails_cmd += " -m #{options[:template]}"
153
- end
154
- if options[:database]
155
- rails_cmd += " -d #{options[:database]}"
156
- end
160
+ rails_cmd << " -m #{options[:template]}" if options[:template]
161
+ rails_cmd << " -d #{options[:database]}" if options[:database]
157
162
  run(rails_cmd)
158
163
  end
159
164
 
160
- def is_rails_project?
165
+ def rails_project?
161
166
  File.exists? File.join(@app_path, 'script', 'rails')
162
167
  end
168
+
169
+ def linux?
170
+ /linux/i === RbConfig::CONFIG['host_os']
171
+ end
172
+
173
+ def mac?
174
+ /darwin/i === RbConfig::CONFIG['host_os']
175
+ end
176
+
177
+ def windows?
178
+ %r{msdos|mswin|djgpp|mingw} === RbConfig::CONFIG['host_os']
179
+ end
180
+
181
+ def image_magick_installed?
182
+ # true if command executed succesfully
183
+ # false for non zero exit status
184
+ # nil if command execution fails
185
+ system('identify -version')
186
+ end
163
187
  end
164
188
  end
@@ -1,7 +1,8 @@
1
1
  module <%= class_name %>
2
2
  class Engine < Rails::Engine
3
- engine_name '<%= file_name %>'
3
+ require 'spree/core'
4
4
  isolate_namespace Spree
5
+ engine_name '<%= file_name %>'
5
6
 
6
7
  config.autoload_paths += %W(#{config.root}/lib)
7
8
 
@@ -21,7 +21,7 @@ module <%= class_name %>
21
21
  if res == '' || res.downcase == 'y'
22
22
  run 'bundle exec rake db:migrate'
23
23
  else
24
- puts 'Skiping rake db:migrate, don\'t forget to run it!'
24
+ puts 'Skipping rake db:migrate, don\'t forget to run it!'
25
25
  end
26
26
  end
27
27
  end
data/spree_cmd.gemspec CHANGED
@@ -20,4 +20,6 @@ Gem::Specification.new do |s|
20
20
  s.require_paths = ["lib"]
21
21
 
22
22
  s.add_development_dependency 'rspec'
23
+ # Temporary hack until https://github.com/wycats/thor/issues/234 is fixed
24
+ s.add_dependency 'thor', '0.14.6'
23
25
  end
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree_cmd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
5
- prerelease:
4
+ version: 1.1.2.rc1
5
+ prerelease: 6
6
6
  platform: ruby
7
7
  authors:
8
8
  - Chris Mar
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-16 00:00:00.000000000 Z
12
+ date: 2012-06-25 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70184006757120 !ruby/object:Gem::Requirement
16
+ requirement: &70189203150080 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,18 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70184006757120
24
+ version_requirements: *70189203150080
25
+ - !ruby/object:Gem::Dependency
26
+ name: thor
27
+ requirement: &70189203149140 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - =
31
+ - !ruby/object:Gem::Version
32
+ version: 0.14.6
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *70189203149140
25
36
  description: tools to create new Spree stores and extensions
26
37
  email:
27
38
  - chris@spreecommerce.com
@@ -75,16 +86,13 @@ required_ruby_version: !ruby/object:Gem::Requirement
75
86
  version: '0'
76
87
  segments:
77
88
  - 0
78
- hash: 1521068613993842786
89
+ hash: -4114835332715602194
79
90
  required_rubygems_version: !ruby/object:Gem::Requirement
80
91
  none: false
81
92
  requirements:
82
- - - ! '>='
93
+ - - ! '>'
83
94
  - !ruby/object:Gem::Version
84
- version: '0'
85
- segments:
86
- - 0
87
- hash: 1521068613993842786
95
+ version: 1.3.1
88
96
  requirements: []
89
97
  rubyforge_project: spree_cmd
90
98
  rubygems_version: 1.8.10