[DRE-commits] [librarian-puppet] 35/97: Fix Git dependency with :path attribute
Stig Sandbeck Mathisen
ssm at debian.org
Tue Mar 11 12:12:49 UTC 2014
This is an automated email from the git hooks/post-receive script.
ssm pushed a commit to branch master
in repository librarian-puppet.
commit b5186c88f4f4720329b8b6c1a2b43ca4bbcedebc
Author: Carlos Sanchez <csanchez at maestrodev.com>
Date: Wed Dec 11 12:06:51 2013 +0100
Fix Git dependency with :path attribute
Add fixture
---
features/install.feature | 13 +++++++
lib/librarian/puppet/source/git.rb | 70 ++++++++++++++++++++------------------
2 files changed, 49 insertions(+), 34 deletions(-)
diff --git a/features/install.feature b/features/install.feature
index 55b9be5..bf17686 100644
--- a/features/install.feature
+++ b/features/install.feature
@@ -196,3 +196,16 @@ Feature: cli/install
When I run `librarian-puppet install`
Then the exit status should be 1
And the output should contain "Could not resolve the dependencies"
+
+ @veryslow
+ Scenario: Install a module from git and using path
+ Given a file named "Puppetfile" with:
+ """
+ forge "http://forge.puppetlabs.com"
+
+ mod 'test', :git => 'https://github.com/rodjek/librarian-puppet.git', :path => 'features/examples/test'
+ """
+ When I run `librarian-puppet install`
+ Then the exit status should be 0
+ And the file "modules/test/Modulefile" should match /version *'0\.0\.1'/
+ And a file named "modules/stdlib/Modulefile" should exist
diff --git a/lib/librarian/puppet/source/git.rb b/lib/librarian/puppet/source/git.rb
index fe9a733..607f38d 100644
--- a/lib/librarian/puppet/source/git.rb
+++ b/lib/librarian/puppet/source/git.rb
@@ -14,38 +14,6 @@ module Librarian
command = %W(rev-parse #{reference}^{commit} --quiet)
run!(command, :chdir => true).strip
end
-
- # Naming this method 'version' causes an exception to be raised.
- def module_version
- return '0.0.1' unless modulefile?
-
- metadata = ::Puppet::ModuleTool::Metadata.new
- ::Puppet::ModuleTool::ModulefileReader.evaluate(metadata, modulefile)
-
- metadata.version
- end
-
- def dependencies
- return {} unless modulefile?
-
- metadata = ::Puppet::ModuleTool::Metadata.new
-
- ::Puppet::ModuleTool::ModulefileReader.evaluate(metadata, modulefile)
-
- metadata.dependencies.inject({}) do |h, dependency|
- name = dependency.instance_variable_get(:@full_module_name)
- version = dependency.instance_variable_get(:@version_requirement)
- h.update(name => version)
- end
- end
-
- def modulefile
- File.join(path, 'Modulefile')
- end
-
- def modulefile?
- File.exists?(modulefile)
- end
end
end
end
@@ -95,11 +63,11 @@ module Librarian
def fetch_version(name, extra)
cache!
found_path = found_path(name)
- repository.module_version
+ module_version
end
def fetch_dependencies(name, version, extra)
- repository.dependencies.map do |k, v|
+ dependencies.map do |k, v|
v = Requirement.new(v).gem_requirement
Dependency.new(k, v, forge_source)
end
@@ -109,6 +77,40 @@ module Librarian
Forge.from_lock_options(environment, :remote=>"http://forge.puppetlabs.com")
end
+ private
+
+ # Naming this method 'version' causes an exception to be raised.
+ def module_version
+ return '0.0.1' unless modulefile?
+
+ metadata = ::Puppet::ModuleTool::Metadata.new
+ ::Puppet::ModuleTool::ModulefileReader.evaluate(metadata, modulefile)
+
+ metadata.version
+ end
+
+ def dependencies
+ return {} unless modulefile?
+
+ metadata = ::Puppet::ModuleTool::Metadata.new
+
+ ::Puppet::ModuleTool::ModulefileReader.evaluate(metadata, modulefile)
+
+ metadata.dependencies.inject({}) do |h, dependency|
+ name = dependency.instance_variable_get(:@full_module_name)
+ version = dependency.instance_variable_get(:@version_requirement)
+ h.update(name => version)
+ end
+ end
+
+ def modulefile
+ File.join(filesystem_path, 'Modulefile')
+ end
+
+ def modulefile?
+ File.exists?(modulefile)
+ end
+
end
end
end
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/librarian-puppet.git
More information about the Pkg-ruby-extras-commits
mailing list