Class: PuppetLibrary::Forge::GitRepository

Inherits:
Abstract
  • Object
show all
Defined in:
lib/puppet_library/forge/git_repository.rb

Instance Method Summary collapse

Methods inherited from Abstract

#collect_dependencies_versions, #get_module_buffer, #get_module_metadata, #get_module_metadata_with_dependencies, #retrieve_all_metadata, #retrieve_metadata, #search_modules

Constructor Details

#initialize(author, name, version_tag_regex, git_path) ⇒ GitRepository

Returns a new instance of GitRepository.



24
25
26
27
28
29
30
# File 'lib/puppet_library/forge/git_repository.rb', line 24

def initialize(author, name, version_tag_regex, git_path)
    super(self)
    @author = author
    @name = name
    @path = File.expand_path(git_path)
    @version_tag_regex = version_tag_regex
end

Instance Method Details

#get_all_metadataObject



57
58
59
# File 'lib/puppet_library/forge/git_repository.rb', line 57

def 
    (@author, @name)
end

#get_metadata(author, module_name) ⇒ Object



48
49
50
51
52
53
54
55
# File 'lib/puppet_library/forge/git_repository.rb', line 48

def (author, module_name)
    unless author == @author && module_name == @name
        return []
    end
    tags.map do |tag|
        modulefile_for_tag(tag).
    end
end

#get_module(author, name, version) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/puppet_library/forge/git_repository.rb', line 32

def get_module(author, name, version)
    unless author == @author && name == @name
        return nil
    end
    unless tags.include? tag_name(version)
        return nil
    end
    on_tag_for(version) do
        PuppetLibrary::Archive::Archiver.archive_dir(@path, "#{@author}-#{@name}-#{version}") do |archive|
            archive.add_file("metadata.json", 0644) do |entry|
                entry.write modulefile..to_json
            end
        end
    end
end