spree 0.40.4 → 0.50.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of spree might be problematic. Click here for more details.

data/README.md CHANGED
@@ -73,7 +73,7 @@ The source code is essentially a collection of gems. Spree is meant to be run w
73
73
 
74
74
  1. Clone the git repo
75
75
 
76
- git clone git://github.com/railsdog/spree.git spree
76
+ git clone git://github.com/spree/spree.git spree
77
77
  cd spree
78
78
 
79
79
  2. Install the gem dependencies
@@ -92,29 +92,39 @@ The source code is essentially a collection of gems. Spree is meant to be run w
92
92
  Running Tests
93
93
  -------------
94
94
 
95
+ If you want to run all the tests across all the gems then
96
+
97
+ $ cd spree
98
+ $ rake spec #=> 'this will run spec tests for all the gems'
99
+ $ rake cucumber #=> 'this will run cucumber tests for all the gems'
100
+ $ rake #=> 'this will run both spec and cucumber tests for all the gems'
101
+
95
102
  Each gem contains its own series of tests, and for each directory, you need to do a quick one-time
96
103
  creation of a test application and then you can use it to run the tests. For example, to run the
97
104
  tests for the core project.
98
105
 
99
- rails new testapp -m spec/test_template.rb -T -J
100
- cd testapp
101
- rails g spree_core:install
102
- rake db:migrate db:seed db:test:prepare
106
+ $ cd core
107
+ $ rake test_app
108
+ $ rake spec
109
+ $ rake cucumber
110
+ $ rake #=> 'this will run both spec and cucumber tests for the gem'
103
111
 
104
- Then run the tests
112
+ # If you want to run specs for only a single spec file
113
+ $ bundle exec rspec spec/models/state_spec.rb
105
114
 
106
- rspec spec
115
+ # If you want to run a particular line of spec
116
+ $ bundle exec rspec spec/models/state_spec.rb:7
107
117
 
108
- Note that each project has its own generator for "installing." This basically sets up the test
109
- app with what it needs to run (primarily migrations.) So for the spree_auth gem, for example,
110
- you would use the following
118
+ # If you want to run a single cucumber feature
119
+ # bundle exec cucumber features/admin/orders.feature --require features
111
120
 
112
- rails g spree_auth:install
121
+ # If you want to run a particular scenario then include the line number
122
+ # bundle exec cucumber features/admin/orders.feature:3 --require features
113
123
 
114
124
 
115
125
  Contributing
116
126
  ------------
117
127
 
118
- Spree is an open source project. We encourage contributions. Please see the [contributors guidelines](http://spreecommerce.com/documentation/contributing_to_spree.html) before contributing.
128
+ Spree is an open source project. We encourage contributions. Please see the [contributors guidelines](http://spreecommerce.com/documentation/contributing_to_spree.html) before contributing.
119
129
 
120
130
  The Github team has also been kind enough to write up some great [documentation](http://help.github.com/pull-requests/) on working with pull requests. Contributions should be performed on [topic branches](http://progit.org/book/ch3-4.html) in your personal forks - just issue your pull requests from there. We're also asking that you continue to log important issues for non-trivial patches in our [lighthouse repository](http://railsdog.lighthouseapp.com/projects/31096-spree). You can just link the pull request in the ticket (and link the ticket in the pull request.)
@@ -4,6 +4,10 @@ module Spree
4
4
  module Generators
5
5
  class TestAppGenerator < Rails::Generators::Base
6
6
 
7
+ class << self
8
+ attr_accessor :verbose
9
+ end
10
+
7
11
  class_option :app_name, :type => :string,
8
12
  :desc => "The name of the test rails app to generate. Defaults to test_app.",
9
13
  :default => "test_app"
@@ -13,10 +17,20 @@ module Spree
13
17
  end
14
18
 
15
19
  def generate_app
16
- remove_directory_if_exists("spec/#{test_app}")
17
- inside "spec" do
18
- run "rails new #{test_app} -GJT --skip-gemfile"
19
- end
20
+ silence_stream(STDOUT) {
21
+ remove_directory_if_exists("spec/#{test_app}")
22
+ inside "spec" do
23
+ run "rails new #{test_app} -GJTq --skip-gemfile"
24
+ end
25
+ }
26
+ end
27
+
28
+ def create_rspec_gemfile
29
+ # newer versions of rspec require a Gemfile in the local gem dirs so create one there as well as in spec/test_app
30
+ silence_stream(STDOUT) {
31
+ template "Gemfile", :force => true
32
+ remove_file "Gemfile.lock"
33
+ }
20
34
  end
21
35
 
22
36
  def create_root
@@ -24,64 +38,61 @@ module Spree
24
38
  end
25
39
 
26
40
  def remove_unneeded_files
27
- remove_file "doc"
28
- remove_file "lib/tasks"
29
- remove_file "public/images/rails.png"
30
- remove_file "public/index.html"
31
- remove_file "README"
32
- remove_file "vendor"
41
+ silence_stream(STDOUT) {
42
+ remove_file "doc"
43
+ remove_file "lib/tasks"
44
+ remove_file "public/images/rails.png"
45
+ remove_file "public/index.html"
46
+ remove_file "README"
47
+ remove_file "vendor"
48
+ }
33
49
  end
34
50
 
35
51
  def replace_gemfile
36
- template "Gemfile"
52
+ silence_stream(STDOUT) {
53
+ template "Gemfile"
54
+ }
37
55
  end
38
56
 
39
57
  def setup_environments
40
- template "config/environments/cucumber.rb"
41
- append_file "config/environments/test.rb" do
42
- <<-constantz
43
- CART = "cart"
44
- ADDRESS = "address"
45
- DELIVERY = "delivery"
46
- PAYMENT = "payment"
47
- CONFIRM = "confirm"
48
- COMPLETE = "complete"
49
- CANCELED = "canceled"
50
- RETURNED = "returned"
51
- RETURN_AUTHORIZED = "awaiting_return"
52
-
53
- ORDER_STATES = [CART, ADDRESS, DELIVERY, PAYMENT, CONFIRM, COMPLETE, CANCELED, RETURNED, RETURN_AUTHORIZED]
54
-
55
- READY = "ready"
56
- SHIPPED = "shipped"
57
- PARTIAL = "partial"
58
- PENDING = "pending"
59
- BACKORDER = "backorder"
60
-
61
- SHIPMENT_STATES = [READY, SHIPPED, PARTIAL, PENDING, BACKORDER]
62
-
63
- PROCESSING = 'processing'
64
- FAILED = 'failed'
65
- COMPLETED = 'completed'
66
- VOID = 'void'
67
- CHECKOUT = 'checkout'
68
-
69
- PAYMENT_STATES = [CHECKOUT, PROCESSING, FAILED, COMPLETED, VOID, PENDING]
70
- constantz
71
- end
58
+ silence_stream(STDOUT) {
59
+ template "config/environments/cucumber.rb"
60
+ }
72
61
  end
73
62
 
74
63
  def create_databases_yml
75
- remove_file "config/database.yml"
76
- template "config/database.yml"
64
+ silence_stream(STDOUT) {
65
+ remove_file "config/database.yml"
66
+ template "config/database.yml"
67
+ }
68
+ end
69
+
70
+ def tweak_gemfile
71
+ silence_stream(STDOUT) {
72
+ append_file '../../Gemfile' do
73
+ full_path_for_local_gems
74
+ end
75
+
76
+ append_file 'Gemfile' do
77
+ full_path_for_local_gems
78
+ end
79
+ }
80
+ end
81
+
82
+ protected
83
+ def full_path_for_local_gems
84
+ # Gemfile needs to be full local path to the source (ex. /Users/schof/repos/spree/auth)
85
+ # By default we do nothing but each gem should override this method with the appropriate content
77
86
  end
78
87
 
79
88
  private
80
89
 
81
90
  def run_migrations
82
91
  inside "" do
83
- run "rake db:migrate db:seed RAILS_ENV=test"
84
- run "rake db:migrate db:seed RAILS_ENV=cucumber"
92
+ silence_stream(STDOUT) {
93
+ run "rake db:migrate db:seed RAILS_ENV=test"
94
+ run "rake db:migrate db:seed RAILS_ENV=cucumber"
95
+ }
85
96
  end
86
97
  end
87
98
 
@@ -90,7 +101,24 @@ constantz
90
101
  end
91
102
 
92
103
  def remove_directory_if_exists(path)
93
- run "rm -r #{path}" if File.directory?(path)
104
+ silence_stream(STDOUT) {
105
+ run "rm -r #{path}" if File.directory?(path)
106
+ }
107
+ end
108
+
109
+ def silence_stream(stream)
110
+ if self.class.verbose
111
+ yield
112
+ else
113
+ begin
114
+ old_stream = stream.dup
115
+ stream.reopen(RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? 'NUL:' : '/dev/null')
116
+ stream.sync = true
117
+ yield
118
+ ensure
119
+ stream.reopen(old_stream)
120
+ end
121
+ end
94
122
  end
95
123
  end
96
124
  end
@@ -1,16 +1,34 @@
1
1
  source 'http://rubygems.org'
2
2
 
3
- gem 'rails', '~> 3.0.1'
4
- gem 'sqlite3-ruby', :require => 'sqlite3'
3
+ gem 'sqlite3'
5
4
 
6
5
  group :test do
7
- gem 'rspec-rails', '~> 2.1.0'
8
- gem 'factory_girl_rails'
6
+ gem 'rspec-rails', '= 2.5.0'
7
+ gem 'factory_girl', '= 1.3.3'
8
+ gem 'factory_girl_rails', '= 1.0.1'
9
+ gem 'rcov'
10
+ gem 'shoulda'
11
+ gem 'faker'
12
+ if RUBY_VERSION < "1.9"
13
+ gem "ruby-debug"
14
+ else
15
+ gem "ruby-debug19"
16
+ end
9
17
  end
10
18
 
11
19
  group :cucumber do
12
20
  gem 'cucumber-rails'
13
21
  gem 'database_cleaner', '~> 0.5.2'
14
22
  gem 'nokogiri'
15
- gem 'capybara'
23
+ gem 'capybara', '= 0.4.1.2'
24
+ gem 'factory_girl', '= 1.3.3'
25
+ gem 'factory_girl_rails', '= 1.0.1'
26
+ gem 'faker'
27
+ gem 'launchy'
28
+
29
+ if RUBY_VERSION < "1.9"
30
+ gem "ruby-debug"
31
+ else
32
+ gem "ruby-debug19"
33
+ end
16
34
  end
@@ -1,12 +1,29 @@
1
- require File.expand_path('../../config/application', __FILE__)
2
-
3
1
  require 'rubygems'
4
2
  require 'rake'
5
3
  require 'rake/testtask'
6
4
  require 'rake/packagetask'
7
5
  require 'rake/gempackagetask'
8
6
 
9
- spec = eval(File.read('<%=file_name %>.gemspec'))
7
+ gemfile = File.expand_path('../spec/test_app/Gemfile', __FILE__)
8
+ if File.exists?(gemfile) && (%w(spec cucumber).include?(ARGV.first.to_s) || ARGV.size == 0)
9
+ require 'bundler'
10
+ ENV['BUNDLE_GEMFILE'] = gemfile
11
+ Bundler.setup
12
+
13
+ require 'rspec'
14
+ require 'rspec/core/rake_task'
15
+ RSpec::Core::RakeTask.new
16
+
17
+ require 'cucumber/rake/task'
18
+ Cucumber::Rake::Task.new do |t|
19
+ t.cucumber_opts = %w{--format progress}
20
+ end
21
+ end
22
+
23
+ desc "Default Task"
24
+ task :default => [:spec, :cucumber ]
25
+
26
+ spec = eval(File.read('<%= file_name %>.gemspec'))
10
27
 
11
28
  Rake::GemPackageTask.new(spec) do |p|
12
29
  p.gem_spec = spec
@@ -22,10 +39,37 @@ end
22
39
  desc "Default Task"
23
40
  task :default => [ :spec ]
24
41
 
25
- require 'rspec/core/rake_task'
26
- RSpec::Core::RakeTask.new
42
+ desc "Regenerates a rails 3 app for testing"
43
+ task :test_app do
44
+ require '../spree/lib/generators/spree/test_app_generator'
45
+ class <%= file_name.classify %>TestAppGenerator < Spree::Generators::TestAppGenerator
27
46
 
28
- # require 'cucumber/rake/task'
29
- # Cucumber::Rake::Task.new do |t|
30
- # t.cucumber_opts = %w{--format pretty}
31
- # end
47
+ def install_gems
48
+ inside "test_app" do
49
+ run 'rake spree_core:install'
50
+ run 'rake <%= file_name %>:install'
51
+ end
52
+ end
53
+
54
+ def migrate_db
55
+ run_migrations
56
+ end
57
+
58
+ protected
59
+ def full_path_for_local_gems
60
+ <<-gems
61
+ gem 'spree_core', :path => \'#{File.join(File.dirname(__FILE__), "../spree/", "core")}\'
62
+ gem '<%= file_name %>', :path => \'#{File.dirname(__FILE__)}\'
63
+ gems
64
+ end
65
+
66
+ end
67
+ <%= file_name.classify %>TestAppGenerator.start
68
+ end
69
+
70
+ namespace :test_app do
71
+ desc 'Rebuild test and cucumber databases'
72
+ task :rebuild_dbs do
73
+ system("cd spec/test_app && rake db:drop db:migrate RAILS_ENV=test && rake db:drop db:migrate RAILS_ENV=cucumber")
74
+ end
75
+ end
@@ -32,7 +32,7 @@ TestApp::Application.configure do
32
32
 
33
33
  # Print deprecation notices to the stderr
34
34
  config.active_support.deprecation = :stderr
35
-
35
+
36
36
  config.action_mailer.default_url_options = { :host => 'testapp.com' }
37
-
37
+
38
38
  end
@@ -1,9 +1,9 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.platform = Gem::Platform::RUBY
3
3
  s.name = '<%= file_name %>'
4
- s.version = '1.0.0'
4
+ s.version = '<%= Spree.version %>'
5
5
  s.summary = 'Add gem summary here'
6
- #s.description = 'Add (optional) gem description here'
6
+ s.description = 'Add (optional) gem description here'
7
7
  s.required_ruby_version = '>= 1.8.7'
8
8
 
9
9
  # s.author = 'David Heinemeier Hansson'
@@ -11,11 +11,12 @@ Gem::Specification.new do |s|
11
11
  # s.homepage = 'http://www.rubyonrails.org'
12
12
  # s.rubyforge_project = 'actionmailer'
13
13
 
14
- s.files = Dir['CHANGELOG', 'README.md', 'LICENSE', 'lib/**/*', 'app/**/*']
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
16
  s.require_path = 'lib'
16
17
  s.requirements << 'none'
17
18
 
18
19
  s.has_rdoc = true
19
20
 
20
21
  s.add_dependency('spree_core', '>= <%= Spree.version %>')
21
- end
22
+ end
@@ -1,7 +1,7 @@
1
1
  # This file is copied to ~/spec when you run 'ruby script/generate rspec'
2
2
  # from the project root directory.
3
3
  ENV["RAILS_ENV"] ||= 'test'
4
- require File.expand_path("../../../config/environment", __FILE__)
4
+ require File.expand_path("../test_app/config/environment", __FILE__)
5
5
  require 'rspec/rails'
6
6
 
7
7
  # Requires supporting files with custom matchers and macros, etc,
@@ -3,6 +3,10 @@ module SpreeSite
3
3
  def self.activate
4
4
  # Add your custom site logic here
5
5
  end
6
+
7
+ def load_tasks
8
+ end
9
+
6
10
  config.to_prepare &method(:activate).to_proc
7
11
  end
8
12
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree
3
3
  version: !ruby/object:Gem::Version
4
- hash: 183
5
- prerelease:
4
+ hash: 215
5
+ prerelease: false
6
6
  segments:
7
7
  - 0
8
- - 40
9
- - 4
10
- version: 0.40.4
8
+ - 50
9
+ - 0
10
+ version: 0.50.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sean Schofield
@@ -15,104 +15,105 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-10-21 00:00:00 Z
18
+ date: 2011-03-23 00:00:00 -04:00
19
+ default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
- version_requirements: &id001 !ruby/object:Gem::Requirement
22
+ name: spree_core
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
22
25
  none: false
23
26
  requirements:
24
27
  - - "="
25
28
  - !ruby/object:Gem::Version
26
- hash: 183
29
+ hash: 215
27
30
  segments:
28
31
  - 0
29
- - 40
30
- - 4
31
- version: 0.40.4
32
- requirement: *id001
32
+ - 50
33
+ - 0
34
+ version: 0.50.0
33
35
  type: :runtime
34
- prerelease: false
35
- name: spree_core
36
+ version_requirements: *id001
36
37
  - !ruby/object:Gem::Dependency
37
- version_requirements: &id002 !ruby/object:Gem::Requirement
38
+ name: spree_auth
39
+ prerelease: false
40
+ requirement: &id002 !ruby/object:Gem::Requirement
38
41
  none: false
39
42
  requirements:
40
43
  - - "="
41
44
  - !ruby/object:Gem::Version
42
- hash: 183
45
+ hash: 215
43
46
  segments:
44
47
  - 0
45
- - 40
46
- - 4
47
- version: 0.40.4
48
- requirement: *id002
48
+ - 50
49
+ - 0
50
+ version: 0.50.0
49
51
  type: :runtime
50
- prerelease: false
51
- name: spree_auth
52
+ version_requirements: *id002
52
53
  - !ruby/object:Gem::Dependency
53
- version_requirements: &id003 !ruby/object:Gem::Requirement
54
+ name: spree_api
55
+ prerelease: false
56
+ requirement: &id003 !ruby/object:Gem::Requirement
54
57
  none: false
55
58
  requirements:
56
59
  - - "="
57
60
  - !ruby/object:Gem::Version
58
- hash: 183
61
+ hash: 215
59
62
  segments:
60
63
  - 0
61
- - 40
62
- - 4
63
- version: 0.40.4
64
- requirement: *id003
64
+ - 50
65
+ - 0
66
+ version: 0.50.0
65
67
  type: :runtime
66
- prerelease: false
67
- name: spree_api
68
+ version_requirements: *id003
68
69
  - !ruby/object:Gem::Dependency
69
- version_requirements: &id004 !ruby/object:Gem::Requirement
70
+ name: spree_dash
71
+ prerelease: false
72
+ requirement: &id004 !ruby/object:Gem::Requirement
70
73
  none: false
71
74
  requirements:
72
75
  - - "="
73
76
  - !ruby/object:Gem::Version
74
- hash: 183
77
+ hash: 215
75
78
  segments:
76
79
  - 0
77
- - 40
78
- - 4
79
- version: 0.40.4
80
- requirement: *id004
80
+ - 50
81
+ - 0
82
+ version: 0.50.0
81
83
  type: :runtime
82
- prerelease: false
83
- name: spree_dash
84
+ version_requirements: *id004
84
85
  - !ruby/object:Gem::Dependency
85
- version_requirements: &id005 !ruby/object:Gem::Requirement
86
+ name: spree_sample
87
+ prerelease: false
88
+ requirement: &id005 !ruby/object:Gem::Requirement
86
89
  none: false
87
90
  requirements:
88
91
  - - "="
89
92
  - !ruby/object:Gem::Version
90
- hash: 183
93
+ hash: 215
91
94
  segments:
92
95
  - 0
93
- - 40
94
- - 4
95
- version: 0.40.4
96
- requirement: *id005
96
+ - 50
97
+ - 0
98
+ version: 0.50.0
97
99
  type: :runtime
98
- prerelease: false
99
- name: spree_sample
100
+ version_requirements: *id005
100
101
  - !ruby/object:Gem::Dependency
101
- version_requirements: &id006 !ruby/object:Gem::Requirement
102
+ name: spree_promo
103
+ prerelease: false
104
+ requirement: &id006 !ruby/object:Gem::Requirement
102
105
  none: false
103
106
  requirements:
104
107
  - - "="
105
108
  - !ruby/object:Gem::Version
106
- hash: 183
109
+ hash: 215
107
110
  segments:
108
111
  - 0
109
- - 40
110
- - 4
111
- version: 0.40.4
112
- requirement: *id006
112
+ - 50
113
+ - 0
114
+ version: 0.50.0
113
115
  type: :runtime
114
- prerelease: false
115
- name: spree_promo
116
+ version_requirements: *id006
116
117
  description: "Spree is an open source e-commerce framework for Ruby on Rails. Join us on the spree-user google group or in #spree on IRC"
117
118
  email: sean@railsdog.com
118
119
  executables: []
@@ -143,6 +144,7 @@ files:
143
144
  - lib/generators/templates/spree_site.rb
144
145
  - lib/spree.rb
145
146
  - lib/tasks/install.rake
147
+ has_rdoc: true
146
148
  homepage: http://spreecommerce.com
147
149
  licenses: []
148
150
 
@@ -176,7 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
176
178
  requirements:
177
179
  - none
178
180
  rubyforge_project: spree
179
- rubygems_version: 1.8.10
181
+ rubygems_version: 1.3.7
180
182
  signing_key:
181
183
  specification_version: 3
182
184
  summary: Full-stack e-commerce framework for Ruby on Rails.