Skip to content
Browse files

have Gemfile at root level for bundle exec to work with cucumber and …

…spec
  • Loading branch information...
1 parent 0bf3fec commit 03a7b27270f0a01505cd6de1252eee50a414b359 @neerajdotname neerajdotname committed with schof
Showing with 58 additions and 47 deletions.
  1. +8 −10 api/Rakefile
  2. +8 −9 auth/Rakefile
  3. +6 −8 core/Rakefile
  4. +7 −9 dash/Rakefile
  5. +21 −0 lib/generators/spree/test_app_generator.rb
  6. +8 −11 promo/Rakefile
View
18 api/Rakefile
@@ -37,16 +37,6 @@ task :test_app do
require '../lib/generators/spree/test_app_generator'
class ApiTestAppGenerator < Spree::Generators::TestAppGenerator
- def tweak_gemfile
- append_file 'Gemfile' do
- <<-gems
-gem 'spree_core', :path => \'#{File.join(File.dirname(__FILE__), "..", "core")}\'
-gem 'spree_auth', :path => \'#{File.join(File.dirname(__FILE__), "..", "auth")}\'
-gem 'spree_api', :path => \'#{File.dirname(__FILE__)}\'
- gems
- end
- end
-
def install_gems
inside "test_app" do
run 'rake spree_core:install'
@@ -59,6 +49,14 @@ gem 'spree_api', :path => \'#{File.dirname(__FILE__)}\'
run_migrations
end
+ protected
+ def full_path_for_local_gems
+ <<-gems
+gem 'spree_core', :path => \'#{File.join(File.dirname(__FILE__), "..", "core")}\'
+gem 'spree_auth', :path => \'#{File.join(File.dirname(__FILE__), "..", "auth")}\'
+gem 'spree_api', :path => \'#{File.dirname(__FILE__)}\'
+ gems
+ end
end
ApiTestAppGenerator.start
View
17 auth/Rakefile
@@ -42,15 +42,6 @@ task :test_app do
require '../lib/generators/spree/test_app_generator'
class AuthTestAppGenerator < Spree::Generators::TestAppGenerator
- def tweak_gemfile
- append_file 'Gemfile' do
- <<-gems
-gem 'spree_core', :path => \'#{File.join(File.dirname(__FILE__), "..", "core")}\'
-gem 'spree_auth', :path => \'#{File.dirname(__FILE__)}\'
- gems
- end
- end
-
def install_gems
inside "test_app" do
run 'rake spree_auth:install'
@@ -62,6 +53,14 @@ gem 'spree_auth', :path => \'#{File.dirname(__FILE__)}\'
run_migrations
end
+ protected
+ def full_path_for_local_gems
+ <<-gems
+gem 'spree_core', :path => \'#{File.join(File.dirname(__FILE__), "..", "core")}\'
+gem 'spree_auth', :path => \'#{File.dirname(__FILE__)}\'
+ gems
+ end
+
end
AuthTestAppGenerator.start
end
View
14 core/Rakefile
@@ -43,14 +43,6 @@ task :test_app do
require '../lib/generators/spree/test_app_generator'
class CoreTestAppGenerator < Spree::Generators::TestAppGenerator
- def tweak_gemfile
- append_file 'Gemfile' do
- <<-gems
-gem 'spree_core', :path => \'#{File.dirname(__FILE__)}\'
- gems
- end
- end
-
def install_spree_core
inside "test_app" do
run 'rake spree_core:install'
@@ -61,6 +53,12 @@ gem 'spree_core', :path => \'#{File.dirname(__FILE__)}\'
run_migrations
end
+ protected
+ def full_path_for_local_gems
+ <<-gems
+gem 'spree_core', :path => \'#{File.dirname(__FILE__)}\'
+ gems
+ end
end
CoreTestAppGenerator.start
end
View
16 dash/Rakefile
@@ -37,15 +37,6 @@ task :test_app do
require '../lib/generators/spree/test_app_generator'
class DashTestAppGenerator < Spree::Generators::TestAppGenerator
- def tweak_gemfile
- append_file 'Gemfile' do
- <<-gems
-gem 'spree_core', :path => \'#{File.join(File.dirname(__FILE__), "..", "core")}\'
-gem 'spree_dash', :path => \'#{File.dirname(__FILE__)}\'
- gems
- end
- end
-
def install_spree_dash
inside "test_app" do
run 'rake spree_core:install'
@@ -57,6 +48,13 @@ gem 'spree_dash', :path => \'#{File.dirname(__FILE__)}\'
run_migrations
end
+ protected
+ def full_path_for_local_gems
+ <<-gems
+gem 'spree_core', :path => \'#{File.join(File.dirname(__FILE__), "..", "core")}\'
+gem 'spree_dash', :path => \'#{File.dirname(__FILE__)}\'
+ gems
+ end
end
DashTestAppGenerator.start
end
View
21 lib/generators/spree/test_app_generator.rb
@@ -19,6 +19,11 @@ def generate_app
end
end
+ def create_rspec_gemfile
+ # newer versions of rspec require a Gemfil in the local gem dirs so create one there as well as in spec/test_app
+ template "Gemfile"
+ end
+
def create_root
self.destination_root = File.expand_path("spec/#{test_app}", destination_root)
end
@@ -76,6 +81,22 @@ def create_databases_yml
template "config/database.yml"
end
+ def tweak_gemfile
+ append_file '../../Gemfile' do
+ full_path_for_local_gems
+ end
+
+ append_file 'Gemfile' do
+ full_path_for_local_gems
+ end
+ end
+
+ protected
+ def full_path_for_local_gems
+ # Gemfile needs to be full local path to the source (ex. /Users/schof/repos/spree/auth)
+ # By default we do nothing but each gem should override this method with the appropriate content
+ end
+
private
def run_migrations
View
19 promo/Rakefile
@@ -35,16 +35,6 @@ task :test_app do
require '../lib/generators/spree/test_app_generator'
class AuthTestAppGenerator < Spree::Generators::TestAppGenerator
- def tweak_gemfile
- append_file 'Gemfile' do
- <<-gems
-gem 'spree_core', :path => \'#{File.join(File.dirname(__FILE__), "..", "core")}\'
-gem 'spree_promo', :path => \'#{File.dirname(__FILE__)}\'
-gem 'spree_auth', :path => \'#{File.join(File.dirname(__FILE__), "..", "auth")}\'
- gems
- end
- end
-
def install_gems
inside "test_app" do
run 'rake spree_core:install'
@@ -57,7 +47,14 @@ gem 'spree_auth', :path => \'#{File.join(File.dirname(__FILE__), "..", "auth")}\
run_migrations
end
+ protected
+ def full_path_for_local_gems
+ <<-gems
+gem 'spree_core', :path => \'#{File.join(File.dirname(__FILE__), "..", "core")}\'
+gem 'spree_promo', :path => \'#{File.dirname(__FILE__)}\'
+gem 'spree_auth', :path => \'#{File.join(File.dirname(__FILE__), "..", "auth")}\'
+ gems
+ end
end
AuthTestAppGenerator.start
end
-

0 comments on commit 03a7b27

Please sign in to comment.
Something went wrong with that request. Please try again.