summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Gemfile21
-rw-r--r--lib/puppet/provider/vcsrepo/git.rb3
-rw-r--r--spec/unit/puppet/provider/vcsrepo/git_spec.rb2
3 files changed, 23 insertions, 3 deletions
diff --git a/Gemfile b/Gemfile
index 62c5693..e1ae0fa 100644
--- a/Gemfile
+++ b/Gemfile
@@ -1,5 +1,15 @@
source ENV['GEM_SOURCE'] || "https://rubygems.org"
+def location_for(place, fake_version = nil)
+ if place =~ /^(git:[^#]*)#(.*)/
+ [fake_version, { :git => $1, :branch => $2, :require => false }].compact
+ elsif place =~ /^file:\/\/(.*)/
+ ['>= 0', { :path => File.expand_path($1), :require => false }]
+ else
+ [place, { :require => false }]
+ end
+end
+
group :development, :unit_tests do
gem 'rake', :require => false
gem 'rspec-core', '3.1.7', :require => false
@@ -11,8 +21,17 @@ group :development, :unit_tests do
gem 'json', :require => false
end
+beaker_version = ENV['BEAKER_VERSION']
+beaker_rspec_version = ENV['BEAKER_RSPEC_VERSION']
group :system_tests do
- gem 'beaker-rspec', :require => false
+ if beaker_version
+ gem 'beaker', *location_for(beaker_version)
+ end
+ if beaker_rspec_version
+ gem 'beaker-rspec', *location_for(beaker_rspec_version)
+ else
+ gem 'beaker-rspec', :require => false
+ end
gem 'serverspec', :require => false
end
diff --git a/lib/puppet/provider/vcsrepo/git.rb b/lib/puppet/provider/vcsrepo/git.rb
index 9d3f7f3..000032e 100644
--- a/lib/puppet/provider/vcsrepo/git.rb
+++ b/lib/puppet/provider/vcsrepo/git.rb
@@ -142,7 +142,8 @@ Puppet::Type.type(:vcsrepo).provide(:git, :parent => Puppet::Provider::Vcsrepo)
# we loop around the hash. Otherwise, we assume single url specified
# in source property
if @resource.value(:source).is_a?(Hash)
- @resource.value(:source).each do |remote_name, remote_url|
+ @resource.value(:source).keys.sort.each do |remote_name|
+ remote_url = @resource.value(:source)[remote_name]
at_path { do_update |= update_remote_url(remote_name, remote_url) }
end
else
diff --git a/spec/unit/puppet/provider/vcsrepo/git_spec.rb b/spec/unit/puppet/provider/vcsrepo/git_spec.rb
index d0153a1..d33c98a 100644
--- a/spec/unit/puppet/provider/vcsrepo/git_spec.rb
+++ b/spec/unit/puppet/provider/vcsrepo/git_spec.rb
@@ -263,7 +263,7 @@ branches
context "when multiple sources are modified" do
it "should update the urls" do
resource[:source] = {"origin" => "git://git@foo.com/bar.git", "new_remote" => "git://git@foo.com/baz.git"}
- provider.expects(:git).at_least_once.with('config', '-l').returns("remote.origin.url=git://git@foo.com/foo.git\n", "remote.origin.url=git://git@foo.com/bar.git\n")
+ provider.expects(:git).at_least_once.with('config', '-l').returns("remote.origin.url=git://git@foo.com/bar.git\n", "remote.origin.url=git://git@foo.com/foo.git\n")
provider.expects(:git).with('remote', 'set-url', 'origin', 'git://git@foo.com/bar.git')
provider.expects(:git).with('remote', 'add', 'new_remote', 'git://git@foo.com/baz.git')
provider.expects(:git).with('remote','update')