ctpl 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/VERSION +1 -1
- data/lib/ctpl/compiler.rb +8 -2
- data/thor/compile.thor +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 310e68e2ad2eb3420fad89c919676ce09eee04fc
|
4
|
+
data.tar.gz: a2be68184e06bbf74349603bff7b9709a20419c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2526b626c99d35562843692367ee53875443eff0bcd0a67cdb0c1005924222260be1fab9a260ff6a5cb01a0e87b8125b0381fbe50452d7f12249f097f220d711
|
7
|
+
data.tar.gz: f14a4259fbf045c369582e62cbf1b92fb9e30046ab880fd412e0bc0ec489cc026baa5f8dc62267e0b65b6da4964172cc9aa671a1342a8d655b99dd05196ec016
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.6
|
data/lib/ctpl/compiler.rb
CHANGED
@@ -3,22 +3,27 @@ require 'yaml'
|
|
3
3
|
class PipelineCompiler
|
4
4
|
include Thor::Shell
|
5
5
|
|
6
|
-
def initialize(mainPipelinePath, globalAliasesPath, partialsFolder)
|
6
|
+
def initialize(mainPipelinePath, globalAliasesPath, partialsFolder, verbose = false)
|
7
7
|
loadGlobalAliases(globalAliasesPath)
|
8
8
|
loadMainPipeline(mainPipelinePath)
|
9
9
|
loadPartials(partialsFolder)
|
10
|
+
@verbose = verbose
|
10
11
|
end
|
11
12
|
|
12
13
|
def merge
|
13
14
|
pipeline = {}
|
15
|
+
say_status 'ok', "Parsing main/global pipeline file", :white if @verbose
|
16
|
+
|
14
17
|
pipeline = parseToYaml(@mainPipeline) unless @mainPipeline == ""
|
15
18
|
|
16
19
|
# that is our one level merger for the special keys we support
|
17
20
|
@partials.each do |filename, partialContent|
|
18
|
-
say_status 'ok', "
|
21
|
+
say_status 'ok', "starting to handle partial: #{filename}", :white
|
19
22
|
partialAsHashmap = parseToYaml(partialContent)
|
20
23
|
|
24
|
+
say_status 'step', File.basename(filename, '.yaml') + ": merging hashmaps jobs, resources, types and groups", :white if @verbose
|
21
25
|
%w(jobs resources resource_types groups).each do |mergeKey|
|
26
|
+
say_status 'step', File.basename(filename, '.yaml') + ": merging #{mergeKey}", :white if @verbose
|
22
27
|
if partialAsHashmap.key?(mergeKey)
|
23
28
|
pipeline[mergeKey] = [] unless pipeline.key?(mergeKey)
|
24
29
|
pipeline[mergeKey].concat partialAsHashmap[mergeKey]
|
@@ -28,6 +33,7 @@ class PipelineCompiler
|
|
28
33
|
|
29
34
|
# now put all the others which should not be conflicting. We might do this manually per key to inform
|
30
35
|
# when we have conflicts .. since this will override existing keys
|
36
|
+
say_status 'step', File.basename(filename, '.yaml') + ": merging all the rest of the partial", :white if @verbose
|
31
37
|
pipeline.merge(partialAsHashmap)
|
32
38
|
end
|
33
39
|
|
data/thor/compile.thor
CHANGED
@@ -10,7 +10,7 @@ module Ctpl
|
|
10
10
|
method_option :output, :aliases => 'o', :required => false, :type => :string, :default => './pipeline.yaml', :desc => "Optional, defaults to pipeline.yaml. Output path to save the merged yaml in"
|
11
11
|
def compile
|
12
12
|
baseFolder = options[:basefolder]
|
13
|
-
merger = PipelineCompiler.new("#{baseFolder}/pipeline-template.yaml", "#{baseFolder}/aliases.yaml", baseFolder)
|
13
|
+
merger = PipelineCompiler.new("#{baseFolder}/pipeline-template.yaml", "#{baseFolder}/aliases.yaml", baseFolder, options[:verbose])
|
14
14
|
p = merger.merge
|
15
15
|
say_status 'ok', "Transforming back to yaml ", :white
|
16
16
|
yaml = "# DO NOT CHANGE THIS FILE\n# Generated by ctp (https://github.com/EugenMayer/concourse-pipeline-templateer)\n# See '#{baseFolder}' for the source files\n" + p.to_yaml
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ctpl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eugen Mayer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -64,7 +64,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
64
64
|
version: '0'
|
65
65
|
requirements: []
|
66
66
|
rubyforge_project:
|
67
|
-
rubygems_version: 2.
|
67
|
+
rubygems_version: 2.6.14.3
|
68
68
|
signing_key:
|
69
69
|
specification_version: 4
|
70
70
|
summary: Implements an opinionated tool to template / split concourse pipeline files
|