spree 0.60.6 → 0.70.0.rc2
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 +41 -31
- data/lib/spree.rb +1 -4
- data/lib/spree/bin/spree +6 -0
- data/lib/spree/cli.rb +52 -0
- data/lib/spree/engine.rb +5 -0
- data/lib/spree/extension.rb +77 -0
- data/lib/spree/templates/extension/Gemfile +22 -0
- data/lib/{generators/templates → spree/templates/extension}/LICENSE +11 -8
- data/lib/{generators/templates → spree/templates/extension}/README.md +7 -0
- data/lib/spree/templates/extension/Rakefile +31 -0
- data/lib/{generators/templates/Versionfile.tt → spree/templates/extension/Versionfile} +2 -2
- data/lib/spree/templates/extension/app/assets/javascripts/admin/%file_name%.js +1 -0
- data/lib/spree/templates/extension/app/assets/javascripts/store/%file_name%.js +1 -0
- data/lib/spree/templates/extension/app/assets/stylesheets/admin/%file_name%.css +3 -0
- data/lib/spree/templates/extension/app/assets/stylesheets/store/%file_name%.css +3 -0
- data/lib/{generators/templates/extension.gemspec.tt → spree/templates/extension/extension.gemspec} +6 -3
- data/lib/{generators/templates/gitignore.tt → spree/templates/extension/gitignore} +1 -0
- data/lib/spree/templates/extension/lib/%file_name%.rb.tt +2 -0
- data/lib/spree/templates/extension/lib/%file_name%/engine.rb.tt +24 -0
- data/lib/spree/templates/extension/lib/generators/%file_name%/install/install_generator.rb.tt +29 -0
- data/lib/{generators/templates → spree/templates/extension}/routes.rb +0 -0
- data/lib/spree/templates/extension/rspec +1 -0
- data/lib/spree/templates/extension/script/rails.tt +12 -0
- data/lib/spree/templates/extension/spec_helper.rb.tt +33 -0
- metadata +75 -61
- data/lib/generators/spree/extension_generator.rb +0 -71
- data/lib/generators/spree/site_generator.rb +0 -45
- data/lib/generators/spree/test_app_generator.rb +0 -145
- data/lib/generators/templates/Gemfile +0 -32
- data/lib/generators/templates/Rakefile.tt +0 -75
- data/lib/generators/templates/config/database.yml +0 -17
- data/lib/generators/templates/config/database.yml.mysql +0 -29
- data/lib/generators/templates/config/database.yml.sqlite3 +0 -17
- data/lib/generators/templates/config/environments/cucumber.rb +0 -38
- data/lib/generators/templates/extension/extension.rb.tt +0 -17
- data/lib/generators/templates/hooks.rb.tt +0 -3
- data/lib/generators/templates/install.rake.tt +0 -25
- data/lib/generators/templates/lib/tasks/%file_name%.rake.tt +0 -1
- data/lib/generators/templates/spec_helper.rb +0 -30
- data/lib/generators/templates/spree_site.rb +0 -12
- data/lib/tasks/install.rake +0 -29
@@ -0,0 +1,29 @@
|
|
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
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
@@ -0,0 +1,12 @@
|
|
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 %>
|
@@ -0,0 +1,33 @@
|
|
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
|
metadata
CHANGED
@@ -1,151 +1,165 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 15425137
|
5
|
+
prerelease: 7
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
|
8
|
+
- 70
|
9
|
+
- 0
|
10
|
+
- rc
|
11
|
+
- 2
|
12
|
+
version: 0.70.0.rc2
|
11
13
|
platform: ruby
|
12
14
|
authors:
|
13
15
|
- Sean Schofield
|
14
16
|
autorequire:
|
15
|
-
bindir: bin
|
17
|
+
bindir: lib/spree/bin
|
16
18
|
cert_chain: []
|
17
19
|
|
18
|
-
date:
|
20
|
+
date: 2011-09-30 00:00:00 Z
|
19
21
|
dependencies:
|
20
22
|
- !ruby/object:Gem::Dependency
|
21
|
-
prerelease: false
|
22
23
|
type: :runtime
|
24
|
+
prerelease: false
|
23
25
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
26
|
none: false
|
25
27
|
requirements:
|
26
28
|
- - "="
|
27
29
|
- !ruby/object:Gem::Version
|
28
|
-
hash:
|
30
|
+
hash: 15425137
|
29
31
|
segments:
|
30
32
|
- 0
|
31
|
-
-
|
32
|
-
-
|
33
|
-
|
33
|
+
- 70
|
34
|
+
- 0
|
35
|
+
- rc
|
36
|
+
- 2
|
37
|
+
version: 0.70.0.rc2
|
34
38
|
version_requirements: *id001
|
35
39
|
name: spree_core
|
36
40
|
- !ruby/object:Gem::Dependency
|
37
|
-
prerelease: false
|
38
41
|
type: :runtime
|
42
|
+
prerelease: false
|
39
43
|
requirement: &id002 !ruby/object:Gem::Requirement
|
40
44
|
none: false
|
41
45
|
requirements:
|
42
46
|
- - "="
|
43
47
|
- !ruby/object:Gem::Version
|
44
|
-
hash:
|
48
|
+
hash: 15425137
|
45
49
|
segments:
|
46
50
|
- 0
|
47
|
-
-
|
48
|
-
-
|
49
|
-
|
51
|
+
- 70
|
52
|
+
- 0
|
53
|
+
- rc
|
54
|
+
- 2
|
55
|
+
version: 0.70.0.rc2
|
50
56
|
version_requirements: *id002
|
51
57
|
name: spree_auth
|
52
58
|
- !ruby/object:Gem::Dependency
|
53
|
-
prerelease: false
|
54
59
|
type: :runtime
|
60
|
+
prerelease: false
|
55
61
|
requirement: &id003 !ruby/object:Gem::Requirement
|
56
62
|
none: false
|
57
63
|
requirements:
|
58
64
|
- - "="
|
59
65
|
- !ruby/object:Gem::Version
|
60
|
-
hash:
|
66
|
+
hash: 15425137
|
61
67
|
segments:
|
62
68
|
- 0
|
63
|
-
-
|
64
|
-
-
|
65
|
-
|
69
|
+
- 70
|
70
|
+
- 0
|
71
|
+
- rc
|
72
|
+
- 2
|
73
|
+
version: 0.70.0.rc2
|
66
74
|
version_requirements: *id003
|
67
75
|
name: spree_api
|
68
76
|
- !ruby/object:Gem::Dependency
|
69
|
-
prerelease: false
|
70
77
|
type: :runtime
|
78
|
+
prerelease: false
|
71
79
|
requirement: &id004 !ruby/object:Gem::Requirement
|
72
80
|
none: false
|
73
81
|
requirements:
|
74
82
|
- - "="
|
75
83
|
- !ruby/object:Gem::Version
|
76
|
-
hash:
|
84
|
+
hash: 15425137
|
77
85
|
segments:
|
78
86
|
- 0
|
79
|
-
-
|
80
|
-
-
|
81
|
-
|
87
|
+
- 70
|
88
|
+
- 0
|
89
|
+
- rc
|
90
|
+
- 2
|
91
|
+
version: 0.70.0.rc2
|
82
92
|
version_requirements: *id004
|
83
93
|
name: spree_dash
|
84
94
|
- !ruby/object:Gem::Dependency
|
85
|
-
prerelease: false
|
86
95
|
type: :runtime
|
96
|
+
prerelease: false
|
87
97
|
requirement: &id005 !ruby/object:Gem::Requirement
|
88
98
|
none: false
|
89
99
|
requirements:
|
90
100
|
- - "="
|
91
101
|
- !ruby/object:Gem::Version
|
92
|
-
hash:
|
102
|
+
hash: 15425137
|
93
103
|
segments:
|
94
104
|
- 0
|
95
|
-
-
|
96
|
-
-
|
97
|
-
|
105
|
+
- 70
|
106
|
+
- 0
|
107
|
+
- rc
|
108
|
+
- 2
|
109
|
+
version: 0.70.0.rc2
|
98
110
|
version_requirements: *id005
|
99
111
|
name: spree_sample
|
100
112
|
- !ruby/object:Gem::Dependency
|
101
|
-
prerelease: false
|
102
113
|
type: :runtime
|
114
|
+
prerelease: false
|
103
115
|
requirement: &id006 !ruby/object:Gem::Requirement
|
104
116
|
none: false
|
105
117
|
requirements:
|
106
118
|
- - "="
|
107
119
|
- !ruby/object:Gem::Version
|
108
|
-
hash:
|
120
|
+
hash: 15425137
|
109
121
|
segments:
|
110
122
|
- 0
|
111
|
-
-
|
112
|
-
-
|
113
|
-
|
123
|
+
- 70
|
124
|
+
- 0
|
125
|
+
- rc
|
126
|
+
- 2
|
127
|
+
version: 0.70.0.rc2
|
114
128
|
version_requirements: *id006
|
115
129
|
name: spree_promo
|
116
130
|
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
131
|
email: sean@railsdog.com
|
118
|
-
executables:
|
119
|
-
|
132
|
+
executables:
|
133
|
+
- spree
|
120
134
|
extensions: []
|
121
135
|
|
122
136
|
extra_rdoc_files: []
|
123
137
|
|
124
138
|
files:
|
125
139
|
- README.md
|
126
|
-
- lib/
|
127
|
-
- lib/
|
128
|
-
- lib/
|
129
|
-
- lib/
|
130
|
-
- lib/
|
131
|
-
- lib/
|
132
|
-
- lib/
|
133
|
-
- lib/
|
134
|
-
- lib/
|
135
|
-
- lib/
|
136
|
-
- lib/
|
137
|
-
- lib/
|
138
|
-
- lib/
|
139
|
-
- lib/
|
140
|
-
- lib/
|
141
|
-
- lib/
|
142
|
-
- lib/
|
143
|
-
- lib/
|
144
|
-
- lib/
|
145
|
-
- lib/
|
146
|
-
- lib/
|
140
|
+
- lib/spree/bin/spree
|
141
|
+
- lib/spree/cli.rb
|
142
|
+
- lib/spree/engine.rb
|
143
|
+
- lib/spree/extension.rb
|
144
|
+
- lib/spree/templates/extension/app/assets/javascripts/admin/%file_name%.js
|
145
|
+
- lib/spree/templates/extension/app/assets/javascripts/store/%file_name%.js
|
146
|
+
- lib/spree/templates/extension/app/assets/stylesheets/admin/%file_name%.css
|
147
|
+
- lib/spree/templates/extension/app/assets/stylesheets/store/%file_name%.css
|
148
|
+
- lib/spree/templates/extension/extension.gemspec
|
149
|
+
- lib/spree/templates/extension/Gemfile
|
150
|
+
- lib/spree/templates/extension/gitignore
|
151
|
+
- lib/spree/templates/extension/lib/%file_name%/engine.rb.tt
|
152
|
+
- lib/spree/templates/extension/lib/%file_name%.rb.tt
|
153
|
+
- lib/spree/templates/extension/lib/generators/%file_name%/install/install_generator.rb.tt
|
154
|
+
- lib/spree/templates/extension/LICENSE
|
155
|
+
- lib/spree/templates/extension/Rakefile
|
156
|
+
- lib/spree/templates/extension/README.md
|
157
|
+
- lib/spree/templates/extension/routes.rb
|
158
|
+
- lib/spree/templates/extension/rspec
|
159
|
+
- lib/spree/templates/extension/script/rails.tt
|
160
|
+
- lib/spree/templates/extension/spec_helper.rb.tt
|
161
|
+
- lib/spree/templates/extension/Versionfile
|
147
162
|
- lib/spree.rb
|
148
|
-
- lib/tasks/install.rake
|
149
163
|
homepage: http://spreecommerce.com
|
150
164
|
licenses: []
|
151
165
|
|
@@ -1,71 +0,0 @@
|
|
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
|
@@ -1,45 +0,0 @@
|
|
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
|
@@ -1,145 +0,0 @@
|
|
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"
|
86
|
-
append_file '../../Gemfile' do
|
87
|
-
"gem 'mysql2'"
|
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
|