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,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,162 @@
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
+ end
13
+
14
+ it "loads the library via a virtual spec" do
15
+ run <<-R
16
+ require 'no-gemspec'
17
+ puts NOGEMSPEC
18
+ R
19
+
20
+ out.should == "1.0"
21
+ end
22
+ end
23
+
24
+ describe "with bundled and system gems" do
25
+ before :each do
26
+ system_gems "rack-1.0.0"
27
+
28
+ install_gemfile <<-G
29
+ source "file://#{gem_repo1}"
30
+
31
+ gem "activesupport", "2.3.5"
32
+ G
33
+ end
34
+
35
+ it "does not pull in system gems" do
36
+ run <<-R
37
+ require 'rubygems'
38
+
39
+ begin;
40
+ require 'rack'
41
+ rescue LoadError
42
+ puts 'WIN'
43
+ end
44
+ R
45
+
46
+ out.should == "WIN"
47
+ end
48
+
49
+ it "provides a gem method" do
50
+ run <<-R
51
+ gem 'activesupport'
52
+ require 'activesupport'
53
+ puts ACTIVESUPPORT
54
+ R
55
+
56
+ out.should == "2.3.5"
57
+ end
58
+
59
+ it "raises an exception if gem is used to invoke a system gem not in the bundle" do
60
+ run <<-R
61
+ begin
62
+ gem 'rack'
63
+ rescue LoadError => e
64
+ puts e.message
65
+ end
66
+ R
67
+
68
+ out.should == "rack is not part of the bundle. Add it to Gemfile."
69
+ end
70
+
71
+ it "sets GEM_HOME appropriately" do
72
+ run "puts ENV['GEM_HOME']"
73
+ out.should == default_bundle_path.to_s
74
+ end
75
+ end
76
+
77
+ describe "with system gems in the bundle" do
78
+ before :each do
79
+ system_gems "rack-1.0.0"
80
+
81
+ install_gemfile <<-G
82
+ source "file://#{gem_repo1}"
83
+ gem "rack", "1.0.0"
84
+ gem "activesupport", "2.3.5"
85
+ G
86
+ end
87
+
88
+ it "sets GEM_PATH appropriately" do
89
+ run "puts Gem.path"
90
+ paths = out.split("\n")
91
+ paths.should include(system_gem_path.to_s)
92
+ paths.should include(default_bundle_path.to_s)
93
+ end
94
+ end
95
+
96
+ describe "with a gemspec that requires other files" do
97
+ before :each do
98
+ build_git "bar", :gemspec => false do |s|
99
+ s.write "lib/bar/version.rb", %{BAR_VERSION = '1.0'}
100
+ s.write "bar.gemspec", <<-G
101
+ lib = File.expand_path('../lib/', __FILE__)
102
+ $:.unshift lib unless $:.include?(lib)
103
+ require 'bar/version'
104
+
105
+ Gem::Specification.new do |s|
106
+ s.name = 'bar'
107
+ s.version = BAR_VERSION
108
+ s.summary = 'Bar'
109
+ s.files = Dir["lib/**/*.rb"]
110
+ end
111
+ G
112
+ end
113
+
114
+ gemfile <<-G
115
+ gem "bar", :git => "#{lib_path('bar-1.0')}"
116
+ G
117
+ end
118
+
119
+ it "evals each gemspec in the context of its parent directory" do
120
+ bundle :install
121
+ run "require 'bar'; puts BAR"
122
+ out.should == "1.0"
123
+ end
124
+
125
+ it "error intelligently if the gemspec has a LoadError" do
126
+ update_git "bar", :gemspec => false do |s|
127
+ s.write "bar.gemspec", "require 'foobarbaz'"
128
+ end
129
+ bundle :install
130
+ out.should include("was a LoadError while evaluating bar.gemspec")
131
+ out.should include("foobarbaz")
132
+ out.should include("bar.gemspec:1")
133
+ out.should include("try to require a relative path") if RUBY_VERSION >= "1.9.0"
134
+ end
135
+
136
+ it "evals each gemspec with a binding from the top level" do
137
+ bundle "install"
138
+
139
+ ruby <<-RUBY
140
+ require 'bundler'
141
+ def Bundler.require(path)
142
+ raise "LOSE"
143
+ end
144
+ Bundler.load
145
+ RUBY
146
+
147
+ err.should be_empty
148
+ out.should be_empty
149
+ end
150
+ end
151
+
152
+ describe "when Bundler is bundled" do
153
+ it "doesn't blow up" do
154
+ install_gemfile <<-G
155
+ gem "bundler", :path => "#{File.expand_path("..", lib)}"
156
+ G
157
+
158
+ bundle %|exec ruby -e "require 'bundler'; Bundler.setup"|
159
+ err.should be_empty
160
+ end
161
+ end
162
+ 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,102 @@
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
+ # This is obviously not true on 1.9 thanks to the AWEOME! gem prelude :'(
73
+ it "does not invoke setup inside env.rb" do
74
+ install_gemfile <<-G
75
+ source "file://#{gem_repo1}"
76
+ gem "activesupport"
77
+ G
78
+
79
+ ruby <<-RUBY
80
+ require 'bundler'
81
+ Bundler.load
82
+ puts $LOAD_PATH.grep(/activesupport/i)
83
+ RUBY
84
+
85
+ out.should == ""
86
+ end if RUBY_VERSION < "1.9"
87
+
88
+ describe "not hurting brittle rubygems" do
89
+ it "does not inject #source into the generated YAML of the gem specs" do
90
+ system_gems "activerecord-2.3.2", "activesupport-2.3.2"
91
+ gemfile <<-G
92
+ gem "activerecord"
93
+ G
94
+
95
+ Bundler.load.specs.each do |spec|
96
+ spec.to_yaml.should_not =~ /^\s+source:/
97
+ spec.to_yaml.should_not =~ /^\s+groups:/
98
+ end
99
+ end
100
+ end
101
+
102
+ end