honkster-bundler 1.1.pre

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (137) hide show
  1. data/.gitignore +14 -0
  2. data/CHANGELOG.md +547 -0
  3. data/ISSUES.md +32 -0
  4. data/LICENSE +20 -0
  5. data/README.md +29 -0
  6. data/Rakefile +150 -0
  7. data/UPGRADING.md +103 -0
  8. data/bin/bundle +21 -0
  9. data/bundler.gemspec +30 -0
  10. data/lib/bundler.rb +268 -0
  11. data/lib/bundler/capistrano.rb +11 -0
  12. data/lib/bundler/cli.rb +515 -0
  13. data/lib/bundler/definition.rb +427 -0
  14. data/lib/bundler/dependency.rb +114 -0
  15. data/lib/bundler/deployment.rb +37 -0
  16. data/lib/bundler/dsl.rb +245 -0
  17. data/lib/bundler/environment.rb +47 -0
  18. data/lib/bundler/gem_helper.rb +145 -0
  19. data/lib/bundler/graph.rb +130 -0
  20. data/lib/bundler/index.rb +114 -0
  21. data/lib/bundler/installer.rb +84 -0
  22. data/lib/bundler/lazy_specification.rb +71 -0
  23. data/lib/bundler/lockfile_parser.rb +108 -0
  24. data/lib/bundler/remote_specification.rb +59 -0
  25. data/lib/bundler/resolver.rb +454 -0
  26. data/lib/bundler/rubygems_ext.rb +203 -0
  27. data/lib/bundler/runtime.rb +148 -0
  28. data/lib/bundler/settings.rb +117 -0
  29. data/lib/bundler/setup.rb +15 -0
  30. data/lib/bundler/shared_helpers.rb +151 -0
  31. data/lib/bundler/source.rb +662 -0
  32. data/lib/bundler/spec_set.rb +134 -0
  33. data/lib/bundler/templates/Executable +16 -0
  34. data/lib/bundler/templates/Gemfile +4 -0
  35. data/lib/bundler/templates/newgem/Gemfile.tt +4 -0
  36. data/lib/bundler/templates/newgem/Rakefile.tt +2 -0
  37. data/lib/bundler/templates/newgem/bin/newgem.tt +3 -0
  38. data/lib/bundler/templates/newgem/gitignore.tt +3 -0
  39. data/lib/bundler/templates/newgem/lib/newgem.rb.tt +7 -0
  40. data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
  41. data/lib/bundler/templates/newgem/newgem.gemspec.tt +21 -0
  42. data/lib/bundler/ui.rb +60 -0
  43. data/lib/bundler/vendor/thor.rb +319 -0
  44. data/lib/bundler/vendor/thor/actions.rb +297 -0
  45. data/lib/bundler/vendor/thor/actions/create_file.rb +105 -0
  46. data/lib/bundler/vendor/thor/actions/directory.rb +93 -0
  47. data/lib/bundler/vendor/thor/actions/empty_directory.rb +134 -0
  48. data/lib/bundler/vendor/thor/actions/file_manipulation.rb +229 -0
  49. data/lib/bundler/vendor/thor/actions/inject_into_file.rb +104 -0
  50. data/lib/bundler/vendor/thor/base.rb +556 -0
  51. data/lib/bundler/vendor/thor/core_ext/file_binary_read.rb +9 -0
  52. data/lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb +75 -0
  53. data/lib/bundler/vendor/thor/core_ext/ordered_hash.rb +100 -0
  54. data/lib/bundler/vendor/thor/error.rb +30 -0
  55. data/lib/bundler/vendor/thor/invocation.rb +168 -0
  56. data/lib/bundler/vendor/thor/parser.rb +4 -0
  57. data/lib/bundler/vendor/thor/parser/argument.rb +67 -0
  58. data/lib/bundler/vendor/thor/parser/arguments.rb +161 -0
  59. data/lib/bundler/vendor/thor/parser/option.rb +120 -0
  60. data/lib/bundler/vendor/thor/parser/options.rb +174 -0
  61. data/lib/bundler/vendor/thor/shell.rb +88 -0
  62. data/lib/bundler/vendor/thor/shell/basic.rb +275 -0
  63. data/lib/bundler/vendor/thor/shell/color.rb +108 -0
  64. data/lib/bundler/vendor/thor/shell/html.rb +121 -0
  65. data/lib/bundler/vendor/thor/task.rb +114 -0
  66. data/lib/bundler/vendor/thor/util.rb +229 -0
  67. data/lib/bundler/vendor/thor/version.rb +3 -0
  68. data/lib/bundler/version.rb +6 -0
  69. data/lib/bundler/vlad.rb +9 -0
  70. data/man/bundle-config.ronn +90 -0
  71. data/man/bundle-exec.ronn +98 -0
  72. data/man/bundle-install.ronn +310 -0
  73. data/man/bundle-package.ronn +59 -0
  74. data/man/bundle-update.ronn +176 -0
  75. data/man/bundle.ronn +77 -0
  76. data/man/gemfile.5.ronn +273 -0
  77. data/man/index.txt +6 -0
  78. data/spec/cache/gems_spec.rb +205 -0
  79. data/spec/cache/git_spec.rb +9 -0
  80. data/spec/cache/path_spec.rb +27 -0
  81. data/spec/cache/platform_spec.rb +57 -0
  82. data/spec/install/deploy_spec.rb +197 -0
  83. data/spec/install/deprecated_spec.rb +43 -0
  84. data/spec/install/gems/c_ext_spec.rb +48 -0
  85. data/spec/install/gems/env_spec.rb +107 -0
  86. data/spec/install/gems/flex_spec.rb +272 -0
  87. data/spec/install/gems/groups_spec.rb +228 -0
  88. data/spec/install/gems/packed_spec.rb +72 -0
  89. data/spec/install/gems/platform_spec.rb +195 -0
  90. data/spec/install/gems/resolving_spec.rb +72 -0
  91. data/spec/install/gems/simple_case_spec.rb +749 -0
  92. data/spec/install/gems/sudo_spec.rb +77 -0
  93. data/spec/install/gems/win32_spec.rb +26 -0
  94. data/spec/install/gemspec_spec.rb +96 -0
  95. data/spec/install/git_spec.rb +553 -0
  96. data/spec/install/invalid_spec.rb +17 -0
  97. data/spec/install/path_spec.rb +329 -0
  98. data/spec/install/upgrade_spec.rb +26 -0
  99. data/spec/lock/flex_spec.rb +650 -0
  100. data/spec/lock/git_spec.rb +35 -0
  101. data/spec/other/check_spec.rb +221 -0
  102. data/spec/other/config_spec.rb +40 -0
  103. data/spec/other/console_spec.rb +54 -0
  104. data/spec/other/exec_spec.rb +241 -0
  105. data/spec/other/ext_spec.rb +16 -0
  106. data/spec/other/gem_helper_spec.rb +126 -0
  107. data/spec/other/help_spec.rb +36 -0
  108. data/spec/other/init_spec.rb +40 -0
  109. data/spec/other/newgem_spec.rb +24 -0
  110. data/spec/other/open_spec.rb +35 -0
  111. data/spec/other/show_spec.rb +82 -0
  112. data/spec/pack/gems_spec.rb +22 -0
  113. data/spec/quality_spec.rb +55 -0
  114. data/spec/resolver/basic_spec.rb +20 -0
  115. data/spec/resolver/platform_spec.rb +57 -0
  116. data/spec/runtime/environment_rb_spec.rb +162 -0
  117. data/spec/runtime/executable_spec.rb +110 -0
  118. data/spec/runtime/load_spec.rb +102 -0
  119. data/spec/runtime/platform_spec.rb +90 -0
  120. data/spec/runtime/require_spec.rb +231 -0
  121. data/spec/runtime/setup_spec.rb +412 -0
  122. data/spec/runtime/with_clean_env_spec.rb +15 -0
  123. data/spec/spec_helper.rb +82 -0
  124. data/spec/support/builders.rb +566 -0
  125. data/spec/support/helpers.rb +243 -0
  126. data/spec/support/indexes.rb +113 -0
  127. data/spec/support/matchers.rb +89 -0
  128. data/spec/support/path.rb +71 -0
  129. data/spec/support/platforms.rb +49 -0
  130. data/spec/support/ruby_ext.rb +19 -0
  131. data/spec/support/rubygems_ext.rb +30 -0
  132. data/spec/support/rubygems_hax/rubygems_plugin.rb +9 -0
  133. data/spec/support/sudo.rb +21 -0
  134. data/spec/update/gems_spec.rb +112 -0
  135. data/spec/update/git_spec.rb +159 -0
  136. data/spec/update/source_spec.rb +50 -0
  137. metadata +251 -0
@@ -0,0 +1,49 @@
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 all_platforms
26
+ [rb, java, linux, mswin]
27
+ end
28
+
29
+ def local
30
+ generic(Gem::Platform.local)
31
+ end
32
+
33
+ def not_local
34
+ all_platforms.find { |p| p != generic(Gem::Platform.local) }
35
+ end
36
+
37
+ def local_tag
38
+ if RUBY_PLATFORM == "java"
39
+ :jruby
40
+ else
41
+ :ruby
42
+ end
43
+ end
44
+
45
+ def not_local_tag
46
+ [:ruby, :jruby].find { |tag| tag != local_tag }
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,19 @@
1
+ class IO
2
+ def read_available_bytes(chunk_size = 1024, select_timeout = 5)
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
+ buffer << self.readpartial(chunk_size)
11
+ sleep 0.1
12
+ rescue(EOFError)
13
+ break
14
+ end
15
+ end
16
+
17
+ return buffer.join
18
+ end
19
+ end
@@ -0,0 +1,30 @@
1
+ module Spec
2
+ module Rubygems
3
+ def self.setup
4
+ Gem.clear_paths
5
+
6
+ ENV['BUNDLE_PATH'] = nil
7
+ ENV['GEM_HOME'] = ENV['GEM_PATH'] = Path.base_system_gems.to_s
8
+ ENV['PATH'] = ["#{Path.root}/bin", "#{Path.system_gem_path}/bin", ENV['PATH']].join(File::PATH_SEPARATOR)
9
+
10
+ unless File.exist?("#{Path.base_system_gems}")
11
+ FileUtils.mkdir_p(Path.base_system_gems)
12
+ puts "running `gem install builder rake fakeweb --no-rdoc --no-ri`"
13
+ `gem install builder rake fakeweb --no-rdoc --no-ri`
14
+ end
15
+
16
+ ENV['HOME'] = Path.home.to_s
17
+
18
+ Gem::DefaultUserInteraction.ui = Gem::SilentUI.new
19
+ end
20
+
21
+ def gem_command(command, args = "", options = {})
22
+ if command == :exec && !options[:no_quote]
23
+ args = args.gsub(/(?=")/, "\\")
24
+ args = %["#{args}"]
25
+ end
26
+ lib = File.join(File.dirname(__FILE__), '..', '..', 'lib')
27
+ %x{#{Gem.ruby} -I#{lib} -rubygems -S gem --backtrace #{command} #{args}}.strip
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,9 @@
1
+ class Gem::Platform
2
+ @local = new(ENV['BUNDLER_SPEC_PLATFORM']) if ENV['BUNDLER_SPEC_PLATFORM']
3
+ end
4
+
5
+ if ENV['BUNDLER_SPEC_VERSION']
6
+ module Bundler
7
+ VERSION = ENV['BUNDLER_SPEC_VERSION'].dup
8
+ end
9
+ end
@@ -0,0 +1,21 @@
1
+ module Spec
2
+ module Sudo
3
+ def self.present?
4
+ @which_sudo ||= `which sudo`.strip
5
+ !@which_sudo.empty? && ENV['BUNDLER_SUDO_TESTS']
6
+ end
7
+
8
+ def test_sudo?
9
+ Sudo.present?
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,112 @@
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
+ end
47
+
48
+ describe "bundle update in more complicated situations" do
49
+ before :each do
50
+ build_repo2
51
+ end
52
+
53
+ it "will eagerly unlock dependencies of a specified gem" do
54
+ install_gemfile <<-G
55
+ source "file://#{gem_repo2}"
56
+
57
+ gem "thin"
58
+ gem "rack-obama"
59
+ G
60
+
61
+ update_repo2 do
62
+ build_gem "thin" , '2.0' do |s|
63
+ s.add_dependency "rack"
64
+ end
65
+ end
66
+
67
+ bundle "update thin"
68
+ should_be_installed "thin 2.0", "rack 1.2", "rack-obama 1.0"
69
+ end
70
+ end
71
+
72
+ describe "bundle update without a Gemfile.lock" do
73
+ it "should not explode" do
74
+ build_repo2
75
+
76
+ gemfile <<-G
77
+ source "file://#{gem_repo2}"
78
+
79
+ gem "rack", "1.0"
80
+ G
81
+
82
+ bundle "update"
83
+
84
+ should_be_installed "rack 1.0.0"
85
+ end
86
+ end
87
+
88
+ describe "bundle update when a gem depends on a newer version of bundler" do
89
+ before(:each) do
90
+ build_repo2 do
91
+ build_gem "rails", "3.0.1" do |s|
92
+ s.add_dependency "bundler", Bundler::VERSION.succ
93
+ end
94
+ end
95
+
96
+ gemfile <<-G
97
+ source "file://#{gem_repo2}"
98
+ gem "rails", "3.0.1"
99
+ G
100
+ end
101
+
102
+ it "should not explode" do
103
+ bundle "update"
104
+ err.should be_empty
105
+ end
106
+
107
+ it "should explain that bundler conflicted" do
108
+ bundle "update"
109
+ out.should_not =~ /In snapshot/
110
+ out.should =~ /Current Bundler version/
111
+ end
112
+ end
@@ -0,0 +1,159 @@
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
+ describe "with submodules" do
98
+ before :each do
99
+ build_gem "submodule", :to_system => true do |s|
100
+ s.write "lib/submodule.rb", "puts 'GEM'"
101
+ end
102
+
103
+ build_git "submodule", "1.0" do |s|
104
+ s.write "lib/submodule.rb", "puts 'GIT'"
105
+ end
106
+
107
+ build_git "has_submodule", "1.0" do |s|
108
+ s.add_dependency "submodule"
109
+ end
110
+
111
+ Dir.chdir(lib_path('has_submodule-1.0')) do
112
+ `git submodule add #{lib_path('submodule-1.0')} submodule-1.0`
113
+ `git commit -m "submodulator"`
114
+ end
115
+ end
116
+
117
+ it "it unlocks the source when submodules is added to a git source" do
118
+ install_gemfile <<-G
119
+ git "#{lib_path('has_submodule-1.0')}" do
120
+ gem "has_submodule"
121
+ end
122
+ G
123
+
124
+ run "require 'submodule'"
125
+ out.should == 'GEM'
126
+
127
+ install_gemfile <<-G
128
+ git "#{lib_path('has_submodule-1.0')}", :submodules => true do
129
+ gem "has_submodule"
130
+ end
131
+ G
132
+
133
+ run "require 'submodule'"
134
+ out.should == 'GIT'
135
+ end
136
+
137
+ it "it unlocks the source when submodules is removed from git source" do
138
+ pending "This would require actually removing the submodule from the clone"
139
+ install_gemfile <<-G
140
+ git "#{lib_path('has_submodule-1.0')}", :submodules => true do
141
+ gem "has_submodule"
142
+ end
143
+ G
144
+
145
+ run "require 'submodule'"
146
+ out.should == 'GIT'
147
+
148
+ install_gemfile <<-G
149
+ git "#{lib_path('has_submodule-1.0')}" do
150
+ gem "has_submodule"
151
+ end
152
+ G
153
+
154
+ run "require 'submodule'"
155
+ out.should == 'GEM'
156
+ end
157
+ end
158
+ end
159
+ end
@@ -0,0 +1,50 @@
1
+ require "spec_helper"
2
+
3
+ describe "bundle update" do
4
+ describe "git sources" do
5
+ before :each do
6
+ build_repo2
7
+ @git = build_git "foo", :path => lib_path("foo") do |s|
8
+ s.executables = "foobar"
9
+ end
10
+
11
+ install_gemfile <<-G
12
+ source "file://#{gem_repo2}"
13
+ git "#{lib_path('foo')}" do
14
+ gem 'foo'
15
+ end
16
+ gem 'rack'
17
+ G
18
+ end
19
+
20
+ it "updates the source" do
21
+ update_git "foo", :path => @git.path
22
+
23
+ bundle "update --source foo"
24
+
25
+ in_app_root do
26
+ run <<-RUBY
27
+ require 'foo'
28
+ puts "WIN" if defined?(FOO_PREV_REF)
29
+ RUBY
30
+
31
+ out.should == "WIN"
32
+ end
33
+ end
34
+
35
+ it "unlocks gems that were originally pulled in by the source" do
36
+ update_git "foo", "2.0", :path => @git.path
37
+
38
+ bundle "update --source foo"
39
+ should_be_installed "foo 2.0"
40
+ end
41
+
42
+ it "leaves all other gems frozen" do
43
+ update_repo2
44
+ update_git "foo", :path => @git.path
45
+
46
+ bundle "update --source foo"
47
+ should_be_installed "rack 1.0"
48
+ end
49
+ end
50
+ end