bundler 1.3.0.pre → 1.3.0.pre.2
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/.rspec +2 -0
- data/.travis.yml +13 -10
- data/CHANGELOG.md +15 -0
- data/CONTRIBUTING.md +13 -0
- data/ISSUES.md +8 -2
- data/README.md +12 -16
- data/Rakefile +54 -14
- data/UPGRADING.md +1 -1
- data/lib/bundler.rb +13 -10
- data/lib/bundler/cli.rb +33 -24
- data/lib/bundler/dsl.rb +5 -1
- data/lib/bundler/fetcher.rb +1 -1
- data/lib/bundler/rubygems_integration.rb +5 -0
- data/lib/bundler/runtime.rb +10 -4
- data/lib/bundler/source/git.rb +6 -3
- data/lib/bundler/source/git/git_proxy.rb +4 -2
- data/lib/bundler/source/path.rb +2 -0
- data/lib/bundler/templates/newgem/bin/newgem.tt +1 -1
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +1 -1
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +1 -1
- data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +1 -1
- data/lib/bundler/templates/newgem/test/minitest_helper.rb.tt +1 -1
- data/lib/bundler/ui.rb +4 -0
- data/lib/bundler/version.rb +1 -1
- data/spec/bundler/bundler_spec.rb +39 -9
- data/spec/bundler/dsl_spec.rb +17 -5
- data/spec/bundler/gem_helper_spec.rb +1 -1
- data/spec/cache/git_spec.rb +19 -0
- data/spec/install/gems/dependency_api_spec.rb +26 -4
- data/spec/other/config_spec.rb +12 -0
- data/spec/other/newgem_spec.rb +262 -101
- data/spec/other/show_spec.rb +9 -0
- data/spec/runtime/require_spec.rb +22 -0
- data/spec/runtime/setup_spec.rb +0 -57
- data/spec/support/builders.rb +1 -1
- data/spec/support/helpers.rb +0 -2
- metadata +28 -101
data/.rspec
ADDED
data/.travis.yml
CHANGED
@@ -1,12 +1,6 @@
|
|
1
1
|
language: ruby
|
2
2
|
script: rake spec:travis
|
3
|
-
before_script:
|
4
|
-
- rake --version
|
5
|
-
- gem install rake -v '10.0.2'
|
6
|
-
- gem list rake
|
7
|
-
- rake --version
|
8
|
-
- sudo apt-get install groff -y
|
9
|
-
- rake spec:deps
|
3
|
+
before_script: rake spec:travis:deps
|
10
4
|
notifications:
|
11
5
|
email:
|
12
6
|
- mail@arko.net
|
@@ -17,22 +11,31 @@ notifications:
|
|
17
11
|
channels:
|
18
12
|
- "irc.freenode.org#bundler"
|
19
13
|
rvm:
|
20
|
-
- ruby-head
|
21
|
-
- 2.0.0
|
22
14
|
- 1.9.3
|
23
15
|
- 1.9.2
|
24
16
|
- 1.8.7
|
25
|
-
|
26
17
|
# Rubygems versions MUST be available as rake tasks
|
27
18
|
# see Rakefile:66 for the list of possible RGV values
|
28
19
|
env:
|
20
|
+
# we need to know if changes to rubygems will break bundler on release
|
29
21
|
- RGV=master
|
22
|
+
# test the latest rubygems release with all of our supported rubies
|
30
23
|
- RGV=v1.8.24
|
31
24
|
matrix:
|
32
25
|
allow_failures:
|
26
|
+
# we want to know how we're doing with head, but not fail the build
|
33
27
|
- rvm: ruby-head
|
28
|
+
# until the 2.0 rc, it's okay for failures to crop up
|
29
|
+
- rvm: 2.0.0-preview2
|
30
|
+
# 1.9.2 is simply too slow. it sometimes exceeds the 25m hard limit.
|
34
31
|
- rvm: 1.9.2
|
35
32
|
include:
|
33
|
+
# riding the edge
|
34
|
+
- rvm: ruby-head
|
35
|
+
env: RGV=master
|
36
|
+
# 2.0 release track
|
37
|
+
- rvm: 2.0.0-preview2
|
38
|
+
env: RGV=v2.0.0.preview2
|
36
39
|
# Bundler 1.x supports Rubygems down to 1.5.3 on Ruby 1.9.3
|
37
40
|
- rvm: 1.9.3
|
38
41
|
env: RGV=v1.7.2
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
## 1.3.0.pre.2 (Dec 9, 2012)
|
2
|
+
|
3
|
+
Features:
|
4
|
+
|
5
|
+
- `config` expands local overrides like `local.rack .` (@gkop, #2205)
|
6
|
+
- `gem` generates files correctly for names like `jquery-rails` (@banyan, #2201)
|
7
|
+
- use gems from gists with the :gist option in the Gemfile (@jgaskins)
|
8
|
+
|
9
|
+
Bugfixes:
|
10
|
+
|
11
|
+
- Gemfile sources other than rubygems.org work even when .gemrc contains sources
|
12
|
+
- caching git gems now caches specs, fixing e.g. git ls-files (@bison, #2039)
|
13
|
+
- `show GEM` now warns if the directory has been deleted (@rohit, #2070)
|
14
|
+
- git output hidden when running in --quiet mode (@rohit)
|
15
|
+
|
1
16
|
## 1.3.0.pre (Nov 29, 2012)
|
2
17
|
|
3
18
|
Features:
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Creating Issues
|
2
|
+
|
3
|
+
If you're having a problem, please see [ISSUES](../ISSUES.md) for troubleshooting steps and a guide for how to submit a ticket that will help us solve the problem you are having as quickly as possible.
|
4
|
+
|
5
|
+
# Discussing Bundler
|
6
|
+
|
7
|
+
If you'd like to discuss features, ask questions, or just engage in general Bundler-focused discussion, please see the [#bundler](irc://irc.freenode.net/#bundler) IRC channel on Freenode, and the [Bundler mailing list](http://groups.google.com/ruby-bundler) on Google Groups.
|
8
|
+
|
9
|
+
# Helping Out
|
10
|
+
|
11
|
+
If you'd like to help make Bundler better, you totally rock! Please check out the [CONTRIBUTE](../CONTRIBUTE.md) file for an introduction to the project, guidelines for contributing, and suggestions for things anyone can do that would be helpful.
|
12
|
+
|
13
|
+
Thanks for helping us make Bundler better.
|
data/ISSUES.md
CHANGED
@@ -19,7 +19,7 @@ Please open a ticket with Heroku if you're having trouble deploying. They have a
|
|
19
19
|
After reading the documentation, try these troubleshooting steps:
|
20
20
|
|
21
21
|
# remove user-specific gems and git repos
|
22
|
-
rm -rf ~/.bundle/ ~/.gem/
|
22
|
+
rm -rf ~/.bundle/ ~/.gem/bundler/ ~/.gems/cache/bundler/
|
23
23
|
|
24
24
|
# remove system-wide git repos and git checkouts
|
25
25
|
rm -rf $GEM_HOME/bundler/ $GEM_HOME/cache/bundler/
|
@@ -33,6 +33,10 @@ After reading the documentation, try these troubleshooting steps:
|
|
33
33
|
# remove the saved resolve of the Gemfile
|
34
34
|
rm -rf Gemfile.lock
|
35
35
|
|
36
|
+
# uninstall the rubygems-bundler and open_gem gems
|
37
|
+
rvm gemset use global # if using rvm
|
38
|
+
gem uninstall rubygems-bundler open_gem
|
39
|
+
|
36
40
|
# try to install one more time
|
37
41
|
bundle install
|
38
42
|
|
@@ -49,9 +53,11 @@ The Bundler team needs to know some things in order to diagnose and hopefully fi
|
|
49
53
|
- What version of Ruby you are using (run `ruby -v`)
|
50
54
|
- What version of Rubygems you are using (run `gem -v`)
|
51
55
|
- Whether you are using RVM, and if so what version (run `rvm -v`)
|
52
|
-
- Whether you have the `rubygems-bundler` gem, which can break gem
|
56
|
+
- Whether you have the `rubygems-bundler` gem, which can break gem executables (run `gem list rubygems-bundler`)
|
53
57
|
- Whether you have the `open_gem` gem, which can cause rake activation conflicts (run `gem list open_gem`)
|
54
58
|
|
59
|
+
If you have either `rubygems-bundler` or `open_gem` installed, please try removing them and then following the troublshooting steps above before opening a new ticket.
|
60
|
+
|
55
61
|
If you are using Rails 2.3, please also include:
|
56
62
|
|
57
63
|
- Your boot.rb file
|
data/README.md
CHANGED
@@ -1,16 +1,18 @@
|
|
1
|
-
[![Build Status](https://secure.travis-ci.org/carlhuda/bundler.png?branch=master)](http://travis-ci.org/carlhuda/bundler)
|
1
|
+
# Bundler: a gem to bundle gems [![Build Status](https://secure.travis-ci.org/carlhuda/bundler.png?branch=master)](http://travis-ci.org/carlhuda/bundler)
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
Bundler is a tool that manages gem dependencies for your ruby application. It
|
6
|
-
takes a gem manifest file and is able to fetch, download, and install the gems
|
7
|
-
and all child dependencies specified in this manifest. It can manage any update
|
8
|
-
to the gem manifest file and update the bundle's gems accordingly. It also lets
|
9
|
-
you run any ruby code in context of the bundle's gem environment.
|
3
|
+
Bundler manages the gems that a ruby application depends on. Given a list of gems, it can automatically download and install those gems, as well as any other gems needed by the gems that are listed. Before installing gems, it checks the versions of every gem to make sure that they are compatible, and can all be loaded at the same time. After the gems have been installed, Bundler can help you update some or all of them when new versions become available. Finally, it records the exact versions that have been installed, so that others can install the exact same gems.
|
10
4
|
|
11
5
|
### Installation and usage
|
12
6
|
|
13
|
-
See [gembundler.com](http://gembundler.com) for
|
7
|
+
See [gembundler.com](http://gembundler.com) for installation and usage instructions. tl;dr:
|
8
|
+
|
9
|
+
```
|
10
|
+
gem install bundler
|
11
|
+
bundle init
|
12
|
+
echo "gem 'rails'" >> Gemfile
|
13
|
+
bundle install
|
14
|
+
bundle exec rails new myapp
|
15
|
+
```
|
14
16
|
|
15
17
|
### Troubleshooting
|
16
18
|
|
@@ -20,13 +22,7 @@ For help with common problems, see [ISSUES](https://github.com/carlhuda/bundler/
|
|
20
22
|
|
21
23
|
To see what has changed in recent versions of Bundler, see the [CHANGELOG](https://github.com/carlhuda/bundler/blob/master/CHANGELOG.md).
|
22
24
|
|
23
|
-
The `master` branch contains our current progress towards version 1.3.
|
24
|
-
Please submit pull requests with bugfixes to the stable branch for
|
25
|
-
version you would like to fix.
|
26
|
-
|
27
|
-
### Upgrading from Bundler 0.8 to 0.9 and above
|
28
|
-
|
29
|
-
See [UPGRADING](https://github.com/carlhuda/bundler/blob/master/UPGRADING.md).
|
25
|
+
The `master` branch contains our current progress towards version 1.3. Versions 1.0 to 1.2 each have their own stable branches. Please submit bugfixes as pull requests to the stable branch for the version you would like to fix.
|
30
26
|
|
31
27
|
### Other questions
|
32
28
|
|
data/Rakefile
CHANGED
@@ -1,8 +1,23 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
$:.unshift File.expand_path("../lib", __FILE__)
|
3
|
-
require 'rubygems'
|
4
3
|
require 'bundler/gem_tasks'
|
4
|
+
require 'rubygems'
|
5
5
|
require 'shellwords'
|
6
|
+
require 'benchmark'
|
7
|
+
|
8
|
+
# Benchmark task execution
|
9
|
+
module Rake
|
10
|
+
class Task
|
11
|
+
alias_method :real_invoke, :invoke
|
12
|
+
|
13
|
+
def invoke(*args)
|
14
|
+
time = Benchmark.measure(@name) do
|
15
|
+
real_invoke(*args)
|
16
|
+
end
|
17
|
+
puts "#{@name} ran for #{time}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
6
21
|
|
7
22
|
task :release => ["man:clean", "man:build"]
|
8
23
|
|
@@ -13,16 +28,30 @@ rescue
|
|
13
28
|
false
|
14
29
|
end
|
15
30
|
|
16
|
-
def sudo_task(task)
|
17
|
-
system("sudo -E rake #{task}")
|
18
|
-
end
|
19
|
-
|
20
31
|
namespace :spec do
|
21
32
|
desc "Ensure spec dependencies are installed"
|
22
33
|
task :deps do
|
23
34
|
sh "#{Gem.ruby} -S gem list ronn | (grep 'ronn' 1> /dev/null) || #{Gem.ruby} -S gem install ronn --no-ri --no-rdoc"
|
24
35
|
sh "#{Gem.ruby} -S gem list rspec | (grep 'rspec (2.' 1> /dev/null) || #{Gem.ruby} -S gem install rspec --no-ri --no-rdoc"
|
25
36
|
end
|
37
|
+
|
38
|
+
namespace :travis do
|
39
|
+
task :deps do
|
40
|
+
# Give the travis user a name so that git won't fatally error
|
41
|
+
system("sudo sed -i 's/1000::/1000:Travis:/g' /etc/passwd")
|
42
|
+
# Strip secure_path so that RVM paths transmit through sudo -E
|
43
|
+
system("sudo sed -i '/secure_path/d' /etc/sudoers")
|
44
|
+
# Install groff for the ronn gem
|
45
|
+
system("sudo apt-get install groff -y")
|
46
|
+
# Recompile ruby-head, because the VM version is quite old
|
47
|
+
if ENV['RUBY_VERSION'] == 'ruby-head'
|
48
|
+
system("rvm reinstall ruby-head")
|
49
|
+
system("ruby --version")
|
50
|
+
end
|
51
|
+
# Install the other gem deps, etc.
|
52
|
+
Rake::Task["spec:deps"].invoke
|
53
|
+
end
|
54
|
+
end
|
26
55
|
end
|
27
56
|
|
28
57
|
begin
|
@@ -64,7 +93,7 @@ begin
|
|
64
93
|
namespace :rubygems do
|
65
94
|
# Rubygems specs by version
|
66
95
|
rubyopt = ENV["RUBYOPT"]
|
67
|
-
%w(master v1.3.6 v1.3.7 v1.4.2 v1.5.3 v1.6.2 v1.7.2 v1.8.24
|
96
|
+
%w(master v1.3.6 v1.3.7 v1.4.2 v1.5.3 v1.6.2 v1.7.2 v1.8.24 v2.0.0.preview2).each do |rg|
|
68
97
|
desc "Run specs with Rubygems #{rg}"
|
69
98
|
RSpec::Core::RakeTask.new(rg) do |t|
|
70
99
|
t.rspec_opts = %w(-fs --color)
|
@@ -85,12 +114,15 @@ begin
|
|
85
114
|
|
86
115
|
Dir.chdir("tmp/rubygems") do
|
87
116
|
system("git remote update")
|
88
|
-
|
89
|
-
|
90
|
-
|
117
|
+
if rg == "master"
|
118
|
+
system("git checkout origin/master")
|
119
|
+
else
|
120
|
+
system("git checkout #{rg}")
|
121
|
+
end
|
122
|
+
hash = `git rev-parse HEAD`.chomp
|
91
123
|
end
|
92
124
|
|
93
|
-
puts "
|
125
|
+
puts "Checked out rubygems '#{rg}' at #{hash}"
|
94
126
|
ENV["RUBYOPT"] = "-I#{File.expand_path("tmp/rubygems/lib")} #{rubyopt}"
|
95
127
|
puts "RUBYOPT=#{ENV['RUBYOPT']}"
|
96
128
|
end
|
@@ -115,7 +147,6 @@ begin
|
|
115
147
|
|
116
148
|
desc "Run the tests on Travis CI against a rubygem version (using ENV['RGV'])"
|
117
149
|
task :travis do
|
118
|
-
ENV['TRACE'] = 'true' # print debug info when an exception comes up
|
119
150
|
rg = ENV['RGV'] || 'master'
|
120
151
|
|
121
152
|
puts "\n\e[1;33m[Travis CI] Running bundler specs against rubygems #{rg}\e[m\n\n"
|
@@ -124,16 +155,25 @@ begin
|
|
124
155
|
Rake::Task["spec:rubygems:#{rg}"].reenable
|
125
156
|
|
126
157
|
puts "\n\e[1;33m[Travis CI] Running bundler sudo specs against rubygems #{rg}\e[m\n\n"
|
127
|
-
sudos =
|
128
|
-
|
158
|
+
sudos = system("sudo -E rake spec:rubygems:#{rg}:sudo")
|
159
|
+
# clean up by chowning the newly root-owned tmp directory back to the travis user
|
160
|
+
system("sudo chown -R #{ENV['USER']} #{File.join(File.dirname(__FILE__), 'tmp')}")
|
129
161
|
|
130
162
|
Rake::Task["spec:rubygems:#{rg}"].reenable
|
131
163
|
|
132
164
|
puts "\n\e[1;33m[Travis CI] Running bundler real world specs against rubygems #{rg}\e[m\n\n"
|
133
165
|
realworld = safe_task { Rake::Task["spec:rubygems:#{rg}:realworld"].invoke }
|
134
166
|
|
167
|
+
{"specs" => specs, "sudo" => sudos, "realworld" => realworld}.each do |name, passed|
|
168
|
+
if passed
|
169
|
+
puts "\e[0;32m[Travis CI] #{name} passed\e[m"
|
170
|
+
else
|
171
|
+
puts "\e[0;31m[Travis CI] #{name} failed\e[m"
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
135
175
|
unless specs && sudos && realworld
|
136
|
-
fail "
|
176
|
+
fail "Spec run failed, please review the log for more information"
|
137
177
|
end
|
138
178
|
end
|
139
179
|
end
|
data/UPGRADING.md
CHANGED
@@ -8,7 +8,7 @@ The "env" file that 0.9 created at `.bundle/environment.rb` has been
|
|
8
8
|
removed. As a side effect of this, Passenger will only find your
|
9
9
|
bundled gems if you install with `bundle install --deployment`.
|
10
10
|
Alternatively, you can tell Passenger where you gems are installed,
|
11
|
-
[something like this](http://
|
11
|
+
[something like this](http://andre.arko.net/2010/08/16/using-passengerpane-with-gem_home-set/).
|
12
12
|
|
13
13
|
The `bundle lock` command is no longer needed, as the
|
14
14
|
Gemfile.lock file is now automatically generated by `bundle install`.
|
data/lib/bundler.rb
CHANGED
@@ -288,17 +288,12 @@ module Bundler
|
|
288
288
|
|
289
289
|
def load_gemspec_uncached(file)
|
290
290
|
path = Pathname.new(file)
|
291
|
-
# Eval the gemspec from its parent directory
|
291
|
+
# Eval the gemspec from its parent directory, because some gemspecs
|
292
|
+
# depend on "./" relative paths.
|
292
293
|
Dir.chdir(path.dirname.to_s) do
|
293
|
-
contents =
|
294
|
-
if contents
|
295
|
-
|
296
|
-
Gem::Specification.from_yaml(contents)
|
297
|
-
# Raises ArgumentError if the file is not valid YAML (on syck)
|
298
|
-
# Psych raises a Psych::SyntaxError
|
299
|
-
rescue YamlSyntaxError, ArgumentError, Gem::EndOfYAMLException, Gem::Exception
|
300
|
-
eval_gemspec(path, contents)
|
301
|
-
end
|
294
|
+
contents = path.read
|
295
|
+
if contents[0..2] == "---" # YAML header
|
296
|
+
eval_yaml_gemspec(path, contents)
|
302
297
|
else
|
303
298
|
eval_gemspec(path, contents)
|
304
299
|
end
|
@@ -311,6 +306,14 @@ module Bundler
|
|
311
306
|
|
312
307
|
private
|
313
308
|
|
309
|
+
def eval_yaml_gemspec(path, contents)
|
310
|
+
# If the YAML is invalid, Syck raises an ArgumentError, and Psych
|
311
|
+
# raises a Psych::SyntaxError. See psyched_yaml.rb for more info.
|
312
|
+
Gem::Specification.from_yaml(contents)
|
313
|
+
rescue YamlSyntaxError, ArgumentError, Gem::EndOfYAMLException, Gem::Exception
|
314
|
+
eval_gemspec(path, contents)
|
315
|
+
end
|
316
|
+
|
314
317
|
def eval_gemspec(path, contents)
|
315
318
|
eval(contents, TOPLEVEL_BINDING, path.expand_path.to_s)
|
316
319
|
rescue LoadError, SyntaxError => e
|
data/lib/bundler/cli.rb
CHANGED
@@ -174,9 +174,7 @@ module Bundler
|
|
174
174
|
def install
|
175
175
|
opts = options.dup
|
176
176
|
if opts[:without]
|
177
|
-
opts[:without].map
|
178
|
-
opts[:without].flatten!
|
179
|
-
opts[:without].map!{|g| g.to_sym }
|
177
|
+
opts[:without] = opts[:without].map{|g| g.tr(' ', ':') }
|
180
178
|
end
|
181
179
|
|
182
180
|
# Can't use Bundler.settings for this because settings needs gemfile.dirname
|
@@ -314,7 +312,11 @@ module Bundler
|
|
314
312
|
Bundler.load.lock
|
315
313
|
|
316
314
|
if gem_name
|
317
|
-
|
315
|
+
path_to_gem = locate_gem(gem_name)
|
316
|
+
unless File.directory?(path_to_gem)
|
317
|
+
Bundler.ui.warn "Warning: The following path to #{gem_name} no longer exists."
|
318
|
+
end
|
319
|
+
Bundler.ui.info path_to_gem
|
318
320
|
elsif options[:paths]
|
319
321
|
Bundler.load.specs.sort_by { |s| s.name }.each do |s|
|
320
322
|
Bundler.ui.info locate_gem(s.name)
|
@@ -451,7 +453,7 @@ module Bundler
|
|
451
453
|
|
452
454
|
desc "config NAME [VALUE]", "retrieve or set a configuration value"
|
453
455
|
long_desc <<-D
|
454
|
-
Retrieves or sets a configuration value. If only parameter is provided, retrieve the value. If two parameters are provided, replace the
|
456
|
+
Retrieves or sets a configuration value. If only one parameter is provided, retrieve the value. If two parameters are provided, replace the
|
455
457
|
existing value with the newly provided one.
|
456
458
|
|
457
459
|
By default, setting a configuration value sets it for all projects
|
@@ -520,6 +522,11 @@ module Bundler
|
|
520
522
|
Bundler.ui.info "You are replacing the current local value of #{name}, which is currently #{local.inspect}"
|
521
523
|
end
|
522
524
|
|
525
|
+
if name.match(/\Alocal\./)
|
526
|
+
pathname = Pathname.new(args.join(" "))
|
527
|
+
args = [pathname.expand_path.to_s] if pathname.directory?
|
528
|
+
end
|
529
|
+
|
523
530
|
Bundler.settings.send("set_#{scope}", name, args.join(" "))
|
524
531
|
else
|
525
532
|
Bundler.ui.error "Invalid scope --#{scope} given. Please use --local or --global."
|
@@ -593,6 +600,7 @@ module Bundler
|
|
593
600
|
method_option :test, :type => :string, :default => 'rspec', :aliases => '-t', :banner => "Generate a test directory for your library: 'rspec' is the default, but 'minitest' is also supported."
|
594
601
|
def gem(name)
|
595
602
|
name = name.chomp("/") # remove trailing slash if present
|
603
|
+
namespaced_path = name.tr('-', '/')
|
596
604
|
target = File.join(Dir.pwd, name)
|
597
605
|
constant_name = name.split('_').map{|p| p[0..0].upcase + p[1..-1] }.join
|
598
606
|
constant_name = constant_name.split('-').map{|q| q[0..0].upcase + q[1..-1] }.join('::') if constant_name =~ /-/
|
@@ -601,31 +609,32 @@ module Bundler
|
|
601
609
|
git_user_name = `git config user.name`.chomp
|
602
610
|
git_user_email = `git config user.email`.chomp
|
603
611
|
opts = {
|
604
|
-
:name
|
605
|
-
:
|
606
|
-
:
|
607
|
-
:
|
608
|
-
:
|
612
|
+
:name => name,
|
613
|
+
:namespaced_path => namespaced_path,
|
614
|
+
:constant_name => constant_name,
|
615
|
+
:constant_array => constant_array,
|
616
|
+
:author => git_user_name.empty? ? "TODO: Write your name" : git_user_name,
|
617
|
+
:email => git_user_email.empty? ? "TODO: Write your email address" : git_user_email
|
609
618
|
}
|
610
|
-
template(File.join("newgem/Gemfile.tt"), File.join(target, "Gemfile"),
|
611
|
-
template(File.join("newgem/Rakefile.tt"), File.join(target, "Rakefile"),
|
612
|
-
template(File.join("newgem/LICENSE.txt.tt"), File.join(target, "LICENSE.txt"),
|
613
|
-
template(File.join("newgem/README.md.tt"), File.join(target, "README.md"),
|
614
|
-
template(File.join("newgem/gitignore.tt"), File.join(target, ".gitignore"),
|
615
|
-
template(File.join("newgem/newgem.gemspec.tt"), File.join(target, "#{name}.gemspec"),
|
616
|
-
template(File.join("newgem/lib/newgem.rb.tt"), File.join(target, "lib/#{
|
617
|
-
template(File.join("newgem/lib/newgem/version.rb.tt"), File.join(target, "lib/#{
|
619
|
+
template(File.join("newgem/Gemfile.tt"), File.join(target, "Gemfile"), opts)
|
620
|
+
template(File.join("newgem/Rakefile.tt"), File.join(target, "Rakefile"), opts)
|
621
|
+
template(File.join("newgem/LICENSE.txt.tt"), File.join(target, "LICENSE.txt"), opts)
|
622
|
+
template(File.join("newgem/README.md.tt"), File.join(target, "README.md"), opts)
|
623
|
+
template(File.join("newgem/gitignore.tt"), File.join(target, ".gitignore"), opts)
|
624
|
+
template(File.join("newgem/newgem.gemspec.tt"), File.join(target, "#{name}.gemspec"), opts)
|
625
|
+
template(File.join("newgem/lib/newgem.rb.tt"), File.join(target, "lib/#{namespaced_path}.rb"), opts)
|
626
|
+
template(File.join("newgem/lib/newgem/version.rb.tt"), File.join(target, "lib/#{namespaced_path}/version.rb"), opts)
|
618
627
|
if options[:bin]
|
619
|
-
template(File.join("newgem/bin/newgem.tt"), File.join(target, 'bin', name),
|
628
|
+
template(File.join("newgem/bin/newgem.tt"), File.join(target, 'bin', name), opts)
|
620
629
|
end
|
621
630
|
case options[:test]
|
622
631
|
when 'rspec'
|
623
|
-
template(File.join("newgem/rspec.tt"), File.join(target, ".rspec"),
|
624
|
-
template(File.join("newgem/spec/spec_helper.rb.tt"), File.join(target, "spec/spec_helper.rb"),
|
625
|
-
template(File.join("newgem/spec/newgem_spec.rb.tt"), File.join(target, "spec/#{
|
632
|
+
template(File.join("newgem/rspec.tt"), File.join(target, ".rspec"), opts)
|
633
|
+
template(File.join("newgem/spec/spec_helper.rb.tt"), File.join(target, "spec/spec_helper.rb"), opts)
|
634
|
+
template(File.join("newgem/spec/newgem_spec.rb.tt"), File.join(target, "spec/#{namespaced_path}_spec.rb"), opts)
|
626
635
|
when 'minitest'
|
627
|
-
template(File.join("newgem/test/minitest_helper.rb.tt"), File.join(target, "test/minitest_helper.rb"),
|
628
|
-
template(File.join("newgem/test/test_newgem.rb.tt"), File.join(target, "test/test_#{
|
636
|
+
template(File.join("newgem/test/minitest_helper.rb.tt"), File.join(target, "test/minitest_helper.rb"), opts)
|
637
|
+
template(File.join("newgem/test/test_newgem.rb.tt"), File.join(target, "test/test_#{namespaced_path}.rb"), opts)
|
629
638
|
end
|
630
639
|
Bundler.ui.info "Initializating git repo in #{target}"
|
631
640
|
Dir.chdir(target) { `git init`; `git add .` }
|
data/lib/bundler/dsl.rb
CHANGED
@@ -201,7 +201,7 @@ module Bundler
|
|
201
201
|
def _normalize_options(name, version, opts)
|
202
202
|
_normalize_hash(opts)
|
203
203
|
|
204
|
-
valid_keys = %w(group groups git github path name branch ref tag require submodules platform platforms type)
|
204
|
+
valid_keys = %w(group groups git gist github path name branch ref tag require submodules platform platforms type)
|
205
205
|
invalid_keys = opts.keys - valid_keys
|
206
206
|
if invalid_keys.any?
|
207
207
|
plural = invalid_keys.size > 1
|
@@ -235,6 +235,10 @@ module Bundler
|
|
235
235
|
opts["git"] = "git://github.com/#{github}.git"
|
236
236
|
end
|
237
237
|
|
238
|
+
if gist = opts.delete("gist")
|
239
|
+
opts["git"] = "git://gist.github.com/#{gist}.git"
|
240
|
+
end
|
241
|
+
|
238
242
|
["git", "path"].each do |type|
|
239
243
|
if param = opts[type]
|
240
244
|
if version.first && version.first =~ /^\s*=?\s*(\d[^\s]*)\s*$/
|