bundler 0.9.14 → 0.9.15

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of bundler might be problematic. Click here for more details.

data/CHANGELOG.md CHANGED
@@ -1,3 +1,38 @@
1
+ ## 0.9.15 (April 1, 2010)
2
+
3
+ Features:
4
+
5
+ - Use the env_file if possible instead of doing a runtime resolve
6
+ - Huge speedup when calling Bundler.setup while locked
7
+ - Ensures bundle exec is fast while locked
8
+ - Regenerates env_file if it was generated by an older version
9
+ - Update cached/packed gems when you update gems via bundle install
10
+
11
+ Bugfixes:
12
+
13
+ - Prep for Rubygems 1.3.7 changes
14
+ - Install command now pulls git branches correctly (#211)
15
+ - Raise errors on invalid options in the Gemfile
16
+
17
+ ## 0.9.14 (March 30, 2010)
18
+
19
+ Features:
20
+
21
+ - install command output vastly improved
22
+ - installation message now accurate, with 'using' and 'installing'
23
+ - bundler gems no longer listed as 'system gems'
24
+ - show command output now includes sha and branch name for git gems
25
+ - init command now takes --gemspec option for bootstrapping gem Gemfiles
26
+ - Bundler.with_clean_env for shelling out to ruby scripts
27
+ - show command now aliased as 'list'
28
+ - VISUAL env var respected for GUI editors
29
+
30
+ Bugfixes:
31
+
32
+ - exec command now finds binaries from gems with no gemspec
33
+ - note source of Gemfile resolver errors
34
+ - don't blow up if git urls are changed
35
+
1
36
  ## 0.9.13 (March 23, 2010)
2
37
 
3
38
  Bugfixes:
data/README.md CHANGED
@@ -6,169 +6,11 @@ and all child dependencies specified in this manifest. It can manage any update
6
6
  to the gem manifest file and update the bundle's gems accordingly. It also lets
7
7
  you run any ruby code in context of the bundle's gem environment.
8
8
 
9
- ## Installation
9
+ ## Installation and usage
10
10
 
11
- If you are upgrading from Bundler 0.8, be sure to read the upgrade notes
12
- located at the bottom of this file.
11
+ See [gembundler.com](http://gembundler.com) for up-to-date installation and usage instructions
13
12
 
14
- Bundler has no dependencies besides Ruby and RubyGems. You can install the
15
- latest release via RubyGems:
16
-
17
- gem install bundler
18
-
19
- If you want to contribute, or need a change that hasn't been released yet,
20
- just clone the git repository and install the gem with rake:
21
-
22
- rake install
23
-
24
- ## Usage
25
-
26
- The first thing to do is create a gem manifest file named `Gemfile` at the
27
- root directory of your application. This can quickly be done by running
28
- `bundle init` in the directory that you wish the Gemfile to be created in.
29
-
30
- ### Gemfile
31
-
32
- This is where you specify all of your application's dependencies. The
33
- following is an example. For more information, refer to Bundler::Dsl.
34
-
35
- # Add :gemcutter as a source that Bundler will use to find gems listed
36
- # in the manifest. At least one source should be listed. URLs may also
37
- # be used, such as http://gems.github.com.
38
- #
39
- source :gemcutter
40
-
41
- # Specify a dependency on rails. When bundler downloads gems,
42
- # it will download rails as well as all of rails' dependencies
43
- # (such as activerecord, actionpack, etc...)
44
- #
45
- # At least one dependency must be specified
46
- #
47
- gem "rails"
48
-
49
- # Specify a dependency on rack v.1.0.0. The version is optional.
50
- # If present, it can be specified the same way as with rubygems'
51
- # #gem method.
52
- #
53
- gem "rack", "1.0.0"
54
-
55
- # Add a git repository as a source. Valid options include :branch, :tag,
56
- # and :ref. Next, add any gems that you want from that repo.
57
- #
58
- git "git://github.com/indirect/rails3-generators.git"
59
- gem "rails3-generators"
60
-
61
- ### Groups
62
-
63
- Applications may have dependencies that are specific to certain environments,
64
- such as testing or deployment.
65
-
66
- You can specify groups of gems in the Gemfile using the following syntax:
67
-
68
- gem "nokogiri", :group => :test
69
-
70
- # or
71
-
72
- group :test do
73
- gem "webrat"
74
- end
75
-
76
- Note that Bundler adds all the gems without an explicit group name to the
77
- `:default` group.
78
-
79
- Groups are involved in a number of scenarios:
80
-
81
- 1. When installing gems using bundle install, you can choose to leave
82
- out any group by specifying `--without group1 group2`. This can be
83
- helpful if, for instance, you have a gem that you cannot compile
84
- in certain environments.
85
- 2. When setting up load paths using Bundler.setup, Bundler will, by
86
- default, add the load paths for all groups. You can restrict the
87
- groups to add by doing `Bundler.setup(:group, :names)`. If you do
88
- this, you need to specify the `:default` group if you want it
89
- included.
90
- 3. When auto-requiring files using Bundler.require, Bundler will,
91
- by default, auto-require just the `:default` group. You can specify
92
- a list of groups to auto-require such as
93
- `Bundler.require(:default, :test)`
94
-
95
- ### Installing gems
96
-
97
- Once the Gemfile manifest file has been created, the next step is to install
98
- all the gems needed to satisfy the manifest's dependencies. The command to
99
- do this is `bundle install`.
100
-
101
- This command will load the Gemfile, resolve all the dependencies, download
102
- all gems that are missing, and install them to the bundler's gem repository.
103
- Gems that are already installed into the system RubyGems repository will be
104
- referenced, rather than installed again. Every time an update is made to the
105
- Gemfile, run `bundle install` again to install any newly needed gems.
106
-
107
- If you want to install the gems into the project's folder, like Bundler 0.8
108
- and earlier did, you can run `bundle install vendor`, and the gems will
109
- be installed into the `vendor` subdirectory of your project.
110
-
111
- ### Locking dependencies
112
-
113
- By default, bundler will only ensure that the activated gems satisfy the
114
- Gemfile's dependencies. If you install a newer version of a gem and it
115
- satisfies the dependencies, it will be used instead of the older one.
116
-
117
- The command `bundle lock` will lock the bundle to the current set of
118
- resolved gems. This ensures that, until the lock file is removed,
119
- `bundle install` and `Bundle.setup` will always activate the same gems.
120
-
121
- When you are distributing your application, you should add the Gemfile and
122
- Gemfile.lock files to your source control, so that the set of libraries your
123
- code will run against are fixed. Simply run `bundle install` after checking
124
- out or deploying your code to ensure your libraries are present.
125
-
126
- DO NOT add the .bundle directory to your source control. The files there are
127
- internal to bundler and vary between machines. If you are using git, you can
128
- exclude all machine-specific bundler files by adding a single line to your
129
- .gitignore file containing `.bundle`.
130
-
131
- ### Running the application
132
-
133
- Bundler must be required and setup before anything else is required. This
134
- is because it will configure all the load paths and manage gems for you.
135
- To do this, include the following at the beginning of your code.
136
-
137
- begin
138
- # Try to require the preresolved locked set of gems.
139
- require File.expand_path('../.bundle/environment', __FILE__)
140
- rescue LoadError
141
- # Fall back on doing an unlocked resolve at runtime.
142
- require "rubygems"
143
- require "bundler"
144
- Bundler.setup
145
- end
146
-
147
- # Your application's requires come here, e.g.
148
- # require 'date' # a ruby standard library
149
- # require 'rack' # a bundled gem
150
-
151
- # Alternatively, you can require all the bundled libs at once
152
- # Bundler.require
153
-
154
- The `bundle exec` command provides a way to run arbitrary ruby code in
155
- context of the bundle. For example:
156
-
157
- bundle exec ruby my_ruby_script.rb
158
-
159
- To enter a shell that will run all gem executables (such as `rake`, `rails`,
160
- etc... ) use `bundle exec bash` (replacing bash for whatever your favorite
161
- shell is).
162
-
163
- ### Packing the bundle's gems
164
-
165
- When sharing or deploying an application, you may want to include
166
- everything necessary to install gem dependencies. `bundle package` will
167
- copy .gem files for all of the bundle's dependencies into vendor/cache.
168
- After that, `bundle install` will always work, since it will install the
169
- local .gem files, and will not contact any of the remote sources.
170
-
171
- ## Gem resolution
13
+ ## Gem dependency resolution
172
14
 
173
15
  One of the most important things that the bundler does is do a
174
16
  dependency resolution on the full list of gems that you specify, all
@@ -205,12 +47,6 @@ so it can detect that all gems *together* require activesupport "2.3.4".
205
47
  Upgrading to Bundler 0.9 from Bundler 0.8 requires upgrading several
206
48
  API calls in your Gemfile, and some workarounds if you are using Rails 2.3.
207
49
 
208
- ### Rails 2.3
209
-
210
- Using Bundler 0.9 with Rails 2.3 requires adding a preinitializer, and
211
- making a few changes to boot.rb. A detailed description of the changes
212
- needed can be found in [Bundler 0.9 and Rails 2.3.5](http://andre.arko.net/2010/02/13/using-bundler-09-with-rails-235/).
213
-
214
50
  ### Gemfile Removals
215
51
 
216
52
  Bundler 0.9 removes the following Bundler 0.8 Gemfile APIs:
@@ -278,10 +114,6 @@ Bundler 0.9 changes the following Bundler 0.8 Gemfile APIs:
278
114
 
279
115
  For information about future plans and changes that will happen between now and bundler 1.0, see the [ROADMAP](http://github.com/carlhuda/bundler/blob/master/ROADMAP.md). To see what has changed in each version of bundler, starting with 0.9.5, see the [CHANGELOG](http://github.com/carlhuda/bundler/blob/master/CHANGELOG.md).
280
116
 
281
- ### Usage
282
-
283
- Explanations of common Bundler use cases can be found in [Using Bundler in Real Life](http://yehudakatz.com/2010/02/09/using-bundler-in-real-life/). The general philosophy behind Bundler 0.9 is explained at some length in [Bundler 0.9: Heading Toward 1.0](http://yehudakatz.com/2010/02/01/bundler-0-9-heading-toward-1-0/). Using Bundler with a Rails 2.3.5 app is explained with more detail in [Bundler 0.9 and Rails 2.3.5](http://andre.arko.net/2010/02/13/using-bundler-09-with-rails-235/).
284
-
285
117
  ### Deploying to memory-constrained servers
286
118
 
287
119
  When deploying to a server that is memory-constrained, like Dreamhost, you should run `bundle package` on your local development machine, and then check in the resulting `Gemfile.lock` file and `vendor/cache` directory. The lockfile and cached gems will mean bundler can just install the gems immediately, without contacting any gem servers or using a lot of memory to resolve the dependency tree. On the server, you only need to run `bundle install` after you update your deployed code.
data/bin/bundle CHANGED
@@ -1,3 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
1
3
  # Check if an older version of bundler is installed
2
4
  require 'bundler'
3
5
  $:.each do |path|
data/lib/bundler.rb CHANGED
@@ -2,10 +2,9 @@ require 'fileutils'
2
2
  require 'pathname'
3
3
  require 'yaml'
4
4
  require 'bundler/rubygems_ext'
5
-
5
+ require 'bundler/version'
6
6
 
7
7
  module Bundler
8
- VERSION = "0.9.14"
9
8
  ORIGINAL_ENV = ENV.to_hash
10
9
 
11
10
  autoload :Definition, 'bundler/definition'
@@ -43,6 +42,7 @@ module Bundler
43
42
  class GitError < BundlerError; status_code(11) ; end
44
43
  class DeprecatedMethod < BundlerError; status_code(12) ; end
45
44
  class DeprecatedOption < BundlerError; status_code(12) ; end
45
+ class InvalidOption < BundlerError; status_code(15) ; end
46
46
 
47
47
  class << self
48
48
  attr_writer :ui, :bundle_path
@@ -66,33 +66,39 @@ module Bundler
66
66
  end
67
67
 
68
68
  def setup(*groups)
69
- gemfile = default_gemfile
70
- load(gemfile).setup(*groups)
69
+ load.setup(*groups)
71
70
  end
72
71
 
73
72
  def require(*groups)
74
- gemfile = default_gemfile
75
- load(gemfile).require(*groups)
73
+ load.require(*groups)
74
+ end
75
+
76
+ def load
77
+ if current_env_file?
78
+ SharedHelpers.gem_loaded = true
79
+ Kernel.require env_file
80
+ Bundler
81
+ else
82
+ runtime
83
+ end
76
84
  end
77
85
 
78
- def load(gemfile = default_gemfile)
79
- root = Pathname.new(gemfile).dirname
80
- Runtime.new root, definition(gemfile)
86
+ def runtime
87
+ Runtime.new(root, definition)
81
88
  end
82
89
 
83
- def definition(gemfile = default_gemfile)
90
+ def definition
84
91
  configure
85
- root = Pathname.new(gemfile).dirname
86
92
  lockfile = root.join("Gemfile.lock")
87
93
  if lockfile.exist?
88
94
  Definition.from_lock(lockfile)
89
95
  else
90
- Definition.from_gemfile(gemfile)
96
+ Definition.from_gemfile(default_gemfile)
91
97
  end
92
98
  end
93
99
 
94
100
  def home
95
- Pathname.new(bundle_path).join("bundler")
101
+ bundle_path.join("bundler")
96
102
  end
97
103
 
98
104
  def install_path
@@ -115,6 +121,10 @@ module Bundler
115
121
  @settings ||= Settings.new(root)
116
122
  end
117
123
 
124
+ def env_file
125
+ SharedHelpers.env_file
126
+ end
127
+
118
128
  def with_clean_env
119
129
  bundled_env = ENV.to_hash
120
130
  ENV.replace(ORIGINAL_ENV)
@@ -141,5 +151,9 @@ module Bundler
141
151
 
142
152
  Gem.clear_paths
143
153
  end
154
+
155
+ def current_env_file?
156
+ env_file.exist? && (env_file.read(100) =~ /Bundler #{Bundler::VERSION}/)
157
+ end
144
158
  end
145
159
  end
data/lib/bundler/cli.rb CHANGED
@@ -88,6 +88,7 @@ module Bundler
88
88
  Installer.install(Bundler.root, Bundler.definition, opts)
89
89
 
90
90
  lock if options[:relock]
91
+ cache if Bundler.root.join("vendor/cache").exist?
91
92
  rescue GemNotFound => e
92
93
  if Bundler.definition.sources.empty?
93
94
  Bundler.ui.warn "Your Gemfile doesn't have any sources. You can add one with a line like 'source :gemcutter'"
@@ -136,8 +137,7 @@ module Bundler
136
137
 
137
138
  desc "cache", "Cache all the gems to vendor/cache"
138
139
  def cache
139
- environment = Bundler.load
140
- environment.cache
140
+ Bundler.runtime.cache
141
141
  rescue GemNotFound => e
142
142
  Bundler.ui.error(e.message)
143
143
  Bundler.ui.info "Run `bundle install` to install missing gems."
@@ -164,14 +164,9 @@ module Bundler
164
164
  ENV['BUNDLE_GEMFILE'] = Bundler::SharedHelpers.default_gemfile.to_s
165
165
 
166
166
  # Set RUBYOPT
167
- locked_env = Bundler.root.join(".bundle/environment.rb")
168
167
  rubyopt = [ENV["RUBYOPT"]].compact
169
- if locked_env.exist?
170
- rubyopt.unshift "-r#{locked_env.to_s}"
171
- else
172
- rubyopt.unshift "-rbundler/setup"
173
- rubyopt.unshift "-I#{File.expand_path('../..', __FILE__)}"
174
- end
168
+ rubyopt.unshift "-rbundler/setup"
169
+ rubyopt.unshift "-I#{File.expand_path('../..', __FILE__)}"
175
170
  ENV["RUBYOPT"] = rubyopt.join(' ')
176
171
 
177
172
  # Run
data/lib/bundler/dsl.rb CHANGED
@@ -98,6 +98,14 @@ module Bundler
98
98
  def _normalize_options(name, version, opts)
99
99
  _normalize_hash(opts)
100
100
 
101
+ invalid_keys = opts.keys - %w(group git path name branch ref tag require)
102
+ if invalid_keys.any?
103
+ plural = invalid_keys.size > 1
104
+ raise InvalidOption, "You passed #{invalid_keys.join(", ")} " \
105
+ "#{plural ? 'as options, but they are' : 'as an option, but it is'}" \
106
+ " invalid"
107
+ end
108
+
101
109
  group = opts.delete("group") || @group
102
110
 
103
111
  # Normalize git and path options
@@ -79,16 +79,12 @@ module Bundler
79
79
  shared_helpers = File.read(File.expand_path("../shared_helpers.rb", __FILE__))
80
80
  template = File.read(File.expand_path("../templates/environment.erb", __FILE__))
81
81
  erb = ERB.new(template, nil, '-')
82
- FileUtils.mkdir_p(rb_lock_file.dirname)
83
- File.open(rb_lock_file, 'w') do |f|
82
+ Bundler.env_file.dirname.mkpath
83
+ File.open(Bundler.env_file, 'w') do |f|
84
84
  f.puts erb.result(binding)
85
85
  end
86
86
  end
87
87
 
88
- def rb_lock_file
89
- root.join(".bundle/environment.rb")
90
- end
91
-
92
88
  def gemfile_fingerprint
93
89
  Digest::SHA1.hexdigest(File.read("#{root}/Gemfile"))
94
90
  end
@@ -54,10 +54,8 @@ module Gem
54
54
  class Dependency
55
55
  attr_accessor :source, :groups
56
56
 
57
- alias :to_yaml_properties_before_crazy to_yaml_properties
58
-
59
57
  def to_yaml_properties
60
- to_yaml_properties_before_crazy.reject { |p| ["@source", "@groups"].include?(p.to_s) }
58
+ instance_variables.reject { |p| ["@source", "@groups"].include?(p.to_s) }
61
59
  end
62
60
  end
63
61
  end
data/lib/bundler/setup.rb CHANGED
@@ -1,9 +1,14 @@
1
1
  # This is not actually required by the actual library
2
+ # loads the bundled environment
2
3
  require 'bundler/shared_helpers'
3
4
 
4
5
  if Bundler::SharedHelpers.in_bundle?
5
- require 'rubygems'
6
- require 'bundler'
7
-
8
- Bundler.setup
6
+ env_file = Bundler::SharedHelpers.env_file
7
+ if env_file.exist?
8
+ require env_file
9
+ else
10
+ require 'rubygems'
11
+ require 'bundler'
12
+ Bundler.setup
13
+ end
9
14
  end
@@ -1,3 +1,5 @@
1
+ require 'pathname'
2
+
1
3
  module Gem
2
4
  class Dependency
3
5
  if !instance_methods.map { |m| m.to_s }.include?("requirement")
@@ -10,6 +12,7 @@ end
10
12
 
11
13
  module Bundler
12
14
  module SharedHelpers
15
+ attr_accessor :gem_loaded
13
16
 
14
17
  def default_gemfile
15
18
  gemfile = find_gemfile
@@ -21,6 +24,10 @@ module Bundler
21
24
  find_gemfile
22
25
  end
23
26
 
27
+ def env_file
28
+ default_gemfile.dirname.join(".bundle/environment.rb")
29
+ end
30
+
24
31
  private
25
32
 
26
33
  def find_gemfile
@@ -267,8 +267,8 @@ module Bundler
267
267
 
268
268
  def initialize(options)
269
269
  super
270
- @uri = options["uri"]
271
- @ref = options["ref"] || options["branch"] || options["tag"] || 'master'
270
+ @uri = options["uri"]
271
+ @ref = options["ref"] || options["branch"] || options["tag"] || 'master'
272
272
  end
273
273
 
274
274
  def to_s
@@ -344,7 +344,7 @@ module Bundler
344
344
  def cache
345
345
  if cached?
346
346
  Bundler.ui.info "Updating #{uri}"
347
- in_cache { git %|fetch --quiet "#{uri}" master:master| }
347
+ in_cache { git %|fetch --quiet "#{uri}" refs/heads/*:refs/heads/*| }
348
348
  else
349
349
  Bundler.ui.info "Fetching #{uri}"
350
350
  FileUtils.mkdir_p(cache_path.dirname)
@@ -1,8 +1,8 @@
1
1
  # DO NOT MODIFY THIS FILE
2
+ # Generated by Bundler <%= Bundler::VERSION %>
2
3
 
3
4
  require 'digest/sha1'
4
5
  require 'rubygems'
5
-
6
6
  <%= shared_helpers %>
7
7
 
8
8
  module Bundler
@@ -70,6 +70,6 @@ module Bundler
70
70
  end
71
71
  end
72
72
 
73
- # Setup bundle when it's required.
74
- setup
73
+ # Set up load paths unless this file is being loaded after the Bundler gem
74
+ setup unless gem_loaded
75
75
  end
@@ -0,0 +1,3 @@
1
+ module Bundler
2
+ VERSION = "0.9.15"
3
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 9
8
- - 14
9
- version: 0.9.14
8
+ - 15
9
+ version: 0.9.15
10
10
  platform: ruby
11
11
  authors:
12
12
  - Carl Lerche
@@ -16,12 +16,10 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2010-03-30 00:00:00 -07:00
19
+ date: 2010-04-02 00:00:00 -07:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
- name: rspec
24
- prerelease: false
25
23
  requirement: &id001 !ruby/object:Gem::Requirement
26
24
  requirements:
27
25
  - - ">="
@@ -29,9 +27,11 @@ dependencies:
29
27
  segments:
30
28
  - 0
31
29
  version: "0"
30
+ prerelease: false
32
31
  type: :development
32
+ name: rspec
33
33
  version_requirements: *id001
34
- description:
34
+ description: Bundler manages an application's dependencies through its entire life, across many machines, systematically and repeatably
35
35
  email:
36
36
  - carlhuda@engineyard.com
37
37
  executables:
@@ -80,6 +80,7 @@ files:
80
80
  - lib/bundler/vendor/thor/util.rb
81
81
  - lib/bundler/vendor/thor/version.rb
82
82
  - lib/bundler/vendor/thor.rb
83
+ - lib/bundler/version.rb
83
84
  - lib/bundler.rb
84
85
  - LICENSE
85
86
  - README.md
@@ -112,10 +113,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
113
  version: 1.3.6
113
114
  requirements: []
114
115
 
115
- rubyforge_project:
116
+ rubyforge_project: bundler
116
117
  rubygems_version: 1.3.6
117
118
  signing_key:
118
119
  specification_version: 3
119
- summary: Bundles are fun
120
+ summary: The best way to manage your application's dependencies
120
121
  test_files: []
121
122