honkster-bundler 1.1.pre

Sign up to get free protection for your applications and to get access to all the features.
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
data/ISSUES.md ADDED
@@ -0,0 +1,32 @@
1
+ # Bundler Issues
2
+
3
+ ## Troubleshooting
4
+
5
+ Instructions for common Bundler use-cases can be found on the [Bundler documentation site](http://gembundler.com/v1.0/). Detailed information about each Bundler command, including help with common problems, can be found in the [Bundler man pages](http://gembundler.com/man/bundle.1.html).
6
+
7
+ After reading the documentation, try these troubleshooting steps:
8
+
9
+ rm -rf ~/.bundle/ ~/.gem/ .bundle/ vendor/cache/ Gemfile.lock
10
+ bundle install
11
+
12
+ ## Reporting unresolved problems
13
+
14
+ If you are still having problems, please report issues to the [Bundler issue tracker](http://github.com/carlhuda/bundler/issues/).
15
+
16
+ Instructions that allow the Bundler team to reproduce your issue are vitally important. When you report a bug, please create a gist of the following information and include a link in your ticket:
17
+
18
+ - What version of bundler you are using
19
+ - What version of Ruby you are using
20
+ - Whether you are using RVM, and if so what version
21
+ - Your Gemfile
22
+ - Your Gemfile.lock
23
+ - If you are on 0.9, whether you have locked or not
24
+ - If you are on 1.0, the result of `bundle config`
25
+ - The command you ran to generate exception(s)
26
+ - The exception backtrace(s)
27
+
28
+ If you are using Rails 2.3, please also include:
29
+
30
+ - Your boot.rb file
31
+ - Your preinitializer.rb file
32
+ - Your environment.rb file
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2009 Engine Yard
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Bundler: a gem to bundle gems
2
+
3
+ Bundler is a tool that manages gem dependencies for your ruby application. It
4
+ takes a gem manifest file and is able to fetch, download, and install the gems
5
+ and all child dependencies specified in this manifest. It can manage any update
6
+ to the gem manifest file and update the bundle's gems accordingly. It also lets
7
+ you run any ruby code in context of the bundle's gem environment.
8
+
9
+ ### Installation and usage
10
+
11
+ See [gembundler.com](http://gembundler.com) for up-to-date installation and usage instructions.
12
+
13
+ ### Troubleshooting
14
+
15
+ For help with common problems, see [ISSUES](http://github.com/carlhuda/bundler/blob/master/ISSUES.md).
16
+
17
+ ### Development
18
+
19
+ To see what has changed in recent versions of bundler, see the [CHANGELOG](http://github.com/carlhuda/bundler/blob/master/CHANGELOG.md).
20
+
21
+ The `master` branch contains our current progress towards version 1.1. Because of that, please submit bugfix pull requests against the `1-0-stable` branch.
22
+
23
+ ### Upgrading from Bundler 0.8 to 0.9 and above
24
+
25
+ See [UPGRADING](http://github.com/carlhuda/bundler/blob/master/UPGRADING.md).
26
+
27
+ ### Other questions
28
+
29
+ Feel free to chat with the Bundler core team (and many other users) on IRC in the [#bundler](irc://irc.freenode.net/bundler) channel on Freenode, or via email on the [Bundler mailing list](http://groups.google.com/group/ruby-bundler).
data/Rakefile ADDED
@@ -0,0 +1,150 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.unshift File.expand_path("../lib", __FILE__)
3
+ require 'bundler/gem_helper'
4
+ Bundler::GemHelper.install_tasks
5
+
6
+ def sudo?
7
+ ENV['BUNDLER_SUDO_TESTS']
8
+ end
9
+
10
+ begin
11
+ require 'rspec/core/rake_task'
12
+ require 'ronn'
13
+
14
+ desc "Run specs"
15
+ RSpec::Core::RakeTask.new do |t|
16
+ t.rspec_opts = %w(-fs --color)
17
+ t.ruby_opts = %w(-w)
18
+ end
19
+ task :spec => "man:build"
20
+
21
+ namespace :ci do
22
+ desc "Run specs without color"
23
+ RSpec::Core::RakeTask.new(:spec) do |t|
24
+ t.rspec_opts = %w(-fs)
25
+ t.ruby_opts = %w(-w)
26
+ end
27
+ task :spec => "man:build"
28
+ end
29
+
30
+ namespace :spec do
31
+ desc "Run the spec suite with the sudo tests"
32
+ task :sudo => ["set_sudo", "clean", "spec"]
33
+
34
+ task :set_sudo do
35
+ ENV['BUNDLER_SUDO_TESTS'] = '1'
36
+ end
37
+
38
+ task :clean do
39
+ if sudo?
40
+ system "sudo rm -rf #{File.expand_path('../tmp', __FILE__)}"
41
+ else
42
+ rm_rf 'tmp'
43
+ end
44
+ end
45
+
46
+ namespace :rubygems do
47
+ # Rubygems 1.3.5, 1.3.6, and HEAD specs
48
+ rubyopt = ENV["RUBYOPT"]
49
+ %w(master REL_1_3_5 REL_1_3_6).each do |rg|
50
+ desc "Run specs with Rubygems #{rg}"
51
+ RSpec::Core::RakeTask.new(rg) do |t|
52
+ t.rspec_opts = %w(-fs --color)
53
+ t.ruby_opts = %w(-w)
54
+ end
55
+
56
+ task "clone_rubygems_#{rg}" do
57
+ unless File.directory?("tmp/rubygems_#{rg}")
58
+ system("git clone git://github.com/jbarnette/rubygems.git tmp/rubygems_#{rg} && cd tmp/rubygems_#{rg} && git reset --hard #{rg}")
59
+ end
60
+ ENV["RUBYOPT"] = "-I#{File.expand_path("tmp/rubygems_#{rg}/lib")} #{rubyopt}"
61
+ end
62
+
63
+ task rg => "clone_rubygems_#{rg}"
64
+ task "rubygems:all" => rg
65
+ end
66
+ end
67
+
68
+ namespace :ruby do
69
+ # Ruby 1.8.6, 1.8.7, and 1.9.2 specs
70
+ task "ensure_rvm" do
71
+ raise "RVM is not available" unless File.exist?(File.expand_path("~/.rvm/scripts/rvm"))
72
+ end
73
+
74
+ %w(1.8.6-p399 1.8.7-p302 1.9.2-p0).each do |ruby|
75
+ ruby_cmd = File.expand_path("~/.rvm/bin/ruby-#{ruby}")
76
+
77
+ desc "Run specs on Ruby #{ruby}"
78
+ RSpec::Core::RakeTask.new(ruby) do |t|
79
+ t.rspec_opts = %w(-fs --color)
80
+ t.ruby_opts = %w(-w)
81
+ end
82
+
83
+ task "ensure_ruby_#{ruby}" do
84
+ raise "Could not find Ruby #{ruby} at #{ruby_cmd}" unless File.exist?(ruby_cmd)
85
+ end
86
+
87
+ task "ensure_ruby_#{ruby}" => "ensure_rvm"
88
+ task ruby => "ensure_ruby_#{ruby}"
89
+ task "ruby:all" => ruby
90
+ end
91
+ end
92
+
93
+ end
94
+
95
+ rescue LoadError
96
+ task :spec do
97
+ abort "Run `rake spec:deps` to be able to run the specs"
98
+ end
99
+ end
100
+
101
+ namespace :spec do
102
+ desc "Ensure spec dependencies are installed"
103
+ task :deps do
104
+ sh "gem list ronn | (grep 'ronn' 1> /dev/null) || gem install ronn --no-ri --no-rdoc"
105
+ sh "gem list rspec | (grep 'rspec (2.0' 1> /dev/null) || gem install rspec --no-ri --no-rdoc"
106
+ end
107
+ end
108
+
109
+ namespace :man do
110
+ directory "lib/bundler/man"
111
+
112
+ Dir["man/*.ronn"].each do |ronn|
113
+ basename = File.basename(ronn, ".ronn")
114
+ roff = "lib/bundler/man/#{basename}"
115
+
116
+ file roff => ["lib/bundler/man", ronn] do
117
+ sh "ronn --roff --pipe #{ronn} > #{roff}"
118
+ end
119
+
120
+ file "#{roff}.txt" => roff do
121
+ sh "groff -Wall -mtty-char -mandoc -Tascii #{roff} | col -b > #{roff}.txt"
122
+ end
123
+
124
+ task :build_all_pages => "#{roff}.txt"
125
+ end
126
+
127
+ desc "Build the man pages"
128
+ task :build => "man:build_all_pages"
129
+
130
+ desc "Clean up from the built man pages"
131
+ task :clean do
132
+ rm_rf "lib/bundler/man"
133
+ end
134
+ end
135
+
136
+ namespace :vendor do
137
+ desc "Build the vendor dir"
138
+ task :build => :clean do
139
+ sh "git clone git://github.com/wycats/thor.git lib/bundler/vendor/tmp"
140
+ sh "mv lib/bundler/vendor/tmp/lib/* lib/bundler/vendor/"
141
+ rm_rf "lib/bundler/vendor/tmp"
142
+ end
143
+
144
+ desc "Clean the vendor dir"
145
+ task :clean do
146
+ rm_rf "lib/bundler/vendor"
147
+ end
148
+ end
149
+
150
+ task :default => :spec
data/UPGRADING.md ADDED
@@ -0,0 +1,103 @@
1
+ ## Bundler 0.9 to 1.0 and above
2
+
3
+ Upgrading from Bundler 0.9 to 1.0 is relatively painless. The
4
+ Gemfile API is the same, so your old Gemfiles should continue
5
+ to work.
6
+
7
+ The "env" file that 0.9 created at `.bundle/environment.rb` has been
8
+ removed. As a side effect of this, Passenger will only find your
9
+ bundled gems if you install with `bundle install --deployment`.
10
+ Alternatively, you can tell Passenger where you gems are installed,
11
+ [something like this](http://bit.ly/passenger-gem-home).
12
+
13
+ The `bundle lock` command is no longer needed, as the
14
+ Gemfile.lock file is now automatically generated by `bundle install`.
15
+ If you have not yet done so, add your Gemfile.lock to source control
16
+ and check it in.
17
+
18
+ Running `bundle install` no longer updates the versions of your gems.
19
+ If you need to update just one gem, run `bundle update GEMNAME`. To
20
+ update all gems to the newest versions possible, run `bundle update`.
21
+
22
+ Bundler now supports multiple platforms, using a block syntax to
23
+ declare platform-specific gems:
24
+
25
+ platform :jruby do
26
+ gem "jruby-maven-plugins"
27
+ end
28
+
29
+ Deploying using Bundler is even easier than it was before, as Bundler
30
+ now includes a Capistrano recipe. Simply add this line to the top of
31
+ your deploy.rb file to run Bundler automatically as part of deploying:
32
+
33
+ require 'bundler/capistrano'
34
+
35
+ For more details on deploying using bundler, see the documentation
36
+ for the bundler cap task, and the [documentation on deploying](http://gembundler.com/v1.0/deploying.html).
37
+
38
+
39
+ ## Bundler 0.8 to 0.9 and above
40
+
41
+ Upgrading to Bundler 0.9 from Bundler 0.8 requires upgrading several
42
+ API calls in your Gemfile, and some workarounds if you are using Rails 2.3.
43
+
44
+ ### Gemfile Removals
45
+
46
+ Bundler 0.9 removes the following Bundler 0.8 Gemfile APIs:
47
+
48
+ 1. `disable_system_gems`: This is now the default (and only) option
49
+ for bundler. Bundler uses the system gems you have specified
50
+ in the Gemfile, and only the system gems you have specified
51
+ (and their dependencies)
52
+ 2. `disable_rubygems`: This is no longer supported. We are looking
53
+ into ways to get the fastest performance out of each supported
54
+ scenario, and we will make speed the default where possible.
55
+ 3. `clear_sources`: Bundler now defaults to an empty source
56
+ list. If you want to include Rubygems, you can add the source
57
+ via source "http://gemcutter.org". If you use bundle init, this
58
+ source will be automatically added for you in the generated
59
+ Gemfile
60
+ 4. `bundle_path`: You can specify this setting when installing
61
+ via `bundle install /path/to/bundle`. Bundler will remember
62
+ where you installed the dependencies to on a particular
63
+ machine for future installs, loads, setups, etc.
64
+ 5. `bin_path`: Bundler no longer generates binaries in the root
65
+ of your app. You should use `bundle exec` to execute binaries
66
+ in the current context.
67
+
68
+ ### Gemfile Changes
69
+
70
+ Bundler 0.9 changes the following Bundler 0.8 Gemfile APIs:
71
+
72
+ 1. Bundler 0.8 supported :only and :except as APIs for describing
73
+ groups of gems. Bundler 0.9 supports a single `group` method,
74
+ which you can use to group gems together. See the above "Group"
75
+ section for more information.
76
+
77
+ This means that `gem "foo", :only => :production` becomes
78
+ `gem "foo", :group => :production`, and
79
+ `only :production { gem "foo" }` becomes
80
+ `group :production { gem "foo" }`
81
+
82
+ The short version is: group your gems together logically, and
83
+ use the available commands to make use of the groups you've
84
+ created.
85
+
86
+ 2. `:require_as` becomes `:require`
87
+
88
+ 3. `:vendored_at` is fully removed; you should use `:path`
89
+
90
+ ### API Changes
91
+
92
+ 1. `Bundler.require_env(:environment)` becomes
93
+ `Bundler.require(:multiple, :groups)`. You must
94
+ now specify the default group (the default group is the
95
+ group made up of the gems not assigned to any group)
96
+ explicitly. So `Bundler.require_env(:test)` becomes
97
+ `Bundler.require(:default, :test)`
98
+
99
+ 2. `require 'vendor/gems/environment'`: In unlocked
100
+ mode, where using system gems, this becomes
101
+ `Bundler.setup(:multiple, :groups)`. If you don't
102
+ specify any groups, this puts all groups on the load
103
+ path. In locked, mode, it becomes `require '.bundle/environment'`
data/bin/bundle ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Check if an older version of bundler is installed
4
+ require 'bundler'
5
+ $:.each do |path|
6
+ if path =~ %r'/bundler-0.(\d+)' && $1.to_i < 9
7
+ abort "Please remove older versions of bundler. This can be done by running `gem cleanup bundler`."
8
+ end
9
+ end
10
+ require 'bundler/cli'
11
+
12
+ begin
13
+ Bundler::CLI.start
14
+ rescue Bundler::BundlerError => e
15
+ Bundler.ui.error e.message
16
+ Bundler.ui.error e.backtrace.join("\n") if ENV["DEBUG"]
17
+ exit e.status_code
18
+ rescue Interrupt
19
+ Bundler.ui.error "\nQuitting..."
20
+ exit 1
21
+ end
data/bundler.gemspec ADDED
@@ -0,0 +1,30 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib/', __FILE__)
3
+ $:.unshift lib unless $:.include?(lib)
4
+
5
+ require 'bundler/version'
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = "honkster-bundler"
9
+ s.version = Bundler::VERSION
10
+ s.platform = Gem::Platform::RUBY
11
+ s.authors = ["Carl Lerche", "Yehuda Katz", "André Arko"]
12
+ s.email = ["carlhuda@engineyard.com"]
13
+ s.homepage = "http://gembundler.com"
14
+ s.summary = %q{The best way to manage your application's dependencies}
15
+ s.description = %q{Bundler manages an application's dependencies through its entire life, across many machines, systematically and repeatably}
16
+
17
+ s.required_rubygems_version = ">= 1.3.6"
18
+ s.rubyforge_project = "bundler"
19
+
20
+ s.add_development_dependency "ronn"
21
+ s.add_development_dependency "rspec", "2.0.0.rc"
22
+
23
+ # Man files are required because they are ignored by git
24
+ man_files = Dir.glob("lib/bundler/man/**/*")
25
+ s.files = `git ls-files`.split("\n") + man_files
26
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
27
+ s.executables = %w(bundle)
28
+ s.default_executable = "bundle"
29
+ s.require_paths = ["lib"]
30
+ end
data/lib/bundler.rb ADDED
@@ -0,0 +1,268 @@
1
+ require 'rbconfig'
2
+ require 'fileutils'
3
+ require 'pathname'
4
+ require 'yaml'
5
+ require 'bundler/rubygems_ext'
6
+ require 'bundler/version'
7
+
8
+ module Bundler
9
+ ORIGINAL_ENV = ENV.to_hash
10
+
11
+ autoload :Definition, 'bundler/definition'
12
+ autoload :Dependency, 'bundler/dependency'
13
+ autoload :Dsl, 'bundler/dsl'
14
+ autoload :Environment, 'bundler/environment'
15
+ autoload :GemHelper, 'bundler/gem_helper'
16
+ autoload :Graph, 'bundler/graph'
17
+ autoload :Index, 'bundler/index'
18
+ autoload :Installer, 'bundler/installer'
19
+ autoload :LazySpecification, 'bundler/lazy_specification'
20
+ autoload :LockfileParser, 'bundler/lockfile_parser'
21
+ autoload :RemoteSpecification, 'bundler/remote_specification'
22
+ autoload :Resolver, 'bundler/resolver'
23
+ autoload :Runtime, 'bundler/runtime'
24
+ autoload :Settings, 'bundler/settings'
25
+ autoload :SharedHelpers, 'bundler/shared_helpers'
26
+ autoload :SpecSet, 'bundler/spec_set'
27
+ autoload :Source, 'bundler/source'
28
+ autoload :Specification, 'bundler/shared_helpers'
29
+ autoload :UI, 'bundler/ui'
30
+
31
+ class BundlerError < StandardError
32
+ def self.status_code(code = nil)
33
+ define_method(:status_code) { code }
34
+ end
35
+ end
36
+
37
+ class GemfileNotFound < BundlerError; status_code(10) ; end
38
+ class GemNotFound < BundlerError; status_code(7) ; end
39
+ class GemfileError < BundlerError; status_code(4) ; end
40
+ class PathError < BundlerError; status_code(13) ; end
41
+ class GitError < BundlerError; status_code(11) ; end
42
+ class DeprecatedError < BundlerError; status_code(12) ; end
43
+ class GemspecError < BundlerError; status_code(14) ; end
44
+ class DslError < BundlerError; status_code(15) ; end
45
+ class ProductionError < BundlerError; status_code(16) ; end
46
+ class InvalidOption < DslError ; end
47
+
48
+
49
+ WINDOWS = RbConfig::CONFIG["host_os"] =~ %r!(msdos|mswin|djgpp|mingw)!
50
+ NULL = WINDOWS ? "NUL" : "/dev/null"
51
+
52
+ # Internal errors, should be rescued
53
+ class VersionConflict < BundlerError
54
+ attr_reader :conflicts
55
+
56
+ def initialize(conflicts, msg = nil)
57
+ super(msg)
58
+ @conflicts = conflicts
59
+ end
60
+
61
+ status_code(6)
62
+ end
63
+
64
+ class InvalidSpecSet < StandardError; end
65
+
66
+ class << self
67
+ attr_writer :ui, :bundle_path
68
+
69
+ def configure
70
+ @configured ||= begin
71
+ configure_gem_home_and_path
72
+ true
73
+ end
74
+ end
75
+
76
+ def ui
77
+ @ui ||= UI.new
78
+ end
79
+
80
+ def bundle_path
81
+ # STDERR.puts settings.path
82
+ @bundle_path ||= Pathname.new(settings.path).expand_path(root)
83
+ end
84
+
85
+ def bin_path
86
+ @bin_path ||= begin
87
+ path = settings[:bin] || "bin"
88
+ path = Pathname.new(path).expand_path(root)
89
+ FileUtils.mkdir_p(path)
90
+ Pathname.new(path).expand_path
91
+ end
92
+ end
93
+
94
+ def setup(*groups)
95
+ return @setup if defined?(@setup) && @setup
96
+
97
+ if groups.empty?
98
+ # Load all groups, but only once
99
+ @setup = load.setup
100
+ else
101
+ # Figure out which groups haven't been loaded yet
102
+ unloaded = groups - (@completed_groups || [])
103
+ # Record groups that are now loaded
104
+ @completed_groups = groups | (@completed_groups || [])
105
+ # Load any groups that are not yet loaded
106
+ unloaded.any? ? load.setup(*unloaded) : load
107
+ end
108
+ end
109
+
110
+ def require(*groups)
111
+ setup(*groups).require(*groups)
112
+ end
113
+
114
+ def load
115
+ @load ||= Runtime.new(root, definition)
116
+ end
117
+
118
+ def environment
119
+ Bundler::Environment.new(root, definition)
120
+ end
121
+
122
+ def definition(unlock = nil)
123
+ @definition = nil if unlock
124
+ @definition ||= begin
125
+ configure
126
+ upgrade_lockfile
127
+ Definition.build(default_gemfile, default_lockfile, unlock)
128
+ end
129
+ end
130
+
131
+ def ruby_scope
132
+ "#{Gem.ruby_engine}/#{Gem::ConfigMap[:ruby_version]}"
133
+ end
134
+
135
+ def user_bundle_path
136
+ Pathname.new(Gem.user_home).join(".bundler")
137
+ end
138
+
139
+ def home
140
+ bundle_path.join("bundler")
141
+ end
142
+
143
+ def install_path
144
+ home.join("gems")
145
+ end
146
+
147
+ def specs_path
148
+ bundle_path.join("specifications")
149
+ end
150
+
151
+ def cache
152
+ bundle_path.join("cache/bundler")
153
+ end
154
+
155
+ def root
156
+ default_gemfile.dirname.expand_path
157
+ end
158
+
159
+ def app_config_path
160
+ ENV['BUNDLE_APP_CONFIG'] ?
161
+ Pathname.new(ENV['BUNDLE_APP_CONFIG']).expand_path(root) :
162
+ root.join('.bundle')
163
+ end
164
+
165
+ def app_cache
166
+ root.join("vendor/cache")
167
+ end
168
+
169
+ def tmp
170
+ user_bundle_path.join("tmp", Process.pid.to_s)
171
+ end
172
+
173
+ def settings
174
+ @settings ||= Settings.new(app_config_path)
175
+ end
176
+
177
+ def with_clean_env
178
+ bundled_env = ENV.to_hash
179
+ ENV.replace(ORIGINAL_ENV)
180
+ yield
181
+ ensure
182
+ ENV.replace(bundled_env.to_hash)
183
+ end
184
+
185
+ def default_gemfile
186
+ SharedHelpers.default_gemfile
187
+ end
188
+
189
+ def default_lockfile
190
+ SharedHelpers.default_lockfile
191
+ end
192
+
193
+ def requires_sudo?
194
+ path = bundle_path
195
+ path = path.parent until path.exist?
196
+ sudo_present = !`which sudo 2>#{NULL}`.empty?
197
+
198
+ settings.allow_sudo? && !File.writable?(path) && sudo_present
199
+ end
200
+
201
+ def mkdir_p(path)
202
+ if requires_sudo?
203
+ sudo "mkdir -p '#{path}'" unless File.exist?(path)
204
+ else
205
+ FileUtils.mkdir_p(path)
206
+ end
207
+ end
208
+
209
+ def sudo(str)
210
+ `sudo -p 'Enter your password to install the bundled RubyGems to your system: ' #{str}`
211
+ end
212
+
213
+ def read_file(file)
214
+ File.open(file, "rb") { |f| f.read }
215
+ end
216
+
217
+ def load_gemspec(file)
218
+ path = Pathname.new(file)
219
+ # Eval the gemspec from its parent directory
220
+ Dir.chdir(path.dirname) do
221
+ begin
222
+ Gem::Specification.from_yaml(path.basename)
223
+ # Raises ArgumentError if the file is not valid YAML
224
+ rescue ArgumentError, SyntaxError, Gem::EndOfYAMLException, Gem::Exception
225
+ begin
226
+ eval(File.read(path.basename), TOPLEVEL_BINDING, path.expand_path.to_s)
227
+ rescue LoadError => e
228
+ original_line = e.backtrace.find { |line| line.include?(path.to_s) }
229
+ msg = "There was a LoadError while evaluating #{path.basename}:\n #{e.message}"
230
+ msg << " from\n #{original_line}" if original_line
231
+ msg << "\n"
232
+
233
+ if RUBY_VERSION >= "1.9.0"
234
+ msg << "\nDoes it try to require a relative path? That doesn't work in Ruby 1.9."
235
+ end
236
+
237
+ raise GemspecError, msg
238
+ end
239
+ end
240
+ end
241
+ end
242
+
243
+ private
244
+
245
+ def configure_gem_home_and_path
246
+ if settings[:disable_shared_gems]
247
+ ENV['GEM_PATH'] = ''
248
+ ENV['GEM_HOME'] = File.expand_path(bundle_path, root)
249
+ elsif Gem.dir != bundle_path.to_s
250
+ paths = [Gem.dir, Gem.path].flatten.compact.uniq.reject{|p| p.empty? }
251
+ ENV["GEM_PATH"] = paths.join(File::PATH_SEPARATOR)
252
+ ENV["GEM_HOME"] = bundle_path.to_s
253
+ end
254
+
255
+ FileUtils.mkdir_p bundle_path.to_s
256
+ Gem.clear_paths
257
+ end
258
+
259
+ def upgrade_lockfile
260
+ lockfile = default_lockfile
261
+ if lockfile.exist? && lockfile.read(3) == "---"
262
+ Bundler.ui.warn "Detected Gemfile.lock generated by 0.9, deleting..."
263
+ lockfile.rmtree
264
+ end
265
+ end
266
+
267
+ end
268
+ end