Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Gemfile stanza is not replaced on update #79

Open
dazza-codes opened this issue May 19, 2017 · 0 comments
Open

Gemfile stanza is not replaced on update #79

dazza-codes opened this issue May 19, 2017 · 0 comments

Comments

@dazza-codes
Copy link

dazza-codes commented May 19, 2017

In the hyrax master branch (May 19, 2017), the engine cart is appending a new Gemfile stanza when one already exists. The update should replace an existing stanza. How engine-cart detects the need to update may be a part of this too.

As background/context for this issue:

$ git remote -v
origin	git@github.com:projecthydra-labs/hyrax.git (fetch)
origin	git@github.com:projecthydra-labs/hyrax.git (push)

$ git lol -n2
* 57d81b4 (HEAD -> master, origin/master, origin/HEAD) Don't overwrite the data key
* 716c95c Don't put objects in the repository when they aren't required for the test

$ rbenv versions
  system
* 2.4.1 (set by /users/dlweber/.rbenv/version)
$ gem --version
2.6.11
$ bundle --version
Bundler version 1.14.6

$ rbenv which rails
/data/src/dlss/hydra/hyrax/.bundle/bin/rails
$ rails --version
Rails 5.1.1

##
## This was a clean hyrax git-clone (no Gemfile.lock or .internal_test_app existed)
## After running bundle install and EC:generate, the Gemfile has a new EC stanza
##

$ git diff
diff --git a/Gemfile b/Gemfile
index 1a6710d..b116551 100644
--- a/Gemfile
+++ b/Gemfile
@@ -48,3 +48,37 @@ end
 unless File.exist?(file)
   eval_gemfile File.expand_path('spec/test_app_templates/Gemfile.extra', File.dirname(__FILE__))
 end
+# BEGIN ENGINE_CART BLOCK
+# engine_cart: 1.1.0
+# engine_cart stanza: 0.10.0
+# the below comes from engine_cart, a gem used to test this Rails engine gem in the context of a Rails app.
+file = File.expand_path('Gemfile', ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path('.internal_test_app', File.dirname(__FILE__)))
+if File.exist?(file)
+  begin
+    eval_gemfile file
+  rescue Bundler::GemfileError => e
+    Bundler.ui.warn '[EngineCart] Skipping Rails application dependencies:'
+    Bundler.ui.warn e.message
+  end
+else
+  Bundler.ui.warn "[EngineCart] Unable to find test application dependencies in #{file}, using placeholder dependencies"
+
+  if ENV['RAILS_VERSION']
+    if ENV['RAILS_VERSION'] == 'edge'
+      gem 'rails', github: 'rails/rails'
+      ENV['ENGINE_CART_RAILS_OPTIONS'] = '--edge --skip-turbolinks'
+    else
+      gem 'rails', ENV['RAILS_VERSION']
+    end
+  end
+
+  case ENV['RAILS_VERSION']
+  when /^4.2/
+    gem 'responders', '~> 2.0'
+    gem 'sass-rails', '>= 5.0'
+    gem 'coffee-rails', '~> 4.1.0'
+  when /^4.[01]/
+    gem 'sass-rails', '< 5.0'
+  end
+end
+# END ENGINE_CART BLOCK
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant