honkster-bundler 1.1.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +14 -0
- data/CHANGELOG.md +547 -0
- data/ISSUES.md +32 -0
- data/LICENSE +20 -0
- data/README.md +29 -0
- data/Rakefile +150 -0
- data/UPGRADING.md +103 -0
- data/bin/bundle +21 -0
- data/bundler.gemspec +30 -0
- data/lib/bundler.rb +268 -0
- data/lib/bundler/capistrano.rb +11 -0
- data/lib/bundler/cli.rb +515 -0
- data/lib/bundler/definition.rb +427 -0
- data/lib/bundler/dependency.rb +114 -0
- data/lib/bundler/deployment.rb +37 -0
- data/lib/bundler/dsl.rb +245 -0
- data/lib/bundler/environment.rb +47 -0
- data/lib/bundler/gem_helper.rb +145 -0
- data/lib/bundler/graph.rb +130 -0
- data/lib/bundler/index.rb +114 -0
- data/lib/bundler/installer.rb +84 -0
- data/lib/bundler/lazy_specification.rb +71 -0
- data/lib/bundler/lockfile_parser.rb +108 -0
- data/lib/bundler/remote_specification.rb +59 -0
- data/lib/bundler/resolver.rb +454 -0
- data/lib/bundler/rubygems_ext.rb +203 -0
- data/lib/bundler/runtime.rb +148 -0
- data/lib/bundler/settings.rb +117 -0
- data/lib/bundler/setup.rb +15 -0
- data/lib/bundler/shared_helpers.rb +151 -0
- data/lib/bundler/source.rb +662 -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 +3 -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 +60 -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 +98 -0
- data/man/bundle-install.ronn +310 -0
- data/man/bundle-package.ronn +59 -0
- data/man/bundle-update.ronn +176 -0
- data/man/bundle.ronn +77 -0
- data/man/gemfile.5.ronn +273 -0
- data/man/index.txt +6 -0
- data/spec/cache/gems_spec.rb +205 -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 +43 -0
- data/spec/install/gems/c_ext_spec.rb +48 -0
- data/spec/install/gems/env_spec.rb +107 -0
- data/spec/install/gems/flex_spec.rb +272 -0
- data/spec/install/gems/groups_spec.rb +228 -0
- data/spec/install/gems/packed_spec.rb +72 -0
- data/spec/install/gems/platform_spec.rb +195 -0
- data/spec/install/gems/resolving_spec.rb +72 -0
- data/spec/install/gems/simple_case_spec.rb +749 -0
- data/spec/install/gems/sudo_spec.rb +77 -0
- data/spec/install/gems/win32_spec.rb +26 -0
- data/spec/install/gemspec_spec.rb +96 -0
- data/spec/install/git_spec.rb +553 -0
- data/spec/install/invalid_spec.rb +17 -0
- data/spec/install/path_spec.rb +329 -0
- data/spec/install/upgrade_spec.rb +26 -0
- data/spec/lock/flex_spec.rb +650 -0
- data/spec/lock/git_spec.rb +35 -0
- data/spec/other/check_spec.rb +221 -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 +126 -0
- data/spec/other/help_spec.rb +36 -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 +22 -0
- data/spec/quality_spec.rb +55 -0
- data/spec/resolver/basic_spec.rb +20 -0
- data/spec/resolver/platform_spec.rb +57 -0
- data/spec/runtime/environment_rb_spec.rb +162 -0
- data/spec/runtime/executable_spec.rb +110 -0
- data/spec/runtime/load_spec.rb +102 -0
- data/spec/runtime/platform_spec.rb +90 -0
- data/spec/runtime/require_spec.rb +231 -0
- data/spec/runtime/setup_spec.rb +412 -0
- data/spec/runtime/with_clean_env_spec.rb +15 -0
- data/spec/spec_helper.rb +82 -0
- data/spec/support/builders.rb +566 -0
- data/spec/support/helpers.rb +243 -0
- data/spec/support/indexes.rb +113 -0
- data/spec/support/matchers.rb +89 -0
- data/spec/support/path.rb +71 -0
- data/spec/support/platforms.rb +49 -0
- data/spec/support/ruby_ext.rb +19 -0
- data/spec/support/rubygems_ext.rb +30 -0
- data/spec/support/rubygems_hax/rubygems_plugin.rb +9 -0
- data/spec/support/sudo.rb +21 -0
- data/spec/update/gems_spec.rb +112 -0
- data/spec/update/git_spec.rb +159 -0
- data/spec/update/source_spec.rb +50 -0
- metadata +251 -0
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Gem::Specification#match_platform" do
|
4
|
+
it "works" do
|
5
|
+
darwin = gem "lol", "1.0", "platform_specific-1.0-x86-darwin-10"
|
6
|
+
darwin.match_platform(pl('java')).should be_false
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
describe "Bundler::GemHelpers#generic" do
|
11
|
+
include Bundler::GemHelpers
|
12
|
+
|
13
|
+
it "works" do
|
14
|
+
generic(pl('x86-darwin-10')).should == pl('ruby')
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,126 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require 'bundler/gem_helper'
|
3
|
+
|
4
|
+
describe "Bundler::GemHelper tasks" do
|
5
|
+
context "determining gemspec" do
|
6
|
+
it "interpolates the name when there is only one gemspec" do
|
7
|
+
bundle 'gem test'
|
8
|
+
app = bundled_app("test")
|
9
|
+
helper = Bundler::GemHelper.new(app.to_s)
|
10
|
+
helper.gemspec.name.should == 'test'
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should fail when there is no gemspec" do
|
14
|
+
bundle 'gem test'
|
15
|
+
app = bundled_app("test")
|
16
|
+
FileUtils.rm(File.join(app.to_s, 'test.gemspec'))
|
17
|
+
proc { Bundler::GemHelper.new(app.to_s) }.should raise_error(/Unable to determine name/)
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should fail when there are two gemspecs and the name isn't specified" do
|
21
|
+
bundle 'gem test'
|
22
|
+
app = bundled_app("test")
|
23
|
+
File.open(File.join(app.to_s, 'test2.gemspec'), 'w') {|f| f << ''}
|
24
|
+
proc { Bundler::GemHelper.new(app.to_s) }.should raise_error(/Unable to determine name/)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
context "gem management" do
|
29
|
+
def mock_confirm_message(message)
|
30
|
+
Bundler.ui.should_receive(:confirm).with(message)
|
31
|
+
end
|
32
|
+
|
33
|
+
def mock_build_message
|
34
|
+
mock_confirm_message "test 0.0.1 built to pkg/test-0.0.1.gem"
|
35
|
+
end
|
36
|
+
|
37
|
+
before(:each) do
|
38
|
+
bundle 'gem test'
|
39
|
+
@app = bundled_app("test")
|
40
|
+
@gemspec = File.read("#{@app.to_s}/test.gemspec")
|
41
|
+
File.open("#{@app.to_s}/test.gemspec", 'w'){|f| f << @gemspec.gsub('TODO: ', '') }
|
42
|
+
@helper = Bundler::GemHelper.new(@app.to_s)
|
43
|
+
end
|
44
|
+
|
45
|
+
it "uses a shell UI for output" do
|
46
|
+
Bundler.ui.should be_a(Bundler::UI::Shell)
|
47
|
+
end
|
48
|
+
|
49
|
+
describe 'build' do
|
50
|
+
it "builds" do
|
51
|
+
mock_build_message
|
52
|
+
@helper.build_gem
|
53
|
+
bundled_app('test/pkg/test-0.0.1.gem').should exist
|
54
|
+
end
|
55
|
+
|
56
|
+
it "raises an appropriate error when the build fails" do
|
57
|
+
# break the gemspec by adding back the TODOs...
|
58
|
+
File.open("#{@app.to_s}/test.gemspec", 'w'){|f| f << @gemspec }
|
59
|
+
proc { @helper.build_gem }.should raise_error(/TODO/)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe 'install' do
|
64
|
+
it "installs" do
|
65
|
+
mock_build_message
|
66
|
+
mock_confirm_message "test (0.0.1) installed"
|
67
|
+
@helper.install_gem
|
68
|
+
bundled_app('test/pkg/test-0.0.1.gem').should exist
|
69
|
+
%x{gem list}.should include("test (0.0.1)")
|
70
|
+
end
|
71
|
+
|
72
|
+
it "raises an appropriate error when the install fails" do
|
73
|
+
@helper.should_receive(:build_gem) do
|
74
|
+
# write an invalid gem file, so we can simulate install failure...
|
75
|
+
FileUtils.mkdir_p(File.join(@app.to_s, 'pkg'))
|
76
|
+
File.open("#{@app.to_s}/pkg/test-0.0.1.gem", 'w'){|f| f << "not actually a gem"}
|
77
|
+
end
|
78
|
+
proc { @helper.install_gem }.should raise_error
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe 'release' do
|
83
|
+
it "shouldn't push if there are uncommitted files" do
|
84
|
+
proc { @helper.release_gem }.should raise_error(/files that need to be committed/)
|
85
|
+
end
|
86
|
+
|
87
|
+
it 'raises an appropriate error if there is no git remote' do
|
88
|
+
Bundler.ui.stub(:confirm => nil, :error => nil) # silence messages
|
89
|
+
|
90
|
+
Dir.chdir(gem_repo1) {
|
91
|
+
`git init --bare`
|
92
|
+
}
|
93
|
+
Dir.chdir(@app) {
|
94
|
+
`git init`
|
95
|
+
`git config user.email "you@example.com"`
|
96
|
+
`git config user.name "name"`
|
97
|
+
`git commit -a -m "initial commit"`
|
98
|
+
}
|
99
|
+
|
100
|
+
proc { @helper.release_gem }.should raise_error
|
101
|
+
end
|
102
|
+
|
103
|
+
it "releases" do
|
104
|
+
mock_build_message
|
105
|
+
mock_confirm_message /Tagged v0.0.1/
|
106
|
+
mock_confirm_message "Pushed git commits and tags"
|
107
|
+
|
108
|
+
@helper.should_receive(:rubygem_push).with(bundled_app('test/pkg/test-0.0.1.gem').to_s)
|
109
|
+
|
110
|
+
Dir.chdir(gem_repo1) {
|
111
|
+
`git init --bare`
|
112
|
+
}
|
113
|
+
Dir.chdir(@app) {
|
114
|
+
`git init`
|
115
|
+
`git config user.email "you@example.com"`
|
116
|
+
`git config user.name "name"`
|
117
|
+
`git remote add origin file://#{gem_repo1}`
|
118
|
+
`git commit -a -m "initial commit"`
|
119
|
+
Open3.popen3("git push origin master") # use popen3 to silence output...
|
120
|
+
`git commit -a -m "another commit"`
|
121
|
+
}
|
122
|
+
@helper.release_gem
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle help" do
|
4
|
+
it "complains if older versions of bundler are installed" do
|
5
|
+
system_gems "bundler-0.8.1"
|
6
|
+
|
7
|
+
bundle "help", :expect_err => true
|
8
|
+
err.should == "Please remove older versions of bundler. This can be done by running `gem cleanup bundler`."
|
9
|
+
end
|
10
|
+
|
11
|
+
it "uses groff when available" do
|
12
|
+
fake_groff!
|
13
|
+
|
14
|
+
bundle "help gemfile"
|
15
|
+
out.should == %|["-Wall", "-mtty-char", "-mandoc", "-Tascii", "#{root}/lib/bundler/man/gemfile.5"]|
|
16
|
+
end
|
17
|
+
|
18
|
+
it "prefixes bundle commands with bundle- when finding the groff files" do
|
19
|
+
fake_groff!
|
20
|
+
|
21
|
+
bundle "help install"
|
22
|
+
out.should == %|["-Wall", "-mtty-char", "-mandoc", "-Tascii", "#{root}/lib/bundler/man/bundle-install"]|
|
23
|
+
end
|
24
|
+
|
25
|
+
it "simply outputs the txt file when there is no groff on the path" do
|
26
|
+
kill_path!
|
27
|
+
|
28
|
+
bundle "help install"
|
29
|
+
out.should =~ /BUNDLE-INSTALL/
|
30
|
+
end
|
31
|
+
|
32
|
+
it "still outputs the old help for commands that do not have man pages yet" do
|
33
|
+
bundle "help check"
|
34
|
+
out.should include("Check searches the local machine")
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle init" do
|
4
|
+
it "generates a Gemfile" do
|
5
|
+
bundle :init
|
6
|
+
bundled_app("Gemfile").should exist
|
7
|
+
end
|
8
|
+
|
9
|
+
it "does not change existing Gemfiles" do
|
10
|
+
gemfile <<-G
|
11
|
+
gem "rails"
|
12
|
+
G
|
13
|
+
|
14
|
+
lambda {
|
15
|
+
bundle :init
|
16
|
+
}.should_not change { File.read(bundled_app("Gemfile")) }
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should generate from an existing gemspec" do
|
20
|
+
spec_file = tmp.join('test.gemspec')
|
21
|
+
File.open(spec_file, 'w') do |file|
|
22
|
+
file << <<-S
|
23
|
+
Gem::Specification.new do |s|
|
24
|
+
s.name = 'test'
|
25
|
+
s.add_dependency 'rack', '= 1.0.1'
|
26
|
+
s.add_development_dependency 'rspec', '1.2'
|
27
|
+
end
|
28
|
+
S
|
29
|
+
end
|
30
|
+
|
31
|
+
bundle :init, :gemspec => spec_file
|
32
|
+
|
33
|
+
gemfile = bundled_app("Gemfile").read
|
34
|
+
gemfile.should =~ /source :gemcutter/
|
35
|
+
gemfile.scan(/gem "rack", "= 1.0.1"/).size.should == 1
|
36
|
+
gemfile.scan(/gem "rspec", "= 1.2"/).size.should == 1
|
37
|
+
gemfile.scan(/group :development/).size.should == 1
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle gem" do
|
4
|
+
before :each do
|
5
|
+
bundle 'gem test-gem'
|
6
|
+
end
|
7
|
+
|
8
|
+
it "generates a gem skeleton" do
|
9
|
+
bundled_app("test-gem/test-gem.gemspec").should exist
|
10
|
+
bundled_app("test-gem/Gemfile").should exist
|
11
|
+
bundled_app("test-gem/Rakefile").should exist
|
12
|
+
bundled_app("test-gem/lib/test-gem.rb").should exist
|
13
|
+
bundled_app("test-gem/lib/test-gem/version.rb").should exist
|
14
|
+
end
|
15
|
+
|
16
|
+
it "starts with version 0.0.1" do
|
17
|
+
bundled_app("test-gem/lib/test-gem/version.rb").read.should =~ /VERSION = "0.0.1"/
|
18
|
+
end
|
19
|
+
|
20
|
+
it "nests constants so they work" do
|
21
|
+
bundled_app("test-gem/lib/test-gem/version.rb").read.should =~ /module Test\n module Gem/
|
22
|
+
bundled_app("test-gem/lib/test-gem.rb").read.should =~ /module Test\n module Gem/
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle open" do
|
4
|
+
before :each do
|
5
|
+
install_gemfile <<-G
|
6
|
+
source "file://#{gem_repo1}"
|
7
|
+
gem "rails"
|
8
|
+
G
|
9
|
+
end
|
10
|
+
|
11
|
+
it "opens the gem with BUNDLER_EDITOR as highest priority" do
|
12
|
+
bundle "open rails", :env => {"EDITOR" => "echo editor", "VISUAL" => "echo visual", "BUNDLER_EDITOR" => "echo bundler_editor"}
|
13
|
+
out.should == "bundler_editor #{default_bundle_path('gems', 'rails-2.3.2')}"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "opens the gem with VISUAL as 2nd highest priority" do
|
17
|
+
bundle "open rails", :env => {"EDITOR" => "echo editor", "VISUAL" => "echo visual", "BUNDLER_EDITOR" => ""}
|
18
|
+
out.should == "visual #{default_bundle_path('gems', 'rails-2.3.2')}"
|
19
|
+
end
|
20
|
+
|
21
|
+
it "opens the gem with EDITOR as 3rd highest priority" do
|
22
|
+
bundle "open rails", :env => {"EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => ""}
|
23
|
+
out.should == "editor #{default_bundle_path('gems', 'rails-2.3.2')}"
|
24
|
+
end
|
25
|
+
|
26
|
+
it "complains if no EDITOR is set" do
|
27
|
+
bundle "open rails", :env => {"EDITOR" => "", "VISUAL" => "", "BUNDLER_EDITOR" => ""}
|
28
|
+
out.should == "To open a bundled gem, set $EDITOR or $BUNDLER_EDITOR"
|
29
|
+
end
|
30
|
+
|
31
|
+
it "complains if gem not in bundle" do
|
32
|
+
bundle "open missing", :env => {"EDITOR" => "echo editor", "VISUAL" => "", "BUNDLER_EDITOR" => ""}
|
33
|
+
out.should match(/could not find gem 'missing'/i)
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,82 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle show" do
|
4
|
+
before :each do
|
5
|
+
install_gemfile <<-G
|
6
|
+
source "file://#{gem_repo1}"
|
7
|
+
gem "rails"
|
8
|
+
G
|
9
|
+
end
|
10
|
+
|
11
|
+
it "creates a Gemfile.lock if one did not exist" do
|
12
|
+
FileUtils.rm("Gemfile.lock")
|
13
|
+
|
14
|
+
bundle "show"
|
15
|
+
|
16
|
+
bundled_app("Gemfile.lock").should exist
|
17
|
+
end
|
18
|
+
|
19
|
+
it "creates a Gemfile.lock if one did not exist and we're doing bundle show rails" do
|
20
|
+
FileUtils.rm("Gemfile.lock")
|
21
|
+
|
22
|
+
bundle "show rails"
|
23
|
+
|
24
|
+
bundled_app("Gemfile.lock").should exist
|
25
|
+
end
|
26
|
+
|
27
|
+
it "prints path if gem exists in bundle" do
|
28
|
+
bundle "show rails"
|
29
|
+
out.should == default_bundle_path('gems', 'rails-2.3.2').to_s
|
30
|
+
end
|
31
|
+
|
32
|
+
it "prints the path to the running bundler" do
|
33
|
+
bundle "show bundler"
|
34
|
+
out.should == File.expand_path('../../../', __FILE__)
|
35
|
+
end
|
36
|
+
|
37
|
+
it "complains if gem not in bundle" do
|
38
|
+
bundle "show missing"
|
39
|
+
out.should =~ /could not find gem 'missing'/i
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
describe "bundle show with a git repo" do
|
44
|
+
before :each do
|
45
|
+
@git = build_git "foo", "1.0"
|
46
|
+
end
|
47
|
+
|
48
|
+
it "prints out git info" do
|
49
|
+
install_gemfile <<-G
|
50
|
+
gem "foo", :git => "#{lib_path('foo-1.0')}"
|
51
|
+
G
|
52
|
+
should_be_installed "foo 1.0"
|
53
|
+
|
54
|
+
bundle :show
|
55
|
+
out.should include("foo (1.0 #{@git.ref_for('master', 6)}")
|
56
|
+
end
|
57
|
+
|
58
|
+
it "prints out branch names other than master" do
|
59
|
+
update_git "foo", :branch => "omg" do |s|
|
60
|
+
s.write "lib/foo.rb", "FOO = '1.0.omg'"
|
61
|
+
end
|
62
|
+
@revision = revision_for(lib_path("foo-1.0"))[0...6]
|
63
|
+
|
64
|
+
install_gemfile <<-G
|
65
|
+
gem "foo", :git => "#{lib_path('foo-1.0')}", :branch => "omg"
|
66
|
+
G
|
67
|
+
should_be_installed "foo 1.0.omg"
|
68
|
+
|
69
|
+
bundle :show
|
70
|
+
out.should include("foo (1.0 #{@git.ref_for('omg', 6)}")
|
71
|
+
end
|
72
|
+
|
73
|
+
it "doesn't print the branch when tied to a ref" do
|
74
|
+
sha = revision_for(lib_path("foo-1.0"))
|
75
|
+
install_gemfile <<-G
|
76
|
+
gem "foo", :git => "#{lib_path('foo-1.0')}", :ref => "#{sha}"
|
77
|
+
G
|
78
|
+
|
79
|
+
bundle :show
|
80
|
+
out.should include("foo (1.0 #{sha[0..6]})")
|
81
|
+
end
|
82
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle pack with gems" do
|
4
|
+
describe "when there are only gemsources" do
|
5
|
+
before :each do
|
6
|
+
gemfile <<-G
|
7
|
+
gem 'rack'
|
8
|
+
G
|
9
|
+
|
10
|
+
system_gems "rack-1.0.0"
|
11
|
+
bundle :pack
|
12
|
+
end
|
13
|
+
|
14
|
+
it "locks the gemfile" do
|
15
|
+
bundled_app("Gemfile.lock").should exist
|
16
|
+
end
|
17
|
+
|
18
|
+
it "caches the gems" do
|
19
|
+
bundled_app("vendor/cache/rack-1.0.0.gem").should exist
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "The library itself" do
|
4
|
+
def check_for_tab_characters(filename)
|
5
|
+
failing_lines = []
|
6
|
+
File.readlines(filename).each_with_index do |line,number|
|
7
|
+
failing_lines << number + 1 if line =~ /\t/
|
8
|
+
end
|
9
|
+
|
10
|
+
unless failing_lines.empty?
|
11
|
+
"#{filename} has tab characters on lines #{failing_lines.join(', ')}"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def check_for_extra_spaces(filename)
|
16
|
+
failing_lines = []
|
17
|
+
File.readlines(filename).each_with_index do |line,number|
|
18
|
+
next if line =~ /^\s+#.*\s+\n$/
|
19
|
+
failing_lines << number + 1 if line =~ /\s+\n$/
|
20
|
+
end
|
21
|
+
|
22
|
+
unless failing_lines.empty?
|
23
|
+
"#{filename} has spaces on the EOL on lines #{failing_lines.join(', ')}"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
RSpec::Matchers.define :be_well_formed do
|
28
|
+
failure_message_for_should do |actual|
|
29
|
+
actual.join("\n")
|
30
|
+
end
|
31
|
+
|
32
|
+
match do |actual|
|
33
|
+
actual.empty?
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
it "has no malformed whitespace" do
|
38
|
+
error_messages = []
|
39
|
+
Dir.chdir(File.expand_path("../..", __FILE__)) do
|
40
|
+
`git ls-files`.split("\n").each do |filename|
|
41
|
+
next if filename =~ /\.gitmodules|fixtures/
|
42
|
+
error_messages << check_for_tab_characters(filename)
|
43
|
+
error_messages << check_for_extra_spaces(filename)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
error_messages.compact.should be_well_formed
|
47
|
+
end
|
48
|
+
|
49
|
+
it "can still be built" do
|
50
|
+
Dir.chdir(root) do
|
51
|
+
`gem build bundler.gemspec`
|
52
|
+
$?.should == 0
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|