spree 0.70.7 → 1.0.0.rc1

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.

Files changed (28) hide show
  1. data/README.md +27 -19
  2. data/lib/generators/spree/install/install_generator.rb +198 -0
  3. data/lib/generators/spree/install/templates/config/initializers/spree.rb +9 -0
  4. data/lib/generators/spree/site/site_generator.rb +18 -0
  5. data/lib/spree.rb +0 -2
  6. data/lib/spree/cli.rb +2 -2
  7. data/lib/spree/url_helpers.rb +7 -0
  8. metadata +49 -51
  9. data/lib/spree/engine.rb +0 -5
  10. data/lib/spree/extension.rb +0 -77
  11. data/lib/spree/templates/extension/Gemfile +0 -22
  12. data/lib/spree/templates/extension/LICENSE +0 -26
  13. data/lib/spree/templates/extension/README.md +0 -20
  14. data/lib/spree/templates/extension/Rakefile +0 -36
  15. data/lib/spree/templates/extension/Versionfile +0 -9
  16. data/lib/spree/templates/extension/app/assets/javascripts/admin/%file_name%.js +0 -1
  17. data/lib/spree/templates/extension/app/assets/javascripts/store/%file_name%.js +0 -1
  18. data/lib/spree/templates/extension/app/assets/stylesheets/admin/%file_name%.css +0 -3
  19. data/lib/spree/templates/extension/app/assets/stylesheets/store/%file_name%.css +0 -3
  20. data/lib/spree/templates/extension/extension.gemspec +0 -24
  21. data/lib/spree/templates/extension/gitignore +0 -10
  22. data/lib/spree/templates/extension/lib/%file_name%.rb.tt +0 -2
  23. data/lib/spree/templates/extension/lib/%file_name%/engine.rb.tt +0 -24
  24. data/lib/spree/templates/extension/lib/generators/%file_name%/install/install_generator.rb.tt +0 -29
  25. data/lib/spree/templates/extension/routes.rb +0 -3
  26. data/lib/spree/templates/extension/rspec +0 -1
  27. data/lib/spree/templates/extension/script/rails.tt +0 -12
  28. data/lib/spree/templates/extension/spec_helper.rb.tt +0 -33
data/README.md CHANGED
@@ -20,6 +20,8 @@ All of the gems are designed to work together to provide a fully functional e-co
20
20
  however, to use only the pieces you are interested in. So for example, you could use just the barebones spree\_core gem
21
21
  and perhaps combine it with your own custom authorization scheme instead of using spree_auth.
22
22
 
23
+ [![Build Status](https://secure.travis-ci.org/spree/spree.png)](http://travis-ci.org/spree/spree)
24
+
23
25
  Using the Gem
24
26
  -------------
25
27
 
@@ -31,19 +33,35 @@ Update your bundle
31
33
 
32
34
  $ bundle install
33
35
 
34
- Then use the install generator to do the basic setup
36
+ Use the install generator to do the basic setup. The install generator will prompt you to run migrations, setup some
37
+ basic data, and load sample products, orders, etc.
35
38
 
36
39
  $ rails g spree:site
37
40
 
38
- Now you just need to run the new migrations, and setup some basic data
41
+ To auto accept all prompts while running the install generator, pass -A as an option
42
+
43
+ $ rails g spree:site -A
44
+
45
+ If you chose to ignore the prompts while running the basic install
46
+ generator you can manually run migrations and load basic data with the following
47
+ commands
39
48
 
40
49
  $ bundle exec rake db:migrate
41
50
  $ bundle exec rake db:seed
42
51
 
43
- If you also want some sample products, orders, etc. to play with you can run the appropriate rake task.
52
+ To manually load sample products, orders, etc., run the following rake task
44
53
 
45
54
  $ bundle exec rake spree_sample:load
46
55
 
56
+ Peformance
57
+ ----------
58
+
59
+ Rails 3.1 introduced a concept known as the asset pipeline. Unfortunately it results in poor performance when running your site in development mode (production mode is unaffected.) You may want to run the following command when testing locally in development mode
60
+
61
+ $ bundle exec rake assets:precompile:nondigest
62
+
63
+ Using the precompile rake task in development will prevent any changes to asset files from being automatically included in when you reload the page. You must re-run the precompile task for changes to become available.
64
+
47
65
  Browse Store
48
66
  ------------
49
67
 
@@ -83,15 +101,15 @@ The source code is essentially a collection of gems. Spree is meant to be run w
83
101
  Performance
84
102
  -----------
85
103
 
86
- You may noticed that your Spree store runs slowly in development mode. This is a side-effect of how Rails works in development mode which is to continuous reload your Ruby objects on each request. The introduction of the asset pipeline in Rails 3.1 made default performance in development mode significantly worse. There are, however, a few tricks to speeding up performance in development mode.
104
+ You may noticed that your Spree store runs slowly in development mode. This is a side-effect of how Rails works in development mode which is to continuous reload your Ruby objects on each request. The introduction of the asset pipeline in Rails 3.1 made default performance in development mode significantly worse. There are, however, a few tricks to speeding up performance.
87
105
 
88
106
  You can recompile your assets as follows:
89
107
 
90
- $ bundle exec rake assets:precompile:nondigest
108
+ $ bundle exec rake assets:precompile RAILS_ENV=development
91
109
 
92
110
  If you want to remove precompiled assets (recommended before you commit to git and push your changes) use the following rake task:
93
111
 
94
- $ bundle exec rake assets:clean
112
+ $ bundle exec rake assets:clean
95
113
 
96
114
 
97
115
 
@@ -101,7 +119,7 @@ Running Tests
101
119
  If you want to run all the tests across all the gems then
102
120
 
103
121
  $ cd spree
104
- $ bundle exec rake #=> 'this will run both spec and cucumber tests for all the gems'
122
+ $ bundle exec rake #=> 'this will run rspec tests for all the gems'
105
123
 
106
124
  Each gem contains its own series of tests, and for each directory, you need to do a quick one-time
107
125
  creation of a test application and then you can use it to run the tests. For example, to run the
@@ -110,11 +128,9 @@ tests for the core project.
110
128
  $ cd core
111
129
  $ bundle exec rake test_app
112
130
 
113
- Now you can run just the specs, just the features or everything together
131
+ You can run all of the tests with a single command
114
132
 
115
- $ bundle exec rake spec
116
- $ bundle exec rake cucumber
117
- $ bundle exec rake #=> 'this will run both spec and cucumber tests for the gem'
133
+ $ bundle exec rake
118
134
 
119
135
  If you want to run specs for only a single spec file
120
136
 
@@ -124,14 +140,6 @@ If you want to run a particular line of spec
124
140
 
125
141
  $ bundle exec rspec spec/models/state_spec.rb:7
126
142
 
127
- If you want to run a single cucumber feature
128
-
129
- $ bundle exec cucumber features/admin/orders.feature --require features
130
-
131
- If you want to run a particular scenario then include the line number
132
-
133
- $ bundle exec cucumber features/admin/orders.feature:3 --require features
134
-
135
143
 
136
144
  Contributing
137
145
  ------------
@@ -0,0 +1,198 @@
1
+ require 'rails/generators'
2
+ require 'highline/import'
3
+ require 'bundler'
4
+ require 'bundler/cli'
5
+
6
+ module Spree
7
+ class InstallGenerator < Rails::Generators::Base
8
+ argument :after_bundle_only, :type => :string, :default => "false"
9
+
10
+ class_option :auto_accept, :type => :boolean, :default => false, :aliases => '-A', :desc => "Answer yes to all prompts"
11
+ class_option :skip_install_data, :type => :boolean, :default => false
12
+ class_option :lib_name, :default => 'spree'
13
+ class_option :test_app, :type => :boolean, :default => false
14
+
15
+ def self.source_paths
16
+ paths = self.superclass.source_paths
17
+ paths << File.expand_path('../templates', "../../#{__FILE__}")
18
+ paths << File.expand_path('../templates', "../#{__FILE__}")
19
+ paths << File.expand_path('../templates', __FILE__)
20
+ paths.flatten
21
+ end
22
+
23
+ def ask_questions
24
+ @install_blue_theme = ask_with_default("Would you like to install the default blue theme?")
25
+ @install_default_gateways = ask_with_default("Would you like to install the default gateways?")
26
+
27
+ if options[:skip_install_data]
28
+ @run_migrations = false
29
+ @load_seed_data = false
30
+ @load_sample_data = false
31
+ else
32
+ @run_migrations = ask_with_default("Would you like to run the migrations?")
33
+ if @run_migrations
34
+ @load_seed_data = ask_with_default("Would you like to load the seed data?")
35
+ @load_sample_data = ask_with_default("Would you like to load the sample data?")
36
+ else
37
+ @load_seed_data = false
38
+ @load_sample_data = false
39
+ end
40
+ end
41
+ end
42
+
43
+ def add_files
44
+ template 'config/initializers/spree.rb', 'config/initializers/spree.rb'
45
+ end
46
+
47
+ def config_spree_yml
48
+ create_file "config/spree.yml" do
49
+ settings = { 'version' => Spree.version }
50
+
51
+ settings.to_yaml
52
+ end
53
+ end
54
+
55
+ def remove_unneeded_files
56
+ remove_file "public/index.html"
57
+ end
58
+
59
+ def additional_tweaks
60
+ return unless File.exists? 'public/robots.txt'
61
+ append_file "public/robots.txt", <<-ROBOTS
62
+ User-agent: *
63
+ Disallow: /checkouts
64
+ Disallow: /orders
65
+ Disallow: /countries
66
+ Disallow: /line_items
67
+ Disallow: /password_resets
68
+ Disallow: /states
69
+ Disallow: /user_sessions
70
+ Disallow: /users
71
+ ROBOTS
72
+ end
73
+
74
+ def create_overrides_directory
75
+ empty_directory "app/overrides"
76
+ end
77
+
78
+ def configure_application
79
+ application <<-APP
80
+
81
+ config.to_prepare do
82
+ # Load application's model / class decorators
83
+ Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
84
+ Rails.configuration.cache_classes ? require(c) : load(c)
85
+ end
86
+
87
+ # Load application's view overrides
88
+ Dir.glob(File.join(File.dirname(__FILE__), "../app/overrides/*.rb")) do |c|
89
+ Rails.configuration.cache_classes ? require(c) : load(c)
90
+ end
91
+ end
92
+ APP
93
+
94
+ append_file "config/environment.rb", "\nActiveRecord::Base.include_root_in_json = true\n"
95
+ end
96
+
97
+ def install_gems
98
+ return if options[:test_app]
99
+ gems = {}
100
+
101
+ if @install_blue_theme
102
+ gems['spree_blue_theme'] = { :git => 'git@github.com:spree/spree_blue_theme.git',
103
+ :ref => '10666404ccb3ed4a4cc9cbe41e822ab2bb55112e' }
104
+ end
105
+
106
+ if @install_default_gateways
107
+ gems['spree_usa_epay'] = { :git => 'git@github.com:spree/spree_usa_epay.git',
108
+ :ref => '01db40c31e6933c7744403ce13536a34167165eb' }
109
+
110
+ gems['spree_skrill'] = { :git => 'git@github.com:spree/spree_skrill.git',
111
+ :ref => '6743bcbd0146d1c7145d6befc648005d8d0cf79a' }
112
+ end
113
+
114
+ unless gems.empty?
115
+ gems.each do |name, options|
116
+ gem name, options
117
+ end
118
+ bundle_command :update
119
+ end
120
+ end
121
+
122
+ def include_seed_data
123
+ append_file "db/seeds.rb", <<-SEEDS
124
+ \n
125
+ Spree::Core::Engine.load_seed if defined?(Spree::Core)
126
+ Spree::Auth::Engine.load_seed if defined?(Spree::Auth)
127
+ SEEDS
128
+ end
129
+
130
+ def install_migrations
131
+ say_status :copying, "migrations"
132
+ silence_stream(STDOUT) do
133
+ silence_warnings { rake 'railties:install:migrations' }
134
+ end
135
+ end
136
+
137
+ def run_migrations
138
+ if @run_migrations
139
+ say_status :running, "migrations"
140
+ rake('db:migrate')
141
+ else
142
+ say_status :skipping, "migrations (don't forget to run rake db:migrate)"
143
+ end
144
+ end
145
+
146
+ def populate_seed_data
147
+ if @load_seed_data
148
+ say_status :loading, "seed data"
149
+ rake('db:seed AUTO_ACCEPT=true')
150
+ else
151
+ say_status :skipping, "seed data (you can always run rake db:seed)"
152
+ end
153
+ end
154
+
155
+ def load_sample_data
156
+ if @load_sample_data
157
+ say_status :loading, "sample data"
158
+ rake('spree_sample:load')
159
+ else
160
+ say_status :skipping, "sample data (you can always run rake spree_sample:load)"
161
+ end
162
+ end
163
+
164
+ def notify_about_routes
165
+ insert_into_file File.join('config', 'routes.rb'), :after => "Application.routes.draw do\n" do
166
+ " # Mount Spree's routes\n mount Spree::Core::Engine, :at => '/'\n"
167
+ end
168
+
169
+ unless options[:quiet]
170
+ puts "*" * 50
171
+ puts "We added the following line to your application's config/routes.rb file:"
172
+ puts " "
173
+ puts " mount Spree::Core::Engine, :at => '/'"
174
+ end
175
+ end
176
+
177
+ private
178
+
179
+ def ask_with_default(message, default='yes')
180
+ return true if options[:auto_accept]
181
+
182
+ valid = false
183
+ until valid
184
+ response = ask "#{message} (y/n) [#{default}]"
185
+ response = default if response.empty?
186
+ valid = (response =~ /\Ay(?:es)?|no?\Z/i)
187
+ end
188
+ response.downcase[0] == ?y
189
+ end
190
+
191
+ # Copied from https://github.com/rails/rails/blob/b1ceffd7b224c397d8ba5344b9c1438dd62f8325/railties/lib/rails/generators/app_base.rb#L189
192
+ def bundle_command(command)
193
+ say_status :run, "bundle #{command}"
194
+ Bundler::CLI.new.send(command)
195
+ end
196
+
197
+ end
198
+ end
@@ -0,0 +1,9 @@
1
+ # Used to configure Spree Preferences
2
+ #
3
+ # In order to override a default setting set: config.setting_name = 'new value'
4
+ #
5
+ Spree.config do |config|
6
+ # Example:
7
+ # Uncomment to override the default site name.
8
+ # config.site_name = "Spree Demo Site"
9
+ end
@@ -0,0 +1,18 @@
1
+ require 'rails/generators'
2
+ require File.expand_path('../../install/install_generator', __FILE__)
3
+
4
+ module Spree
5
+ class SiteGenerator < Rails::Generators::Base
6
+ class_option :auto_accept, :type => :boolean, :default => false, :aliases => '-A', :desc => "Answer yes to all prompts"
7
+
8
+ def run_install_generator
9
+ if options[:auto_accept]
10
+ Spree::InstallGenerator.start ["--auto-accept"]
11
+ else
12
+ Spree::InstallGenerator.start
13
+ end
14
+
15
+ puts ActiveSupport::Deprecation.warn "rails g spree:site has been deprecated and will be removed in the future, use rails g spree:install instead."
16
+ end
17
+ end
18
+ end
@@ -4,5 +4,3 @@ require 'spree_api'
4
4
  require 'spree_dash'
5
5
  require 'spree_promo'
6
6
  require 'spree_sample'
7
-
8
- require 'spree/engine'
@@ -1,7 +1,7 @@
1
1
  require "rubygems"
2
- require "spree_core/version"
2
+ require "spree/core/version"
3
3
  require "thor"
4
- require 'spree/extension'
4
+ require 'generators/spree/extension/extension_generator'
5
5
  #require 'spree/application'
6
6
  #require 'spree/test'
7
7
 
@@ -0,0 +1,7 @@
1
+ module Spree
2
+ module UrlHelpers
3
+ def spree
4
+ Spree::Core::Engine.routes.url_helpers
5
+ end
6
+ end
7
+ end
metadata CHANGED
@@ -1,13 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spree
3
3
  version: !ruby/object:Gem::Version
4
- hash: 265
5
- prerelease:
4
+ hash: 15424055
5
+ prerelease: 6
6
6
  segments:
7
+ - 1
7
8
  - 0
8
- - 70
9
- - 7
10
- version: 0.70.7
9
+ - 0
10
+ - rc
11
+ - 1
12
+ version: 1.0.0.rc1
11
13
  platform: ruby
12
14
  authors:
13
15
  - Sean Schofield
@@ -15,7 +17,7 @@ autorequire:
15
17
  bindir: lib/spree/bin
16
18
  cert_chain: []
17
19
 
18
- date: 2012-07-08 00:00:00 Z
20
+ date: 2011-12-23 00:00:00 Z
19
21
  dependencies:
20
22
  - !ruby/object:Gem::Dependency
21
23
  version_requirements: &id001 !ruby/object:Gem::Requirement
@@ -23,12 +25,14 @@ dependencies:
23
25
  requirements:
24
26
  - - "="
25
27
  - !ruby/object:Gem::Version
26
- hash: 265
28
+ hash: 15424055
27
29
  segments:
30
+ - 1
31
+ - 0
28
32
  - 0
29
- - 70
30
- - 7
31
- version: 0.70.7
33
+ - rc
34
+ - 1
35
+ version: 1.0.0.rc1
32
36
  requirement: *id001
33
37
  type: :runtime
34
38
  prerelease: false
@@ -39,12 +43,14 @@ dependencies:
39
43
  requirements:
40
44
  - - "="
41
45
  - !ruby/object:Gem::Version
42
- hash: 265
46
+ hash: 15424055
43
47
  segments:
48
+ - 1
44
49
  - 0
45
- - 70
46
- - 7
47
- version: 0.70.7
50
+ - 0
51
+ - rc
52
+ - 1
53
+ version: 1.0.0.rc1
48
54
  requirement: *id002
49
55
  type: :runtime
50
56
  prerelease: false
@@ -55,12 +61,14 @@ dependencies:
55
61
  requirements:
56
62
  - - "="
57
63
  - !ruby/object:Gem::Version
58
- hash: 265
64
+ hash: 15424055
59
65
  segments:
66
+ - 1
67
+ - 0
60
68
  - 0
61
- - 70
62
- - 7
63
- version: 0.70.7
69
+ - rc
70
+ - 1
71
+ version: 1.0.0.rc1
64
72
  requirement: *id003
65
73
  type: :runtime
66
74
  prerelease: false
@@ -71,12 +79,14 @@ dependencies:
71
79
  requirements:
72
80
  - - "="
73
81
  - !ruby/object:Gem::Version
74
- hash: 265
82
+ hash: 15424055
75
83
  segments:
84
+ - 1
76
85
  - 0
77
- - 70
78
- - 7
79
- version: 0.70.7
86
+ - 0
87
+ - rc
88
+ - 1
89
+ version: 1.0.0.rc1
80
90
  requirement: *id004
81
91
  type: :runtime
82
92
  prerelease: false
@@ -87,12 +97,14 @@ dependencies:
87
97
  requirements:
88
98
  - - "="
89
99
  - !ruby/object:Gem::Version
90
- hash: 265
100
+ hash: 15424055
91
101
  segments:
102
+ - 1
103
+ - 0
92
104
  - 0
93
- - 70
94
- - 7
95
- version: 0.70.7
105
+ - rc
106
+ - 1
107
+ version: 1.0.0.rc1
96
108
  requirement: *id005
97
109
  type: :runtime
98
110
  prerelease: false
@@ -103,12 +115,14 @@ dependencies:
103
115
  requirements:
104
116
  - - "="
105
117
  - !ruby/object:Gem::Version
106
- hash: 265
118
+ hash: 15424055
107
119
  segments:
120
+ - 1
121
+ - 0
108
122
  - 0
109
- - 70
110
- - 7
111
- version: 0.70.7
123
+ - rc
124
+ - 1
125
+ version: 1.0.0.rc1
112
126
  requirement: *id006
113
127
  type: :runtime
114
128
  prerelease: false
@@ -123,28 +137,12 @@ extra_rdoc_files: []
123
137
 
124
138
  files:
125
139
  - README.md
140
+ - lib/generators/spree/install/install_generator.rb
141
+ - lib/generators/spree/install/templates/config/initializers/spree.rb
142
+ - lib/generators/spree/site/site_generator.rb
126
143
  - lib/spree/bin/spree
127
144
  - lib/spree/cli.rb
128
- - lib/spree/engine.rb
129
- - lib/spree/extension.rb
130
- - lib/spree/templates/extension/app/assets/javascripts/admin/%file_name%.js
131
- - lib/spree/templates/extension/app/assets/javascripts/store/%file_name%.js
132
- - lib/spree/templates/extension/app/assets/stylesheets/admin/%file_name%.css
133
- - lib/spree/templates/extension/app/assets/stylesheets/store/%file_name%.css
134
- - lib/spree/templates/extension/extension.gemspec
135
- - lib/spree/templates/extension/Gemfile
136
- - lib/spree/templates/extension/gitignore
137
- - lib/spree/templates/extension/lib/%file_name%/engine.rb.tt
138
- - lib/spree/templates/extension/lib/%file_name%.rb.tt
139
- - lib/spree/templates/extension/lib/generators/%file_name%/install/install_generator.rb.tt
140
- - lib/spree/templates/extension/LICENSE
141
- - lib/spree/templates/extension/Rakefile
142
- - lib/spree/templates/extension/README.md
143
- - lib/spree/templates/extension/routes.rb
144
- - lib/spree/templates/extension/rspec
145
- - lib/spree/templates/extension/script/rails.tt
146
- - lib/spree/templates/extension/spec_helper.rb.tt
147
- - lib/spree/templates/extension/Versionfile
145
+ - lib/spree/url_helpers.rb
148
146
  - lib/spree.rb
149
147
  homepage: http://spreecommerce.com
150
148
  licenses: []
@@ -178,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
178
176
  version: 1.3.6
179
177
  requirements:
180
178
  - none
181
- rubyforge_project: spree
179
+ rubyforge_project:
182
180
  rubygems_version: 1.8.10
183
181
  signing_key:
184
182
  specification_version: 3
@@ -1,5 +0,0 @@
1
- module Spree
2
- class Engine < Rails::Engine
3
- engine_name 'spree'
4
- end
5
- end
@@ -1,77 +0,0 @@
1
- module Spree
2
- class Extension < Thor
3
- include Thor::Actions
4
-
5
- def self.source_root
6
- File.dirname(__FILE__) + '/templates/extension'
7
- end
8
-
9
- desc "generate NAME", "generate extension"
10
- def generate(name)
11
-
12
- class_path = name.include?('/') ? name.split('/') : name.split('::')
13
- class_path.map! { |m| m.underscore }
14
- self.file_name = 'spree_' + class_path.pop.gsub('spree_', '')
15
- self.human_name = name.titleize
16
- self.class_name = file_name.classify
17
-
18
- empty_directory file_name
19
-
20
- directory "app", "#{file_name}/app"
21
-
22
- empty_directory "#{file_name}/app/controllers"
23
- empty_directory "#{file_name}/app/helpers"
24
- empty_directory "#{file_name}/app/models"
25
- empty_directory "#{file_name}/app/views"
26
- empty_directory "#{file_name}/app/overrides"
27
- empty_directory "#{file_name}/config"
28
- empty_directory "#{file_name}/db"
29
-
30
- directory "lib", "#{file_name}/lib"
31
- directory "script", "#{file_name}/script"
32
-
33
- empty_directory "#{file_name}/spec"
34
-
35
- template "LICENSE", "#{file_name}/LICENSE"
36
- template "Rakefile", "#{file_name}/Rakefile"
37
- template "README.md", "#{file_name}/README.md"
38
- template "gitignore", "#{file_name}/.gitignore"
39
- template "extension.gemspec", "#{file_name}/#{file_name}.gemspec"
40
- template "Versionfile", "#{file_name}/Versionfile"
41
- template "routes.rb", "#{file_name}/config/routes.rb"
42
- template "Gemfile", "#{file_name}/Gemfile" unless integrated
43
- template "spec_helper.rb.tt", "#{file_name}/spec/spec_helper.rb"
44
- template "rspec", "#{file_name}/.rspec"
45
-
46
- if integrated
47
- append_to_file(gemfile) do
48
- "\ngem '#{file_name}', :path => '#{file_name}'"
49
- end
50
- end
51
- end
52
-
53
- no_tasks do
54
- # File/Lib Name (ex. spree_paypal_express)
55
- attr_accessor :file_name
56
- end
57
-
58
- no_tasks do
59
- # Human Readable Name (ex. Paypal Express)
60
- attr_accessor :human_name
61
- end
62
-
63
- no_tasks do
64
- # Class Name (ex. PaypalExpress)
65
- attr_accessor :class_name
66
- end
67
-
68
- protected
69
- def gemfile
70
- File.expand_path("Gemfile", Dir.pwd)
71
- end
72
- # extension is integrated with an existing rails app (as opposed to standalone repository)
73
- def integrated
74
- File.exist?(gemfile)
75
- end
76
- end
77
- end
@@ -1,22 +0,0 @@
1
- source 'http://rubygems.org'
2
-
3
- gem 'sqlite3'
4
-
5
- group :test do
6
- gem 'rspec-rails', '= 2.6.1'
7
- end
8
-
9
- group :cucumber do
10
- gem 'cucumber-rails', '1.0.0'
11
- gem 'database_cleaner', '= 0.6.7'
12
- gem 'nokogiri'
13
- gem 'capybara', '1.0.1'
14
- end
15
-
16
- if RUBY_VERSION < "1.9"
17
- gem "ruby-debug"
18
- else
19
- gem "ruby-debug19"
20
- end
21
-
22
- gemspec
@@ -1,26 +0,0 @@
1
- Copyright (c) <%= Date.today.year %> [name of plugin creator]
2
- All rights reserved.
3
-
4
- Redistribution and use in source and binary forms, with or without modification,
5
- are permitted provided that the following conditions are met:
6
-
7
- * Redistributions of source code must retain the above copyright notice,
8
- this list of conditions and the following disclaimer.
9
- * Redistributions in binary form must reproduce the above copyright notice,
10
- this list of conditions and the following disclaimer in the documentation
11
- and/or other materials provided with the distribution.
12
- * Neither the name Spree nor the names of its contributors may be used to
13
- endorse or promote products derived from this software without specific
14
- prior written permission.
15
-
16
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
20
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21
- EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22
- PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23
- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24
- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25
- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -1,20 +0,0 @@
1
- <%= class_name %>
2
- <%= "=" * class_name.size %>
3
-
4
- Introduction goes here.
5
-
6
-
7
- Example
8
- =======
9
-
10
- Example goes here.
11
-
12
- Testing
13
- -------
14
-
15
- Be sure to add the rspec-rails gem to your Gemfile and then create a dummy test app for the specs to run against.
16
-
17
- $ bundle exec rake test app
18
- $ bundle exec rspec spec
19
-
20
- Copyright (c) <%= Date.today.year %> [name of extension creator], released under the New BSD License
@@ -1,36 +0,0 @@
1
- require 'rake'
2
- require 'rake/testtask'
3
- require 'rake/packagetask'
4
- require 'rubygems/package_task'
5
- # If this extension was generated from inside an application,
6
- # then you *must* specify the rspec-rails and cucumber-rails gems as dependencies
7
- # for that application, otherwise these files will not be found.
8
- #
9
- # Alternatively, place a Gemfile inside the extension directory which specifies these gems as dependencies
10
- require 'rspec/core/rake_task'
11
- require 'cucumber/rake/task'
12
- require 'spree_core/testing_support/common_rake'
13
-
14
- RSpec::Core::RakeTask.new
15
- Cucumber::Rake::Task.new
16
-
17
- task :default => [:spec, :cucumber ]
18
-
19
- spec = eval(File.read('<%=file_name%>.gemspec'))
20
-
21
- Gem::PackageTask.new(spec) do |p|
22
- p.gem_spec = spec
23
- end
24
-
25
- desc "Release to gemcutter"
26
- task :release => :package do
27
- require 'rake/gemcutter'
28
- Rake::Gemcutter::Tasks.new(spec).define
29
- Rake::Task['gem:push'].invoke
30
- end
31
-
32
- desc "Generates a dummy app for testing"
33
- task :test_app do
34
- ENV['LIB_NAME'] = '<%=file_name%>'
35
- Rake::Task['common:test_app'].invoke
36
- end
@@ -1,9 +0,0 @@
1
- # This file is used to designate compatibilty with different versions of Spree
2
- # Please see http://spreecommerce.com/documentation/extensions.html#versionfile for details
3
-
4
- # Examples
5
- #
6
- # "0.70.x" => { :branch => "master"}
7
- # "0.60.x" => { :branch => "0-60-stable" }
8
- # "0.40.x" => { :tag => "v1.0.0", :version => "1.0.0" }
9
-
@@ -1 +0,0 @@
1
- //= require admin/spree_core
@@ -1 +0,0 @@
1
- //= require store/spree_core
@@ -1,3 +0,0 @@
1
- /*
2
- *= require admin/spree_core
3
- */
@@ -1,3 +0,0 @@
1
- /*
2
- *= require store/spree_core
3
- */
@@ -1,24 +0,0 @@
1
- # encoding: UTF-8
2
- Gem::Specification.new do |s|
3
- s.platform = Gem::Platform::RUBY
4
- s.name = '<%= file_name %>'
5
- s.version = '<%= Spree.version %>'
6
- s.summary = 'Add gem summary here'
7
- s.description = 'Add (optional) gem description here'
8
- s.required_ruby_version = '>= 1.8.7'
9
-
10
- # s.author = 'David Heinemeier Hansson'
11
- # s.email = 'david@loudthinking.com'
12
- # s.homepage = 'http://www.rubyonrails.org'
13
- # s.rubyforge_project = 'actionmailer'
14
-
15
- #s.files = `git ls-files`.split("\n")
16
- #s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
- s.require_path = 'lib'
18
- s.requirements << 'none'
19
-
20
- s.add_dependency 'spree_core', '>= <%= Spree.version %>'
21
- s.add_development_dependency 'rspec-rails'
22
- s.add_development_dependency 'sqlite3'
23
- end
24
-
@@ -1,10 +0,0 @@
1
- \#*
2
- *~
3
- .#*
4
- .DS_Store
5
- .idea
6
- .project
7
- tmp
8
- nbproject
9
- *.swp
10
- spec/dummy
@@ -1,2 +0,0 @@
1
- require 'spree_core'
2
- require '<%=file_name%>/engine'
@@ -1,24 +0,0 @@
1
- module <%= class_name %>
2
- class Engine < Rails::Engine
3
- engine_name '<%= file_name %>'
4
-
5
- config.autoload_paths += %W(#{config.root}/lib)
6
-
7
- # use rspec for tests
8
- config.generators do |g|
9
- g.test_framework :rspec
10
- end
11
-
12
- def self.activate
13
- Dir.glob(File.join(File.dirname(__FILE__), "../../app/**/*_decorator*.rb")) do |c|
14
- Rails.application.config.cache_classes ? require(c) : load(c)
15
- end
16
-
17
- Dir.glob(File.join(File.dirname(__FILE__), "../../app/overrides/*.rb")) do |c|
18
- Rails.application.config.cache_classes ? require(c) : load(c)
19
- end
20
- end
21
-
22
- config.to_prepare &method(:activate).to_proc
23
- end
24
- end
@@ -1,29 +0,0 @@
1
- module <%= class_name %>
2
- module Generators
3
- class InstallGenerator < Rails::Generators::Base
4
-
5
- def add_javascripts
6
- append_file "app/assets/javascripts/store/all.js", "//= require store/<%= file_name %>\n"
7
- append_file "app/assets/javascripts/admin/all.js", "//= require admin/<%= file_name %>\n"
8
- end
9
-
10
- def add_stylesheets
11
- inject_into_file "app/assets/stylesheets/store/all.css", " *= require store/<%= file_name %>\n", :before => /\*\//, :verbose => true
12
- inject_into_file "app/assets/stylesheets/admin/all.css", " *= require admin/<%= file_name %>\n", :before => /\*\//, :verbose => true
13
- end
14
-
15
- def add_migrations
16
- run 'bundle exec rake railties:install:migrations FROM=<%= file_name %>'
17
- end
18
-
19
- def run_migrations
20
- res = ask "Would you like to run the migrations now? [Y/n]"
21
- if res == "" || res.downcase == "y"
22
- run 'bundle exec rake db:migrate'
23
- else
24
- puts "Skiping rake db:migrate, don't forget to run it!"
25
- end
26
- end
27
- end
28
- end
29
- end
@@ -1,3 +0,0 @@
1
- Rails.application.routes.draw do
2
- # Add your extension routes here
3
- end
@@ -1 +0,0 @@
1
- --colour
@@ -1,12 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
-
4
- <% if integrated %>
5
- ENGINE_PATH = File.expand_path('../..', __FILE__)
6
- APP_PATH = File.expand_path('../../../config/application', __FILE__)
7
- require File.expand_path('../../../config/boot', __FILE__)
8
- require 'rails/commands'
9
- <% else %>
10
- ENGINE_PATH = File.expand_path('../..', __FILE__)
11
- load File.expand_path('../../spec/dummy/script/rails', __FILE__)
12
- <% end %>
@@ -1,33 +0,0 @@
1
- # Configure Rails Environment
2
- ENV["RAILS_ENV"] = "test"
3
-
4
- <% if integrated %>
5
- require File.expand_path("../../../config/environment.rb", __FILE__)
6
- <% else %>
7
- require File.expand_path("../dummy/config/environment.rb", __FILE__)
8
- <% end %>
9
-
10
- require 'rspec/rails'
11
-
12
- # Requires supporting ruby files with custom matchers and macros, etc,
13
- # in spec/support/ and its subdirectories.
14
- Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
15
-
16
- RSpec.configure do |config|
17
- # == Mock Framework
18
- #
19
- # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
20
- #
21
- # config.mock_with :mocha
22
- # config.mock_with :flexmock
23
- # config.mock_with :rr
24
- config.mock_with :rspec
25
-
26
- # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
27
- config.fixture_path = "#{::Rails.root}/spec/fixtures"
28
-
29
- # If you're not using ActiveRecord, or you'd prefer not to run each of your
30
- # examples within a transaction, remove the following line or assign false
31
- # instead of true.
32
- config.use_transactional_fixtures = true
33
- end