bundler_package_git 1.1.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +22 -0
- data/.rvmrc +1 -0
- data/CHANGELOG.md +659 -0
- data/ISSUES.md +47 -0
- data/LICENSE +23 -0
- data/README.md +29 -0
- data/Rakefile +167 -0
- data/UPGRADING.md +103 -0
- data/bin/bundle +22 -0
- data/bundler.gemspec +30 -0
- data/lib/bundler.rb +283 -0
- data/lib/bundler/capistrano.rb +11 -0
- data/lib/bundler/cli.rb +490 -0
- data/lib/bundler/definition.rb +429 -0
- data/lib/bundler/dependency.rb +130 -0
- data/lib/bundler/deployment.rb +53 -0
- data/lib/bundler/dsl.rb +243 -0
- data/lib/bundler/environment.rb +47 -0
- data/lib/bundler/fetcher.rb +101 -0
- data/lib/bundler/gem_helper.rb +146 -0
- data/lib/bundler/graph.rb +130 -0
- data/lib/bundler/index.rb +131 -0
- data/lib/bundler/installer.rb +117 -0
- data/lib/bundler/lazy_specification.rb +71 -0
- data/lib/bundler/lockfile_parser.rb +108 -0
- data/lib/bundler/remote_specification.rb +57 -0
- data/lib/bundler/resolver.rb +470 -0
- data/lib/bundler/rubygems_ext.rb +226 -0
- data/lib/bundler/runtime.rb +201 -0
- data/lib/bundler/settings.rb +117 -0
- data/lib/bundler/setup.rb +16 -0
- data/lib/bundler/shared_helpers.rb +167 -0
- data/lib/bundler/source.rb +675 -0
- data/lib/bundler/spec_set.rb +134 -0
- data/lib/bundler/templates/Executable +16 -0
- data/lib/bundler/templates/Gemfile +4 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +4 -0
- data/lib/bundler/templates/newgem/Rakefile.tt +2 -0
- data/lib/bundler/templates/newgem/bin/newgem.tt +3 -0
- data/lib/bundler/templates/newgem/gitignore.tt +4 -0
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +7 -0
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +21 -0
- data/lib/bundler/ui.rb +73 -0
- data/lib/bundler/vendor/net/http/faster.rb +27 -0
- data/lib/bundler/vendor/net/http/persistent.rb +464 -0
- data/lib/bundler/vendor/thor.rb +319 -0
- data/lib/bundler/vendor/thor/actions.rb +297 -0
- data/lib/bundler/vendor/thor/actions/create_file.rb +105 -0
- data/lib/bundler/vendor/thor/actions/directory.rb +93 -0
- data/lib/bundler/vendor/thor/actions/empty_directory.rb +134 -0
- data/lib/bundler/vendor/thor/actions/file_manipulation.rb +229 -0
- data/lib/bundler/vendor/thor/actions/inject_into_file.rb +104 -0
- data/lib/bundler/vendor/thor/base.rb +556 -0
- data/lib/bundler/vendor/thor/core_ext/file_binary_read.rb +9 -0
- data/lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb +75 -0
- data/lib/bundler/vendor/thor/core_ext/ordered_hash.rb +100 -0
- data/lib/bundler/vendor/thor/error.rb +30 -0
- data/lib/bundler/vendor/thor/invocation.rb +168 -0
- data/lib/bundler/vendor/thor/parser.rb +4 -0
- data/lib/bundler/vendor/thor/parser/argument.rb +67 -0
- data/lib/bundler/vendor/thor/parser/arguments.rb +161 -0
- data/lib/bundler/vendor/thor/parser/option.rb +120 -0
- data/lib/bundler/vendor/thor/parser/options.rb +174 -0
- data/lib/bundler/vendor/thor/shell.rb +88 -0
- data/lib/bundler/vendor/thor/shell/basic.rb +275 -0
- data/lib/bundler/vendor/thor/shell/color.rb +108 -0
- data/lib/bundler/vendor/thor/shell/html.rb +121 -0
- data/lib/bundler/vendor/thor/task.rb +114 -0
- data/lib/bundler/vendor/thor/util.rb +229 -0
- data/lib/bundler/vendor/thor/version.rb +3 -0
- data/lib/bundler/version.rb +6 -0
- data/lib/bundler/vlad.rb +9 -0
- data/man/bundle-config.ronn +90 -0
- data/man/bundle-exec.ronn +111 -0
- data/man/bundle-install.ronn +314 -0
- data/man/bundle-package.ronn +59 -0
- data/man/bundle-update.ronn +176 -0
- data/man/bundle.ronn +80 -0
- data/man/gemfile.5.ronn +279 -0
- data/man/index.txt +6 -0
- data/spec/cache/gems_spec.rb +219 -0
- data/spec/cache/git_spec.rb +9 -0
- data/spec/cache/path_spec.rb +27 -0
- data/spec/cache/platform_spec.rb +57 -0
- data/spec/install/deploy_spec.rb +197 -0
- data/spec/install/deprecated_spec.rb +37 -0
- data/spec/install/gems/c_ext_spec.rb +48 -0
- data/spec/install/gems/dependency_api_spec.rb +85 -0
- data/spec/install/gems/env_spec.rb +107 -0
- data/spec/install/gems/flex_spec.rb +313 -0
- data/spec/install/gems/groups_spec.rb +245 -0
- data/spec/install/gems/packed_spec.rb +84 -0
- data/spec/install/gems/platform_spec.rb +208 -0
- data/spec/install/gems/resolving_spec.rb +72 -0
- data/spec/install/gems/simple_case_spec.rb +715 -0
- data/spec/install/gems/standalone_spec.rb +162 -0
- data/spec/install/gems/sudo_spec.rb +73 -0
- data/spec/install/gems/win32_spec.rb +26 -0
- data/spec/install/gemspec_spec.rb +108 -0
- data/spec/install/git_spec.rb +571 -0
- data/spec/install/invalid_spec.rb +17 -0
- data/spec/install/path_spec.rb +353 -0
- data/spec/install/upgrade_spec.rb +26 -0
- data/spec/lock/git_spec.rb +35 -0
- data/spec/lock/lockfile_spec.rb +683 -0
- data/spec/other/check_spec.rb +221 -0
- data/spec/other/clean_spec.rb +202 -0
- data/spec/other/config_spec.rb +40 -0
- data/spec/other/console_spec.rb +54 -0
- data/spec/other/exec_spec.rb +241 -0
- data/spec/other/ext_spec.rb +16 -0
- data/spec/other/gem_helper_spec.rb +128 -0
- data/spec/other/help_spec.rb +38 -0
- data/spec/other/init_spec.rb +40 -0
- data/spec/other/newgem_spec.rb +24 -0
- data/spec/other/open_spec.rb +35 -0
- data/spec/other/show_spec.rb +82 -0
- data/spec/pack/gems_spec.rb +54 -0
- data/spec/quality_spec.rb +58 -0
- data/spec/resolver/basic_spec.rb +20 -0
- data/spec/resolver/platform_spec.rb +82 -0
- data/spec/runtime/executable_spec.rb +110 -0
- data/spec/runtime/load_spec.rb +107 -0
- data/spec/runtime/platform_spec.rb +90 -0
- data/spec/runtime/require_spec.rb +231 -0
- data/spec/runtime/setup_spec.rb +688 -0
- data/spec/runtime/with_clean_env_spec.rb +15 -0
- data/spec/spec_helper.rb +85 -0
- data/spec/support/artifice/endpoint.rb +50 -0
- data/spec/support/artifice/endpoint_fallback.rb +22 -0
- data/spec/support/artifice/endpoint_marshal_fail.rb +11 -0
- data/spec/support/artifice/endpoint_redirect.rb +11 -0
- data/spec/support/builders.rb +574 -0
- data/spec/support/fakeweb/rack-1.0.0.marshal +2 -0
- data/spec/support/fakeweb/windows.rb +23 -0
- data/spec/support/helpers.rb +246 -0
- data/spec/support/indexes.rb +112 -0
- data/spec/support/matchers.rb +89 -0
- data/spec/support/path.rb +73 -0
- data/spec/support/platforms.rb +53 -0
- data/spec/support/ruby_ext.rb +20 -0
- data/spec/support/rubygems_ext.rb +35 -0
- data/spec/support/rubygems_hax/platform.rb +11 -0
- data/spec/support/sudo.rb +21 -0
- data/spec/update/gems_spec.rb +121 -0
- data/spec/update/git_spec.rb +196 -0
- data/spec/update/source_spec.rb +51 -0
- metadata +294 -0
data/ISSUES.md
ADDED
@@ -0,0 +1,47 @@
|
|
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
|
+
# remove user-specific gems and git repos
|
10
|
+
rm -rf ~/.bundle/ ~/.gem/
|
11
|
+
|
12
|
+
# remove system-wide git repos and git checkouts
|
13
|
+
rm -rf $GEM_HOME/bundler/ $GEM_HOME/cache/bundler/
|
14
|
+
|
15
|
+
# remove project-specific settings and git repos
|
16
|
+
rm -rf .bundle/
|
17
|
+
|
18
|
+
# remove project-specific cached .gem files
|
19
|
+
rm -rf vendor/cache/
|
20
|
+
|
21
|
+
# remove the saved resolve of the Gemfile
|
22
|
+
rm -rf Gemfile.lock
|
23
|
+
|
24
|
+
# try to install one more time
|
25
|
+
bundle install
|
26
|
+
|
27
|
+
## Reporting unresolved problems
|
28
|
+
|
29
|
+
If you are still having problems, please report issues to the [Bundler issue tracker](http://github.com/carlhuda/bundler/issues/).
|
30
|
+
|
31
|
+
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:
|
32
|
+
|
33
|
+
- What version of bundler you are using
|
34
|
+
- What version of Ruby you are using
|
35
|
+
- Whether you are using RVM, and if so what version
|
36
|
+
- Your Gemfile
|
37
|
+
- Your Gemfile.lock
|
38
|
+
- If you are on 0.9, whether you have locked or not
|
39
|
+
- If you are on 1.0, the result of `bundle config`
|
40
|
+
- The command you ran to generate exception(s)
|
41
|
+
- The exception backtrace(s)
|
42
|
+
|
43
|
+
If you are using Rails 2.3, please also include:
|
44
|
+
|
45
|
+
- Your boot.rb file
|
46
|
+
- Your preinitializer.rb file
|
47
|
+
- Your environment.rb file
|
data/LICENSE
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
Portions copyright (c) 2010 Andre Arko
|
2
|
+
Portions copyright (c) 2009 Engine Yard
|
3
|
+
|
4
|
+
MIT License
|
5
|
+
|
6
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
7
|
+
a copy of this software and associated documentation files (the
|
8
|
+
"Software"), to deal in the Software without restriction, including
|
9
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
10
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
11
|
+
permit persons to whom the Software is furnished to do so, subject to
|
12
|
+
the following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be
|
15
|
+
included in all copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
18
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
19
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
20
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
21
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
22
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
23
|
+
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,167 @@
|
|
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
|
+
begin
|
22
|
+
require 'ci/reporter/rake/rspec'
|
23
|
+
|
24
|
+
namespace :ci do
|
25
|
+
desc "Run specs with Hudson output"
|
26
|
+
RSpec::Core::RakeTask.new(:spec)
|
27
|
+
task :spec => ["ci:setup:rspec", "man:build"]
|
28
|
+
end
|
29
|
+
|
30
|
+
rescue LoadError
|
31
|
+
namespace :ci do
|
32
|
+
task :spec do
|
33
|
+
abort "Run `rake ci:deps` to be able to run the CI specs"
|
34
|
+
end
|
35
|
+
|
36
|
+
desc "Install CI dependencies"
|
37
|
+
task :deps do
|
38
|
+
sh "gem list ci_reporter | (grep 'ci_reporter' 1> /dev/null) || gem install ci_reporter --no-ri --no-rdoc"
|
39
|
+
end
|
40
|
+
task :deps => "spec:deps"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
namespace :spec do
|
45
|
+
desc "Run the spec suite with the sudo tests"
|
46
|
+
task :sudo => ["set_sudo", "clean", "spec"]
|
47
|
+
|
48
|
+
task :set_sudo do
|
49
|
+
ENV['BUNDLER_SUDO_TESTS'] = '1'
|
50
|
+
end
|
51
|
+
|
52
|
+
task :clean do
|
53
|
+
if sudo?
|
54
|
+
system "sudo rm -rf #{File.expand_path('../tmp', __FILE__)}"
|
55
|
+
else
|
56
|
+
rm_rf 'tmp'
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
namespace :rubygems do
|
61
|
+
# Rubygems 1.3.5, 1.3.6, and HEAD specs
|
62
|
+
rubyopt = ENV["RUBYOPT"]
|
63
|
+
%w(master v1.3.6 v1.3.7 v1.4.0 v1.4.1 v1.5.0).each do |rg|
|
64
|
+
desc "Run specs with Rubygems #{rg}"
|
65
|
+
RSpec::Core::RakeTask.new(rg) do |t|
|
66
|
+
t.rspec_opts = %w(-fs --color)
|
67
|
+
t.ruby_opts = %w(-w)
|
68
|
+
end
|
69
|
+
|
70
|
+
task "clone_rubygems_#{rg}" do
|
71
|
+
unless File.directory?("tmp/rubygems")
|
72
|
+
system("git clone git://github.com/rubygems/rubygems.git tmp/rubygems")
|
73
|
+
end
|
74
|
+
system("cd tmp/rubygems && git checkout #{rg}")
|
75
|
+
system("git pull") if rg == "master"
|
76
|
+
ENV["RUBYOPT"] = "-I#{File.expand_path("tmp/rubygems/lib")} #{rubyopt}"
|
77
|
+
end
|
78
|
+
|
79
|
+
task rg => "clone_rubygems_#{rg}"
|
80
|
+
task "rubygems:all" => rg
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
namespace :ruby do
|
85
|
+
# Ruby 1.8.6, 1.8.7, and 1.9.2 specs
|
86
|
+
task "ensure_rvm" do
|
87
|
+
raise "RVM is not available" unless File.exist?(File.expand_path("~/.rvm/scripts/rvm"))
|
88
|
+
end
|
89
|
+
|
90
|
+
%w(1.8.6-p399 1.8.7-p302 1.9.2-p0).each do |ruby|
|
91
|
+
ruby_cmd = File.expand_path("~/.rvm/bin/ruby-#{ruby}")
|
92
|
+
|
93
|
+
desc "Run specs on Ruby #{ruby}"
|
94
|
+
RSpec::Core::RakeTask.new(ruby) do |t|
|
95
|
+
t.rspec_opts = %w(-fs --color)
|
96
|
+
t.ruby_opts = %w(-w)
|
97
|
+
end
|
98
|
+
|
99
|
+
task "ensure_ruby_#{ruby}" do
|
100
|
+
raise "Could not find Ruby #{ruby} at #{ruby_cmd}" unless File.exist?(ruby_cmd)
|
101
|
+
end
|
102
|
+
|
103
|
+
task "ensure_ruby_#{ruby}" => "ensure_rvm"
|
104
|
+
task ruby => "ensure_ruby_#{ruby}"
|
105
|
+
task "ruby:all" => ruby
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
end
|
110
|
+
|
111
|
+
rescue LoadError
|
112
|
+
task :spec do
|
113
|
+
abort "Run `rake spec:deps` to be able to run the specs"
|
114
|
+
end
|
115
|
+
|
116
|
+
namespace :spec do
|
117
|
+
desc "Ensure spec dependencies are installed"
|
118
|
+
task :deps do
|
119
|
+
sh "gem list ronn | (grep 'ronn' 1> /dev/null) || gem install ronn --no-ri --no-rdoc"
|
120
|
+
sh "gem list rspec | (grep 'rspec (2.0' 1> /dev/null) || gem install rspec --no-ri --no-rdoc"
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
end
|
125
|
+
|
126
|
+
namespace :man do
|
127
|
+
directory "lib/bundler/man"
|
128
|
+
|
129
|
+
Dir["man/*.ronn"].each do |ronn|
|
130
|
+
basename = File.basename(ronn, ".ronn")
|
131
|
+
roff = "lib/bundler/man/#{basename}"
|
132
|
+
|
133
|
+
file roff => ["lib/bundler/man", ronn] do
|
134
|
+
sh "ronn --roff --pipe #{ronn} > #{roff}"
|
135
|
+
end
|
136
|
+
|
137
|
+
file "#{roff}.txt" => roff do
|
138
|
+
sh "groff -Wall -mtty-char -mandoc -Tascii #{roff} | col -b > #{roff}.txt"
|
139
|
+
end
|
140
|
+
|
141
|
+
task :build_all_pages => "#{roff}.txt"
|
142
|
+
end
|
143
|
+
|
144
|
+
desc "Build the man pages"
|
145
|
+
task :build => "man:build_all_pages"
|
146
|
+
|
147
|
+
desc "Clean up from the built man pages"
|
148
|
+
task :clean do
|
149
|
+
rm_rf "lib/bundler/man"
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
namespace :vendor do
|
154
|
+
desc "Build the vendor dir"
|
155
|
+
task :build => :clean do
|
156
|
+
sh "git clone git://github.com/wycats/thor.git lib/bundler/vendor/tmp"
|
157
|
+
sh "mv lib/bundler/vendor/tmp/lib/* lib/bundler/vendor/"
|
158
|
+
rm_rf "lib/bundler/vendor/tmp"
|
159
|
+
end
|
160
|
+
|
161
|
+
desc "Clean the vendor dir"
|
162
|
+
task :clean do
|
163
|
+
rm_rf "lib/bundler/vendor"
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
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,22 @@
|
|
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.debug e.backtrace.join("\n")
|
17
|
+
exit e.status_code
|
18
|
+
rescue Interrupt => e
|
19
|
+
Bundler.ui.error "\nQuitting..."
|
20
|
+
Bundler.ui.debug e.backtrace.join("\n")
|
21
|
+
exit 1
|
22
|
+
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 = "bundler_package_git"
|
9
|
+
s.version = Bundler::VERSION
|
10
|
+
s.platform = Gem::Platform::RUBY
|
11
|
+
s.authors = ["Carl Lerche", "Yehuda Katz", "André Arko", "Terence Lee"]
|
12
|
+
s.email = ["andrew.nesbitt@forward.co.uk"]
|
13
|
+
s.homepage = "http://gembundler.com"
|
14
|
+
s.summary = %q{Bundler with support for packaging git sources }
|
15
|
+
s.description = %q{Bundler with support for packaging git sources - See https://github.com/carlhuda/bundler/issues/labels/git#issue/67 }
|
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,283 @@
|
|
1
|
+
require 'rbconfig'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'pathname'
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'psych'
|
7
|
+
rescue LoadError
|
8
|
+
end
|
9
|
+
|
10
|
+
require 'yaml'
|
11
|
+
require 'bundler/rubygems_ext'
|
12
|
+
require 'bundler/version'
|
13
|
+
|
14
|
+
module Bundler
|
15
|
+
ORIGINAL_ENV = ENV.to_hash
|
16
|
+
|
17
|
+
autoload :Definition, 'bundler/definition'
|
18
|
+
autoload :Dependency, 'bundler/dependency'
|
19
|
+
autoload :Dsl, 'bundler/dsl'
|
20
|
+
autoload :Environment, 'bundler/environment'
|
21
|
+
autoload :Fetcher, 'bundler/fetcher'
|
22
|
+
autoload :GemHelper, 'bundler/gem_helper'
|
23
|
+
autoload :Graph, 'bundler/graph'
|
24
|
+
autoload :Index, 'bundler/index'
|
25
|
+
autoload :Installer, 'bundler/installer'
|
26
|
+
autoload :LazySpecification, 'bundler/lazy_specification'
|
27
|
+
autoload :LockfileParser, 'bundler/lockfile_parser'
|
28
|
+
autoload :RemoteSpecification, 'bundler/remote_specification'
|
29
|
+
autoload :Resolver, 'bundler/resolver'
|
30
|
+
autoload :Runtime, 'bundler/runtime'
|
31
|
+
autoload :Settings, 'bundler/settings'
|
32
|
+
autoload :SharedHelpers, 'bundler/shared_helpers'
|
33
|
+
autoload :SpecSet, 'bundler/spec_set'
|
34
|
+
autoload :Source, 'bundler/source'
|
35
|
+
autoload :Specification, 'bundler/shared_helpers'
|
36
|
+
autoload :UI, 'bundler/ui'
|
37
|
+
|
38
|
+
class BundlerError < StandardError
|
39
|
+
def self.status_code(code = nil)
|
40
|
+
define_method(:status_code) { code }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
class GemfileNotFound < BundlerError; status_code(10) ; end
|
45
|
+
class GemNotFound < BundlerError; status_code(7) ; end
|
46
|
+
class GemfileError < BundlerError; status_code(4) ; end
|
47
|
+
class PathError < BundlerError; status_code(13) ; end
|
48
|
+
class GitError < BundlerError; status_code(11) ; end
|
49
|
+
class DeprecatedError < BundlerError; status_code(12) ; end
|
50
|
+
class GemspecError < BundlerError; status_code(14) ; end
|
51
|
+
class DslError < BundlerError; status_code(15) ; end
|
52
|
+
class ProductionError < BundlerError; status_code(16) ; end
|
53
|
+
class InvalidOption < DslError ; end
|
54
|
+
class HTTPError < BundlerError; status_code(17) ; end
|
55
|
+
|
56
|
+
|
57
|
+
WINDOWS = RbConfig::CONFIG["host_os"] =~ %r!(msdos|mswin|djgpp|mingw)!
|
58
|
+
FREEBSD = RbConfig::CONFIG["host_os"] =~ /bsd/
|
59
|
+
NULL = WINDOWS ? "NUL" : "/dev/null"
|
60
|
+
|
61
|
+
# Internal errors, should be rescued
|
62
|
+
class VersionConflict < BundlerError
|
63
|
+
attr_reader :conflicts
|
64
|
+
|
65
|
+
def initialize(conflicts, msg = nil)
|
66
|
+
super(msg)
|
67
|
+
@conflicts = conflicts
|
68
|
+
end
|
69
|
+
|
70
|
+
status_code(6)
|
71
|
+
end
|
72
|
+
|
73
|
+
class InvalidSpecSet < StandardError; end
|
74
|
+
|
75
|
+
class << self
|
76
|
+
attr_writer :ui, :bundle_path
|
77
|
+
|
78
|
+
def configure
|
79
|
+
@configured ||= begin
|
80
|
+
configure_gem_home_and_path
|
81
|
+
true
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def ui
|
86
|
+
@ui ||= UI.new
|
87
|
+
end
|
88
|
+
|
89
|
+
def bundle_path
|
90
|
+
# STDERR.puts settings.path
|
91
|
+
@bundle_path ||= Pathname.new(settings.path).expand_path(root)
|
92
|
+
end
|
93
|
+
|
94
|
+
def bin_path
|
95
|
+
@bin_path ||= begin
|
96
|
+
path = settings[:bin] || "bin"
|
97
|
+
path = Pathname.new(path).expand_path(root)
|
98
|
+
FileUtils.mkdir_p(path)
|
99
|
+
Pathname.new(path).expand_path
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
103
|
+
def setup(*groups)
|
104
|
+
# Just return if all groups are already loaded
|
105
|
+
return @setup if defined?(@setup)
|
106
|
+
|
107
|
+
if groups.empty?
|
108
|
+
# Load all groups, but only once
|
109
|
+
@setup = load.setup
|
110
|
+
else
|
111
|
+
@completed_groups ||= []
|
112
|
+
# Figure out which groups haven't been loaded yet
|
113
|
+
unloaded = groups - @completed_groups
|
114
|
+
# Record groups that are now loaded
|
115
|
+
@completed_groups = groups
|
116
|
+
# Load any groups that are not yet loaded
|
117
|
+
unloaded.any? ? load.setup(*unloaded) : load
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def require(*groups)
|
122
|
+
setup(*groups).require(*groups)
|
123
|
+
end
|
124
|
+
|
125
|
+
def load
|
126
|
+
@load ||= Runtime.new(root, definition)
|
127
|
+
end
|
128
|
+
|
129
|
+
def environment
|
130
|
+
Bundler::Environment.new(root, definition)
|
131
|
+
end
|
132
|
+
|
133
|
+
def definition(unlock = nil)
|
134
|
+
@definition = nil if unlock
|
135
|
+
@definition ||= begin
|
136
|
+
configure
|
137
|
+
upgrade_lockfile
|
138
|
+
Definition.build(default_gemfile, default_lockfile, unlock)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
def ruby_scope
|
143
|
+
"#{Gem.ruby_engine}/#{Gem::ConfigMap[:ruby_version]}"
|
144
|
+
end
|
145
|
+
|
146
|
+
def user_bundle_path
|
147
|
+
Pathname.new(Gem.user_home).join(".bundler")
|
148
|
+
end
|
149
|
+
|
150
|
+
def home
|
151
|
+
bundle_path.join("bundler")
|
152
|
+
end
|
153
|
+
|
154
|
+
def install_path
|
155
|
+
home.join("gems")
|
156
|
+
end
|
157
|
+
|
158
|
+
def specs_path
|
159
|
+
bundle_path.join("specifications")
|
160
|
+
end
|
161
|
+
|
162
|
+
def cache
|
163
|
+
bundle_path.join("cache/bundler")
|
164
|
+
end
|
165
|
+
|
166
|
+
def root
|
167
|
+
default_gemfile.dirname.expand_path
|
168
|
+
end
|
169
|
+
|
170
|
+
def app_config_path
|
171
|
+
ENV['BUNDLE_APP_CONFIG'] ?
|
172
|
+
Pathname.new(ENV['BUNDLE_APP_CONFIG']).expand_path(root) :
|
173
|
+
root.join('.bundle')
|
174
|
+
end
|
175
|
+
|
176
|
+
def app_cache
|
177
|
+
root.join("vendor/cache")
|
178
|
+
end
|
179
|
+
|
180
|
+
def tmp
|
181
|
+
user_bundle_path.join("tmp", Process.pid.to_s)
|
182
|
+
end
|
183
|
+
|
184
|
+
def settings
|
185
|
+
@settings ||= Settings.new(app_config_path)
|
186
|
+
end
|
187
|
+
|
188
|
+
def with_clean_env
|
189
|
+
bundled_env = ENV.to_hash
|
190
|
+
ENV.replace(ORIGINAL_ENV)
|
191
|
+
yield
|
192
|
+
ensure
|
193
|
+
ENV.replace(bundled_env.to_hash)
|
194
|
+
end
|
195
|
+
|
196
|
+
def default_gemfile
|
197
|
+
SharedHelpers.default_gemfile
|
198
|
+
end
|
199
|
+
|
200
|
+
def default_lockfile
|
201
|
+
SharedHelpers.default_lockfile
|
202
|
+
end
|
203
|
+
|
204
|
+
def requires_sudo?
|
205
|
+
return @requires_sudo if @checked_for_sudo
|
206
|
+
|
207
|
+
path = bundle_path
|
208
|
+
path = path.parent until path.exist?
|
209
|
+
sudo_present = !(`which sudo` rescue '').empty?
|
210
|
+
|
211
|
+
@checked_for_sudo = true
|
212
|
+
@requires_sudo = settings.allow_sudo? && !File.writable?(path) && sudo_present
|
213
|
+
end
|
214
|
+
|
215
|
+
def mkdir_p(path)
|
216
|
+
if requires_sudo?
|
217
|
+
sudo "mkdir -p '#{path}'" unless File.exist?(path)
|
218
|
+
else
|
219
|
+
FileUtils.mkdir_p(path)
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
def sudo(str)
|
224
|
+
`sudo -p 'Enter your password to install the bundled RubyGems to your system: ' #{str}`
|
225
|
+
end
|
226
|
+
|
227
|
+
def read_file(file)
|
228
|
+
File.open(file, "rb") { |f| f.read }
|
229
|
+
end
|
230
|
+
|
231
|
+
def load_gemspec(file)
|
232
|
+
path = Pathname.new(file)
|
233
|
+
# Eval the gemspec from its parent directory
|
234
|
+
Dir.chdir(path.dirname.to_s) do
|
235
|
+
contents = File.read(path.basename.to_s)
|
236
|
+
begin
|
237
|
+
Gem::Specification.from_yaml(contents)
|
238
|
+
# Raises ArgumentError if the file is not valid YAML
|
239
|
+
rescue ArgumentError, SyntaxError, Gem::EndOfYAMLException, Gem::Exception
|
240
|
+
begin
|
241
|
+
eval(contents, TOPLEVEL_BINDING, path.expand_path.to_s)
|
242
|
+
rescue LoadError => e
|
243
|
+
original_line = e.backtrace.find { |line| line.include?(path.to_s) }
|
244
|
+
msg = "There was a LoadError while evaluating #{path.basename}:\n #{e.message}"
|
245
|
+
msg << " from\n #{original_line}" if original_line
|
246
|
+
msg << "\n"
|
247
|
+
|
248
|
+
if RUBY_VERSION >= "1.9.0"
|
249
|
+
msg << "\nDoes it try to require a relative path? That doesn't work in Ruby 1.9."
|
250
|
+
end
|
251
|
+
|
252
|
+
raise GemspecError, msg
|
253
|
+
end
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
|
258
|
+
private
|
259
|
+
|
260
|
+
def configure_gem_home_and_path
|
261
|
+
if settings[:disable_shared_gems]
|
262
|
+
ENV['GEM_PATH'] = ''
|
263
|
+
ENV['GEM_HOME'] = File.expand_path(bundle_path, root)
|
264
|
+
elsif Gem.dir != bundle_path.to_s
|
265
|
+
paths = [Gem.dir, Gem.path].flatten.compact.uniq.reject{|p| p.empty? }
|
266
|
+
ENV["GEM_PATH"] = paths.join(File::PATH_SEPARATOR)
|
267
|
+
ENV["GEM_HOME"] = bundle_path.to_s
|
268
|
+
end
|
269
|
+
|
270
|
+
FileUtils.mkdir_p bundle_path.to_s
|
271
|
+
Gem.clear_paths
|
272
|
+
end
|
273
|
+
|
274
|
+
def upgrade_lockfile
|
275
|
+
lockfile = default_lockfile
|
276
|
+
if lockfile.exist? && lockfile.read(3) == "---"
|
277
|
+
Bundler.ui.warn "Detected Gemfile.lock generated by 0.9, deleting..."
|
278
|
+
lockfile.rmtree
|
279
|
+
end
|
280
|
+
end
|
281
|
+
|
282
|
+
end
|
283
|
+
end
|