bundler 1.1.pre.4 → 1.1.pre.5

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bundler might be problematic. Click here for more details.

Files changed (65) hide show
  1. data/.travis.yml +1 -0
  2. data/CHANGELOG.md +51 -2
  3. data/ISSUES.md +25 -11
  4. data/README.md +3 -3
  5. data/Rakefile +44 -48
  6. data/lib/bundler.rb +21 -20
  7. data/lib/bundler/cli.rb +46 -11
  8. data/lib/bundler/definition.rb +6 -4
  9. data/lib/bundler/dependency.rb +5 -0
  10. data/lib/bundler/dsl.rb +1 -7
  11. data/lib/bundler/endpoint_specification.rb +22 -0
  12. data/lib/bundler/fetcher.rb +76 -22
  13. data/lib/bundler/gem_helper.rb +2 -7
  14. data/lib/bundler/gem_tasks.rb +2 -0
  15. data/lib/bundler/index.rb +48 -41
  16. data/lib/bundler/installer.rb +5 -0
  17. data/lib/bundler/lazy_specification.rb +7 -6
  18. data/lib/bundler/resolver.rb +1 -1
  19. data/lib/bundler/rubygems_ext.rb +1 -1
  20. data/lib/bundler/rubygems_integration.rb +69 -31
  21. data/lib/bundler/runtime.rb +2 -2
  22. data/lib/bundler/setup.rb +3 -0
  23. data/lib/bundler/shared_helpers.rb +2 -2
  24. data/lib/bundler/source.rb +48 -46
  25. data/lib/bundler/spec_set.rb +1 -0
  26. data/lib/bundler/templates/newgem/Gemfile.tt +1 -1
  27. data/lib/bundler/templates/newgem/Rakefile.tt +2 -2
  28. data/lib/bundler/templates/newgem/bin/newgem.tt +1 -1
  29. data/lib/bundler/templates/newgem/gitignore.tt +14 -1
  30. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +2 -0
  31. data/lib/bundler/templates/newgem/newgem.gemspec.tt +13 -17
  32. data/lib/bundler/ui.rb +29 -15
  33. data/lib/bundler/vendor/net/http/persistent.rb +4 -0
  34. data/lib/bundler/vendored_thor.rb +7 -0
  35. data/lib/bundler/version.rb +1 -1
  36. data/man/bundle-install.ronn +7 -0
  37. data/man/bundle.ronn +6 -0
  38. data/man/gemfile.5.ronn +2 -0
  39. data/spec/cache/gems_spec.rb +11 -0
  40. data/spec/install/deploy_spec.rb +1 -1
  41. data/spec/install/gems/dependency_api_spec.rb +62 -7
  42. data/spec/install/gems/groups_spec.rb +3 -3
  43. data/spec/install/gems/post_install_spec.rb +47 -0
  44. data/spec/install/gems/sudo_spec.rb +3 -2
  45. data/spec/install/git_spec.rb +1 -2
  46. data/spec/install/path_spec.rb +1 -1
  47. data/spec/lock/lockfile_spec.rb +1 -1
  48. data/spec/other/check_spec.rb +30 -6
  49. data/spec/other/exec_spec.rb +4 -33
  50. data/spec/other/init_spec.rb +3 -3
  51. data/spec/other/newgem_spec.rb +5 -1
  52. data/spec/other/outdated_spec.rb +36 -6
  53. data/spec/quality_spec.rb +5 -1
  54. data/spec/runtime/require_spec.rb +10 -10
  55. data/spec/runtime/setup_spec.rb +31 -8
  56. data/spec/spec_helper.rb +1 -5
  57. data/spec/support/artifice/endpoint.rb +4 -0
  58. data/spec/support/artifice/endpoint_basic_authentication.rb +13 -0
  59. data/spec/support/artifice/endpoint_fallback.rb +0 -4
  60. data/spec/support/artifice/endpoint_redirect.rb +4 -0
  61. data/spec/support/builders.rb +6 -1
  62. data/spec/support/matchers.rb +1 -1
  63. data/spec/support/rubygems_ext.rb +4 -3
  64. data/spec/update/git_spec.rb +2 -2
  65. metadata +55 -143
@@ -1,21 +1,17 @@
1
1
  # -*- encoding: utf-8 -*-
2
- $:.push File.expand_path("../lib", __FILE__)
3
- require "<%=config[:name]%>/version"
2
+ require File.expand_path('../lib/<%=config[:name]%>/version', __FILE__)
4
3
 
5
- Gem::Specification.new do |s|
6
- s.name = <%=config[:name].inspect%>
7
- s.version = <%=config[:constant_name]%>::VERSION
8
- s.platform = Gem::Platform::RUBY
9
- s.authors = [<%=config[:author].inspect%>]
10
- s.email = [<%=config[:email].inspect%>]
11
- s.homepage = ""
12
- s.summary = %q{TODO: Write a gem summary}
13
- s.description = %q{TODO: Write a gem description}
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = [<%=config[:author].inspect%>]
6
+ gem.email = [<%=config[:email].inspect%>]
7
+ gem.description = %q{TODO: Write a gem description}
8
+ gem.summary = %q{TODO: Write a gem summary}
9
+ gem.homepage = ''
14
10
 
15
- s.rubyforge_project = <%=config[:name].inspect%>
16
-
17
- s.files = `git ls-files`.split("\n")
18
- s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
19
- s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
- s.require_paths = ["lib"]
11
+ gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
+ gem.files = `git ls-files`.split("\n")
13
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
14
+ gem.name = <%=config[:name].inspect%>
15
+ gem.require_paths = ['lib']
16
+ gem.version = <%=config[:constant_name]%>::VERSION
21
17
  end
@@ -2,19 +2,23 @@ require 'rubygems/user_interaction'
2
2
 
3
3
  module Bundler
4
4
  class UI
5
- def warn(message)
5
+ def warn(message, newline = nil)
6
6
  end
7
7
 
8
- def debug(message)
8
+ def debug(message, newline = nil)
9
9
  end
10
10
 
11
- def error(message)
11
+ def error(message, newline = nil)
12
12
  end
13
13
 
14
- def info(message)
14
+ def info(message, newline = nil)
15
15
  end
16
16
 
17
- def confirm(message)
17
+ def confirm(message, newline = nil)
18
+ end
19
+
20
+ def debugging?
21
+ false
18
22
  end
19
23
 
20
24
  class Shell < UI
@@ -26,24 +30,28 @@ module Bundler
26
30
  @debug = ENV['DEBUG']
27
31
  end
28
32
 
29
- def debug(msg)
30
- @shell.say(msg) if @debug && !@quiet
33
+ def debug(msg, newline = nil)
34
+ tell_me(msg, nil, newline) if debugging?
35
+ end
36
+
37
+ def debugging?
38
+ @debug && !@quiet
31
39
  end
32
40
 
33
- def info(msg)
34
- @shell.say(msg) if !@quiet
41
+ def info(msg, newline = nil)
42
+ tell_me(msg, nil, newline) if !@quiet
35
43
  end
36
44
 
37
- def confirm(msg)
38
- @shell.say(msg, :green) if !@quiet
45
+ def confirm(msg, newline = nil)
46
+ tell_me(msg, :green, newline) if !@quiet
39
47
  end
40
48
 
41
- def warn(msg)
42
- @shell.say(msg, :yellow)
49
+ def warn(msg, newline = nil)
50
+ tell_me(msg, :yellow, newline)
43
51
  end
44
52
 
45
- def error(msg)
46
- @shell.say(msg, :red)
53
+ def error(msg, newline = nil)
54
+ tell_me(msg, :red, newline)
47
55
  end
48
56
 
49
57
  def be_quiet!
@@ -53,6 +61,12 @@ module Bundler
53
61
  def debug!
54
62
  @debug = true
55
63
  end
64
+
65
+ private
66
+ # valimism
67
+ def tell_me(msg, color = nil, newline = nil)
68
+ newline.nil? ? @shell.say(msg) : @shell.say(msg, nil, newline)
69
+ end
56
70
  end
57
71
 
58
72
  class RGProxy < ::Gem::SilentUI
@@ -348,6 +348,10 @@ class Net::HTTP::Persistent
348
348
  req.add_field(*pair)
349
349
  end
350
350
 
351
+ if uri.user or uri.password
352
+ req.basic_auth uri.user, uri.password
353
+ end
354
+
351
355
  req.add_field 'Connection', 'keep-alive'
352
356
  req.add_field 'Keep-Alive', @keep_alive
353
357
 
@@ -0,0 +1,7 @@
1
+ if defined?(Thor)
2
+ Bundler.ui.warn "Thor has already been required. " +
3
+ "This may cause Bundler to malfunction in unexpected ways."
4
+ end
5
+ $:.unshift File.expand_path('../vendor', __FILE__)
6
+ require 'thor'
7
+ require 'thor/actions'
@@ -2,5 +2,5 @@ module Bundler
2
2
  # We're doing this because we might write tests that deal
3
3
  # with other versions of bundler and we are unsure how to
4
4
  # handle this better.
5
- VERSION = "1.1.pre.4" unless defined?(::Bundler::VERSION)
5
+ VERSION = "1.1.pre.5" unless defined?(::Bundler::VERSION)
6
6
  end
@@ -8,6 +8,7 @@ bundle-install(1) -- Install the dependencies specified in your Gemfile
8
8
  [--without=GROUP1[ GROUP2...]]
9
9
  [--local] [--deployment]
10
10
  [--binstubs[=DIRECTORY]]
11
+ [--standalone[=GROUP1[ GROUP2...]]]
11
12
  [--quiet]
12
13
 
13
14
  ## DESCRIPTION
@@ -69,6 +70,12 @@ update process below under [CONSERVATIVE UPDATING][].
69
70
  a `bin/rails` executable that ensures that all dependencies used
70
71
  come from the bundled gems.
71
72
 
73
+ * `--standalone[=<list>]`:
74
+ Make a bundle that can work without Ruby Gems or Bundler at runtime.
75
+ It takes a space separated list of groups to install. It creates a
76
+ `bundle` directory and installs the bundle there. It also generates
77
+ a `bundle/bundler/setup.rb` file to replace Bundler's own setup.
78
+
72
79
  ## DEPLOYMENT MODE
73
80
 
74
81
  Bundler's defaults are optimized for development. To switch to
@@ -66,6 +66,12 @@ We divide `bundle` subcommands into primary commands and utilities.
66
66
 
67
67
  * `bundle viz(1)`:
68
68
  Generate a visual representation of your dependencies
69
+ <<<<<<< HEAD
70
+
71
+ * `bundle benchmark(1)`:
72
+ Display the time taken for each each gem to be loaded into the environment
73
+ =======
74
+ >>>>>>> parent of e547c86... Add documentation for the benchmark CLI utility
69
75
 
70
76
  * `bundle init(1)`:
71
77
  Generate a simple `Gemfile`, placed in the current directory
@@ -120,6 +120,8 @@ There are a number of `Gemfile` platforms:
120
120
  _mri_ `AND` version 1.8
121
121
  * `mri_19`:
122
122
  _mri_ `AND` version 1.9
123
+ * `rbx`:
124
+ Same as _ruby_, but only Rubinius (not MRI)
123
125
  * `jruby`:
124
126
  JRuby
125
127
  * `mswin`:
@@ -214,6 +214,17 @@ describe "bundle cache" do
214
214
  bundle "install"
215
215
  out.should_not =~ /removing/i
216
216
  end
217
+
218
+ it "should install gems with the name bundler in them (that aren't bundler)" do
219
+ build_gem "foo-bundler", "1.0",
220
+ :path => bundled_app('vendor/cache')
221
+
222
+ install_gemfile <<-G
223
+ gem "foo-bundler"
224
+ G
225
+
226
+ should_be_installed "foo-bundler 1.0"
227
+ end
217
228
  end
218
229
 
219
230
  end
@@ -21,7 +21,7 @@ describe "install with --deployment or --frozen" do
21
21
  it "works after you try to deploy without a lock" do
22
22
  bundle "install --deployment"
23
23
  bundle :install, :exitstatus => true
24
- check exitstatus.should == 0
24
+ exitstatus.should eq(0)
25
25
  should_be_installed "rack 1.0"
26
26
  end
27
27
 
@@ -1,23 +1,27 @@
1
1
  require "spec_helper"
2
2
 
3
3
  describe "gemcutter's dependency API" do
4
+ let(:source_uri) { "http://localgemserver.test" }
5
+
4
6
  it "should use the API" do
5
7
  gemfile <<-G
6
- source "http://localgemserver.test"
8
+ source "#{source_uri}"
7
9
  gem "rack"
8
10
  G
9
11
 
10
12
  bundle :install, :artifice => "endpoint"
13
+ out.should include("Fetching dependency information from the API at #{source_uri}")
11
14
  should_be_installed "rack 1.0.0"
12
15
  end
13
16
 
14
17
  it "should handle nested dependencies" do
15
18
  gemfile <<-G
16
- source "http://localgemserver.test"
19
+ source "#{source_uri}"
17
20
  gem "rails"
18
21
  G
19
22
 
20
23
  bundle :install, :artifice => "endpoint"
24
+ out.should include("Fetching dependency information from the API at #{source_uri}/...")
21
25
  should_be_installed(
22
26
  "rails 2.3.2",
23
27
  "actionpack 2.3.2",
@@ -27,21 +31,59 @@ describe "gemcutter's dependency API" do
27
31
  "activesupport 2.3.2")
28
32
  end
29
33
 
34
+ it "should handle multiple gem dependencies on the same gem" do
35
+ gemfile <<-G
36
+ source "#{source_uri}"
37
+ gem "net-sftp"
38
+ G
39
+
40
+ bundle :install, :artifice => "endpoint"
41
+ should_be_installed "net-sftp 1.1.1"
42
+ end
43
+
44
+ it "should use the endpoint when using --deployment" do
45
+ gemfile <<-G
46
+ source "#{source_uri}"
47
+ gem "rack"
48
+ G
49
+ bundle :install, :artifice => "endpoint"
50
+
51
+ bundle "install --deployment", :artifice => "endpoint"
52
+ out.should include("Fetching dependency information from the API at #{source_uri}")
53
+ should_be_installed "rack 1.0.0"
54
+ end
55
+
56
+ it "passes basic authentication details" do
57
+ uri = URI.parse(source_uri)
58
+ uri.user = "hello"
59
+ uri.password = "there"
60
+
61
+ gemfile <<-G
62
+ source "#{uri}"
63
+ gem "rack"
64
+ G
65
+
66
+ bundle :install, :artifice => "endpoint_basic_authentication"
67
+ out.should include("Fetching dependency information from the API at #{uri}")
68
+ should_be_installed "rack 1.0.0"
69
+ end
70
+
30
71
  it "falls back when the API errors out" do
31
72
  simulate_platform mswin
32
73
 
33
74
  gemfile <<-G
34
- source "http://localgemserver.test/"
75
+ source "#{source_uri}"
35
76
  gem "rcov"
36
77
  G
37
78
 
38
79
  bundle :install, :fakeweb => "windows"
80
+ out.should include("\nError using the API\nFetching source index for #{source_uri}")
39
81
  should_be_installed "rcov 1.0.0"
40
82
  end
41
83
 
42
84
  it "falls back when hitting the Gemcutter Dependency Limit" do
43
85
  gemfile <<-G
44
- source "http://localgemserver.test"
86
+ source "#{source_uri}"
45
87
  gem "activesupport"
46
88
  gem "actionpack"
47
89
  gem "actionmailer"
@@ -51,6 +93,7 @@ describe "gemcutter's dependency API" do
51
93
  gem "rails"
52
94
  G
53
95
  bundle :install, :artifice => "endpoint_fallback"
96
+ out.should include("\nError using the API\nFetching source index for #{source_uri}")
54
97
 
55
98
  should_be_installed(
56
99
  "activesupport 2.3.2",
@@ -65,21 +108,33 @@ describe "gemcutter's dependency API" do
65
108
 
66
109
  it "falls back when Gemcutter API doesn't return proper Marshal format" do
67
110
  gemfile <<-G
68
- source "http://localgemserver.test"
111
+ source "#{source_uri}"
69
112
  gem "rack"
70
113
  G
71
114
 
72
115
  bundle :install, :artifice => "endpoint_marshal_fail"
116
+ out.should include("\nError using the API\nFetching source index for #{source_uri}")
73
117
  should_be_installed "rack 1.0.0"
74
118
  end
75
119
 
76
- it "timeouts when Bundler::Fetcher redirects to much" do
120
+ it "timeouts when Bundler::Fetcher redirects too much" do
77
121
  gemfile <<-G
78
- source "http://localgemserver.test"
122
+ source "#{source_uri}"
79
123
  gem "rack"
80
124
  G
81
125
 
82
126
  bundle :install, :artifice => "endpoint_redirect"
83
127
  out.should match(/Too many redirects/)
84
128
  end
129
+
130
+ it "should use the modern index when the --full-index" do
131
+ gemfile <<-G
132
+ source "#{source_uri}"
133
+ gem "rack"
134
+ G
135
+
136
+ bundle "install --full-index", :artifice => "endpoint"
137
+ out.should include("Fetching source index for #{source_uri}")
138
+ should_be_installed "rack 1.0.0"
139
+ end
85
140
  end
@@ -35,13 +35,13 @@ describe "bundle install with gem sources" do
35
35
 
36
36
  it "sets up everything if Bundler.setup is used with no groups" do
37
37
  out = run("require 'rack'; puts RACK")
38
- check out.should == '1.0.0'
38
+ out.should eq('1.0.0')
39
39
 
40
40
  out = run("require 'activesupport'; puts ACTIVESUPPORT")
41
- check out.should == '2.3.5'
41
+ out.should eq('2.3.5')
42
42
 
43
43
  out = run("require 'thin'; puts THIN")
44
- out.should == '1.0'
44
+ out.should eq('1.0')
45
45
  end
46
46
 
47
47
  it "removes old groups when new groups are set up" do
@@ -0,0 +1,47 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'bundle install with gem sources' do
4
+ describe 'when gems include post install messages' do
5
+ it "should display the post-install messages after installing" do
6
+ gemfile <<-G
7
+ source "file://#{gem_repo1}"
8
+ gem 'rack'
9
+ gem 'thin'
10
+ gem 'rack-obama'
11
+ G
12
+
13
+ bundle :install
14
+ out.should include("Post-install message from rack:")
15
+ out.should include("Rack's post install message")
16
+ out.should include("Post-install message from thin:")
17
+ out.should include("Thin's post install message")
18
+ out.should include("Post-install message from rack-obama:")
19
+ out.should include("Rack-obama's post install message")
20
+ end
21
+ end
22
+
23
+ describe 'when gems do not include post install messages' do
24
+ it "should not display any post-install messages" do
25
+ gemfile <<-G
26
+ source "file://#{gem_repo1}"
27
+ gem "activesupport"
28
+ G
29
+
30
+ bundle :install
31
+ out.should_not include("Post-install message")
32
+ end
33
+ end
34
+
35
+ describe "when a dependecy includes a post install message" do
36
+ it "should display the post install message" do
37
+ gemfile <<-G
38
+ source "file://#{gem_repo1}"
39
+ gem 'rack_middleware'
40
+ G
41
+
42
+ bundle :install
43
+ out.should include("Post-install message from rack:")
44
+ out.should include("Rack's post install message")
45
+ end
46
+ end
47
+ end
@@ -10,10 +10,11 @@ describe "when using sudo", :sudo => true do
10
10
  install_gemfile <<-G
11
11
  source "file://#{gem_repo1}"
12
12
  gem "rack", '1.0'
13
+ gem "thin"
13
14
  G
14
15
 
15
16
  system_gem_path("gems/rack-1.0.0").should exist
16
- check system_gem_path("gems/rack-1.0.0").stat.uid.should == 0
17
+ system_gem_path("gems/rack-1.0.0").stat.uid.should eq(0)
17
18
  should_be_installed "rack 1.0"
18
19
  end
19
20
 
@@ -29,7 +30,7 @@ describe "when using sudo", :sudo => true do
29
30
  G
30
31
 
31
32
  bundle_path.join("gems/rack-1.0.0").should exist
32
- check bundle_path.join("gems/rack-1.0.0").stat.uid.should == 0
33
+ bundle_path.join("gems/rack-1.0.0").stat.uid.should eq(0)
33
34
  should_be_installed "rack 1.0"
34
35
  end
35
36
 
@@ -145,7 +145,7 @@ describe "bundle install with git sources" do
145
145
  gem "foo"
146
146
  end
147
147
  G
148
- check err.should == ""
148
+ err.should eq("")
149
149
 
150
150
  run <<-RUBY
151
151
  require 'foo'
@@ -351,7 +351,6 @@ describe "bundle install with git sources" do
351
351
  out.should include("Git error:")
352
352
  err.should include("fatal")
353
353
  err.should include("omgomg")
354
- err.should include("fatal: The remote end hung up unexpectedly")
355
354
  end
356
355
 
357
356
  it "works when the gem path has spaces in it" do