bundler-prehistoric 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +3 -0
- data/.travis.yml +100 -0
- data/CHANGELOG.md +1640 -0
- data/CONTRIBUTING.md +32 -0
- data/DEVELOPMENT.md +117 -0
- data/Gemfile +3 -0
- data/ISSUES.md +96 -0
- data/LICENSE.md +23 -0
- data/README.md +46 -0
- data/Rakefile +256 -0
- data/UPGRADING.md +103 -0
- data/bin/bundle +21 -0
- data/bin/bundle_ruby +56 -0
- data/bin/bundler +21 -0
- data/bundler.gemspec +33 -0
- data/lib/bundler.rb +442 -0
- data/lib/bundler/backports/time.rb +7 -0
- data/lib/bundler/capistrano.rb +16 -0
- data/lib/bundler/cli.rb +395 -0
- data/lib/bundler/cli/binstubs.rb +38 -0
- data/lib/bundler/cli/cache.rb +34 -0
- data/lib/bundler/cli/check.rb +35 -0
- data/lib/bundler/cli/clean.rb +19 -0
- data/lib/bundler/cli/common.rb +54 -0
- data/lib/bundler/cli/config.rb +84 -0
- data/lib/bundler/cli/console.rb +39 -0
- data/lib/bundler/cli/exec.rb +37 -0
- data/lib/bundler/cli/gem.rb +101 -0
- data/lib/bundler/cli/init.rb +33 -0
- data/lib/bundler/cli/inject.rb +33 -0
- data/lib/bundler/cli/install.rb +133 -0
- data/lib/bundler/cli/open.rb +23 -0
- data/lib/bundler/cli/outdated.rb +80 -0
- data/lib/bundler/cli/package.rb +36 -0
- data/lib/bundler/cli/platform.rb +43 -0
- data/lib/bundler/cli/show.rb +48 -0
- data/lib/bundler/cli/update.rb +73 -0
- data/lib/bundler/cli/viz.rb +27 -0
- data/lib/bundler/constants.rb +5 -0
- data/lib/bundler/current_ruby.rb +155 -0
- data/lib/bundler/definition.rb +604 -0
- data/lib/bundler/dep_proxy.rb +43 -0
- data/lib/bundler/dependency.rb +106 -0
- data/lib/bundler/deployment.rb +59 -0
- data/lib/bundler/deprecate.rb +15 -0
- data/lib/bundler/dsl.rb +305 -0
- data/lib/bundler/endpoint_specification.rb +76 -0
- data/lib/bundler/env.rb +56 -0
- data/lib/bundler/environment.rb +42 -0
- data/lib/bundler/fetcher.rb +396 -0
- data/lib/bundler/friendly_errors.rb +42 -0
- data/lib/bundler/gem_helper.rb +169 -0
- data/lib/bundler/gem_helpers.rb +25 -0
- data/lib/bundler/gem_installer.rb +9 -0
- data/lib/bundler/gem_path_manipulation.rb +8 -0
- data/lib/bundler/gem_tasks.rb +2 -0
- data/lib/bundler/graph.rb +169 -0
- data/lib/bundler/index.rb +184 -0
- data/lib/bundler/injector.rb +64 -0
- data/lib/bundler/installer.rb +332 -0
- data/lib/bundler/lazy_specification.rb +83 -0
- data/lib/bundler/lockfile_parser.rb +146 -0
- data/lib/bundler/match_platform.rb +13 -0
- data/lib/bundler/parallel_workers.rb +18 -0
- data/lib/bundler/parallel_workers/thread_worker.rb +30 -0
- data/lib/bundler/parallel_workers/unix_worker.rb +101 -0
- data/lib/bundler/parallel_workers/worker.rb +69 -0
- data/lib/bundler/psyched_yaml.rb +26 -0
- data/lib/bundler/remote_specification.rb +57 -0
- data/lib/bundler/resolver.rb +534 -0
- data/lib/bundler/retry.rb +60 -0
- data/lib/bundler/ruby_dsl.rb +11 -0
- data/lib/bundler/ruby_version.rb +117 -0
- data/lib/bundler/rubygems_ext.rb +171 -0
- data/lib/bundler/rubygems_integration.rb +578 -0
- data/lib/bundler/runtime.rb +310 -0
- data/lib/bundler/settings.rb +176 -0
- data/lib/bundler/setup.rb +23 -0
- data/lib/bundler/shared_helpers.rb +110 -0
- data/lib/bundler/similarity_detector.rb +63 -0
- data/lib/bundler/source.rb +29 -0
- data/lib/bundler/source/git.rb +289 -0
- data/lib/bundler/source/git/git_proxy.rb +158 -0
- data/lib/bundler/source/path.rb +225 -0
- data/lib/bundler/source/path/installer.rb +38 -0
- data/lib/bundler/source/rubygems.rb +334 -0
- data/lib/bundler/source/svn.rb +260 -0
- data/lib/bundler/source/svn/svn_proxy.rb +110 -0
- data/lib/bundler/spec_set.rb +154 -0
- data/lib/bundler/ssl_certs/.document +1 -0
- data/lib/bundler/ssl_certs/Class3PublicPrimaryCertificationAuthority.pem +14 -0
- data/lib/bundler/ssl_certs/DigiCertHighAssuranceEVRootCA.pem +23 -0
- data/lib/bundler/ssl_certs/EntrustnetSecureServerCertificationAuthority.pem +28 -0
- data/lib/bundler/ssl_certs/GeoTrustGlobalCA.pem +20 -0
- data/lib/bundler/ssl_certs/certificate_manager.rb +41 -0
- data/lib/bundler/templates/Executable +16 -0
- data/lib/bundler/templates/Executable.standalone +12 -0
- data/lib/bundler/templates/Gemfile +4 -0
- data/lib/bundler/templates/newgem/.travis.yml.tt +3 -0
- data/lib/bundler/templates/newgem/Gemfile.tt +4 -0
- data/lib/bundler/templates/newgem/LICENSE.txt.tt +22 -0
- data/lib/bundler/templates/newgem/README.md.tt +31 -0
- data/lib/bundler/templates/newgem/Rakefile.tt +26 -0
- data/lib/bundler/templates/newgem/bin/newgem.tt +3 -0
- data/lib/bundler/templates/newgem/consolerc.tt +3 -0
- data/lib/bundler/templates/newgem/ext/newgem/extconf.rb.tt +3 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.c.tt +9 -0
- data/lib/bundler/templates/newgem/ext/newgem/newgem.h.tt +6 -0
- data/lib/bundler/templates/newgem/gitignore.tt +16 -0
- data/lib/bundler/templates/newgem/lib/newgem.rb.tt +12 -0
- data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +7 -0
- data/lib/bundler/templates/newgem/newgem.gemspec.tt +38 -0
- data/lib/bundler/templates/newgem/rspec.tt +2 -0
- data/lib/bundler/templates/newgem/spec/newgem_spec.rb.tt +11 -0
- data/lib/bundler/templates/newgem/spec/spec_helper.rb.tt +2 -0
- data/lib/bundler/templates/newgem/test/minitest_helper.rb.tt +4 -0
- data/lib/bundler/templates/newgem/test/test_newgem.rb.tt +11 -0
- data/lib/bundler/ui.rb +7 -0
- data/lib/bundler/ui/rg_proxy.rb +21 -0
- data/lib/bundler/ui/shell.rb +98 -0
- data/lib/bundler/ui/silent.rb +44 -0
- data/lib/bundler/vendor/.document +0 -0
- data/lib/bundler/vendor/net/http/faster.rb +26 -0
- data/lib/bundler/vendor/net/http/persistent.rb +1230 -0
- data/lib/bundler/vendor/net/http/persistent/ssl_reuse.rb +128 -0
- data/lib/bundler/vendor/thor.rb +480 -0
- data/lib/bundler/vendor/thor/actions.rb +319 -0
- data/lib/bundler/vendor/thor/actions/create_file.rb +103 -0
- data/lib/bundler/vendor/thor/actions/create_link.rb +59 -0
- data/lib/bundler/vendor/thor/actions/directory.rb +118 -0
- data/lib/bundler/vendor/thor/actions/empty_directory.rb +135 -0
- data/lib/bundler/vendor/thor/actions/file_manipulation.rb +316 -0
- data/lib/bundler/vendor/thor/actions/inject_into_file.rb +107 -0
- data/lib/bundler/vendor/thor/base.rb +656 -0
- data/lib/bundler/vendor/thor/command.rb +133 -0
- data/lib/bundler/vendor/thor/core_ext/hash_with_indifferent_access.rb +77 -0
- data/lib/bundler/vendor/thor/core_ext/io_binary_read.rb +10 -0
- data/lib/bundler/vendor/thor/core_ext/ordered_hash.rb +98 -0
- data/lib/bundler/vendor/thor/error.rb +32 -0
- data/lib/bundler/vendor/thor/group.rb +281 -0
- data/lib/bundler/vendor/thor/invocation.rb +173 -0
- data/lib/bundler/vendor/thor/line_editor.rb +17 -0
- data/lib/bundler/vendor/thor/line_editor/basic.rb +35 -0
- data/lib/bundler/vendor/thor/line_editor/readline.rb +88 -0
- data/lib/bundler/vendor/thor/parser.rb +4 -0
- data/lib/bundler/vendor/thor/parser/argument.rb +73 -0
- data/lib/bundler/vendor/thor/parser/arguments.rb +175 -0
- data/lib/bundler/vendor/thor/parser/option.rb +121 -0
- data/lib/bundler/vendor/thor/parser/options.rb +218 -0
- data/lib/bundler/vendor/thor/rake_compat.rb +71 -0
- data/lib/bundler/vendor/thor/runner.rb +322 -0
- data/lib/bundler/vendor/thor/shell.rb +81 -0
- data/lib/bundler/vendor/thor/shell/basic.rb +420 -0
- data/lib/bundler/vendor/thor/shell/color.rb +149 -0
- data/lib/bundler/vendor/thor/shell/html.rb +126 -0
- data/lib/bundler/vendor/thor/util.rb +267 -0
- data/lib/bundler/vendor/thor/version.rb +3 -0
- data/lib/bundler/vendored_persistent.rb +3 -0
- data/lib/bundler/vendored_thor.rb +8 -0
- data/lib/bundler/version.rb +6 -0
- data/lib/bundler/vlad.rb +11 -0
- data/man/bundle-config.ronn +155 -0
- data/man/bundle-exec.ronn +136 -0
- data/man/bundle-install.ronn +372 -0
- data/man/bundle-package.ronn +59 -0
- data/man/bundle-platform.ronn +42 -0
- data/man/bundle-update.ronn +179 -0
- data/man/bundle.ronn +92 -0
- data/man/gemfile.5.ronn +369 -0
- data/man/index.txt +7 -0
- data/spec/bundler/bundler_spec.rb +74 -0
- data/spec/bundler/cli_spec.rb +16 -0
- data/spec/bundler/definition_spec.rb +21 -0
- data/spec/bundler/dsl_spec.rb +108 -0
- data/spec/bundler/friendly_errors_spec.rb +13 -0
- data/spec/bundler/gem_helper_spec.rb +225 -0
- data/spec/bundler/psyched_yaml_spec.rb +8 -0
- data/spec/bundler/retry_spec.rb +59 -0
- data/spec/bundler/settings_spec.rb +13 -0
- data/spec/bundler/source_spec.rb +25 -0
- data/spec/cache/gems_spec.rb +316 -0
- data/spec/cache/git_spec.rb +188 -0
- data/spec/cache/path_spec.rb +121 -0
- data/spec/cache/platform_spec.rb +53 -0
- data/spec/cache/svn_spec.rb +82 -0
- data/spec/commands/binstubs_spec.rb +246 -0
- data/spec/commands/check_spec.rb +278 -0
- data/spec/commands/clean_spec.rb +652 -0
- data/spec/commands/config_spec.rb +227 -0
- data/spec/commands/console_spec.rb +102 -0
- data/spec/commands/exec_spec.rb +367 -0
- data/spec/commands/help_spec.rb +39 -0
- data/spec/commands/init_spec.rb +39 -0
- data/spec/commands/inject_spec.rb +78 -0
- data/spec/commands/licenses_spec.rb +31 -0
- data/spec/commands/newgem_spec.rb +451 -0
- data/spec/commands/open_spec.rb +80 -0
- data/spec/commands/outdated_spec.rb +168 -0
- data/spec/commands/package_spec.rb +128 -0
- data/spec/commands/show_spec.rb +152 -0
- data/spec/install/binstubs_spec.rb +24 -0
- data/spec/install/bundler_spec.rb +146 -0
- data/spec/install/deploy_spec.rb +237 -0
- data/spec/install/gemfile/gemspec_spec.rb +170 -0
- data/spec/install/gemfile/git_spec.rb +967 -0
- data/spec/install/gemfile/path_spec.rb +480 -0
- data/spec/install/gemfile/svn_spec.rb +582 -0
- data/spec/install/gemfile_spec.rb +44 -0
- data/spec/install/gems/c_ext_spec.rb +48 -0
- data/spec/install/gems/dependency_api_spec.rb +580 -0
- data/spec/install/gems/env_spec.rb +107 -0
- data/spec/install/gems/flex_spec.rb +314 -0
- data/spec/install/gems/groups_spec.rb +308 -0
- data/spec/install/gems/mirror_spec.rb +39 -0
- data/spec/install/gems/platform_spec.rb +221 -0
- data/spec/install/gems/post_install_spec.rb +121 -0
- data/spec/install/gems/resolving_spec.rb +124 -0
- data/spec/install/gems/simple_case_spec.rb +386 -0
- data/spec/install/gems/standalone_spec.rb +260 -0
- data/spec/install/gems/sudo_spec.rb +136 -0
- data/spec/install/gems/win32_spec.rb +26 -0
- data/spec/install/gemspecs_spec.rb +50 -0
- data/spec/install/path_spec.rb +150 -0
- data/spec/install/post_bundle_message_spec.rb +142 -0
- data/spec/install/prereleases_spec.rb +43 -0
- data/spec/install/security_policy_spec.rb +77 -0
- data/spec/install/upgrade_spec.rb +26 -0
- data/spec/lock/git_spec.rb +34 -0
- data/spec/lock/lockfile_spec.rb +912 -0
- data/spec/lock/svn_spec.rb +35 -0
- data/spec/other/bundle_ruby_spec.rb +142 -0
- data/spec/other/cli_dispatch_spec.rb +21 -0
- data/spec/other/ext_spec.rb +60 -0
- data/spec/other/platform_spec.rb +1285 -0
- data/spec/other/ssl_cert_spec.rb +10 -0
- data/spec/quality_spec.rb +88 -0
- data/spec/realworld/dependency_api_spec.rb +60 -0
- data/spec/realworld/edgecases_spec.rb +177 -0
- data/spec/realworld/parallel_spec.rb +69 -0
- data/spec/resolver/basic_spec.rb +66 -0
- data/spec/resolver/platform_spec.rb +88 -0
- data/spec/runtime/executable_spec.rb +149 -0
- data/spec/runtime/load_spec.rb +107 -0
- data/spec/runtime/platform_spec.rb +90 -0
- data/spec/runtime/require_spec.rb +332 -0
- data/spec/runtime/setup_spec.rb +856 -0
- data/spec/runtime/with_clean_env_spec.rb +91 -0
- data/spec/spec_helper.rb +114 -0
- data/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb +13 -0
- data/spec/support/artifice/endpoint.rb +71 -0
- data/spec/support/artifice/endpoint_500.rb +37 -0
- data/spec/support/artifice/endpoint_api_missing.rb +16 -0
- data/spec/support/artifice/endpoint_basic_authentication.rb +13 -0
- data/spec/support/artifice/endpoint_creds_diff_host.rb +38 -0
- data/spec/support/artifice/endpoint_extra.rb +31 -0
- data/spec/support/artifice/endpoint_extra_missing.rb +15 -0
- data/spec/support/artifice/endpoint_fallback.rb +17 -0
- data/spec/support/artifice/endpoint_host_redirect.rb +15 -0
- data/spec/support/artifice/endpoint_marshal_fail.rb +11 -0
- data/spec/support/artifice/endpoint_redirect.rb +15 -0
- data/spec/support/artifice/endpoint_strict_basic_authentication.rb +18 -0
- data/spec/support/artifice/endpoint_timeout.rb +13 -0
- data/spec/support/builders.rb +748 -0
- data/spec/support/fakeweb/rack-1.0.0.marshal +2 -0
- data/spec/support/fakeweb/windows.rb +23 -0
- data/spec/support/hax.rb +22 -0
- data/spec/support/helpers.rb +348 -0
- data/spec/support/indexes.rb +280 -0
- data/spec/support/less_than_proc.rb +14 -0
- data/spec/support/matchers.rb +77 -0
- data/spec/support/path.rb +81 -0
- data/spec/support/permissions.rb +10 -0
- data/spec/support/platforms.rb +94 -0
- data/spec/support/ruby_ext.rb +20 -0
- data/spec/support/rubygems_ext.rb +39 -0
- data/spec/support/streams.rb +13 -0
- data/spec/support/sudo.rb +16 -0
- data/spec/update/gems_spec.rb +201 -0
- data/spec/update/git_spec.rb +236 -0
- data/spec/update/source_spec.rb +63 -0
- data/spec/update/svn_spec.rb +100 -0
- metadata +486 -0
@@ -0,0 +1,39 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle help" do
|
4
|
+
# Rubygems 1.4+ no longer load gem plugins so this test is no longer needed
|
5
|
+
rubygems_under_14 = Gem::Requirement.new("< 1.4").satisfied_by?(Gem::Version.new(Gem::VERSION))
|
6
|
+
it "complains if older versions of bundler are installed", :if => rubygems_under_14 do
|
7
|
+
system_gems "bundler-0.8.1"
|
8
|
+
|
9
|
+
bundle "help", :expect_err => true
|
10
|
+
expect(err).to include("older than 0.9")
|
11
|
+
expect(err).to include("running `gem cleanup bundler`.")
|
12
|
+
end
|
13
|
+
|
14
|
+
it "uses mann when available" do
|
15
|
+
fake_man!
|
16
|
+
|
17
|
+
bundle "help gemfile"
|
18
|
+
expect(out).to eq(%|["#{root}/lib/bundler/man/gemfile.5"]|)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "prefixes bundle commands with bundle- when finding the groff files" do
|
22
|
+
fake_man!
|
23
|
+
|
24
|
+
bundle "help install"
|
25
|
+
expect(out).to eq(%|["#{root}/lib/bundler/man/bundle-install"]|)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "simply outputs the txt file when there is no man on the path" do
|
29
|
+
kill_path!
|
30
|
+
|
31
|
+
bundle "help install", :expect_err => true
|
32
|
+
expect(out).to match(/BUNDLE-INSTALL/)
|
33
|
+
end
|
34
|
+
|
35
|
+
it "still outputs the old help for commands that do not have man pages yet" do
|
36
|
+
bundle "help check"
|
37
|
+
expect(out).to include("Check searches the local machine")
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle init" do
|
4
|
+
it "generates a Gemfile" do
|
5
|
+
bundle :init
|
6
|
+
expect(bundled_app("Gemfile")).to exist
|
7
|
+
end
|
8
|
+
|
9
|
+
it "does not change existing Gemfiles" do
|
10
|
+
gemfile <<-G
|
11
|
+
gem "rails"
|
12
|
+
G
|
13
|
+
|
14
|
+
expect {
|
15
|
+
bundle :init
|
16
|
+
}.not_to 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
|
+
expect(gemfile).to match(/source :gemcutter/)
|
35
|
+
expect(gemfile.scan(/gem "rack", "= 1.0.1"/).size).to eq(1)
|
36
|
+
expect(gemfile.scan(/gem "rspec", "= 1.2"/).size).to eq(1)
|
37
|
+
expect(gemfile.scan(/group :development/).size).to eq(1)
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "bundle inject" do
|
4
|
+
before :each do
|
5
|
+
gemfile <<-G
|
6
|
+
source "file://#{gem_repo1}"
|
7
|
+
gem "rack"
|
8
|
+
G
|
9
|
+
end
|
10
|
+
|
11
|
+
context "without a lockfile" do
|
12
|
+
it "locks with the injected gems" do
|
13
|
+
expect(bundled_app("Gemfile.lock")).not_to exist
|
14
|
+
bundle "inject 'rack-obama' '> 0'"
|
15
|
+
expect(bundled_app("Gemfile.lock").read).to match(/rack-obama/)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
context "with a lockfile" do
|
20
|
+
before do
|
21
|
+
bundle "install"
|
22
|
+
end
|
23
|
+
|
24
|
+
it "adds the injected gems to the Gemfile" do
|
25
|
+
expect(bundled_app("Gemfile").read).not_to match(/rack-obama/)
|
26
|
+
bundle "inject 'rack-obama' '> 0'"
|
27
|
+
expect(bundled_app("Gemfile").read).to match(/rack-obama/)
|
28
|
+
end
|
29
|
+
|
30
|
+
it "locks with the injected gems" do
|
31
|
+
expect(bundled_app("Gemfile.lock").read).not_to match(/rack-obama/)
|
32
|
+
bundle "inject 'rack-obama' '> 0'"
|
33
|
+
expect(bundled_app("Gemfile.lock").read).to match(/rack-obama/)
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
context "with injected gems already in the Gemfile" do
|
38
|
+
it "doesn't add existing gems" do
|
39
|
+
bundle "inject 'rack' '> 0'"
|
40
|
+
expect(out).to match(/cannot specify the same gem twice/i)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context "when frozen" do
|
45
|
+
before do
|
46
|
+
bundle "install"
|
47
|
+
bundle "config --local frozen 1"
|
48
|
+
end
|
49
|
+
|
50
|
+
it "injects anyway" do
|
51
|
+
bundle "inject 'rack-obama' '> 0'"
|
52
|
+
expect(bundled_app("Gemfile").read).to match(/rack-obama/)
|
53
|
+
end
|
54
|
+
|
55
|
+
it "locks with the injected gems" do
|
56
|
+
expect(bundled_app("Gemfile.lock").read).not_to match(/rack-obama/)
|
57
|
+
bundle "inject 'rack-obama' '> 0'"
|
58
|
+
expect(bundled_app("Gemfile.lock").read).to match(/rack-obama/)
|
59
|
+
end
|
60
|
+
|
61
|
+
it "restores frozen afterwards" do
|
62
|
+
bundle "inject 'rack-obama' '> 0'"
|
63
|
+
config = YAML.load(bundled_app(".bundle/config").read)
|
64
|
+
expect(config["BUNDLE_FROZEN"]).to eq("1")
|
65
|
+
end
|
66
|
+
|
67
|
+
it "doesn't allow Gemfile changes" do
|
68
|
+
gemfile <<-G
|
69
|
+
source "file://#{gem_repo1}"
|
70
|
+
gem "rack-obama"
|
71
|
+
G
|
72
|
+
bundle "inject 'rack' '> 0'"
|
73
|
+
expect(out).to match(/trying to install in deployment mode after changing/)
|
74
|
+
|
75
|
+
expect(bundled_app("Gemfile.lock").read).not_to match(/rack-obama/)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle licenses" do
|
4
|
+
before :each do
|
5
|
+
install_gemfile <<-G
|
6
|
+
source "file://#{gem_repo1}"
|
7
|
+
gem "rails"
|
8
|
+
gem "with_license"
|
9
|
+
G
|
10
|
+
end
|
11
|
+
|
12
|
+
it "prints license information for all gems in the bundle" do
|
13
|
+
bundle "licenses"
|
14
|
+
|
15
|
+
expect(out).to include("actionpack: Unknown")
|
16
|
+
expect(out).to include("with_license: MIT")
|
17
|
+
end
|
18
|
+
|
19
|
+
it "performs an automatic bundle install" do
|
20
|
+
gemfile <<-G
|
21
|
+
source "file://#{gem_repo1}"
|
22
|
+
gem "rails"
|
23
|
+
gem "with_license"
|
24
|
+
gem "foo"
|
25
|
+
G
|
26
|
+
|
27
|
+
bundle "config auto_install 1"
|
28
|
+
bundle :licenses
|
29
|
+
expect(out).to include("Installing foo 1.0")
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,451 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "bundle gem" do
|
4
|
+
before do
|
5
|
+
@git_name = `git config --global user.name`.chomp
|
6
|
+
`git config --global user.name "Bundler User"`
|
7
|
+
@git_email = `git config --global user.email`.chomp
|
8
|
+
`git config --global user.email user@example.com`
|
9
|
+
end
|
10
|
+
|
11
|
+
after do
|
12
|
+
`git config --global user.name "#{@git_name}"`
|
13
|
+
`git config --global user.email #{@git_email}`
|
14
|
+
end
|
15
|
+
|
16
|
+
shared_examples_for "git config is present" do
|
17
|
+
context "git config user.{name,email} present" do
|
18
|
+
it "sets gemspec author to git user.name if available" do
|
19
|
+
expect(generated_gem.gemspec.authors.first).to eq("Bundler User")
|
20
|
+
end
|
21
|
+
|
22
|
+
it "sets gemspec email to git user.email if available" do
|
23
|
+
expect(generated_gem.gemspec.email.first).to eq("user@example.com")
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
shared_examples_for "git config is absent" do |hoge|
|
29
|
+
it "sets gemspec author to default message if git user.name is not set or empty" do
|
30
|
+
expect(generated_gem.gemspec.authors.first).to eq("TODO: Write your name")
|
31
|
+
end
|
32
|
+
|
33
|
+
it "sets gemspec email to default message if git user.email is not set or empty" do
|
34
|
+
expect(generated_gem.gemspec.email.first).to eq("TODO: Write your email address")
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
context "gem naming with underscore" do
|
39
|
+
let(:gem_name) { 'test_gem' }
|
40
|
+
|
41
|
+
before do
|
42
|
+
bundle "gem #{gem_name}"
|
43
|
+
# reset gemspec cache for each test because of commit 3d4163a
|
44
|
+
Bundler.clear_gemspec_cache
|
45
|
+
end
|
46
|
+
|
47
|
+
let(:generated_gem) { Bundler::GemHelper.new(bundled_app(gem_name).to_s) }
|
48
|
+
|
49
|
+
it "generates a gem skeleton" do
|
50
|
+
expect(bundled_app("test_gem/test_gem.gemspec")).to exist
|
51
|
+
expect(bundled_app("test_gem/LICENSE.txt")).to exist
|
52
|
+
expect(bundled_app("test_gem/Gemfile")).to exist
|
53
|
+
expect(bundled_app("test_gem/Rakefile")).to exist
|
54
|
+
expect(bundled_app("test_gem/lib/test_gem.rb")).to exist
|
55
|
+
expect(bundled_app("test_gem/lib/test_gem/version.rb")).to exist
|
56
|
+
expect(bundled_app("test_gem/.gitignore")).to exist
|
57
|
+
expect(bundled_app("test_gem/.consolerc")).to exist
|
58
|
+
end
|
59
|
+
|
60
|
+
it "starts with version 0.0.1" do
|
61
|
+
expect(bundled_app("test_gem/lib/test_gem/version.rb").read).to match(/VERSION = "0.0.1"/)
|
62
|
+
end
|
63
|
+
|
64
|
+
it "does not nest constants" do
|
65
|
+
expect(bundled_app("test_gem/lib/test_gem/version.rb").read).to match(/module TestGem/)
|
66
|
+
expect(bundled_app("test_gem/lib/test_gem.rb").read).to match(/module TestGem/)
|
67
|
+
end
|
68
|
+
|
69
|
+
it_should_behave_like "git config is present"
|
70
|
+
|
71
|
+
context "git config user.{name,email} is not set" do
|
72
|
+
before do
|
73
|
+
`git config --global --unset user.name`
|
74
|
+
`git config --global --unset user.email`
|
75
|
+
reset!
|
76
|
+
in_app_root
|
77
|
+
bundle "gem #{gem_name}"
|
78
|
+
end
|
79
|
+
|
80
|
+
it_should_behave_like "git config is absent"
|
81
|
+
end
|
82
|
+
|
83
|
+
it "sets gemspec metadata['allowed_push_host']", :rubygems => "2.0" do
|
84
|
+
expect(generated_gem.gemspec.metadata['allowed_push_host']).
|
85
|
+
to match("delete to allow pushes to any server")
|
86
|
+
end
|
87
|
+
|
88
|
+
it "sets gemspec license to MIT by default" do
|
89
|
+
expect(generated_gem.gemspec.license).to eq("MIT")
|
90
|
+
end
|
91
|
+
|
92
|
+
it "requires the version file" do
|
93
|
+
expect(bundled_app("test_gem/lib/test_gem.rb").read).to match(/require "test_gem\/version"/)
|
94
|
+
end
|
95
|
+
|
96
|
+
it "runs rake without problems" do
|
97
|
+
system_gems ["rake-10.0.2"]
|
98
|
+
|
99
|
+
rakefile = strip_whitespace <<-RAKEFILE
|
100
|
+
task :default do
|
101
|
+
puts 'SUCCESS'
|
102
|
+
end
|
103
|
+
RAKEFILE
|
104
|
+
File.open(bundled_app("test_gem/Rakefile"), 'w') do |file|
|
105
|
+
file.puts rakefile
|
106
|
+
end
|
107
|
+
|
108
|
+
Dir.chdir(bundled_app(gem_name)) do
|
109
|
+
sys_exec("rake")
|
110
|
+
expect(out).to include("SUCCESS")
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
context "--bin parameter set" do
|
115
|
+
before do
|
116
|
+
reset!
|
117
|
+
in_app_root
|
118
|
+
bundle "gem #{gem_name} --bin"
|
119
|
+
end
|
120
|
+
|
121
|
+
it "builds bin skeleton" do
|
122
|
+
expect(bundled_app("test_gem/bin/test_gem")).to exist
|
123
|
+
end
|
124
|
+
|
125
|
+
it "requires 'test-gem'" do
|
126
|
+
expect(bundled_app("test_gem/bin/test_gem").read).to match(/require 'test_gem'/)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
context "no --test parameter" do
|
131
|
+
before do
|
132
|
+
reset!
|
133
|
+
in_app_root
|
134
|
+
bundle "gem #{gem_name}"
|
135
|
+
end
|
136
|
+
|
137
|
+
it "doesn't create any spec/test file" do
|
138
|
+
expect(bundled_app("test_gem/.rspec")).to_not exist
|
139
|
+
expect(bundled_app("test_gem/spec/test_gem_spec.rb")).to_not exist
|
140
|
+
expect(bundled_app("test_gem/spec/spec_helper.rb")).to_not exist
|
141
|
+
expect(bundled_app("test_gem/test/test_test_gem.rb")).to_not exist
|
142
|
+
expect(bundled_app("test_gem/test/minitest_helper.rb")).to_not exist
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
context "--test parameter set to rspec" do
|
147
|
+
before do
|
148
|
+
reset!
|
149
|
+
in_app_root
|
150
|
+
bundle "gem #{gem_name} --test=rspec"
|
151
|
+
end
|
152
|
+
|
153
|
+
it "builds spec skeleton" do
|
154
|
+
expect(bundled_app("test_gem/.rspec")).to exist
|
155
|
+
expect(bundled_app("test_gem/spec/test_gem_spec.rb")).to exist
|
156
|
+
expect(bundled_app("test_gem/spec/spec_helper.rb")).to exist
|
157
|
+
end
|
158
|
+
|
159
|
+
it "requires 'test-gem'" do
|
160
|
+
expect(bundled_app("test_gem/spec/spec_helper.rb").read).to include("require 'test_gem'")
|
161
|
+
end
|
162
|
+
|
163
|
+
it "creates a default test which fails" do
|
164
|
+
expect(bundled_app("test_gem/spec/test_gem_spec.rb").read).to include("expect(false).to eq(true)")
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
context "--test parameter set to minitest" do
|
169
|
+
before do
|
170
|
+
reset!
|
171
|
+
in_app_root
|
172
|
+
bundle "gem #{gem_name} --test=minitest"
|
173
|
+
end
|
174
|
+
|
175
|
+
it "builds spec skeleton" do
|
176
|
+
expect(bundled_app("test_gem/test/test_test_gem.rb")).to exist
|
177
|
+
expect(bundled_app("test_gem/test/minitest_helper.rb")).to exist
|
178
|
+
end
|
179
|
+
|
180
|
+
it "requires 'test-gem'" do
|
181
|
+
expect(bundled_app("test_gem/test/minitest_helper.rb").read).to include("require 'test_gem'")
|
182
|
+
end
|
183
|
+
|
184
|
+
it "requires 'minitest_helper'" do
|
185
|
+
expect(bundled_app("test_gem/test/test_test_gem.rb").read).to include("require 'minitest_helper'")
|
186
|
+
end
|
187
|
+
|
188
|
+
it "creates a default test which fails" do
|
189
|
+
expect(bundled_app("test_gem/test/test_test_gem.rb").read).to include("assert false")
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
context "--test with no arguments" do
|
194
|
+
before do
|
195
|
+
reset!
|
196
|
+
in_app_root
|
197
|
+
bundle "gem #{gem_name} --test"
|
198
|
+
end
|
199
|
+
|
200
|
+
it "defaults to rspec" do
|
201
|
+
expect(bundled_app("test_gem/spec/spec_helper.rb")).to exist
|
202
|
+
expect(bundled_app("test_gem/test/minitest_helper.rb")).to_not exist
|
203
|
+
end
|
204
|
+
|
205
|
+
it "creates a .travis.yml file to test the library against the current Ruby version on Travis CI" do
|
206
|
+
expect(bundled_app("test_gem/.travis.yml").read).to match(%r(- #{RUBY_VERSION}))
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
context "--edit option" do
|
211
|
+
it "opens the generated gemspec in the user's text editor" do
|
212
|
+
reset!
|
213
|
+
in_app_root
|
214
|
+
output = bundle "gem #{gem_name} --edit=echo"
|
215
|
+
gemspec_path = File.join(Dir.pwd, gem_name, "#{gem_name}.gemspec")
|
216
|
+
expect(output).to include("echo \"#{gemspec_path}\"")
|
217
|
+
end
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
context "gem naming with dashed" do
|
222
|
+
let(:gem_name) { 'test-gem' }
|
223
|
+
|
224
|
+
before do
|
225
|
+
bundle "gem #{gem_name}"
|
226
|
+
# reset gemspec cache for each test because of commit 3d4163a
|
227
|
+
Bundler.clear_gemspec_cache
|
228
|
+
end
|
229
|
+
|
230
|
+
let(:generated_gem) { Bundler::GemHelper.new(bundled_app(gem_name).to_s) }
|
231
|
+
|
232
|
+
it "generates a gem skeleton" do
|
233
|
+
expect(bundled_app("test-gem/test-gem.gemspec")).to exist
|
234
|
+
expect(bundled_app("test-gem/LICENSE.txt")).to exist
|
235
|
+
expect(bundled_app("test-gem/Gemfile")).to exist
|
236
|
+
expect(bundled_app("test-gem/Rakefile")).to exist
|
237
|
+
expect(bundled_app("test-gem/lib/test/gem.rb")).to exist
|
238
|
+
expect(bundled_app("test-gem/lib/test/gem/version.rb")).to exist
|
239
|
+
end
|
240
|
+
|
241
|
+
it "starts with version 0.0.1" do
|
242
|
+
expect(bundled_app("test-gem/lib/test/gem/version.rb").read).to match(/VERSION = "0.0.1"/)
|
243
|
+
end
|
244
|
+
|
245
|
+
it "nests constants so they work" do
|
246
|
+
expect(bundled_app("test-gem/lib/test/gem/version.rb").read).to match(/module Test\n module Gem/)
|
247
|
+
expect(bundled_app("test-gem/lib/test/gem.rb").read).to match(/module Test\n module Gem/)
|
248
|
+
end
|
249
|
+
|
250
|
+
it_should_behave_like "git config is present"
|
251
|
+
|
252
|
+
context "git config user.{name,email} is not set" do
|
253
|
+
before do
|
254
|
+
`git config --global --unset user.name`
|
255
|
+
`git config --global --unset user.email`
|
256
|
+
reset!
|
257
|
+
in_app_root
|
258
|
+
bundle "gem #{gem_name}"
|
259
|
+
end
|
260
|
+
|
261
|
+
it_should_behave_like "git config is absent"
|
262
|
+
end
|
263
|
+
|
264
|
+
it "sets gemspec metadata['allowed_push_host']", :rubygems => "2.0" do
|
265
|
+
expect(generated_gem.gemspec.metadata['allowed_push_host']).
|
266
|
+
to match("delete to allow pushes to any server")
|
267
|
+
end
|
268
|
+
|
269
|
+
it "sets gemspec license to MIT by default" do
|
270
|
+
expect(generated_gem.gemspec.license).to eq("MIT")
|
271
|
+
end
|
272
|
+
|
273
|
+
it "requires the version file" do
|
274
|
+
expect(bundled_app("test-gem/lib/test/gem.rb").read).to match(/require "test\/gem\/version"/)
|
275
|
+
end
|
276
|
+
|
277
|
+
it "runs rake without problems" do
|
278
|
+
system_gems ["rake-10.0.2"]
|
279
|
+
|
280
|
+
rakefile = strip_whitespace <<-RAKEFILE
|
281
|
+
task :default do
|
282
|
+
puts 'SUCCESS'
|
283
|
+
end
|
284
|
+
RAKEFILE
|
285
|
+
File.open(bundled_app("test-gem/Rakefile"), 'w') do |file|
|
286
|
+
file.puts rakefile
|
287
|
+
end
|
288
|
+
|
289
|
+
Dir.chdir(bundled_app(gem_name)) do
|
290
|
+
sys_exec("rake")
|
291
|
+
expect(out).to include("SUCCESS")
|
292
|
+
end
|
293
|
+
end
|
294
|
+
|
295
|
+
context "--bin parameter set" do
|
296
|
+
before do
|
297
|
+
reset!
|
298
|
+
in_app_root
|
299
|
+
bundle "gem #{gem_name} --bin"
|
300
|
+
end
|
301
|
+
|
302
|
+
it "builds bin skeleton" do
|
303
|
+
expect(bundled_app("test-gem/bin/test-gem")).to exist
|
304
|
+
end
|
305
|
+
|
306
|
+
it "requires 'test/gem'" do
|
307
|
+
expect(bundled_app("test-gem/bin/test-gem").read).to match(/require 'test\/gem'/)
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
311
|
+
context "no --test parameter" do
|
312
|
+
before do
|
313
|
+
reset!
|
314
|
+
in_app_root
|
315
|
+
bundle "gem #{gem_name}"
|
316
|
+
end
|
317
|
+
|
318
|
+
it "doesn't create any spec/test file" do
|
319
|
+
expect(bundled_app("test-gem/.rspec")).to_not exist
|
320
|
+
expect(bundled_app("test-gem/spec/test/gem_spec.rb")).to_not exist
|
321
|
+
expect(bundled_app("test-gem/spec/spec_helper.rb")).to_not exist
|
322
|
+
expect(bundled_app("test-gem/test/test_test/gem.rb")).to_not exist
|
323
|
+
expect(bundled_app("test-gem/test/minitest_helper.rb")).to_not exist
|
324
|
+
end
|
325
|
+
end
|
326
|
+
|
327
|
+
context "--test parameter set to rspec" do
|
328
|
+
before do
|
329
|
+
reset!
|
330
|
+
in_app_root
|
331
|
+
bundle "gem #{gem_name} --test=rspec"
|
332
|
+
end
|
333
|
+
|
334
|
+
it "builds spec skeleton" do
|
335
|
+
expect(bundled_app("test-gem/.rspec")).to exist
|
336
|
+
expect(bundled_app("test-gem/spec/test/gem_spec.rb")).to exist
|
337
|
+
expect(bundled_app("test-gem/spec/spec_helper.rb")).to exist
|
338
|
+
end
|
339
|
+
|
340
|
+
it "requires 'test/gem'" do
|
341
|
+
expect(bundled_app("test-gem/spec/spec_helper.rb").read).to include("require 'test/gem'")
|
342
|
+
end
|
343
|
+
|
344
|
+
it "creates a default test which fails" do
|
345
|
+
expect(bundled_app("test-gem/spec/test/gem_spec.rb").read).to include("expect(false).to eq(true)")
|
346
|
+
end
|
347
|
+
|
348
|
+
it "creates a default rake task to run the specs" do
|
349
|
+
rakefile = strip_whitespace <<-RAKEFILE
|
350
|
+
require "bundler/gem_tasks"
|
351
|
+
require "rspec/core/rake_task"
|
352
|
+
|
353
|
+
RSpec::Core::RakeTask.new(:spec)
|
354
|
+
|
355
|
+
task :default => :spec
|
356
|
+
|
357
|
+
RAKEFILE
|
358
|
+
|
359
|
+
expect(bundled_app("test-gem/Rakefile").read).to eq(rakefile)
|
360
|
+
end
|
361
|
+
end
|
362
|
+
|
363
|
+
context "--test parameter set to minitest" do
|
364
|
+
before do
|
365
|
+
reset!
|
366
|
+
in_app_root
|
367
|
+
bundle "gem #{gem_name} --test=minitest"
|
368
|
+
end
|
369
|
+
|
370
|
+
it "builds spec skeleton" do
|
371
|
+
expect(bundled_app("test-gem/test/test_test/gem.rb")).to exist
|
372
|
+
expect(bundled_app("test-gem/test/minitest_helper.rb")).to exist
|
373
|
+
end
|
374
|
+
|
375
|
+
it "requires 'test/gem'" do
|
376
|
+
expect(bundled_app("test-gem/test/minitest_helper.rb").read).to match(/require 'test\/gem'/)
|
377
|
+
end
|
378
|
+
|
379
|
+
it "requires 'minitest_helper'" do
|
380
|
+
expect(bundled_app("test-gem/test/test_test/gem.rb").read).to match(/require 'minitest_helper'/)
|
381
|
+
end
|
382
|
+
|
383
|
+
it "creates a default test which fails" do
|
384
|
+
expect(bundled_app("test-gem/test/test_test/gem.rb").read).to match(/assert false/)
|
385
|
+
end
|
386
|
+
|
387
|
+
it "creates a default rake task to run the test suite" do
|
388
|
+
rakefile = strip_whitespace <<-RAKEFILE
|
389
|
+
require "bundler/gem_tasks"
|
390
|
+
require "rake/testtask"
|
391
|
+
|
392
|
+
Rake::TestTask.new(:test) do |t|
|
393
|
+
t.libs << "test"
|
394
|
+
end
|
395
|
+
|
396
|
+
task :default => :test
|
397
|
+
|
398
|
+
RAKEFILE
|
399
|
+
|
400
|
+
expect(bundled_app("test-gem/Rakefile").read).to eq(rakefile)
|
401
|
+
end
|
402
|
+
end
|
403
|
+
|
404
|
+
context "--test with no arguments" do
|
405
|
+
before do
|
406
|
+
reset!
|
407
|
+
in_app_root
|
408
|
+
bundle "gem #{gem_name} --test"
|
409
|
+
end
|
410
|
+
|
411
|
+
it "defaults to rspec" do
|
412
|
+
expect(bundled_app("test-gem/spec/spec_helper.rb")).to exist
|
413
|
+
expect(bundled_app("test-gem/test/minitest_helper.rb")).to_not exist
|
414
|
+
end
|
415
|
+
end
|
416
|
+
|
417
|
+
context "--ext parameter set" do
|
418
|
+
before do
|
419
|
+
reset!
|
420
|
+
in_app_root
|
421
|
+
bundle "gem test_gem --ext"
|
422
|
+
end
|
423
|
+
|
424
|
+
it "builds ext skeleton" do
|
425
|
+
expect(bundled_app("test_gem/ext/test_gem/extconf.rb")).to exist
|
426
|
+
expect(bundled_app("test_gem/ext/test_gem/test_gem.h")).to exist
|
427
|
+
expect(bundled_app("test_gem/ext/test_gem/test_gem.c")).to exist
|
428
|
+
end
|
429
|
+
|
430
|
+
it "includes rake-compiler" do
|
431
|
+
expect(bundled_app("test_gem/test_gem.gemspec").read).to include('spec.add_development_dependency "rake-compiler"')
|
432
|
+
end
|
433
|
+
|
434
|
+
it "depends on compile task for build" do
|
435
|
+
rakefile = strip_whitespace <<-RAKEFILE
|
436
|
+
require "bundler/gem_tasks"
|
437
|
+
|
438
|
+
require "rake/extensiontask"
|
439
|
+
|
440
|
+
task :build => :compile
|
441
|
+
|
442
|
+
Rake::ExtensionTask.new("test_gem") do |ext|
|
443
|
+
ext.lib_dir = "lib/test_gem"
|
444
|
+
end
|
445
|
+
RAKEFILE
|
446
|
+
|
447
|
+
expect(bundled_app("test_gem/Rakefile").read).to eq(rakefile)
|
448
|
+
end
|
449
|
+
end
|
450
|
+
end
|
451
|
+
end
|