Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix dependency management #5

Merged
merged 3 commits into from

3 participants

@rossmeissl

After upgrading to the newest version of git_remote_branch, I was running into Bundler issues due to some new code introduced in this commit.

My understanding is that it is great to use Bundler (i.e., set up a Gemfile) to make it easier for additional developers to contribute to your project (by allowing them to bundle install to prepare development dependencies), but that explicitly calling Bundler.setup from inside the gem is not common practice.

See commit messages for rationales/citations.

rossmeissl added some commits
@rossmeissl rossmeissl Do not run Bundler.setup from main library.
Imagine a typical use case for grb:

* User moves to a project dir (~/myproj)
* User uses grb (grb create funtimes)
* grb executes Bundler.setup, which munges Ruby's load path to match myproj's Gemfile.lock
* grb tries to require "rainbow," which isn't in myproj's Gemfile.lock
* grb dies

Gem dependencies are better handled by Rubygems during install, and later by Bundler when running against an
actual app's Gemfile.
7aa067e
@rossmeissl rossmeissl Don't version Gemfile.lock a24f4b1
@rossmeissl rossmeissl Specify dependencies in the gemspec, not Gemfile b5bef39
@webmat webmat merged commit 8d07316 into webmat:master
@webmat
Owner

Thanks @rossmeissl, I'll try it out and push a new version of the gem this evening!

@rossmeissl

Thanks!

@sumbach

Thanks to both of you!

@webmat
Owner

grb 0.3.3 is out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 14, 2011
  1. @rossmeissl

    Do not run Bundler.setup from main library.

    rossmeissl authored
    Imagine a typical use case for grb:
    
    * User moves to a project dir (~/myproj)
    * User uses grb (grb create funtimes)
    * grb executes Bundler.setup, which munges Ruby's load path to match myproj's Gemfile.lock
    * grb tries to require "rainbow," which isn't in myproj's Gemfile.lock
    * grb dies
    
    Gem dependencies are better handled by Rubygems during install, and later by Bundler when running against an
    actual app's Gemfile.
  2. @rossmeissl
  3. @rossmeissl
This page is out of date. Refresh to see the latest.
View
2  .gitignore
@@ -4,3 +4,5 @@ coverage
test_runs
test_runs/**/*
rdoc
+Gemfile.lock
+*~
View
10 Gemfile
@@ -1,10 +1,2 @@
source :rubygems
-
-gem 'rainbow'
-group :development do
- gem 'rake'
- gem 'rdoc'
- gem 'test-unit'
- gem 'shoulda'
- gem 'mocha', :require => false # Must be loaded only after ActiveSupport::TestCase is defined
-end
+gemspec
View
24 Gemfile.lock
@@ -1,24 +0,0 @@
-GEM
- remote: http://rubygems.org/
- specs:
- json (1.6.1)
- metaclass (0.0.1)
- mocha (0.10.0)
- metaclass (~> 0.0.1)
- rainbow (1.1.3)
- rake (0.9.2.2)
- rdoc (3.11)
- json (~> 1.4)
- shoulda (2.11.3)
- test-unit (2.4.2)
-
-PLATFORMS
- ruby
-
-DEPENDENCIES
- mocha
- rainbow
- rake
- rdoc
- shoulda
- test-unit
View
142 git_remote_branch.gemspec
@@ -1,120 +1,26 @@
---- !ruby/object:Gem::Specification
-name: git_remote_branch
-version: !ruby/object:Gem::Version
- version: 0.3.0
-platform: ruby
-authors:
-- Mathieu Martin
-- Carl Mercier
-autorequire:
-bindir: bin
-cert_chain: []
+# -*- encoding: utf-8 -*-
+$:.push File.expand_path("../lib", __FILE__)
-date: 2008-11-14 00:00:00 -05:00
-default_executable:
-dependencies:
-- !ruby/object:Gem::Dependency
- name: colored
- type: :runtime
- version_requirement:
- version_requirements: !ruby/object:Gem::Requirement
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- version: "1.1"
- version:
-description: git_remote_branch is a learning tool to ease the interaction with remote branches in simple situations.
-email: webmat@gmail.com
-executables:
-- grb
-extensions: []
+Gem::Specification.new do |s|
+ s.name = "git_remote_branch"
+ s.version = '0.3.0'
+ s.platform = Gem::Platform::RUBY
+ s.authors = ["Mathieu Martin", "Carl Mercier"]
+ s.email = "webmat@gmail.com"
+ s.homepage = "http://github.com/webmat/git_remote_branch"
+ s.summary = %Q{git_remote_branch eases the interaction with remote branches}
+ s.description = %Q{git_remote_branch is a learning tool to ease the interaction with remote branches in simple situations.}
-extra_rdoc_files:
-- README.rdoc
-files:
-- bin
-- bin/grb
-- CHANGELOG
-- lib
-- lib/constants.rb
-- lib/git_remote_branch.rb
-- lib/param_reader.rb
-- lib/state.rb
-- lib/string_ext.rb
-- lib/version.rb
-- LICENSE
-- Rakefile
-- README.rdoc
-- tasks
-- tasks/gem.rake
-- tasks/rdoc.rake
-- tasks/test.rake
-- test
-- test/functional
-- test/functional/grb_test.rb
-- test/helpers
-- test/helpers/array_extensions.rb
-- test/helpers/constants.rb
-- test/helpers/extractable.rb
-- test/helpers/git_helper.rb
-- test/helpers/in_dir.rb
-- test/helpers/more_assertions.rb
-- test/helpers/shoulda_functional_helpers.rb
-- test/helpers/shoulda_unit_helpers.rb
-- test/helpers/temp_dir_helper.rb
-- test/test_helper.rb
-- test/unit
-- test/unit/git_helper_test.rb
-- test/unit/git_remote_branch_test.rb
-- test/unit/param_reader_test.rb
-- test/unit/state_test.rb
-- vendor
-- vendor/capture_fu.rb
-has_rdoc: true
-homepage: http://github.com/webmat/git_remote_branch
-post_install_message:
-rdoc_options:
-- --main
-- README.rdoc
-- --exclude
-- lib
-require_paths:
-- lib
-required_ruby_version: !ruby/object:Gem::Requirement
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- version: "0"
- version:
-required_rubygems_version: !ruby/object:Gem::Requirement
- requirements:
- - - ">="
- - !ruby/object:Gem::Version
- version: "0"
- version:
-requirements: []
-
-rubyforge_project: grb
-rubygems_version: 1.3.0
-signing_key:
-specification_version: 2
-summary: git_remote_branch eases the interaction with remote branches
-test_files:
-- test/functional
-- test/functional/grb_test.rb
-- test/helpers
-- test/helpers/array_extensions.rb
-- test/helpers/constants.rb
-- test/helpers/extractable.rb
-- test/helpers/git_helper.rb
-- test/helpers/in_dir.rb
-- test/helpers/more_assertions.rb
-- test/helpers/shoulda_functional_helpers.rb
-- test/helpers/shoulda_unit_helpers.rb
-- test/helpers/temp_dir_helper.rb
-- test/test_helper.rb
-- test/unit
-- test/unit/git_helper_test.rb
-- test/unit/git_remote_branch_test.rb
-- test/unit/param_reader_test.rb
-- test/unit/state_test.rb
+ s.files = `git ls-files`.split("\n")
+ s.test_files = `git ls-files -- test/*`.split("\n")
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
+ s.require_paths = ["lib"]
+
+ s.add_development_dependency "rake"
+ s.add_development_dependency "rdoc"
+ s.add_development_dependency 'test-unit'
+ s.add_development_dependency 'shoulda'
+ s.add_development_dependency 'mocha'
+ s.add_dependency 'rainbow'
+ s.add_dependency 'colored'
+end
View
9 lib/git_remote_branch.rb
@@ -1,13 +1,4 @@
require 'rubygems'
-
-begin
- require 'bundler/setup'
-rescue Bundler::GemNotFound => e
- STDERR.puts e.message
- STDERR.puts "Try running `bundle install`."
- exit!
-end
-
require 'rainbow'
begin
Something went wrong with that request. Please try again.