Class: Librarian::Source::Git::Repository
- Inherits:
-
Object
- Object
- Librarian::Source::Git::Repository
- Defined in:
- lib/librarian/puppet/source/git.rb
Instance Method Summary collapse
- #dependencies ⇒ Object
- #forge_source ⇒ Object
- #hash_from(remote, reference) ⇒ Object
-
#module_version ⇒ Object
Naming this method ‘version’ causes an exception to be raised.
- #modulefile ⇒ Object
- #modulefile? ⇒ Boolean
- #puppetfile? ⇒ Boolean
Instance Method Details
#dependencies ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/librarian/puppet/source/git.rb', line 28 def dependencies return {} unless modulefile? or puppetfile? if modulefile? = ::Puppet::ModuleTool::Metadata.new ::Puppet::ModuleTool::ModulefileReader.evaluate(, modulefile) .dependencies.map do |dependency| name = dependency.instance_variable_get(:@full_module_name) version = dependency.instance_variable_get(:@version_requirement) || ">=0" v = Librarian::Puppet::Requirement.new(version).gem_requirement Dependency.new(name, v, forge_source) end elsif puppetfile? Librarian::Puppet::Environment.new(:project_path => path).specfile.read.dependencies end end |
#forge_source ⇒ Object
59 60 61 |
# File 'lib/librarian/puppet/source/git.rb', line 59 def forge_source Librarian::Puppet::Source::Forge.(environment, :remote=>"http://forge.puppetlabs.com") end |
#hash_from(remote, reference) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/librarian/puppet/source/git.rb', line 8 def hash_from(remote, reference) branch_names = remote_branch_names[remote] if branch_names.include?(reference) reference = "#{remote}/#{reference}" end command = %W(rev-parse #{reference}^{commit} --quiet) run!(command, :chdir => true).strip end |
#module_version ⇒ Object
Naming this method ‘version’ causes an exception to be raised.
19 20 21 22 23 24 25 26 |
# File 'lib/librarian/puppet/source/git.rb', line 19 def module_version return '0.0.1' unless modulefile? = ::Puppet::ModuleTool::Metadata.new ::Puppet::ModuleTool::ModulefileReader.evaluate(, modulefile) .version end |
#modulefile ⇒ Object
47 48 49 |
# File 'lib/librarian/puppet/source/git.rb', line 47 def modulefile File.join(path, 'Modulefile') end |
#modulefile? ⇒ Boolean
51 52 53 |
# File 'lib/librarian/puppet/source/git.rb', line 51 def modulefile? File.exists?(modulefile) end |
#puppetfile? ⇒ Boolean
55 56 57 |
# File 'lib/librarian/puppet/source/git.rb', line 55 def puppetfile? File.exists?(File.join(path, 'Puppetfile')) end |