Class: CiCd::Builder::Repo::Base
- Inherits:
-
Object
- Object
- CiCd::Builder::Repo::Base
- Extended by:
- Forwardable
- Defined in:
- lib/cicd/builder/mixlib/repo/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#builder ⇒ Object
readonly
Returns the value of attribute builder.
Instance Method Summary collapse
-
#getKey ⇒ Object
—————————————————————————————————————.
-
#initialize(builder) ⇒ Base
constructor
—————————————————————————————————————.
-
#initInventory ⇒ Object
—————————————————————————————————————.
-
#tempArtifactFile(name, data) ⇒ Object
—————————————————————————————————————.
Constructor Details
#initialize(builder) ⇒ Base
16 17 18 19 20 21 |
# File 'lib/cicd/builder/mixlib/repo/base.rb', line 16 def initialize(builder) @builder = builder @vars = vars() @logger = logger() = () end |
Instance Attribute Details
#builder ⇒ Object (readonly)
Returns the value of attribute builder.
11 12 13 |
# File 'lib/cicd/builder/mixlib/repo/base.rb', line 11 def builder @builder end |
Instance Method Details
#getKey ⇒ Object
24 25 26 |
# File 'lib/cicd/builder/mixlib/repo/base.rb', line 24 def getKey @builder.getKey # key = "#{@vars[:project_name]}/#{@vars[:variant]}/#{@vars[:build_nam]}/#{@vars[:build_mvn]}/#{@vars[:build_nmn]}" end |
#initInventory ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/cicd/builder/mixlib/repo/base.rb', line 38 def initInventory() hash = { id: "#{@vars[:project_name]}", # In case future generations introduce incompatible features gen: "#{@options[:gen]}", container: { artifacts: %w(assembly metainfo checksum), naming: '<product>-<major>.<minor>.<patch>-<branch>-release-<number>-build-<number>.<extension>', assembly: { extension: 'tar.gz', type: 'targz' }, metainfo: { extension: 'MANIFEST.json', type: 'json' }, checksum: { extension: 'checksum', type: 'Digest::SHA256' }, variants: { :"#{@vars[:variant]}" => { latest: { build: 0, branch: 0, version: 0, release: 0, }, versions: [ "#{@vars[:build_ver]}" ], branches: [ "#{@vars[:build_bra]}" ], builds: [ { drawer: @vars[:build_nam], build_name: @vars[:build_nmn], build_number: @vars[:build_num], release: @vars[:release], } ], } } } } artifacts = getArtifactsDefinition() naming = getNamingDefinition() # By default we use the internal definition ... if artifacts artifacts.each do |name,artifact| hash[:container][name] = artifact end end # By default we use the internal definition ... if naming hash[:container][:naming] = naming end JSON.pretty_generate( hash, { indent: "\t", space: ' '}) end |
#tempArtifactFile(name, data) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/cicd/builder/mixlib/repo/base.rb', line 29 def tempArtifactFile(name,data) io = Tempfile.new(name) data[:temp] = true io.write(data[:data]) io.close data[:file] = io.path end |