gonow-spree 0.70.99
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +128 -0
- data/lib/generators/spree/extension_generator.rb +71 -0
- data/lib/generators/spree/site_generator.rb +45 -0
- data/lib/generators/spree/test_app_generator.rb +145 -0
- data/lib/generators/templates/Gemfile +35 -0
- data/lib/generators/templates/LICENSE +23 -0
- data/lib/generators/templates/README.md +13 -0
- data/lib/generators/templates/Rakefile.tt +75 -0
- data/lib/generators/templates/Versionfile.tt +9 -0
- data/lib/generators/templates/config/database.yml +17 -0
- data/lib/generators/templates/config/database.yml.mysql +29 -0
- data/lib/generators/templates/config/database.yml.sqlite3 +17 -0
- data/lib/generators/templates/config/environments/cucumber.rb +38 -0
- data/lib/generators/templates/extension.gemspec.tt +20 -0
- data/lib/generators/templates/extension/extension.rb.tt +17 -0
- data/lib/generators/templates/gitignore.tt +9 -0
- data/lib/generators/templates/hooks.rb.tt +3 -0
- data/lib/generators/templates/install.rake.tt +25 -0
- data/lib/generators/templates/lib/tasks/%file_name%.rake.tt +1 -0
- data/lib/generators/templates/routes.rb +3 -0
- data/lib/generators/templates/spec_helper.rb +30 -0
- data/lib/generators/templates/spree_site.rb +12 -0
- data/lib/spree.rb +11 -0
- data/lib/tasks/install.rake +29 -0
- metadata +139 -0
data/README.md
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
SUMMARY
|
2
|
+
-------
|
3
|
+
|
4
|
+
Spree is a complete open source commerce solution for Ruby on Rails. It was originally developed by Sean Schofield
|
5
|
+
and is now maintained by a dedicated [core team](http://spreecommerce.com/core-team). You can find out more about
|
6
|
+
by visiting the [Spree e-commerce project page](http://spreecommerce.com).
|
7
|
+
|
8
|
+
Spree actually consists of several different gems, each of which are maintained in a single repository and documented
|
9
|
+
in a single set of [online documentation](http://spreecommerce.com/documentation). By requiring the Spree gem you
|
10
|
+
automatically require all of the necessary dependency gems. Those gems are as follows:
|
11
|
+
|
12
|
+
* spree_api
|
13
|
+
* spree_auth
|
14
|
+
* spree_core
|
15
|
+
* spree_dash
|
16
|
+
* spree_promo
|
17
|
+
* spree_sample
|
18
|
+
|
19
|
+
All of the gems are designed to work together to provide a fully functional e-commerce platform. It is also possible,
|
20
|
+
however, to use only the pieces you are interested in. So for example, you could use just the barebones spree\_core gem
|
21
|
+
and perhaps combine it with your own custom authorization scheme instead of using spree_auth.
|
22
|
+
|
23
|
+
Using the Gem
|
24
|
+
-------------
|
25
|
+
|
26
|
+
Start by adding the gem to your existing Rails 3.x application's Gemfile
|
27
|
+
|
28
|
+
gem 'spree'
|
29
|
+
|
30
|
+
Update your bundle
|
31
|
+
|
32
|
+
bundle install
|
33
|
+
|
34
|
+
Then use the install generator to do the basic setup (add Spree to Gemfile, etc.)
|
35
|
+
|
36
|
+
rails g spree:site
|
37
|
+
|
38
|
+
Now its time to install all of the necessary migrations, assets, etc.
|
39
|
+
|
40
|
+
rake spree:install
|
41
|
+
|
42
|
+
If you'd like to also install sample data and images you can follow up the above command with:
|
43
|
+
|
44
|
+
rake spree_sample:install
|
45
|
+
|
46
|
+
Now you just need to run the new migrations
|
47
|
+
|
48
|
+
rake db:migrate
|
49
|
+
rake db:seed
|
50
|
+
|
51
|
+
If you also want some sample products, orders, etc. to play with you can run the appropriate rake task.
|
52
|
+
|
53
|
+
rake db:sample
|
54
|
+
|
55
|
+
|
56
|
+
Browse Store
|
57
|
+
------------
|
58
|
+
|
59
|
+
http://localhost:nnnn
|
60
|
+
|
61
|
+
Browse Admin Interface
|
62
|
+
----------------------
|
63
|
+
|
64
|
+
http://localhost:nnnn/admin
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
Working with the edge source (latest and greatest features)
|
69
|
+
-----------------------------------------------------------
|
70
|
+
|
71
|
+
The source code is essentially a collection of gems. Spree is meant to be run within the context of Rails application. You can easily create a sandbox application inside of your cloned source directory for testing purposes.
|
72
|
+
|
73
|
+
|
74
|
+
1. Clone the git repo
|
75
|
+
|
76
|
+
git clone git://github.com/spree/spree.git spree
|
77
|
+
cd spree
|
78
|
+
|
79
|
+
2. Install the gem dependencies
|
80
|
+
|
81
|
+
bundle install
|
82
|
+
|
83
|
+
3. Create a sandbox rails application for testing purposes (and automatically perform all necessary database setup)
|
84
|
+
|
85
|
+
rake sandbox
|
86
|
+
|
87
|
+
6. Start the server
|
88
|
+
|
89
|
+
cd sandbox
|
90
|
+
rails server
|
91
|
+
|
92
|
+
Running Tests
|
93
|
+
-------------
|
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
|
+
|
102
|
+
Each gem contains its own series of tests, and for each directory, you need to do a quick one-time
|
103
|
+
creation of a test application and then you can use it to run the tests. For example, to run the
|
104
|
+
tests for the core project.
|
105
|
+
|
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'
|
111
|
+
|
112
|
+
# If you want to run specs for only a single spec file
|
113
|
+
$ bundle exec rspec spec/models/state_spec.rb
|
114
|
+
|
115
|
+
# If you want to run a particular line of spec
|
116
|
+
$ bundle exec rspec spec/models/state_spec.rb:7
|
117
|
+
|
118
|
+
# If you want to run a single cucumber feature
|
119
|
+
# bundle exec cucumber features/admin/orders.feature --require features
|
120
|
+
|
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
|
123
|
+
|
124
|
+
|
125
|
+
Contributing
|
126
|
+
------------
|
127
|
+
|
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.
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Spree
|
4
|
+
module Generators
|
5
|
+
class ExtensionGenerator < Rails::Generators::NamedBase
|
6
|
+
source_root File.expand_path("../../templates", __FILE__)
|
7
|
+
|
8
|
+
desc "Creates a new extension with the name you specify."
|
9
|
+
check_class_collision
|
10
|
+
|
11
|
+
def create_root_files
|
12
|
+
empty_directory file_name
|
13
|
+
empty_directory "#{file_name}/config"
|
14
|
+
empty_directory "#{file_name}/db"
|
15
|
+
empty_directory "#{file_name}/public"
|
16
|
+
template "LICENSE", "#{file_name}/LICENSE"
|
17
|
+
template "Rakefile.tt", "#{file_name}/Rakefile"
|
18
|
+
template "README.md", "#{file_name}/README.md"
|
19
|
+
template "gitignore.tt", "#{file_name}/.gitignore"
|
20
|
+
template "extension.gemspec.tt", "#{file_name}/#{file_name}.gemspec"
|
21
|
+
template "Versionfile.tt", "#{file_name}/Versionfile"
|
22
|
+
end
|
23
|
+
|
24
|
+
def config_routes
|
25
|
+
template "routes.rb", "#{file_name}/config/routes.rb"
|
26
|
+
end
|
27
|
+
|
28
|
+
def install_rake
|
29
|
+
template "install.rake.tt", "#{file_name}/lib/tasks/install.rake"
|
30
|
+
end
|
31
|
+
|
32
|
+
def create_app_dirs
|
33
|
+
empty_directory extension_dir('app')
|
34
|
+
empty_directory extension_dir('app/controllers')
|
35
|
+
empty_directory extension_dir('app/helpers')
|
36
|
+
empty_directory extension_dir('app/models')
|
37
|
+
empty_directory extension_dir('app/views')
|
38
|
+
empty_directory extension_dir('spec')
|
39
|
+
end
|
40
|
+
|
41
|
+
def create_lib_files
|
42
|
+
directory "lib", "#{file_name}/lib"
|
43
|
+
template 'extension/extension.rb.tt', "#{file_name}/lib/#{file_name}.rb"
|
44
|
+
template 'hooks.rb.tt', "#{file_name}/lib/#{file_name}_hooks.rb"
|
45
|
+
end
|
46
|
+
|
47
|
+
def create_spec_helper
|
48
|
+
template "spec_helper.rb", "#{file_name}/spec/spec_helper.rb"
|
49
|
+
end
|
50
|
+
|
51
|
+
def update_gemfile
|
52
|
+
gem file_name, :path => file_name, :require => file_name
|
53
|
+
end
|
54
|
+
|
55
|
+
protected
|
56
|
+
|
57
|
+
def current_locale
|
58
|
+
I18n.locale.to_s
|
59
|
+
end
|
60
|
+
|
61
|
+
def extension_dir(join=nil)
|
62
|
+
if join
|
63
|
+
File.join(file_name, join)
|
64
|
+
else
|
65
|
+
file_name
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Spree
|
2
|
+
module Generators
|
3
|
+
class SiteGenerator < Rails::Generators::Base
|
4
|
+
source_root File.expand_path("../../templates", __FILE__)
|
5
|
+
|
6
|
+
desc "Configures an existing Rails application to use Spree."
|
7
|
+
|
8
|
+
def create_lib_files
|
9
|
+
template 'spree_site.rb', "lib/spree_site.rb"
|
10
|
+
end
|
11
|
+
|
12
|
+
def additional_tweaks
|
13
|
+
remove_file "public/index.html"
|
14
|
+
|
15
|
+
append_file "public/robots.txt", <<-ROBOTS
|
16
|
+
User-agent: *
|
17
|
+
Disallow: /checkouts
|
18
|
+
Disallow: /orders
|
19
|
+
Disallow: /countries
|
20
|
+
Disallow: /line_items
|
21
|
+
Disallow: /password_resets
|
22
|
+
Disallow: /states
|
23
|
+
Disallow: /user_sessions
|
24
|
+
Disallow: /users
|
25
|
+
ROBOTS
|
26
|
+
|
27
|
+
append_file "db/seeds.rb", <<-SEEDS
|
28
|
+
\n
|
29
|
+
Rake::Task["db:load_dir"].invoke( "default" )
|
30
|
+
puts "Default data has been loaded"
|
31
|
+
SEEDS
|
32
|
+
end
|
33
|
+
|
34
|
+
def config_middleware
|
35
|
+
application 'config.middleware.use "SeoAssist"'
|
36
|
+
application 'config.middleware.use "RedirectLegacyProductUrl"'
|
37
|
+
end
|
38
|
+
|
39
|
+
def require_site
|
40
|
+
application "require 'spree_site'"
|
41
|
+
end
|
42
|
+
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,145 @@
|
|
1
|
+
require 'rails/generators'
|
2
|
+
|
3
|
+
module Spree
|
4
|
+
module Generators
|
5
|
+
class TestAppGenerator < Rails::Generators::Base
|
6
|
+
|
7
|
+
class << self
|
8
|
+
attr_accessor :verbose
|
9
|
+
end
|
10
|
+
|
11
|
+
class_option :app_name, :type => :string,
|
12
|
+
:desc => "The name of the test rails app to generate. Defaults to test_app.",
|
13
|
+
:default => "test_app"
|
14
|
+
|
15
|
+
def self.source_root
|
16
|
+
File.expand_path('../../templates', __FILE__)
|
17
|
+
end
|
18
|
+
|
19
|
+
def generate_app
|
20
|
+
remove_directory_if_exists("spec/#{test_app}")
|
21
|
+
inside "spec" do
|
22
|
+
run "bundle exec rails new #{test_app} --database=#{database_name} -GJTq --skip-gemfile"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def create_rspec_gemfile
|
27
|
+
# newer versions of rspec require a Gemfile in the local gem dirs so create one there as well as in spec/test_app
|
28
|
+
silence_stream(STDOUT) {
|
29
|
+
template "Gemfile", :force => true
|
30
|
+
remove_file "Gemfile.lock"
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
def create_root
|
35
|
+
self.destination_root = File.expand_path("spec/#{test_app}", destination_root)
|
36
|
+
end
|
37
|
+
|
38
|
+
def remove_unneeded_files
|
39
|
+
silence_stream(STDOUT) {
|
40
|
+
remove_file "doc"
|
41
|
+
remove_file "lib/tasks"
|
42
|
+
remove_file "public/images/rails.png"
|
43
|
+
remove_file "public/index.html"
|
44
|
+
remove_file "README"
|
45
|
+
remove_file "vendor"
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
def replace_gemfile
|
50
|
+
silence_stream(STDOUT) {
|
51
|
+
template "Gemfile"
|
52
|
+
}
|
53
|
+
end
|
54
|
+
|
55
|
+
def setup_environments
|
56
|
+
silence_stream(STDOUT) {
|
57
|
+
template "config/environments/cucumber.rb"
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
def create_databases_yml
|
62
|
+
silence_stream(STDOUT) {
|
63
|
+
remove_file "config/database.yml"
|
64
|
+
template "config/database.yml.#{database_name}"
|
65
|
+
mv "spec/test_app/config/database.yml.#{database_name}", "spec/test_app/config/database.yml", :verbose => false
|
66
|
+
}
|
67
|
+
end
|
68
|
+
|
69
|
+
def tweak_gemfile
|
70
|
+
silence_stream(STDOUT) {
|
71
|
+
append_file '../../Gemfile' do
|
72
|
+
full_path_for_local_gems
|
73
|
+
end
|
74
|
+
|
75
|
+
append_file 'Gemfile' do
|
76
|
+
full_path_for_local_gems
|
77
|
+
end
|
78
|
+
}
|
79
|
+
end
|
80
|
+
|
81
|
+
def append_db_adapter_gem
|
82
|
+
silence_stream(STDOUT) {
|
83
|
+
case database_name
|
84
|
+
when "mysql"
|
85
|
+
gem "mysql2", "0.2.7"
|
86
|
+
append_file '../../Gemfile' do
|
87
|
+
"gem 'mysql2', '0.2.7'"
|
88
|
+
end
|
89
|
+
else
|
90
|
+
gem "sqlite3-ruby"
|
91
|
+
append_file '../../Gemfile' do
|
92
|
+
"gem 'sqlite3-ruby'"
|
93
|
+
end
|
94
|
+
end
|
95
|
+
}
|
96
|
+
end
|
97
|
+
|
98
|
+
protected
|
99
|
+
def full_path_for_local_gems
|
100
|
+
# Gemfile needs to be full local path to the source (ex. /Users/schof/repos/spree/auth)
|
101
|
+
# By default we do nothing but each gem should override this method with the appropriate content
|
102
|
+
end
|
103
|
+
|
104
|
+
private
|
105
|
+
|
106
|
+
def run_migrations
|
107
|
+
silence_stream(STDOUT) {
|
108
|
+
inside "" do
|
109
|
+
run "bundle exec rake db:drop db:create db:migrate db:seed RAILS_ENV=test"
|
110
|
+
run "bundle exec rake db:drop db:create db:migrate db:seed RAILS_ENV=cucumber"
|
111
|
+
end
|
112
|
+
}
|
113
|
+
end
|
114
|
+
|
115
|
+
def test_app
|
116
|
+
options[:app_name]
|
117
|
+
end
|
118
|
+
|
119
|
+
def database_name
|
120
|
+
ENV['DB_NAME'] || "sqlite3"
|
121
|
+
end
|
122
|
+
|
123
|
+
def remove_directory_if_exists(path)
|
124
|
+
silence_stream(STDOUT) {
|
125
|
+
run "rm -r #{path}" if File.directory?(path)
|
126
|
+
}
|
127
|
+
end
|
128
|
+
|
129
|
+
def silence_stream(stream)
|
130
|
+
if self.class.verbose
|
131
|
+
yield
|
132
|
+
else
|
133
|
+
begin
|
134
|
+
old_stream = stream.dup
|
135
|
+
stream.reopen(RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? 'NUL:' : '/dev/null')
|
136
|
+
stream.sync = true
|
137
|
+
yield
|
138
|
+
ensure
|
139
|
+
stream.reopen(old_stream)
|
140
|
+
end
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
144
|
+
end
|
145
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
source 'http://rubygems.org'
|
2
|
+
|
3
|
+
gem 'rake', '~> 0.8.7'
|
4
|
+
gem 'linecache', '0.43'
|
5
|
+
|
6
|
+
group :test do
|
7
|
+
gem 'rspec-rails', '= 2.6.1'
|
8
|
+
gem 'factory_girl', '= 1.3.3'
|
9
|
+
gem 'factory_girl_rails', '= 1.0.1'
|
10
|
+
gem 'rcov'
|
11
|
+
gem 'shoulda'
|
12
|
+
gem 'faker'
|
13
|
+
if RUBY_VERSION < "1.9"
|
14
|
+
gem "ruby-debug"
|
15
|
+
else
|
16
|
+
gem "ruby-debug19"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
group :cucumber do
|
21
|
+
gem 'cucumber-rails'
|
22
|
+
gem 'database_cleaner', '= 0.6.7'
|
23
|
+
gem 'nokogiri'
|
24
|
+
gem 'capybara', '= 0.4.1.2'
|
25
|
+
gem 'factory_girl', '= 1.3.3'
|
26
|
+
gem 'factory_girl_rails', '= 1.0.1'
|
27
|
+
gem 'faker'
|
28
|
+
gem 'launchy'
|
29
|
+
|
30
|
+
if RUBY_VERSION < "1.9"
|
31
|
+
gem "ruby-debug"
|
32
|
+
else
|
33
|
+
gem "ruby-debug19"
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Redistribution and use in source and binary forms, with or without modification,
|
2
|
+
are permitted provided that the following conditions are met:
|
3
|
+
|
4
|
+
* Redistributions of source code must retain the above copyright notice,
|
5
|
+
this list of conditions and the following disclaimer.
|
6
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
7
|
+
this list of conditions and the following disclaimer in the documentation
|
8
|
+
and/or other materials provided with the distribution.
|
9
|
+
* Neither the name of the Rails Dog LLC nor the names of its
|
10
|
+
contributors may be used to endorse or promote products derived from this
|
11
|
+
software without specific prior written permission.
|
12
|
+
|
13
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
14
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
15
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
16
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
17
|
+
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
18
|
+
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
19
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
20
|
+
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
21
|
+
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
22
|
+
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
23
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/testtask'
|
4
|
+
require 'rake/packagetask'
|
5
|
+
require 'rubygems/package_task'
|
6
|
+
|
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'))
|
27
|
+
|
28
|
+
Gem::PackageTask.new(spec) do |p|
|
29
|
+
p.gem_spec = spec
|
30
|
+
end
|
31
|
+
|
32
|
+
desc "Release to gemcutter"
|
33
|
+
task :release => :package do
|
34
|
+
require 'rake/gemcutter'
|
35
|
+
Rake::Gemcutter::Tasks.new(spec).define
|
36
|
+
Rake::Task['gem:push'].invoke
|
37
|
+
end
|
38
|
+
|
39
|
+
desc "Default Task"
|
40
|
+
task :default => [ :spec ]
|
41
|
+
|
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
|
46
|
+
|
47
|
+
def install_gems
|
48
|
+
inside "test_app" do
|
49
|
+
run 'bundle exec rake spree_core:install'
|
50
|
+
run 'bundle exec 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 && bundle exec rake db:drop db:migrate RAILS_ENV=test && rake db:drop db:migrate RAILS_ENV=cucumber")
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,9 @@
|
|
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.50.x" => { :branch => "master" }
|
7
|
+
# "0.40.x" => { :tag => "v1.0.0", :version => "1.0.0" }
|
8
|
+
|
9
|
+
|
@@ -0,0 +1,17 @@
|
|
1
|
+
development:
|
2
|
+
adapter: sqlite3
|
3
|
+
database: db/cucumber.sqlite3
|
4
|
+
pool: 5
|
5
|
+
timeout: 5000
|
6
|
+
|
7
|
+
test:
|
8
|
+
adapter: sqlite3
|
9
|
+
database: db/test.sqlite3
|
10
|
+
pool: 5
|
11
|
+
timeout: 5000
|
12
|
+
|
13
|
+
cucumber:
|
14
|
+
adapter: sqlite3
|
15
|
+
database: db/cucumber.sqlite3
|
16
|
+
pool: 5
|
17
|
+
timeout: 5000
|
@@ -0,0 +1,29 @@
|
|
1
|
+
development:
|
2
|
+
adapter: mysql2
|
3
|
+
encoding: utf8
|
4
|
+
reconnect: false
|
5
|
+
database: test_app_development
|
6
|
+
pool: 5
|
7
|
+
username: root
|
8
|
+
password: welcome
|
9
|
+
socket: /tmp/mysql.sock
|
10
|
+
|
11
|
+
test:
|
12
|
+
adapter: mysql2
|
13
|
+
encoding: utf8
|
14
|
+
reconnect: false
|
15
|
+
database: test_app_test
|
16
|
+
pool: 5
|
17
|
+
username: root
|
18
|
+
password: welcome
|
19
|
+
socket: /tmp/mysql.sock
|
20
|
+
|
21
|
+
cucumber:
|
22
|
+
adapter: mysql2
|
23
|
+
encoding: utf8
|
24
|
+
reconnect: false
|
25
|
+
database: test_app_cucumber
|
26
|
+
pool: 5
|
27
|
+
username: root
|
28
|
+
password: welcome
|
29
|
+
socket: /tmp/mysql.sock
|
@@ -0,0 +1,17 @@
|
|
1
|
+
development:
|
2
|
+
adapter: sqlite3
|
3
|
+
database: db/cucumber.sqlite3
|
4
|
+
pool: 5
|
5
|
+
timeout: 5000
|
6
|
+
|
7
|
+
test:
|
8
|
+
adapter: sqlite3
|
9
|
+
database: db/test.sqlite3
|
10
|
+
pool: 5
|
11
|
+
timeout: 5000
|
12
|
+
|
13
|
+
cucumber:
|
14
|
+
adapter: sqlite3
|
15
|
+
database: db/cucumber.sqlite3
|
16
|
+
pool: 5
|
17
|
+
timeout: 5000
|
@@ -0,0 +1,38 @@
|
|
1
|
+
TestApp::Application.configure do
|
2
|
+
# Settings specified here will take precedence over those in config/environment.rb
|
3
|
+
|
4
|
+
# The test environment is used exclusively to run your application's
|
5
|
+
# test suite. You never need to work with it otherwise. Remember that
|
6
|
+
# your test database is "scratch space" for the test suite and is wiped
|
7
|
+
# and recreated between test runs. Don't rely on the data there!
|
8
|
+
config.cache_classes = true
|
9
|
+
|
10
|
+
# Log error messages when you accidentally call methods on nil.
|
11
|
+
config.whiny_nils = true
|
12
|
+
|
13
|
+
# Show full error reports and disable caching
|
14
|
+
config.consider_all_requests_local = true
|
15
|
+
config.action_controller.perform_caching = false
|
16
|
+
|
17
|
+
# Raise exceptions instead of rendering exception templates
|
18
|
+
config.action_dispatch.show_exceptions = false
|
19
|
+
|
20
|
+
# Disable request forgery protection in test environment
|
21
|
+
config.action_controller.allow_forgery_protection = false
|
22
|
+
|
23
|
+
# Tell Action Mailer not to deliver emails to the real world.
|
24
|
+
# The :test delivery method accumulates sent emails in the
|
25
|
+
# ActionMailer::Base.deliveries array.
|
26
|
+
config.action_mailer.delivery_method = :test
|
27
|
+
|
28
|
+
# Use SQL instead of Active Record's schema dumper when creating the test database.
|
29
|
+
# This is necessary if your schema can't be completely dumped by the schema dumper,
|
30
|
+
# like if you have constraints or database-specific column types
|
31
|
+
# config.active_record.schema_format = :sql
|
32
|
+
|
33
|
+
# Print deprecation notices to the stderr
|
34
|
+
config.active_support.deprecation = :stderr
|
35
|
+
|
36
|
+
config.action_mailer.default_url_options = { :host => 'testapp.com' }
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
s.platform = Gem::Platform::RUBY
|
3
|
+
s.name = '<%= file_name %>'
|
4
|
+
s.version = '<%= Spree.version %>'
|
5
|
+
s.summary = 'Add gem summary here'
|
6
|
+
s.description = 'Add (optional) gem description here'
|
7
|
+
s.required_ruby_version = '>= 1.8.7'
|
8
|
+
|
9
|
+
# s.author = 'David Heinemeier Hansson'
|
10
|
+
# s.email = 'david@loudthinking.com'
|
11
|
+
# s.homepage = 'http://www.rubyonrails.org'
|
12
|
+
# s.rubyforge_project = 'actionmailer'
|
13
|
+
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
s.require_path = 'lib'
|
17
|
+
s.requirements << 'none'
|
18
|
+
|
19
|
+
s.add_dependency('spree_core', '>= <%= Spree.version %>')
|
20
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spree_core'
|
2
|
+
require '<%=file_name%>_hooks'
|
3
|
+
|
4
|
+
module <%=class_name%>
|
5
|
+
class Engine < Rails::Engine
|
6
|
+
|
7
|
+
config.autoload_paths += %W(#{config.root}/lib)
|
8
|
+
|
9
|
+
def self.activate
|
10
|
+
Dir.glob(File.join(File.dirname(__FILE__), "../app/**/*_decorator*.rb")) do |c|
|
11
|
+
Rails.env.production? ? require(c) : load(c)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
config.to_prepare &method(:activate).to_proc
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
namespace :<%= file_name %> do
|
2
|
+
desc "Copies all migrations and assets (NOTE: This will be obsolete with Rails 3.1)"
|
3
|
+
task :install do
|
4
|
+
Rake::Task['<%= file_name %>:install:migrations'].invoke
|
5
|
+
Rake::Task['<%= file_name %>:install:assets'].invoke
|
6
|
+
end
|
7
|
+
|
8
|
+
namespace :install do
|
9
|
+
desc "Copies all migrations (NOTE: This will be obsolete with Rails 3.1)"
|
10
|
+
task :migrations do
|
11
|
+
source = File.join(File.dirname(__FILE__), '..', '..', 'db')
|
12
|
+
destination = File.join(Rails.root, 'db')
|
13
|
+
Spree::FileUtilz.mirror_files(source, destination)
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "Copies all assets (NOTE: This will be obsolete with Rails 3.1)"
|
17
|
+
task :assets do
|
18
|
+
source = File.join(File.dirname(__FILE__), '..', '..', 'public')
|
19
|
+
destination = File.join(Rails.root, 'public')
|
20
|
+
puts "INFO: Mirroring assets from #{source} to #{destination}"
|
21
|
+
Spree::FileUtilz.mirror_files(source, destination)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
# add custom rake tasks here
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# This file is copied to ~/spec when you run 'ruby script/generate rspec'
|
2
|
+
# from the project root directory.
|
3
|
+
ENV["RAILS_ENV"] ||= 'test'
|
4
|
+
require File.expand_path("../test_app/config/environment", __FILE__)
|
5
|
+
require 'rspec/rails'
|
6
|
+
|
7
|
+
# Requires supporting files with custom matchers and macros, etc,
|
8
|
+
# in ./support/ and its subdirectories.
|
9
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
10
|
+
|
11
|
+
RSpec.configure do |config|
|
12
|
+
# == Mock Framework
|
13
|
+
#
|
14
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
15
|
+
#
|
16
|
+
# config.mock_with :mocha
|
17
|
+
# config.mock_with :flexmock
|
18
|
+
# config.mock_with :rr
|
19
|
+
config.mock_with :rspec
|
20
|
+
|
21
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
22
|
+
|
23
|
+
#config.include Devise::TestHelpers, :type => :controller
|
24
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your
|
25
|
+
# examples within a transaction, comment the following line or assign false
|
26
|
+
# instead of true.
|
27
|
+
config.use_transactional_fixtures = true
|
28
|
+
end
|
29
|
+
|
30
|
+
@configuration ||= AppConfiguration.find_or_create_by_name("Default configuration")
|
data/lib/spree.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
namespace :spree do
|
2
|
+
desc "Copies all migrations and assets (NOTE: This will be obsolete with Rails 3.1)"
|
3
|
+
task :install do
|
4
|
+
Rake::Task['spree:install:migrations'].invoke
|
5
|
+
Rake::Task['spree:install:assets'].invoke
|
6
|
+
end
|
7
|
+
|
8
|
+
namespace :install do
|
9
|
+
|
10
|
+
desc "Copies all migrations (NOTE: This will be obsolete with Rails 3.1)"
|
11
|
+
task :migrations do
|
12
|
+
Rake::Task['spree_core:install:migrations'].invoke
|
13
|
+
Rake::Task['spree_auth:install:migrations'].invoke
|
14
|
+
Rake::Task['spree_api:install:migrations'].invoke
|
15
|
+
Rake::Task['spree_dash:install:migrations'].invoke
|
16
|
+
Rake::Task['spree_promo:install:migrations'].invoke
|
17
|
+
end
|
18
|
+
|
19
|
+
desc "Copies all assets (NOTE: This will be obsolete with Rails 3.1)"
|
20
|
+
task :assets do
|
21
|
+
Rake::Task['spree_core:install:assets'].invoke
|
22
|
+
Rake::Task['spree_auth:install:assets'].invoke
|
23
|
+
Rake::Task['spree_api:install:assets'].invoke
|
24
|
+
Rake::Task['spree_dash:install:assets'].invoke
|
25
|
+
Rake::Task['spree_promo:install:assets'].invoke
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gonow-spree
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.70.99
|
5
|
+
prerelease: !!null
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Sean Schofield
|
9
|
+
autorequire: !!null
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-06-30 00:00:00.000000000 -03:00
|
13
|
+
default_executable: !!null
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: spree_core
|
17
|
+
requirement: &2157674860 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - =
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.70.99
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *2157674860
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: spree_auth
|
28
|
+
requirement: &2157677140 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - =
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.70.99
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *2157677140
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: spree_api
|
39
|
+
requirement: &2157679340 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - =
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: 0.70.99
|
45
|
+
type: :runtime
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *2157679340
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: spree_dash
|
50
|
+
requirement: &2157689660 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - =
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 0.70.99
|
56
|
+
type: :runtime
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: *2157689660
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: spree_sample
|
61
|
+
requirement: &2157691820 !ruby/object:Gem::Requirement
|
62
|
+
none: false
|
63
|
+
requirements:
|
64
|
+
- - =
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: 0.70.99
|
67
|
+
type: :runtime
|
68
|
+
prerelease: false
|
69
|
+
version_requirements: *2157691820
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: spree_promo
|
72
|
+
requirement: &2157693920 !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - =
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 0.70.99
|
78
|
+
type: :runtime
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: *2157693920
|
81
|
+
description: ! 'Spree is an open source e-commerce framework for Ruby on Rails. Join
|
82
|
+
us on the spree-user google group or in #spree on IRC. This customized version use
|
83
|
+
gonow-activemerchant gem'
|
84
|
+
email: sean@railsdog.com
|
85
|
+
executables: []
|
86
|
+
extensions: []
|
87
|
+
extra_rdoc_files: []
|
88
|
+
files:
|
89
|
+
- README.md
|
90
|
+
- lib/generators/spree/extension_generator.rb
|
91
|
+
- lib/generators/spree/site_generator.rb
|
92
|
+
- lib/generators/spree/test_app_generator.rb
|
93
|
+
- lib/generators/templates/config/database.yml
|
94
|
+
- lib/generators/templates/config/database.yml.mysql
|
95
|
+
- lib/generators/templates/config/database.yml.sqlite3
|
96
|
+
- lib/generators/templates/config/environments/cucumber.rb
|
97
|
+
- lib/generators/templates/extension/extension.rb.tt
|
98
|
+
- lib/generators/templates/extension.gemspec.tt
|
99
|
+
- lib/generators/templates/Gemfile
|
100
|
+
- lib/generators/templates/gitignore.tt
|
101
|
+
- lib/generators/templates/hooks.rb.tt
|
102
|
+
- lib/generators/templates/install.rake.tt
|
103
|
+
- lib/generators/templates/lib/tasks/%file_name%.rake.tt
|
104
|
+
- lib/generators/templates/LICENSE
|
105
|
+
- lib/generators/templates/Rakefile.tt
|
106
|
+
- lib/generators/templates/README.md
|
107
|
+
- lib/generators/templates/routes.rb
|
108
|
+
- lib/generators/templates/spec_helper.rb
|
109
|
+
- lib/generators/templates/spree_site.rb
|
110
|
+
- lib/generators/templates/Versionfile.tt
|
111
|
+
- lib/spree.rb
|
112
|
+
- lib/tasks/install.rake
|
113
|
+
has_rdoc: true
|
114
|
+
homepage: http://spreecommerce.com
|
115
|
+
licenses: []
|
116
|
+
post_install_message: !!null
|
117
|
+
rdoc_options: []
|
118
|
+
require_paths:
|
119
|
+
- lib
|
120
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 1.8.7
|
126
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
+
none: false
|
128
|
+
requirements:
|
129
|
+
- - ! '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 1.3.6
|
132
|
+
requirements:
|
133
|
+
- none
|
134
|
+
rubyforge_project: spree
|
135
|
+
rubygems_version: 1.5.0
|
136
|
+
signing_key: !!null
|
137
|
+
specification_version: 3
|
138
|
+
summary: Full-stack e-commerce framework for Ruby on Rails.
|
139
|
+
test_files: []
|