bundler 1.7.15 → 1.8.0.pre

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.

Files changed (191) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +5 -14
  3. data/.rspec +1 -0
  4. data/.travis.yml +22 -15
  5. data/CHANGELOG.md +43 -13
  6. data/CODE_OF_CONDUCT.md +40 -0
  7. data/CONTRIBUTING.md +14 -12
  8. data/DEVELOPMENT.md +4 -2
  9. data/ISSUES.md +1 -1
  10. data/README.md +10 -14
  11. data/Rakefile +10 -10
  12. data/bin/bundle +1 -1
  13. data/bundler.gemspec +5 -4
  14. data/lib/bundler.rb +22 -3
  15. data/lib/bundler/anonymizable_uri.rb +24 -8
  16. data/lib/bundler/cli.rb +103 -66
  17. data/lib/bundler/cli/cache.rb +1 -0
  18. data/lib/bundler/cli/clean.rb +11 -4
  19. data/lib/bundler/cli/common.rb +2 -0
  20. data/lib/bundler/cli/console.rb +22 -26
  21. data/lib/bundler/cli/exec.rb +29 -22
  22. data/lib/bundler/cli/gem.rb +125 -37
  23. data/lib/bundler/cli/install.rb +22 -9
  24. data/lib/bundler/cli/outdated.rb +1 -1
  25. data/lib/bundler/cli/package.rb +8 -1
  26. data/lib/bundler/cli/show.rb +29 -3
  27. data/lib/bundler/cli/update.rb +2 -2
  28. data/lib/bundler/cli/viz.rb +1 -1
  29. data/lib/bundler/definition.rb +14 -22
  30. data/lib/bundler/dependency.rb +8 -1
  31. data/lib/bundler/dsl.rb +17 -4
  32. data/lib/bundler/endpoint_specification.rb +1 -1
  33. data/lib/bundler/env.rb +44 -25
  34. data/lib/bundler/fetcher.rb +33 -25
  35. data/lib/bundler/friendly_errors.rb +38 -5
  36. data/lib/bundler/gem_helper.rb +16 -10
  37. data/lib/bundler/gem_helpers.rb +1 -0
  38. data/lib/bundler/graph.rb +4 -1
  39. data/lib/bundler/index.rb +15 -25
  40. data/lib/bundler/installer.rb +6 -6
  41. data/lib/bundler/lockfile_parser.rb +7 -7
  42. data/lib/bundler/resolver.rb +2 -1
  43. data/lib/bundler/ruby_version.rb +1 -1
  44. data/lib/bundler/rubygems_ext.rb +1 -0
  45. data/lib/bundler/rubygems_integration.rb +1 -1
  46. data/lib/bundler/runtime.rb +22 -40
  47. data/lib/bundler/settings.rb +14 -5
  48. data/lib/bundler/setup.rb +2 -1
  49. data/lib/bundler/shared_helpers.rb +56 -4
  50. data/lib/bundler/source.rb +8 -9
  51. data/lib/bundler/source/git.rb +5 -1
  52. data/lib/bundler/source/git/git_proxy.rb +4 -0
  53. data/lib/bundler/source/path.rb +8 -11
  54. data/lib/bundler/source/path/installer.rb +0 -2
  55. data/lib/bundler/source/rubygems.rb +58 -72
  56. data/lib/bundler/templates/newgem/CODE_OF_CONDUCT.md.tt +13 -0
  57. data/lib/bundler/templates/newgem/LICENSE.txt.tt +17 -18
  58. data/lib/bundler/templates/newgem/README.md.tt +9 -1
  59. data/lib/bundler/templates/newgem/Rakefile.tt +2 -0
  60. data/lib/bundler/templates/newgem/bin/console.tt +14 -0
  61. data/lib/bundler/templates/newgem/bin/setup.tt +7 -0
  62. data/lib/bundler/templates/newgem/exe/newgem.tt +3 -0
  63. data/lib/bundler/templates/newgem/gitignore.tt +2 -0
  64. data/lib/bundler/templates/newgem/lib/newgem/version.rb.tt +1 -1
  65. data/lib/bundler/templates/newgem/newgem.gemspec.tt +17 -13
  66. data/lib/bundler/templates/newgem/test/test_newgem.rb.tt +1 -1
  67. data/lib/bundler/ui/shell.rb +1 -1
  68. data/lib/bundler/version.rb +1 -1
  69. data/lib/bundler/worker.rb +73 -0
  70. data/man/bundle-config.ronn +17 -15
  71. data/man/bundle-install.ronn +102 -93
  72. data/man/bundle-update.ronn +39 -30
  73. data/man/bundle.ronn +6 -0
  74. data/man/gemfile.5.ronn +74 -13
  75. metadata +10 -231
  76. data/lib/bundler/parallel_workers.rb +0 -18
  77. data/lib/bundler/parallel_workers/thread_worker.rb +0 -30
  78. data/lib/bundler/parallel_workers/unix_worker.rb +0 -101
  79. data/lib/bundler/parallel_workers/worker.rb +0 -69
  80. data/lib/bundler/templates/newgem/bin/newgem.tt +0 -3
  81. data/spec/bundler/anonymizable_uri_spec.rb +0 -32
  82. data/spec/bundler/bundler_spec.rb +0 -72
  83. data/spec/bundler/cli_spec.rb +0 -16
  84. data/spec/bundler/definition_spec.rb +0 -22
  85. data/spec/bundler/dsl_spec.rb +0 -82
  86. data/spec/bundler/friendly_errors_spec.rb +0 -13
  87. data/spec/bundler/gem_helper_spec.rb +0 -226
  88. data/spec/bundler/psyched_yaml_spec.rb +0 -8
  89. data/spec/bundler/retry_spec.rb +0 -59
  90. data/spec/bundler/settings_spec.rb +0 -13
  91. data/spec/bundler/source/rubygems_spec.rb +0 -25
  92. data/spec/bundler/source_list_spec.rb +0 -361
  93. data/spec/cache/gems_spec.rb +0 -284
  94. data/spec/cache/git_spec.rb +0 -188
  95. data/spec/cache/path_spec.rb +0 -121
  96. data/spec/cache/platform_spec.rb +0 -57
  97. data/spec/commands/binstubs_spec.rb +0 -219
  98. data/spec/commands/check_spec.rb +0 -278
  99. data/spec/commands/clean_spec.rb +0 -592
  100. data/spec/commands/config_spec.rb +0 -263
  101. data/spec/commands/console_spec.rb +0 -76
  102. data/spec/commands/exec_spec.rb +0 -309
  103. data/spec/commands/help_spec.rb +0 -39
  104. data/spec/commands/init_spec.rb +0 -39
  105. data/spec/commands/inject_spec.rb +0 -78
  106. data/spec/commands/licenses_spec.rb +0 -18
  107. data/spec/commands/newgem_spec.rb +0 -428
  108. data/spec/commands/open_spec.rb +0 -68
  109. data/spec/commands/outdated_spec.rb +0 -156
  110. data/spec/commands/package_spec.rb +0 -114
  111. data/spec/commands/show_spec.rb +0 -125
  112. data/spec/install/binstubs_spec.rb +0 -24
  113. data/spec/install/bundler_spec.rb +0 -146
  114. data/spec/install/deploy_spec.rb +0 -250
  115. data/spec/install/gemfile/gemspec_spec.rb +0 -170
  116. data/spec/install/gemfile/git_spec.rb +0 -967
  117. data/spec/install/gemfile/path_spec.rb +0 -500
  118. data/spec/install/gemfile_spec.rb +0 -44
  119. data/spec/install/gems/c_ext_spec.rb +0 -48
  120. data/spec/install/gems/dependency_api_spec.rb +0 -652
  121. data/spec/install/gems/env_spec.rb +0 -107
  122. data/spec/install/gems/flex_spec.rb +0 -314
  123. data/spec/install/gems/groups_spec.rb +0 -308
  124. data/spec/install/gems/mirror_spec.rb +0 -39
  125. data/spec/install/gems/platform_spec.rb +0 -195
  126. data/spec/install/gems/post_install_spec.rb +0 -121
  127. data/spec/install/gems/resolving_spec.rb +0 -124
  128. data/spec/install/gems/simple_case_spec.rb +0 -377
  129. data/spec/install/gems/sources_spec.rb +0 -386
  130. data/spec/install/gems/standalone_spec.rb +0 -260
  131. data/spec/install/gems/sudo_spec.rb +0 -136
  132. data/spec/install/gems/win32_spec.rb +0 -26
  133. data/spec/install/gemspecs_spec.rb +0 -50
  134. data/spec/install/path_spec.rb +0 -150
  135. data/spec/install/post_bundle_message_spec.rb +0 -142
  136. data/spec/install/prereleases_spec.rb +0 -43
  137. data/spec/install/security_policy_spec.rb +0 -77
  138. data/spec/install/upgrade_spec.rb +0 -26
  139. data/spec/lock/git_spec.rb +0 -34
  140. data/spec/lock/lockfile_spec.rb +0 -924
  141. data/spec/other/bundle_ruby_spec.rb +0 -142
  142. data/spec/other/cli_dispatch_spec.rb +0 -21
  143. data/spec/other/ext_spec.rb +0 -60
  144. data/spec/other/platform_spec.rb +0 -1285
  145. data/spec/other/ssl_cert_spec.rb +0 -23
  146. data/spec/quality_spec.rb +0 -88
  147. data/spec/realworld/dependency_api_spec.rb +0 -60
  148. data/spec/realworld/edgecases_spec.rb +0 -212
  149. data/spec/realworld/parallel_spec.rb +0 -71
  150. data/spec/resolver/basic_spec.rb +0 -66
  151. data/spec/resolver/platform_spec.rb +0 -88
  152. data/spec/runtime/executable_spec.rb +0 -149
  153. data/spec/runtime/load_spec.rb +0 -107
  154. data/spec/runtime/platform_spec.rb +0 -90
  155. data/spec/runtime/require_spec.rb +0 -332
  156. data/spec/runtime/setup_spec.rb +0 -853
  157. data/spec/runtime/with_clean_env_spec.rb +0 -91
  158. data/spec/spec_helper.rb +0 -123
  159. data/spec/support/artifice/endopint_marshal_fail_basic_authentication.rb +0 -13
  160. data/spec/support/artifice/endpoint.rb +0 -71
  161. data/spec/support/artifice/endpoint_500.rb +0 -37
  162. data/spec/support/artifice/endpoint_api_forbidden.rb +0 -11
  163. data/spec/support/artifice/endpoint_api_missing.rb +0 -16
  164. data/spec/support/artifice/endpoint_basic_authentication.rb +0 -13
  165. data/spec/support/artifice/endpoint_creds_diff_host.rb +0 -38
  166. data/spec/support/artifice/endpoint_extra.rb +0 -31
  167. data/spec/support/artifice/endpoint_extra_api.rb +0 -32
  168. data/spec/support/artifice/endpoint_extra_missing.rb +0 -15
  169. data/spec/support/artifice/endpoint_fallback.rb +0 -17
  170. data/spec/support/artifice/endpoint_host_redirect.rb +0 -15
  171. data/spec/support/artifice/endpoint_marshal_fail.rb +0 -11
  172. data/spec/support/artifice/endpoint_redirect.rb +0 -15
  173. data/spec/support/artifice/endpoint_strict_basic_authentication.rb +0 -18
  174. data/spec/support/artifice/endpoint_timeout.rb +0 -13
  175. data/spec/support/builders.rb +0 -693
  176. data/spec/support/fakeweb/rack-1.0.0.marshal +0 -2
  177. data/spec/support/fakeweb/windows.rb +0 -23
  178. data/spec/support/hax.rb +0 -22
  179. data/spec/support/helpers.rb +0 -361
  180. data/spec/support/indexes.rb +0 -280
  181. data/spec/support/matchers.rb +0 -77
  182. data/spec/support/path.rb +0 -85
  183. data/spec/support/permissions.rb +0 -10
  184. data/spec/support/platforms.rb +0 -94
  185. data/spec/support/ruby_ext.rb +0 -20
  186. data/spec/support/rubygems_ext.rb +0 -39
  187. data/spec/support/streams.rb +0 -13
  188. data/spec/support/sudo.rb +0 -16
  189. data/spec/update/gems_spec.rb +0 -201
  190. data/spec/update/git_spec.rb +0 -283
  191. data/spec/update/path_spec.rb +0 -18
@@ -1,39 +0,0 @@
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
@@ -1,39 +0,0 @@
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
@@ -1,78 +0,0 @@
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
@@ -1,18 +0,0 @@
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
- end
@@ -1,428 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe "bundle gem" do
4
- def reset!
5
- super
6
- global_config "BUNDLE_GEM__MIT" => "false", "BUNDLE_GEM__TEST" => "false", "BUNDLE_GEM__COC" => "false"
7
- end
8
-
9
- before do
10
- @git_name = `git config --global user.name`.chomp
11
- `git config --global user.name "Bundler User"`
12
- @git_email = `git config --global user.email`.chomp
13
- `git config --global user.email user@example.com`
14
- end
15
-
16
- after do
17
- `git config --global user.name "#{@git_name}"`
18
- `git config --global user.email #{@git_email}`
19
- end
20
-
21
- shared_examples_for "git config is present" do
22
- context "git config user.{name,email} present" do
23
- it "sets gemspec author to git user.name if available" do
24
- expect(generated_gem.gemspec.authors.first).to eq("Bundler User")
25
- end
26
-
27
- it "sets gemspec email to git user.email if available" do
28
- expect(generated_gem.gemspec.email.first).to eq("user@example.com")
29
- end
30
- end
31
- end
32
-
33
- shared_examples_for "git config is absent" do |hoge|
34
- it "sets gemspec author to default message if git user.name is not set or empty" do
35
- expect(generated_gem.gemspec.authors.first).to eq("TODO: Write your name")
36
- end
37
-
38
- it "sets gemspec email to default message if git user.email is not set or empty" do
39
- expect(generated_gem.gemspec.email.first).to eq("TODO: Write your email address")
40
- end
41
- end
42
-
43
- context "gem naming with underscore" do
44
- let(:gem_name) { 'test_gem' }
45
-
46
- before do
47
- bundle "gem #{gem_name}"
48
- # reset gemspec cache for each test because of commit 3d4163a
49
- Bundler.clear_gemspec_cache
50
- end
51
-
52
- let(:generated_gem) { Bundler::GemHelper.new(bundled_app(gem_name).to_s) }
53
-
54
- it "generates a gem skeleton" do
55
- expect(bundled_app("test_gem/test_gem.gemspec")).to exist
56
- expect(bundled_app("test_gem/LICENSE.txt")).to exist
57
- expect(bundled_app("test_gem/Gemfile")).to exist
58
- expect(bundled_app("test_gem/Rakefile")).to exist
59
- expect(bundled_app("test_gem/lib/test_gem.rb")).to exist
60
- expect(bundled_app("test_gem/lib/test_gem/version.rb")).to exist
61
- end
62
-
63
- it "starts with version 0.0.1" do
64
- expect(bundled_app("test_gem/lib/test_gem/version.rb").read).to match(/VERSION = "0.0.1"/)
65
- end
66
-
67
- it "does not nest constants" do
68
- expect(bundled_app("test_gem/lib/test_gem/version.rb").read).to match(/module TestGem/)
69
- expect(bundled_app("test_gem/lib/test_gem.rb").read).to match(/module TestGem/)
70
- end
71
-
72
- it_should_behave_like "git config is present"
73
-
74
- context "git config user.{name,email} is not set" do
75
- before do
76
- `git config --global --unset user.name`
77
- `git config --global --unset user.email`
78
- reset!
79
- in_app_root
80
- bundle "gem #{gem_name}"
81
- end
82
-
83
- it_should_behave_like "git config is absent"
84
- end
85
-
86
- it "sets gemspec license to MIT by default" do
87
- expect(generated_gem.gemspec.license).to eq("MIT")
88
- end
89
-
90
- it "requires the version file" do
91
- expect(bundled_app("test_gem/lib/test_gem.rb").read).to match(/require "test_gem\/version"/)
92
- end
93
-
94
- it "runs rake without problems" do
95
- system_gems ["rake-10.0.2"]
96
-
97
- rakefile = strip_whitespace <<-RAKEFILE
98
- task :default do
99
- puts 'SUCCESS'
100
- end
101
- RAKEFILE
102
- File.open(bundled_app("test_gem/Rakefile"), 'w') do |file|
103
- file.puts rakefile
104
- end
105
-
106
- Dir.chdir(bundled_app(gem_name)) do
107
- sys_exec("rake")
108
- expect(out).to include("SUCCESS")
109
- end
110
- end
111
-
112
- context "--bin parameter set" do
113
- before do
114
- reset!
115
- in_app_root
116
- bundle "gem #{gem_name} --bin"
117
- end
118
-
119
- it "builds bin skeleton" do
120
- expect(bundled_app("test_gem/bin/test_gem")).to exist
121
- end
122
-
123
- it "requires 'test-gem'" do
124
- expect(bundled_app("test_gem/bin/test_gem").read).to match(/require 'test_gem'/)
125
- end
126
- end
127
-
128
- context "no --test parameter" do
129
- before do
130
- reset!
131
- in_app_root
132
- bundle "gem #{gem_name}"
133
- end
134
-
135
- it "doesn't create any spec/test file" do
136
- expect(bundled_app("test_gem/.rspec")).to_not exist
137
- expect(bundled_app("test_gem/spec/test_gem_spec.rb")).to_not exist
138
- expect(bundled_app("test_gem/spec/spec_helper.rb")).to_not exist
139
- expect(bundled_app("test_gem/test/test_test_gem.rb")).to_not exist
140
- expect(bundled_app("test_gem/test/minitest_helper.rb")).to_not exist
141
- end
142
- end
143
-
144
- context "--test parameter set to rspec" do
145
- before do
146
- reset!
147
- in_app_root
148
- bundle "gem #{gem_name} --test=rspec"
149
- end
150
-
151
- it "builds spec skeleton" do
152
- expect(bundled_app("test_gem/.rspec")).to exist
153
- expect(bundled_app("test_gem/spec/test_gem_spec.rb")).to exist
154
- expect(bundled_app("test_gem/spec/spec_helper.rb")).to exist
155
- end
156
-
157
- it "requires 'test-gem'" do
158
- expect(bundled_app("test_gem/spec/spec_helper.rb").read).to include("require 'test_gem'")
159
- end
160
-
161
- it "creates a default test which fails" do
162
- expect(bundled_app("test_gem/spec/test_gem_spec.rb").read).to include("expect(false).to eq(true)")
163
- end
164
- end
165
-
166
- context "--test parameter set to minitest" do
167
- before do
168
- reset!
169
- in_app_root
170
- bundle "gem #{gem_name} --test=minitest"
171
- end
172
-
173
- it "builds spec skeleton" do
174
- expect(bundled_app("test_gem/test/test_test_gem.rb")).to exist
175
- expect(bundled_app("test_gem/test/minitest_helper.rb")).to exist
176
- end
177
-
178
- it "requires 'test-gem'" do
179
- expect(bundled_app("test_gem/test/minitest_helper.rb").read).to include("require 'test_gem'")
180
- end
181
-
182
- it "requires 'minitest_helper'" do
183
- expect(bundled_app("test_gem/test/test_test_gem.rb").read).to include("require 'minitest_helper'")
184
- end
185
-
186
- it "creates a default test which fails" do
187
- expect(bundled_app("test_gem/test/test_test_gem.rb").read).to include("assert false")
188
- end
189
- end
190
-
191
- context "--test with no arguments" do
192
- before do
193
- reset!
194
- in_app_root
195
- bundle "gem #{gem_name} --test"
196
- end
197
-
198
- it "defaults to rspec" do
199
- expect(bundled_app("test_gem/spec/spec_helper.rb")).to exist
200
- expect(bundled_app("test_gem/test/minitest_helper.rb")).to_not exist
201
- end
202
-
203
- it "creates a .travis.yml file to test the library against the current Ruby version on Travis CI" do
204
- expect(bundled_app("test_gem/.travis.yml").read).to match(%r(- #{RUBY_VERSION}))
205
- end
206
- end
207
-
208
- context "--edit option" do
209
- it "opens the generated gemspec in the user's text editor" do
210
- reset!
211
- in_app_root
212
- output = bundle "gem #{gem_name} --edit=echo"
213
- gemspec_path = File.join(Dir.pwd, gem_name, "#{gem_name}.gemspec")
214
- expect(output).to include("echo \"#{gemspec_path}\"")
215
- end
216
- end
217
- end
218
-
219
- context "gem naming with dashed" do
220
- let(:gem_name) { 'test-gem' }
221
-
222
- before do
223
- bundle "gem #{gem_name}"
224
- # reset gemspec cache for each test because of commit 3d4163a
225
- Bundler.clear_gemspec_cache
226
- end
227
-
228
- let(:generated_gem) { Bundler::GemHelper.new(bundled_app(gem_name).to_s) }
229
-
230
- it "generates a gem skeleton" do
231
- expect(bundled_app("test-gem/test-gem.gemspec")).to exist
232
- expect(bundled_app("test-gem/LICENSE.txt")).to exist
233
- expect(bundled_app("test-gem/Gemfile")).to exist
234
- expect(bundled_app("test-gem/Rakefile")).to exist
235
- expect(bundled_app("test-gem/lib/test/gem.rb")).to exist
236
- expect(bundled_app("test-gem/lib/test/gem/version.rb")).to exist
237
- end
238
-
239
- it "starts with version 0.0.1" do
240
- expect(bundled_app("test-gem/lib/test/gem/version.rb").read).to match(/VERSION = "0.0.1"/)
241
- end
242
-
243
- it "nests constants so they work" do
244
- expect(bundled_app("test-gem/lib/test/gem/version.rb").read).to match(/module Test\n module Gem/)
245
- expect(bundled_app("test-gem/lib/test/gem.rb").read).to match(/module Test\n module Gem/)
246
- end
247
-
248
- it_should_behave_like "git config is present"
249
-
250
- context "git config user.{name,email} is not set" do
251
- before do
252
- `git config --global --unset user.name`
253
- `git config --global --unset user.email`
254
- reset!
255
- in_app_root
256
- bundle "gem #{gem_name}"
257
- end
258
-
259
- it_should_behave_like "git config is absent"
260
- end
261
-
262
- it "sets gemspec license to MIT by default" do
263
- expect(generated_gem.gemspec.license).to eq("MIT")
264
- end
265
-
266
- it "requires the version file" do
267
- expect(bundled_app("test-gem/lib/test/gem.rb").read).to match(/require "test\/gem\/version"/)
268
- end
269
-
270
- it "runs rake without problems" do
271
- system_gems ["rake-10.0.2"]
272
-
273
- rakefile = strip_whitespace <<-RAKEFILE
274
- task :default do
275
- puts 'SUCCESS'
276
- end
277
- RAKEFILE
278
- File.open(bundled_app("test-gem/Rakefile"), 'w') do |file|
279
- file.puts rakefile
280
- end
281
-
282
- Dir.chdir(bundled_app(gem_name)) do
283
- sys_exec("rake")
284
- expect(out).to include("SUCCESS")
285
- end
286
- end
287
-
288
- context "--bin parameter set" do
289
- before do
290
- reset!
291
- in_app_root
292
- bundle "gem #{gem_name} --bin"
293
- end
294
-
295
- it "builds bin skeleton" do
296
- expect(bundled_app("test-gem/bin/test-gem")).to exist
297
- end
298
-
299
- it "requires 'test/gem'" do
300
- expect(bundled_app("test-gem/bin/test-gem").read).to match(/require 'test\/gem'/)
301
- end
302
- end
303
-
304
- context "no --test parameter" do
305
- before do
306
- reset!
307
- in_app_root
308
- bundle "gem #{gem_name}"
309
- end
310
-
311
- it "doesn't create any spec/test file" do
312
- expect(bundled_app("test-gem/.rspec")).to_not exist
313
- expect(bundled_app("test-gem/spec/test/gem_spec.rb")).to_not exist
314
- expect(bundled_app("test-gem/spec/spec_helper.rb")).to_not exist
315
- expect(bundled_app("test-gem/test/test_test/gem.rb")).to_not exist
316
- expect(bundled_app("test-gem/test/minitest_helper.rb")).to_not exist
317
- end
318
- end
319
-
320
- context "--test parameter set to rspec" do
321
- before do
322
- reset!
323
- in_app_root
324
- bundle "gem #{gem_name} --test=rspec"
325
- end
326
-
327
- it "builds spec skeleton" do
328
- expect(bundled_app("test-gem/.rspec")).to exist
329
- expect(bundled_app("test-gem/spec/test/gem_spec.rb")).to exist
330
- expect(bundled_app("test-gem/spec/spec_helper.rb")).to exist
331
- end
332
-
333
- it "requires 'test/gem'" do
334
- expect(bundled_app("test-gem/spec/spec_helper.rb").read).to include("require 'test/gem'")
335
- end
336
-
337
- it "creates a default test which fails" do
338
- expect(bundled_app("test-gem/spec/test/gem_spec.rb").read).to include("expect(false).to eq(true)")
339
- end
340
-
341
- it "creates a default rake task to run the specs" do
342
- rakefile = strip_whitespace <<-RAKEFILE
343
- require "bundler/gem_tasks"
344
- require "rspec/core/rake_task"
345
-
346
- RSpec::Core::RakeTask.new(:spec)
347
-
348
- task :default => :spec
349
-
350
- RAKEFILE
351
-
352
- expect(bundled_app("test-gem/Rakefile").read).to eq(rakefile)
353
- end
354
- end
355
-
356
- context "--test parameter set to minitest" do
357
- before do
358
- reset!
359
- in_app_root
360
- bundle "gem #{gem_name} --test=minitest"
361
- end
362
-
363
- it "builds spec skeleton" do
364
- expect(bundled_app("test-gem/test/test_test/gem.rb")).to exist
365
- expect(bundled_app("test-gem/test/minitest_helper.rb")).to exist
366
- end
367
-
368
- it "requires 'test/gem'" do
369
- expect(bundled_app("test-gem/test/minitest_helper.rb").read).to match(/require 'test\/gem'/)
370
- end
371
-
372
- it "requires 'minitest_helper'" do
373
- expect(bundled_app("test-gem/test/test_test/gem.rb").read).to match(/require 'minitest_helper'/)
374
- end
375
-
376
- it "creates a default test which fails" do
377
- expect(bundled_app("test-gem/test/test_test/gem.rb").read).to match(/assert false/)
378
- end
379
-
380
- it "creates a default rake task to run the test suite" do
381
- rakefile = strip_whitespace <<-RAKEFILE
382
- require "bundler/gem_tasks"
383
- require "rake/testtask"
384
-
385
- Rake::TestTask.new(:test) do |t|
386
- t.libs << "test"
387
- end
388
-
389
- task :default => :test
390
-
391
- RAKEFILE
392
-
393
- expect(bundled_app("test-gem/Rakefile").read).to eq(rakefile)
394
- end
395
- end
396
-
397
- context "--test with no arguments" do
398
- before do
399
- reset!
400
- in_app_root
401
- bundle "gem #{gem_name} --test"
402
- end
403
-
404
- it "defaults to rspec" do
405
- expect(bundled_app("test-gem/spec/spec_helper.rb")).to exist
406
- expect(bundled_app("test-gem/test/minitest_helper.rb")).to_not exist
407
- end
408
- end
409
-
410
- context "--ext parameter set" do
411
- before do
412
- reset!
413
- in_app_root
414
- bundle "gem test_gem --ext"
415
- end
416
-
417
- it "builds ext skeleton" do
418
- expect(bundled_app("test_gem/ext/test_gem/extconf.rb")).to exist
419
- expect(bundled_app("test_gem/ext/test_gem/test_gem.h")).to exist
420
- expect(bundled_app("test_gem/ext/test_gem/test_gem.c")).to exist
421
- end
422
-
423
- it "includes rake-compiler" do
424
- expect(bundled_app("test_gem/test_gem.gemspec").read).to include('spec.add_development_dependency "rake-compiler"')
425
- end
426
- end
427
- end
428
- end