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,18 +0,0 @@
1
- require 'thread'
2
-
3
- require "bundler/parallel_workers/worker"
4
-
5
- module Bundler
6
- module ParallelWorkers
7
- autoload :UnixWorker, "bundler/parallel_workers/unix_worker"
8
- autoload :ThreadWorker, "bundler/parallel_workers/thread_worker"
9
-
10
- def self.worker_pool(size, job)
11
- if Bundler.current_ruby.mswin? || Bundler.current_ruby.jruby? || Bundler.current_ruby.rbx?
12
- ThreadWorker.new(size, job)
13
- else
14
- UnixWorker.new(size, job)
15
- end
16
- end
17
- end
18
- end
@@ -1,30 +0,0 @@
1
- module Bundler
2
- module ParallelWorkers
3
- class ThreadWorker < Worker
4
-
5
- private
6
-
7
- # On platforms where fork is not available
8
- # use Threads for parallely downloading gems
9
- #
10
- # @param size [Integer] Size of thread worker pool
11
- # @param func [Proc] Job to be run inside thread worker pool
12
- def prepare_workers(size, func)
13
- @threads = size.times.map do |i|
14
- Thread.start do
15
- loop do
16
- obj = @request_queue.deq
17
- break if obj.equal? POISON
18
- begin
19
- @response_queue.enq func.call(obj, i)
20
- rescue Exception => e
21
- @response_queue.enq(WrappedException.new(e))
22
- end
23
- end
24
- end
25
- end
26
- end
27
-
28
- end
29
- end
30
- end
@@ -1,101 +0,0 @@
1
- module Bundler
2
- module ParallelWorkers
3
- # UnixWorker is used only on platforms where fork is available. The way
4
- # this code works is, it forks a preconfigured number of workers and then
5
- # It starts preconfigured number of threads that write to the connected pipe.
6
- class UnixWorker < Worker
7
-
8
- class JobHandler < Struct.new(:pid, :io_r, :io_w)
9
- def work(obj)
10
- Marshal.dump obj, io_w
11
- Marshal.load io_r
12
- rescue IOError, Errno::EPIPE
13
- nil
14
- end
15
- end
16
-
17
- def initialize(size, job)
18
- # Close the persistent connections for the main thread before forking
19
- Net::HTTP::Persistent.new('bundler', :ENV).shutdown
20
- super
21
- end
22
-
23
- private
24
-
25
- # Start forked workers for downloading gems. This version of worker
26
- # is only used on platforms where fork is available.
27
- #
28
- # @param size [Integer] Size of worker pool
29
- # @param func [Proc] Job that should be executed in the worker
30
- def prepare_workers(size, func)
31
- @workers = size.times.map do |num|
32
- child_read, parent_write = IO.pipe
33
- parent_read, child_write = IO.pipe
34
-
35
- pid = Process.fork do
36
- begin
37
- parent_read.close
38
- parent_write.close
39
-
40
- while !child_read.eof?
41
- obj = Marshal.load child_read
42
- Marshal.dump func.call(obj, num), child_write
43
- end
44
- rescue Exception => e
45
- begin
46
- Marshal.dump WrappedException.new(e), child_write
47
- rescue Errno::EPIPE
48
- nil
49
- end
50
- ensure
51
- child_read.close
52
- child_write.close
53
- end
54
- end
55
-
56
- child_read.close
57
- child_write.close
58
- JobHandler.new pid, parent_read, parent_write
59
- end
60
- end
61
-
62
- # Start the threads whose job is basically to wait for incoming messages
63
- # on request queue and write that message to the connected pipe. Also retrieve
64
- # messages from child worker via connected pipe and write the message to response queue
65
- #
66
- # @param size [Integer] Number of threads to be started
67
- def prepare_threads(size)
68
- @threads = size.times.map do |i|
69
- Thread.start do
70
- worker = @workers[i]
71
- loop do
72
- obj = @request_queue.deq
73
- break if obj.equal? POISON
74
- @response_queue.enq worker.work(obj)
75
- end
76
- end
77
- end
78
- end
79
-
80
- # Kill the forked workers by sending SIGINT to them
81
- def stop_workers
82
- @workers.each do |worker|
83
- worker.io_r.close unless worker.io_r.closed?
84
- worker.io_w.close unless worker.io_w.closed?
85
- begin
86
- Process.kill :INT, worker.pid
87
- rescue Errno::ESRCH
88
- nil
89
- end
90
- end
91
- @workers.each do |worker|
92
- begin
93
- Process.waitpid worker.pid
94
- rescue Errno::ECHILD
95
- nil
96
- end
97
- end
98
- end
99
- end
100
- end
101
- end
@@ -1,69 +0,0 @@
1
- module Bundler
2
- module ParallelWorkers
3
- class Worker
4
- POISON = Object.new
5
-
6
- class WrappedException < StandardError
7
- attr_reader :exception
8
- def initialize(exn)
9
- @exception = exn
10
- end
11
- end
12
-
13
- # Creates a worker pool of specified size
14
- #
15
- # @param size [Integer] Size of pool
16
- # @param func [Proc] job to run in inside the worker pool
17
- def initialize(size, func)
18
- @request_queue = Queue.new
19
- @response_queue = Queue.new
20
- prepare_workers size, func
21
- prepare_threads size
22
- trap("INT") { @threads.each {|i| i.exit }; stop_workers; exit 1 }
23
- end
24
-
25
- # Enqueue a request to be executed in the worker pool
26
- #
27
- # @param obj [String] mostly it is name of spec that should be downloaded
28
- def enq(obj)
29
- @request_queue.enq obj
30
- end
31
-
32
- # Retrieves results of job function being executed in worker pool
33
- def deq
34
- result = @response_queue.deq
35
- if result.is_a?(WrappedException)
36
- raise result.exception
37
- end
38
- result
39
- end
40
-
41
- # Stop the forked workers and started threads
42
- def stop
43
- stop_threads
44
- stop_workers
45
- end
46
-
47
- private
48
- # Stop the worker threads by sending a poison object down the request queue
49
- # so as worker threads after retrieving it, shut themselves down
50
- def stop_threads
51
- @threads.each do
52
- @request_queue.enq POISON
53
- end
54
- @threads.each do |thread|
55
- thread.join
56
- end
57
- end
58
-
59
- # To be overridden by child classes
60
- def prepare_threads(size)
61
- end
62
-
63
- # To be overridden by child classes
64
- def stop_workers
65
- end
66
-
67
- end
68
- end
69
- end
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require '<%= config[:namespaced_path] %>'
@@ -1,32 +0,0 @@
1
- require 'spec_helper'
2
- require 'bundler/anonymizable_uri'
3
-
4
- describe Bundler::AnonymizableURI do
5
- let(:anonymizable_uri) { Bundler::AnonymizableURI.new(original_uri) }
6
-
7
- describe "#without_credentials" do
8
- context "when the original URI has no credentials" do
9
- let(:original_uri) { URI('https://rubygems.org') }
10
-
11
- it "returns the original URI" do
12
- expect(anonymizable_uri.without_credentials).to eq(original_uri)
13
- end
14
- end
15
-
16
- context "when the original URI has a username and password" do
17
- let(:original_uri) { URI("https://username:password@gems.example.com") }
18
-
19
- it "returns the URI without username and password" do
20
- expect(anonymizable_uri.without_credentials).to eq(URI("https://gems.example.com"))
21
- end
22
- end
23
-
24
- context "when the original URI has only a username" do
25
- let(:original_uri) { URI("https://SeCrEt-ToKeN@gem.fury.io/me/") }
26
-
27
- it "returns the URI without username and password" do
28
- expect(anonymizable_uri.without_credentials).to eq(URI("https://gem.fury.io/me/"))
29
- end
30
- end
31
- end
32
- end
@@ -1,72 +0,0 @@
1
- # encoding: utf-8
2
- require 'spec_helper'
3
- require 'bundler'
4
-
5
- describe Bundler do
6
- describe "#load_gemspec_uncached" do
7
- let(:app_gemspec_path) { tmp("test.gemspec") }
8
- subject { Bundler.load_gemspec_uncached(app_gemspec_path) }
9
-
10
- context "with incorrect YAML file" do
11
- before do
12
- File.open(app_gemspec_path, "wb") do |f|
13
- f.write strip_whitespace(<<-GEMSPEC)
14
- ---
15
- {:!00 ao=gu\g1= 7~f
16
- GEMSPEC
17
- end
18
- end
19
-
20
- it "catches YAML syntax errors" do
21
- expect { subject }.to raise_error(Bundler::GemspecError)
22
- end
23
-
24
- context "on Rubies with a settable YAML engine", :if => defined?(YAML::ENGINE) do
25
- context "with Syck as YAML::Engine" do
26
- it "raises a GemspecError after YAML load throws ArgumentError" do
27
- orig_yamler, YAML::ENGINE.yamler = YAML::ENGINE.yamler, 'syck'
28
-
29
- expect { subject }.to raise_error(Bundler::GemspecError)
30
-
31
- YAML::ENGINE.yamler = orig_yamler
32
- end
33
- end
34
-
35
- context "with Psych as YAML::Engine" do
36
- it "raises a GemspecError after YAML load throws Psych::SyntaxError" do
37
- orig_yamler, YAML::ENGINE.yamler = YAML::ENGINE.yamler, 'psych'
38
-
39
- expect { subject }.to raise_error(Bundler::GemspecError)
40
-
41
- YAML::ENGINE.yamler = orig_yamler
42
- end
43
- end
44
- end
45
- end
46
-
47
- context "with correct YAML file" do
48
- it "can load a gemspec with unicode characters with default ruby encoding" do
49
- # spec_helper forces the external encoding to UTF-8 but that's not the
50
- # ruby default.
51
- if defined?(Encoding)
52
- encoding = Encoding.default_external
53
- Encoding.default_external = "ASCII"
54
- end
55
-
56
- File.open(app_gemspec_path, "wb") do |file|
57
- file.puts <<-GEMSPEC.gsub(/^\s+/, '')
58
- # -*- encoding: utf-8 -*-
59
- Gem::Specification.new do |gem|
60
- gem.author = "André the Giant"
61
- end
62
- GEMSPEC
63
- end
64
-
65
- expect(subject.author).to eq("André the Giant")
66
-
67
- Encoding.default_external = encoding if defined?(Encoding)
68
- end
69
- end
70
-
71
- end
72
- end
@@ -1,16 +0,0 @@
1
- require 'spec_helper'
2
- require 'bundler/cli'
3
-
4
- describe "bundle executable" do
5
- let(:source_uri) { "http://localgemserver.test" }
6
-
7
- it "returns non-zero exit status when passed unrecognized options" do
8
- bundle '--invalid_argument', :exitstatus => true
9
- expect(exitstatus).to_not be_zero
10
- end
11
-
12
- it "returns non-zero exit status when passed unrecognized task" do
13
- bundle 'unrecognized-tast', :exitstatus => true
14
- expect(exitstatus).to_not be_zero
15
- end
16
- end
@@ -1,22 +0,0 @@
1
- require 'spec_helper'
2
- require 'bundler/definition'
3
-
4
- describe Bundler::Definition do
5
- before do
6
- allow(Bundler).to receive(:settings){ Bundler::Settings.new(".") }
7
- allow(Bundler).to receive(:default_gemfile){ Pathname.new("Gemfile") }
8
- end
9
-
10
- describe "#lock" do
11
- context "when it's not possible to write to the file" do
12
- subject{ Bundler::Definition.new(nil, [], Bundler::SourceList.new, []) }
13
-
14
- it "raises an InstallError with explanation" do
15
- expect(File).to receive(:open).with("Gemfile.lock", "wb").
16
- and_raise(Errno::EACCES)
17
- expect{ subject.lock("Gemfile.lock") }.
18
- to raise_error(Bundler::InstallError)
19
- end
20
- end
21
- end
22
- end
@@ -1,82 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Bundler::Dsl do
4
- before do
5
- @rubygems = double("rubygems")
6
- allow(Bundler::Source::Rubygems).to receive(:new){ @rubygems }
7
- end
8
-
9
- describe "#register_host" do
10
- it "registers custom hosts" do
11
- subject.git_source(:example){ |repo_name| "git@git.example.com:#{repo_name}.git" }
12
- subject.git_source(:foobar){ |repo_name| "git@foobar.com:#{repo_name}.git" }
13
- subject.gem("dobry-pies", :example => "strzalek/dobry-pies")
14
- example_uri = "git@git.example.com:strzalek/dobry-pies.git"
15
- expect(subject.dependencies.first.source.uri).to eq(example_uri)
16
- end
17
-
18
- it "raises expection on invalid hostname" do
19
- expect {
20
- subject.git_source(:group){ |repo_name| "git@git.example.com:#{repo_name}.git" }
21
- }.to raise_error(Bundler::InvalidOption)
22
- end
23
-
24
- it "expects block passed" do
25
- expect{ subject.git_source(:example) }.to raise_error(Bundler::InvalidOption)
26
- end
27
-
28
- context "default hosts (git, gist)" do
29
- it "converts :github to :git" do
30
- subject.gem("sparks", :github => "indirect/sparks")
31
- github_uri = "git://github.com/indirect/sparks.git"
32
- expect(subject.dependencies.first.source.uri).to eq(github_uri)
33
- end
34
-
35
- it "converts numeric :gist to :git" do
36
- subject.gem("not-really-a-gem", :gist => 2859988)
37
- github_uri = "https://gist.github.com/2859988.git"
38
- expect(subject.dependencies.first.source.uri).to eq(github_uri)
39
- end
40
-
41
- it "converts :gist to :git" do
42
- subject.gem("not-really-a-gem", :gist => "2859988")
43
- github_uri = "https://gist.github.com/2859988.git"
44
- expect(subject.dependencies.first.source.uri).to eq(github_uri)
45
- end
46
-
47
- it "converts 'rails' to 'rails/rails'" do
48
- subject.gem("rails", :github => "rails")
49
- github_uri = "git://github.com/rails/rails.git"
50
- expect(subject.dependencies.first.source.uri).to eq(github_uri)
51
- end
52
- end
53
- end
54
-
55
- describe "#method_missing" do
56
- it "raises an error for unknown DSL methods" do
57
- expect(Bundler).to receive(:read_file).with("Gemfile").
58
- and_return("unknown")
59
-
60
- error_msg = "Undefined local variable or method `unknown'" \
61
- " for Gemfile\\s+from Gemfile:1"
62
- expect { subject.eval_gemfile("Gemfile") }.
63
- to raise_error(Bundler::GemfileError, Regexp.new(error_msg))
64
- end
65
- end
66
-
67
- describe "#eval_gemfile" do
68
- it "handles syntax errors with a useful message" do
69
- expect(Bundler).to receive(:read_file).with("Gemfile").and_return("}")
70
- expect { subject.eval_gemfile("Gemfile") }.
71
- to raise_error(Bundler::GemfileError, /Gemfile syntax error/)
72
- end
73
- end
74
-
75
- describe "syntax errors" do
76
- it "will raise a Bundler::GemfileError" do
77
- gemfile "gem 'foo', :path => /unquoted/string/syntax/error"
78
- expect { Bundler::Dsl.evaluate(bundled_app("Gemfile"), nil, true) }.
79
- to raise_error(Bundler::GemfileError, /Gemfile syntax error/)
80
- end
81
- end
82
- end