bundler 1.0.0 → 1.0.2

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 (108) hide show
  1. data/.gitignore +12 -0
  2. data/CHANGELOG.md +28 -6
  3. data/ISSUES.md +1 -1
  4. data/README.md +7 -5
  5. data/Rakefile +173 -0
  6. data/UPGRADING.md +103 -0
  7. data/bundler.gemspec +28 -0
  8. data/lib/bundler.rb +1 -0
  9. data/lib/bundler/capistrano.rb +2 -31
  10. data/lib/bundler/cli.rb +18 -16
  11. data/lib/bundler/deployment.rb +37 -0
  12. data/lib/bundler/dsl.rb +3 -3
  13. data/lib/bundler/gem_helper.rb +4 -7
  14. data/lib/bundler/graph.rb +3 -3
  15. data/lib/bundler/installer.rb +1 -0
  16. data/lib/bundler/lockfile_parser.rb +1 -1
  17. data/lib/bundler/man/bundle +1 -1
  18. data/lib/bundler/man/bundle-config +92 -0
  19. data/lib/bundler/man/bundle-config.txt +72 -30
  20. data/lib/bundler/man/bundle-exec +1 -1
  21. data/lib/bundler/man/bundle-exec.txt +1 -1
  22. data/lib/bundler/man/bundle-install +1 -1
  23. data/lib/bundler/man/bundle-install.txt +1 -1
  24. data/lib/bundler/man/bundle-package +1 -1
  25. data/lib/bundler/man/bundle-package.txt +1 -1
  26. data/lib/bundler/man/bundle-update +1 -1
  27. data/lib/bundler/man/bundle-update.txt +1 -1
  28. data/lib/bundler/man/bundle.txt +1 -1
  29. data/lib/bundler/man/gemfile.5 +2 -2
  30. data/lib/bundler/man/gemfile.5.txt +2 -2
  31. data/lib/bundler/settings.rb +2 -2
  32. data/lib/bundler/source.rb +2 -3
  33. data/lib/bundler/templates/Executable +1 -1
  34. data/lib/bundler/templates/newgem/Gemfile.tt +1 -1
  35. data/lib/bundler/templates/newgem/bin/newgem.tt +3 -0
  36. data/lib/bundler/templates/newgem/newgem.gemspec.tt +11 -12
  37. data/lib/bundler/version.rb +1 -1
  38. data/lib/bundler/vlad.rb +9 -0
  39. data/man/bundle-config.ronn +90 -0
  40. data/man/bundle-exec.ronn +98 -0
  41. data/man/bundle-install.ronn +310 -0
  42. data/man/bundle-package.ronn +59 -0
  43. data/man/bundle-update.ronn +176 -0
  44. data/man/bundle.ronn +77 -0
  45. data/man/gemfile.5.ronn +254 -0
  46. data/man/index.txt +6 -0
  47. data/spec/cache/gems_spec.rb +205 -0
  48. data/spec/cache/git_spec.rb +9 -0
  49. data/spec/cache/path_spec.rb +27 -0
  50. data/spec/cache/platform_spec.rb +57 -0
  51. data/spec/install/deploy_spec.rb +171 -0
  52. data/spec/install/deprecated_spec.rb +43 -0
  53. data/spec/install/gems/c_ext_spec.rb +48 -0
  54. data/spec/install/gems/env_spec.rb +107 -0
  55. data/spec/install/gems/flex_spec.rb +272 -0
  56. data/spec/install/gems/groups_spec.rb +209 -0
  57. data/spec/install/gems/locked_spec.rb +48 -0
  58. data/spec/install/gems/packed_spec.rb +72 -0
  59. data/spec/install/gems/platform_spec.rb +181 -0
  60. data/spec/install/gems/resolving_spec.rb +72 -0
  61. data/spec/install/gems/simple_case_spec.rb +709 -0
  62. data/spec/install/gems/sudo_spec.rb +77 -0
  63. data/spec/install/gems/win32_spec.rb +26 -0
  64. data/spec/install/gemspec_spec.rb +96 -0
  65. data/spec/install/git_spec.rb +552 -0
  66. data/spec/install/invalid_spec.rb +17 -0
  67. data/spec/install/path_spec.rb +335 -0
  68. data/spec/install/upgrade_spec.rb +26 -0
  69. data/spec/lock/flex_spec.rb +625 -0
  70. data/spec/lock/git_spec.rb +35 -0
  71. data/spec/other/check_spec.rb +221 -0
  72. data/spec/other/config_spec.rb +40 -0
  73. data/spec/other/console_spec.rb +102 -0
  74. data/spec/other/exec_spec.rb +241 -0
  75. data/spec/other/ext_spec.rb +16 -0
  76. data/spec/other/gem_helper_spec.rb +116 -0
  77. data/spec/other/help_spec.rb +36 -0
  78. data/spec/other/init_spec.rb +40 -0
  79. data/spec/other/newgem_spec.rb +24 -0
  80. data/spec/other/open_spec.rb +51 -0
  81. data/spec/other/show_spec.rb +99 -0
  82. data/spec/pack/gems_spec.rb +22 -0
  83. data/spec/quality_spec.rb +55 -0
  84. data/spec/resolver/basic_spec.rb +20 -0
  85. data/spec/resolver/platform_spec.rb +57 -0
  86. data/spec/runtime/environment_rb_spec.rb +170 -0
  87. data/spec/runtime/executable_spec.rb +110 -0
  88. data/spec/runtime/load_spec.rb +107 -0
  89. data/spec/runtime/platform_spec.rb +90 -0
  90. data/spec/runtime/require_spec.rb +261 -0
  91. data/spec/runtime/setup_spec.rb +412 -0
  92. data/spec/runtime/with_clean_env_spec.rb +15 -0
  93. data/spec/spec_helper.rb +81 -0
  94. data/spec/support/builders.rb +566 -0
  95. data/spec/support/helpers.rb +243 -0
  96. data/spec/support/indexes.rb +113 -0
  97. data/spec/support/matchers.rb +89 -0
  98. data/spec/support/path.rb +71 -0
  99. data/spec/support/platforms.rb +49 -0
  100. data/spec/support/ruby_ext.rb +19 -0
  101. data/spec/support/rubygems_ext.rb +30 -0
  102. data/spec/support/rubygems_hax/rubygems_plugin.rb +9 -0
  103. data/spec/support/sudo.rb +21 -0
  104. data/spec/update/gems_spec.rb +86 -0
  105. data/spec/update/git_spec.rb +159 -0
  106. data/spec/update/source_spec.rb +50 -0
  107. metadata +170 -32
  108. data/ROADMAP.md +0 -36
@@ -0,0 +1,20 @@
1
+ require "spec_helper"
2
+
3
+ describe "Resolving" do
4
+
5
+ before :each do
6
+ @index = an_awesome_index
7
+ end
8
+
9
+ it "resolves a single gem" do
10
+ dep "rack"
11
+
12
+ should_resolve_as %w(rack-1.1)
13
+ end
14
+
15
+ it "resolves a gem with dependencies" do
16
+ dep "actionpack"
17
+
18
+ should_resolve_as %w(actionpack-2.3.5 activesupport-2.3.5 rack-1.0)
19
+ end
20
+ end
@@ -0,0 +1,57 @@
1
+ require "spec_helper"
2
+
3
+ describe "Resolving platform craziness" do
4
+ describe "with semi real cases" do
5
+ before :each do
6
+ @index = an_awesome_index
7
+ end
8
+
9
+ it "resolves a simple multi platform gem" do
10
+ dep "nokogiri"
11
+ platforms "ruby", "java"
12
+
13
+ should_resolve_as %w(nokogiri-1.4.2 nokogiri-1.4.2-java weakling-0.0.3)
14
+ end
15
+
16
+ it "doesn't pull gems when it doesn't exist for the current platform" do
17
+ dep "nokogiri"
18
+ platforms "ruby"
19
+
20
+ should_resolve_as %w(nokogiri-1.4.2)
21
+ end
22
+
23
+ it "doesn't pulls gems when the version is available for all requested platforms" do
24
+ dep "nokogiri"
25
+ platforms "mswin32"
26
+
27
+ should_resolve_as %w(nokogiri-1.4.2.1-x86-mswin32)
28
+ end
29
+ end
30
+
31
+ describe "with conflicting cases" do
32
+ before :each do
33
+ @index = build_index do
34
+ gem "foo", "1.0.0" do
35
+ dep "bar", ">= 0"
36
+ end
37
+
38
+ gem 'bar', "1.0.0" do
39
+ dep "baz", "~> 1.0.0"
40
+ end
41
+
42
+ gem "bar", "1.0.0", "java" do
43
+ dep "baz", " ~> 1.1.0"
44
+ end
45
+
46
+ gem "baz", %w(1.0.0 1.1.0 1.2.0)
47
+ end
48
+ end
49
+
50
+ it "does something" do
51
+ platforms "ruby", "java"
52
+ dep "foo"
53
+
54
+ should_conflict_on "baz"
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,170 @@
1
+ require "spec_helper"
2
+
3
+ describe "environment.rb file" do
4
+
5
+ describe "with git gems that don't have gemspecs" do
6
+ before :each do
7
+ build_git "no-gemspec", :gemspec => false
8
+
9
+ install_gemfile <<-G
10
+ gem "no-gemspec", "1.0", :git => "#{lib_path('no-gemspec-1.0')}"
11
+ G
12
+
13
+ bundle :lock
14
+ end
15
+
16
+ it "loads the library via a virtual spec" do
17
+ run <<-R, :lite_runtime => true
18
+ require 'no-gemspec'
19
+ puts NOGEMSPEC
20
+ R
21
+
22
+ out.should == "1.0"
23
+ end
24
+ end
25
+
26
+ describe "with bundled and system gems" do
27
+ before :each do
28
+ system_gems "rack-1.0.0"
29
+
30
+ install_gemfile <<-G
31
+ source "file://#{gem_repo1}"
32
+
33
+ gem "activesupport", "2.3.5"
34
+ G
35
+
36
+ bundle :lock
37
+ end
38
+
39
+ it "does not pull in system gems" do
40
+ run <<-R, :lite_runtime => true
41
+ require 'rubygems'
42
+
43
+ begin;
44
+ require 'rack'
45
+ rescue LoadError
46
+ puts 'WIN'
47
+ end
48
+ R
49
+
50
+ out.should == "WIN"
51
+ end
52
+
53
+ it "provides a gem method" do
54
+ run <<-R, :lite_runtime => true
55
+ gem 'activesupport'
56
+ require 'activesupport'
57
+ puts ACTIVESUPPORT
58
+ R
59
+
60
+ out.should == "2.3.5"
61
+ end
62
+
63
+ it "raises an exception if gem is used to invoke a system gem not in the bundle" do
64
+ run <<-R, :lite_runtime => true
65
+ begin
66
+ gem 'rack'
67
+ rescue LoadError => e
68
+ puts e.message
69
+ end
70
+ R
71
+
72
+ out.should == "rack is not part of the bundle. Add it to Gemfile."
73
+ end
74
+
75
+ it "sets GEM_HOME appropriately" do
76
+ run "puts ENV['GEM_HOME']", :lite_runtime => true
77
+ out.should == default_bundle_path.to_s
78
+ end
79
+ end
80
+
81
+ describe "with system gems in the bundle" do
82
+ before :each do
83
+ system_gems "rack-1.0.0"
84
+
85
+ install_gemfile <<-G
86
+ source "file://#{gem_repo1}"
87
+ gem "rack", "1.0.0"
88
+ gem "activesupport", "2.3.5"
89
+ G
90
+
91
+ bundle :lock
92
+ end
93
+
94
+ it "sets GEM_PATH appropriately" do
95
+ run "puts Gem.path", :lite_runtime => true
96
+ paths = out.split("\n")
97
+ paths.should include(system_gem_path.to_s)
98
+ paths.should include(default_bundle_path.to_s)
99
+ end
100
+ end
101
+
102
+ describe "with a gemspec that requires other files" do
103
+ before :each do
104
+ build_git "bar", :gemspec => false do |s|
105
+ s.write "lib/bar/version.rb", %{BAR_VERSION = '1.0'}
106
+ s.write "bar.gemspec", <<-G
107
+ lib = File.expand_path('../lib/', __FILE__)
108
+ $:.unshift lib unless $:.include?(lib)
109
+ require 'bar/version'
110
+
111
+ Gem::Specification.new do |s|
112
+ s.name = 'bar'
113
+ s.version = BAR_VERSION
114
+ s.summary = 'Bar'
115
+ s.files = Dir["lib/**/*.rb"]
116
+ end
117
+ G
118
+ end
119
+
120
+ gemfile <<-G
121
+ gem "bar", :git => "#{lib_path('bar-1.0')}"
122
+ G
123
+ end
124
+
125
+ it "evals each gemspec in the context of its parent directory" do
126
+ bundle :install
127
+ bundle :lock
128
+ run "require 'bar'; puts BAR", :lite_runtime => true
129
+ out.should == "1.0"
130
+ end
131
+
132
+ it "error intelligently if the gemspec has a LoadError" do
133
+ update_git "bar", :gemspec => false do |s|
134
+ s.write "bar.gemspec", "require 'foobarbaz'"
135
+ end
136
+ bundle :install
137
+ out.should include("was a LoadError while evaluating bar.gemspec")
138
+ out.should include("foobarbaz")
139
+ out.should include("bar.gemspec:1")
140
+ out.should include("try to require a relative path") if RUBY_VERSION >= "1.9.0"
141
+ end
142
+
143
+ it "evals each gemspec with a binding from the top level" do
144
+ bundle "install"
145
+
146
+ ruby <<-RUBY
147
+ require 'bundler'
148
+ def Bundler.require(path)
149
+ raise "LOSE"
150
+ end
151
+ Bundler.load
152
+ RUBY
153
+
154
+ err.should be_empty
155
+ out.should be_empty
156
+ end
157
+ end
158
+
159
+ describe "when Bundler is bundled" do
160
+ it "doesn't blow up" do
161
+ install_gemfile <<-G
162
+ gem "bundler", :path => "#{File.expand_path("..", lib)}"
163
+ G
164
+ bundle :lock
165
+
166
+ bundle %|exec ruby -e "require 'bundler'; Bundler.setup"|
167
+ err.should be_empty
168
+ end
169
+ end
170
+ end
@@ -0,0 +1,110 @@
1
+ require "spec_helper"
2
+
3
+ describe "Running bin/* commands" do
4
+ before :each do
5
+ gemfile <<-G
6
+ source "file://#{gem_repo1}"
7
+ gem "rack"
8
+ G
9
+ end
10
+
11
+ it "runs the bundled command when in the bundle" do
12
+ bundle "install --binstubs"
13
+
14
+ build_gem "rack", "2.0", :to_system => true do |s|
15
+ s.executables = "rackup"
16
+ end
17
+
18
+ gembin "rackup"
19
+ out.should == "1.0.0"
20
+ end
21
+
22
+ it "allows the location of the gem stubs to be specified" do
23
+ bundle "install --binstubs gbin"
24
+
25
+ bundled_app("bin").should_not exist
26
+ bundled_app("gbin/rackup").should exist
27
+
28
+ gembin bundled_app("gbin/rackup")
29
+ out.should == "1.0.0"
30
+ end
31
+
32
+ it "allows absolute paths as a specification of where to install bin stubs" do
33
+ bundle "install --binstubs #{tmp}/bin"
34
+
35
+ gembin tmp("bin/rackup")
36
+ out.should == "1.0.0"
37
+ end
38
+
39
+ it "runs the bundled command when out of the bundle" do
40
+ bundle "install --binstubs"
41
+
42
+ build_gem "rack", "2.0", :to_system => true do |s|
43
+ s.executables = "rackup"
44
+ end
45
+
46
+ Dir.chdir(tmp) do
47
+ gembin "rackup"
48
+ out.should == "1.0.0"
49
+ end
50
+ end
51
+
52
+ it "works with gems in path" do
53
+ build_lib "rack", :path => lib_path("rack") do |s|
54
+ s.executables = 'rackup'
55
+ end
56
+
57
+ gemfile <<-G
58
+ gem "rack", :path => "#{lib_path('rack')}"
59
+ G
60
+
61
+ bundle "install --binstubs"
62
+
63
+ build_gem 'rack', '2.0', :to_system => true do |s|
64
+ s.executables = 'rackup'
65
+ end
66
+
67
+ gembin "rackup"
68
+ out.should == '1.0'
69
+ end
70
+
71
+ it "don't bundle da bundla" do
72
+ build_gem "bundler", Bundler::VERSION, :to_system => true do |s|
73
+ s.executables = "bundle"
74
+ end
75
+
76
+ gemfile <<-G
77
+ source "file://#{gem_repo1}"
78
+ gem "bundler"
79
+ G
80
+
81
+ bundle "install --binstubs"
82
+
83
+ bundled_app("bin/bundle").should_not exist
84
+ end
85
+
86
+ it "does not generate bin stubs if the option was not specified" do
87
+ bundle "install"
88
+
89
+ bundled_app("bin/rackup").should_not exist
90
+ end
91
+
92
+ it "remembers that the option was specified" do
93
+ gemfile <<-G
94
+ source "file://#{gem_repo1}"
95
+ gem "activesupport"
96
+ G
97
+
98
+ bundle "install --binstubs"
99
+
100
+ gemfile <<-G
101
+ source "file://#{gem_repo1}"
102
+ gem "activesupport"
103
+ gem "rack"
104
+ G
105
+
106
+ bundle "install"
107
+
108
+ bundled_app("bin/rackup").should exist
109
+ end
110
+ end
@@ -0,0 +1,107 @@
1
+ require "spec_helper"
2
+
3
+ describe "Bundler.load" do
4
+ before :each do
5
+ system_gems "rack-1.0.0"
6
+ # clear memoized method results
7
+ # TODO: Don't reset internal ivars
8
+ Bundler.instance_eval do
9
+ @load = nil
10
+ @runtime = nil
11
+ @definition = nil
12
+ end
13
+ end
14
+
15
+ it "provides a list of the env dependencies" do
16
+ gemfile <<-G
17
+ source "file://#{gem_repo1}"
18
+ gem "rack"
19
+ G
20
+
21
+ env = Bundler.load
22
+ env.dependencies.should have_dep("rack", ">= 0")
23
+ end
24
+
25
+ it "provides a list of the resolved gems" do
26
+ gemfile <<-G
27
+ source "file://#{gem_repo1}"
28
+ gem "rack"
29
+ G
30
+
31
+ env = Bundler.load
32
+ env.gems.should have_gem("rack-1.0.0", "bundler-#{Bundler::VERSION}")
33
+ end
34
+
35
+ it "raises an exception if the default gemfile is not found" do
36
+ lambda {
37
+ Bundler.load
38
+ }.should raise_error(Bundler::GemfileNotFound, /could not locate gemfile/i)
39
+ end
40
+
41
+ it "raises an exception if a specified gemfile is not found" do
42
+ lambda {
43
+ ENV['BUNDLE_GEMFILE'] = "omg.rb"
44
+ Bundler.load
45
+ }.should raise_error(Bundler::GemfileNotFound, /omg\.rb/)
46
+ end
47
+
48
+ describe "when called twice" do
49
+ it "doesn't try to load the runtime twice" do
50
+ system_gems "rack-1.0.0", "activesupport-2.3.5"
51
+ gemfile <<-G
52
+ gem "rack"
53
+ gem "activesupport", :group => :test
54
+ G
55
+
56
+ ruby <<-RUBY
57
+ require "bundler"
58
+ Bundler.setup :default
59
+ Bundler.require :default
60
+ puts RACK
61
+ begin
62
+ require "activesupport"
63
+ rescue LoadError
64
+ puts "no activesupport"
65
+ end
66
+ RUBY
67
+
68
+ out.split("\n").should == ["1.0.0", "no activesupport"]
69
+ end
70
+ end
71
+
72
+ describe "when locked" do
73
+ before :each do
74
+ install_gemfile <<-G
75
+ source "file://#{gem_repo1}"
76
+ gem "activesupport"
77
+ G
78
+ bundle :lock
79
+ end
80
+
81
+ # This is obviously not true on 1.9 thanks to the AWEOME! gem prelude :'(
82
+ it "does not invoke setup inside env.rb" do
83
+ ruby <<-RUBY
84
+ require 'bundler'
85
+ Bundler.load
86
+ puts $LOAD_PATH.grep(/activesupport/i)
87
+ RUBY
88
+
89
+ out.should == ""
90
+ end if RUBY_VERSION < "1.9"
91
+ end
92
+
93
+ describe "not hurting brittle rubygems" do
94
+ it "does not inject #source into the generated YAML of the gem specs" do
95
+ system_gems "activerecord-2.3.2", "activesupport-2.3.2"
96
+ gemfile <<-G
97
+ gem "activerecord"
98
+ G
99
+
100
+ Bundler.load.specs.each do |spec|
101
+ spec.to_yaml.should_not =~ /^\s+source:/
102
+ spec.to_yaml.should_not =~ /^\s+groups:/
103
+ end
104
+ end
105
+ end
106
+
107
+ end