bundler-maglev- 1.0.21

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. data/.gitignore +22 -0
  2. data/.travis.yml +32 -0
  3. data/CHANGELOG.md +805 -0
  4. data/ISSUES.md +62 -0
  5. data/LICENSE +23 -0
  6. data/README.md +29 -0
  7. data/Rakefile +212 -0
  8. data/UPGRADING.md +103 -0
  9. data/bin/bundle +22 -0
  10. data/bundler.gemspec +30 -0
  11. data/lib/bundler.rb +286 -0
  12. data/lib/bundler/capistrano.rb +11 -0
  13. data/lib/bundler/cli.rb +520 -0
  14. data/lib/bundler/definition.rb +438 -0
  15. data/lib/bundler/dependency.rb +134 -0
  16. data/lib/bundler/deployment.rb +58 -0
  17. data/lib/bundler/dsl.rb +257 -0
  18. data/lib/bundler/environment.rb +47 -0
  19. data/lib/bundler/gem_helper.rb +151 -0
  20. data/lib/bundler/gem_installer.rb +9 -0
  21. data/lib/bundler/gem_tasks.rb +2 -0
  22. data/lib/bundler/graph.rb +130 -0
  23. data/lib/bundler/index.rb +138 -0
  24. data/lib/bundler/installer.rb +97 -0
  25. data/lib/bundler/lazy_specification.rb +74 -0
  26. data/lib/bundler/lockfile_parser.rb +108 -0
  27. data/lib/bundler/remote_specification.rb +59 -0
  28. data/lib/bundler/resolver.rb +464 -0
  29. data/lib/bundler/rubygems_ext.rb +237 -0
  30. data/lib/bundler/rubygems_integration.rb +349 -0
  31. data/lib/bundler/runtime.rb +152 -0
  32. data/lib/bundler/settings.rb +115 -0
  33. data/lib/bundler/setup.rb +23 -0
  34. data/lib/bundler/shared_helpers.rb +71 -0
  35. data/lib/bundler/source.rb +708 -0
  36. data/lib/bundler/spec_set.rb +135 -0
  37. data/lib/bundler/templates/Executable +16 -0
  38. data/lib/bundler/templates/Gemfile +4 -0
  39. data/lib/bundler/templates/newgem/Gemfile.tt +4 -0
  40. data/lib/bundler/templates/newgem/Rakefile.tt +1 -0
  41. data/lib/bundler/templates/newgem/bin/newgem.tt +3 -0
  42. data/lib/bundler/templates/newgem/gitignore.tt +4 -0
  43. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +9 -0
  44. data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
  45. data/lib/bundler/templates/newgem/newgem.gemspec.tt +24 -0
  46. data/lib/bundler/ui.rb +73 -0
  47. data/lib/bundler/vendor/thor.rb +358 -0
  48. data/lib/bundler/vendor/thor/actions.rb +314 -0
  49. data/lib/bundler/vendor/thor/actions/create_file.rb +105 -0
  50. data/lib/bundler/vendor/thor/actions/create_link.rb +57 -0
  51. data/lib/bundler/vendor/thor/actions/directory.rb +93 -0
  52. data/lib/bundler/vendor/thor/actions/empty_directory.rb +134 -0
  53. data/lib/bundler/vendor/thor/actions/file_manipulation.rb +270 -0
  54. data/lib/bundler/vendor/thor/actions/inject_into_file.rb +109 -0
  55. data/lib/bundler/vendor/thor/base.rb +576 -0
  56. data/lib/bundler/vendor/thor/core_ext/file_binary_read.rb +9 -0
  57. data/lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb +75 -0
  58. data/lib/bundler/vendor/thor/core_ext/ordered_hash.rb +100 -0
  59. data/lib/bundler/vendor/thor/error.rb +30 -0
  60. data/lib/bundler/vendor/thor/group.rb +273 -0
  61. data/lib/bundler/vendor/thor/invocation.rb +168 -0
  62. data/lib/bundler/vendor/thor/parser.rb +4 -0
  63. data/lib/bundler/vendor/thor/parser/argument.rb +67 -0
  64. data/lib/bundler/vendor/thor/parser/arguments.rb +161 -0
  65. data/lib/bundler/vendor/thor/parser/option.rb +120 -0
  66. data/lib/bundler/vendor/thor/parser/options.rb +175 -0
  67. data/lib/bundler/vendor/thor/rake_compat.rb +66 -0
  68. data/lib/bundler/vendor/thor/runner.rb +309 -0
  69. data/lib/bundler/vendor/thor/shell.rb +88 -0
  70. data/lib/bundler/vendor/thor/shell/basic.rb +302 -0
  71. data/lib/bundler/vendor/thor/shell/color.rb +108 -0
  72. data/lib/bundler/vendor/thor/shell/html.rb +121 -0
  73. data/lib/bundler/vendor/thor/task.rb +113 -0
  74. data/lib/bundler/vendor/thor/util.rb +229 -0
  75. data/lib/bundler/vendor/thor/version.rb +3 -0
  76. data/lib/bundler/vendored_thor.rb +7 -0
  77. data/lib/bundler/version.rb +6 -0
  78. data/lib/bundler/vlad.rb +11 -0
  79. data/man/bundle-config.ronn +90 -0
  80. data/man/bundle-exec.ronn +111 -0
  81. data/man/bundle-install.ronn +317 -0
  82. data/man/bundle-package.ronn +59 -0
  83. data/man/bundle-update.ronn +176 -0
  84. data/man/bundle.ronn +80 -0
  85. data/man/gemfile.5.ronn +284 -0
  86. data/man/index.txt +6 -0
  87. data/spec/bundler/gem_helper_spec.rb +143 -0
  88. data/spec/cache/gems_spec.rb +230 -0
  89. data/spec/cache/git_spec.rb +12 -0
  90. data/spec/cache/path_spec.rb +27 -0
  91. data/spec/cache/platform_spec.rb +57 -0
  92. data/spec/install/deploy_spec.rb +197 -0
  93. data/spec/install/deprecated_spec.rb +37 -0
  94. data/spec/install/gems/c_ext_spec.rb +48 -0
  95. data/spec/install/gems/env_spec.rb +107 -0
  96. data/spec/install/gems/flex_spec.rb +313 -0
  97. data/spec/install/gems/groups_spec.rb +259 -0
  98. data/spec/install/gems/packed_spec.rb +84 -0
  99. data/spec/install/gems/platform_spec.rb +192 -0
  100. data/spec/install/gems/resolving_spec.rb +72 -0
  101. data/spec/install/gems/simple_case_spec.rb +770 -0
  102. data/spec/install/gems/sudo_spec.rb +74 -0
  103. data/spec/install/gems/win32_spec.rb +26 -0
  104. data/spec/install/gemspec_spec.rb +125 -0
  105. data/spec/install/git_spec.rb +570 -0
  106. data/spec/install/invalid_spec.rb +35 -0
  107. data/spec/install/path_spec.rb +405 -0
  108. data/spec/install/upgrade_spec.rb +26 -0
  109. data/spec/lock/git_spec.rb +35 -0
  110. data/spec/lock/lockfile_spec.rb +739 -0
  111. data/spec/other/check_spec.rb +221 -0
  112. data/spec/other/config_spec.rb +40 -0
  113. data/spec/other/console_spec.rb +54 -0
  114. data/spec/other/exec_spec.rb +248 -0
  115. data/spec/other/ext_spec.rb +37 -0
  116. data/spec/other/help_spec.rb +39 -0
  117. data/spec/other/init_spec.rb +40 -0
  118. data/spec/other/newgem_spec.rb +46 -0
  119. data/spec/other/open_spec.rb +35 -0
  120. data/spec/other/show_spec.rb +82 -0
  121. data/spec/quality_spec.rb +62 -0
  122. data/spec/resolver/basic_spec.rb +20 -0
  123. data/spec/resolver/platform_spec.rb +82 -0
  124. data/spec/runtime/executable_spec.rb +110 -0
  125. data/spec/runtime/load_spec.rb +107 -0
  126. data/spec/runtime/platform_spec.rb +90 -0
  127. data/spec/runtime/require_spec.rb +231 -0
  128. data/spec/runtime/setup_spec.rb +730 -0
  129. data/spec/runtime/with_clean_env_spec.rb +15 -0
  130. data/spec/spec_helper.rb +92 -0
  131. data/spec/support/builders.rb +597 -0
  132. data/spec/support/helpers.rb +239 -0
  133. data/spec/support/indexes.rb +112 -0
  134. data/spec/support/matchers.rb +77 -0
  135. data/spec/support/path.rb +71 -0
  136. data/spec/support/platforms.rb +53 -0
  137. data/spec/support/ruby_ext.rb +20 -0
  138. data/spec/support/rubygems_ext.rb +37 -0
  139. data/spec/support/rubygems_hax/platform.rb +11 -0
  140. data/spec/support/sudo.rb +21 -0
  141. data/spec/update/gems_spec.rb +122 -0
  142. data/spec/update/git_spec.rb +196 -0
  143. data/spec/update/source_spec.rb +51 -0
  144. metadata +296 -0
@@ -0,0 +1,53 @@
1
+ module Spec
2
+ module Platforms
3
+ include Bundler::GemHelpers
4
+
5
+ def rb
6
+ Gem::Platform::RUBY
7
+ end
8
+
9
+ def mac
10
+ Gem::Platform.new('x86-darwin-10')
11
+ end
12
+
13
+ def java
14
+ Gem::Platform.new([nil, "java", nil])
15
+ end
16
+
17
+ def linux
18
+ Gem::Platform.new(['x86', 'linux', nil])
19
+ end
20
+
21
+ def mswin
22
+ Gem::Platform.new(['x86', 'mswin32', nil])
23
+ end
24
+
25
+ def mingw
26
+ Gem::Platform.new(['x86', 'mingw32', nil])
27
+ end
28
+
29
+ def all_platforms
30
+ [rb, java, linux, mswin, mingw]
31
+ end
32
+
33
+ def local
34
+ generic(Gem::Platform.local)
35
+ end
36
+
37
+ def not_local
38
+ all_platforms.find { |p| p != generic(Gem::Platform.local) }
39
+ end
40
+
41
+ def local_tag
42
+ if RUBY_PLATFORM == "java"
43
+ :jruby
44
+ else
45
+ :ruby
46
+ end
47
+ end
48
+
49
+ def not_local_tag
50
+ [:ruby, :jruby].find { |tag| tag != local_tag }
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,20 @@
1
+ class IO
2
+ def read_available_bytes(chunk_size = 16384, select_timeout = 0.02)
3
+ buffer = []
4
+
5
+ return "" if closed? || eof?
6
+ # IO.select cannot be used here due to the fact that it
7
+ # just does not work on windows
8
+ while true
9
+ begin
10
+ IO.select([self], nil, nil, select_timeout)
11
+ break if eof? # stop raising :-(
12
+ buffer << self.readpartial(chunk_size)
13
+ rescue(EOFError)
14
+ break
15
+ end
16
+ end
17
+
18
+ return buffer.join
19
+ end
20
+ end
@@ -0,0 +1,37 @@
1
+ require 'rubygems/user_interaction'
2
+
3
+ module Spec
4
+ module Rubygems
5
+ def self.setup
6
+ Gem.clear_paths
7
+
8
+ ENV['BUNDLE_PATH'] = nil
9
+ ENV['GEM_HOME'] = ENV['GEM_PATH'] = Path.base_system_gems.to_s
10
+ ENV['PATH'] = ["#{Path.root}/bin", "#{Path.system_gem_path}/bin", ENV['PATH']].join(File::PATH_SEPARATOR)
11
+
12
+ unless File.exist?("#{Path.base_system_gems}")
13
+ FileUtils.mkdir_p(Path.base_system_gems)
14
+ puts "running `gem install rake fakeweb --no-rdoc --no-ri`"
15
+ `gem install fakeweb --no-rdoc --no-ri`
16
+ # Rake version has to be consistent for tests to pass
17
+ `gem install rake --version 0.8.7 --no-rdoc --no-ri`
18
+ # 3.0.0 breaks 1.9.2 specs
19
+ puts "running `gem install builder --version 2.1.2 --no-rdoc --no-ri`"
20
+ `gem install builder --version 2.1.2 --no-rdoc --no-ri`
21
+ end
22
+
23
+ ENV['HOME'] = Path.home.to_s
24
+
25
+ Gem::DefaultUserInteraction.ui = Gem::SilentUI.new
26
+ end
27
+
28
+ def gem_command(command, args = "", options = {})
29
+ if command == :exec && !options[:no_quote]
30
+ args = args.gsub(/(?=")/, "\\")
31
+ args = %["#{args}"]
32
+ end
33
+ lib = File.join(File.dirname(__FILE__), '..', '..', 'lib')
34
+ %x{#{Gem.ruby} -I#{lib} -rubygems -S gem --backtrace #{command} #{args}}.strip
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,11 @@
1
+ require 'rubygems'
2
+
3
+ class Gem::Platform
4
+ @local = new(ENV['BUNDLER_SPEC_PLATFORM']) if ENV['BUNDLER_SPEC_PLATFORM']
5
+ end
6
+
7
+ if ENV['BUNDLER_SPEC_VERSION']
8
+ module Bundler
9
+ VERSION = ENV['BUNDLER_SPEC_VERSION'].dup
10
+ end
11
+ end
@@ -0,0 +1,21 @@
1
+ module Spec
2
+ module Sudo
3
+ def self.present?
4
+ @which_sudo ||= (`which sudo`.chomp rescue '')
5
+ !@which_sudo.empty?
6
+ end
7
+
8
+ def self.test_sudo?
9
+ present? && ENV['BUNDLER_SUDO_TESTS']
10
+ end
11
+
12
+ def sudo(cmd)
13
+ raise "sudo not present" unless Sudo.present?
14
+ sys_exec("sudo #{cmd}")
15
+ end
16
+
17
+ def chown_system_gems_to_root
18
+ sudo "chown -R root #{system_gem_path}"
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,122 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle update" do
4
+ before :each do
5
+ build_repo2
6
+
7
+ install_gemfile <<-G
8
+ source "file://#{gem_repo2}"
9
+ gem "activesupport"
10
+ gem "rack-obama"
11
+ G
12
+ end
13
+
14
+ describe "with no arguments" do
15
+ it "updates the entire bundle" do
16
+ update_repo2 do
17
+ build_gem "activesupport", "3.0"
18
+ end
19
+
20
+ bundle "update"
21
+ should_be_installed "rack 1.2", "rack-obama 1.0", "activesupport 3.0"
22
+ end
23
+
24
+ it "doesn't delete the Gemfile.lock file if something goes wrong" do
25
+ gemfile <<-G
26
+ source "file://#{gem_repo2}"
27
+ gem "activesupport"
28
+ gem "rack-obama"
29
+ exit!
30
+ G
31
+ bundle "update"
32
+ bundled_app("Gemfile.lock").should exist
33
+ end
34
+ end
35
+
36
+ describe "with a top level dependency" do
37
+ it "unlocks all child dependencies that are unrelated to other locked dependencies" do
38
+ update_repo2 do
39
+ build_gem "activesupport", "3.0"
40
+ end
41
+
42
+ bundle "update rack-obama"
43
+ should_be_installed "rack 1.2", "rack-obama 1.0", "activesupport 2.3.5"
44
+ end
45
+ end
46
+
47
+ describe "with --local option" do
48
+ it "doesn't hit repo2" do
49
+ FileUtils.rm_rf(gem_repo2)
50
+
51
+ bundle "update --local"
52
+ out.should_not match(/Fetching source index/)
53
+ end
54
+ end
55
+ end
56
+
57
+ describe "bundle update in more complicated situations" do
58
+ before :each do
59
+ build_repo2
60
+ end
61
+
62
+ it "will eagerly unlock dependencies of a specified gem" do
63
+ install_gemfile <<-G
64
+ source "file://#{gem_repo2}"
65
+
66
+ gem "thin"
67
+ gem "rack-obama"
68
+ G
69
+
70
+ update_repo2 do
71
+ build_gem "thin" , '2.0' do |s|
72
+ s.add_dependency "rack"
73
+ end
74
+ end
75
+
76
+ bundle "update thin"
77
+ should_be_installed "thin 2.0", "rack 1.2", "rack-obama 1.0"
78
+ end
79
+ end
80
+
81
+ describe "bundle update without a Gemfile.lock" do
82
+ it "should not explode" do
83
+ build_repo2
84
+
85
+ gemfile <<-G
86
+ source "file://#{gem_repo2}"
87
+
88
+ gem "rack", "1.0"
89
+ G
90
+
91
+ bundle "update"
92
+
93
+ should_be_installed "rack 1.0.0"
94
+ end
95
+ end
96
+
97
+ describe "bundle update when a gem depends on a newer version of bundler" do
98
+ before(:each) do
99
+ build_repo2 do
100
+ build_gem "rails", "3.0.1" do |s|
101
+ s.add_dependency "bundler", Bundler::VERSION.succ
102
+ end
103
+ end
104
+
105
+ gemfile <<-G
106
+ source "file://#{gem_repo2}"
107
+ gem "rails", "3.0.1"
108
+ G
109
+ end
110
+
111
+ it "should not explode" do
112
+ bundle "update"
113
+ err.should be_empty
114
+ end
115
+
116
+ it "should explain that bundler conflicted" do
117
+ bundle "update"
118
+ out.should_not =~ /in snapshot/i
119
+ out.should =~ /current Bundler version/i
120
+ out.should =~ /perhaps you need to update bundler/i
121
+ end
122
+ end
@@ -0,0 +1,196 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle update" do
4
+ describe "git sources" do
5
+ it "floats on a branch when :branch is used" do
6
+ build_git "foo", "1.0"
7
+ update_git "foo", :branch => "omg"
8
+
9
+ install_gemfile <<-G
10
+ git "#{lib_path('foo-1.0')}", :branch => "omg" do
11
+ gem 'foo'
12
+ end
13
+ G
14
+
15
+ update_git "foo", :branch => "omg" do |s|
16
+ s.write "lib/foo.rb", "FOO = '1.1'"
17
+ end
18
+
19
+ bundle "update"
20
+
21
+ should_be_installed "foo 1.1"
22
+ end
23
+
24
+ it "updates correctly when you have like craziness" do
25
+ build_lib "activesupport", "3.0", :path => lib_path("rails/activesupport")
26
+ build_git "rails", "3.0", :path => lib_path("rails") do |s|
27
+ s.add_dependency "activesupport", "= 3.0"
28
+ end
29
+
30
+ install_gemfile <<-G
31
+ gem "rails", :git => "#{lib_path('rails')}"
32
+ G
33
+
34
+ bundle "update rails"
35
+ out.should include("Using activesupport (3.0) from #{lib_path('rails')} (at master)")
36
+ should_be_installed "rails 3.0", "activesupport 3.0"
37
+ end
38
+
39
+ it "floats on a branch when :branch is used and the source is specified in the update" do
40
+ build_git "foo", "1.0", :path => lib_path("foo")
41
+ update_git "foo", :branch => "omg", :path => lib_path("foo")
42
+
43
+ install_gemfile <<-G
44
+ git "#{lib_path('foo')}", :branch => "omg" do
45
+ gem 'foo'
46
+ end
47
+ G
48
+
49
+ update_git "foo", :branch => "omg", :path => lib_path("foo") do |s|
50
+ s.write "lib/foo.rb", "FOO = '1.1'"
51
+ end
52
+
53
+ bundle "update --source foo"
54
+
55
+ should_be_installed "foo 1.1"
56
+ end
57
+
58
+ it "floats on master when updating all gems that are pinned to the source even if you have child dependencies" do
59
+ build_git "foo", :path => lib_path('foo')
60
+ build_gem "bar", :to_system => true do |s|
61
+ s.add_dependency "foo"
62
+ end
63
+
64
+ install_gemfile <<-G
65
+ gem "foo", :git => "#{lib_path('foo')}"
66
+ gem "bar"
67
+ G
68
+
69
+ update_git "foo", :path => lib_path('foo') do |s|
70
+ s.write "lib/foo.rb", "FOO = '1.1'"
71
+ end
72
+
73
+ bundle "update foo"
74
+
75
+ should_be_installed "foo 1.1"
76
+ end
77
+
78
+ it "notices when you change the repo url in the Gemfile" do
79
+ build_git "foo", :path => lib_path("foo_one")
80
+ build_git "foo", :path => lib_path("foo_two")
81
+
82
+ install_gemfile <<-G
83
+ gem "foo", "1.0", :git => "#{lib_path('foo_one')}"
84
+ G
85
+
86
+ FileUtils.rm_rf lib_path("foo_one")
87
+
88
+ install_gemfile <<-G
89
+ gem "foo", "1.0", :git => "#{lib_path('foo_two')}"
90
+ G
91
+
92
+ err.should be_empty
93
+ out.should include("Fetching #{lib_path}/foo_two")
94
+ out.should include("Your bundle is complete!")
95
+ end
96
+
97
+
98
+ it "fetches tags from the remote" do
99
+ build_git "foo"
100
+ @remote = build_git("bar", :bare => true)
101
+ update_git "foo", :remote => @remote.path
102
+ update_git "foo", :push => "master"
103
+
104
+ install_gemfile <<-G
105
+ gem 'foo', :git => "#{@remote.path}"
106
+ G
107
+
108
+ # Create a new tag on the remote that needs fetching
109
+ update_git "foo", :tag => "fubar"
110
+ update_git "foo", :push => "fubar"
111
+
112
+ gemfile <<-G
113
+ gem 'foo', :git => "#{@remote.path}", :tag => "fubar"
114
+ G
115
+
116
+ bundle "update", :exitstatus => true
117
+ exitstatus.should == 0
118
+ end
119
+
120
+ describe "with submodules" do
121
+ before :each do
122
+ build_gem "submodule", :to_system => true do |s|
123
+ s.write "lib/submodule.rb", "puts 'GEM'"
124
+ end
125
+
126
+ build_git "submodule", "1.0" do |s|
127
+ s.write "lib/submodule.rb", "puts 'GIT'"
128
+ end
129
+
130
+ build_git "has_submodule", "1.0" do |s|
131
+ s.add_dependency "submodule"
132
+ end
133
+
134
+ Dir.chdir(lib_path('has_submodule-1.0')) do
135
+ `git submodule add #{lib_path('submodule-1.0')} submodule-1.0`
136
+ `git commit -m "submodulator"`
137
+ end
138
+ end
139
+
140
+ it "it unlocks the source when submodules is added to a git source" do
141
+ install_gemfile <<-G
142
+ git "#{lib_path('has_submodule-1.0')}" do
143
+ gem "has_submodule"
144
+ end
145
+ G
146
+
147
+ run "require 'submodule'"
148
+ out.should eq('GEM')
149
+
150
+ install_gemfile <<-G
151
+ git "#{lib_path('has_submodule-1.0')}", :submodules => true do
152
+ gem "has_submodule"
153
+ end
154
+ G
155
+
156
+ run "require 'submodule'"
157
+ out.should == 'GIT'
158
+ end
159
+
160
+ it "it unlocks the source when submodules is removed from git source" do
161
+ pending "This would require actually removing the submodule from the clone"
162
+ install_gemfile <<-G
163
+ git "#{lib_path('has_submodule-1.0')}", :submodules => true do
164
+ gem "has_submodule"
165
+ end
166
+ G
167
+
168
+ run "require 'submodule'"
169
+ out.should eq('GIT')
170
+
171
+ install_gemfile <<-G
172
+ git "#{lib_path('has_submodule-1.0')}" do
173
+ gem "has_submodule"
174
+ end
175
+ G
176
+
177
+ run "require 'submodule'"
178
+ out.should == 'GEM'
179
+ end
180
+ end
181
+
182
+ it "errors with a message when the .git repo is gone" do
183
+ build_git "foo", "1.0"
184
+
185
+ install_gemfile <<-G
186
+ gem "foo", :git => "#{lib_path('foo-1.0')}"
187
+ G
188
+
189
+ lib_path("foo-1.0").join(".git").rmtree
190
+
191
+ bundle :update, :expect_err => true
192
+ out.should include(lib_path("foo-1.0").to_s)
193
+ end
194
+
195
+ end
196
+ end