blob: 8382feb45eefd8c4f93a2e47a9663a581da10803 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
require 'yaml'
PRODUCTS = %W[ce ee omnibus runner charts debug].freeze
VERSION_FORMAT = /^(?<major>\d{1,2})\.(?<minor>\d{1,2})$/
def config
# Parse the config file and create a hash.
@config ||= YAML.load_file('./nanoc.yaml')
end
def products
return @products if defined?(@products)
# Pull products data from the config.
@products = PRODUCTS.each_with_object({}) do |key, result|
result[key] = config['products'][key]
end
end
def retrieve_branch(slug)
# If we're on a stable branch, catch the version and
# assign the product branches correctly.
if version = ENV["CI_COMMIT_REF_NAME"].match(VERSION_FORMAT)
case slug
when 'ee'
"#{version[:major]}-#{version[:minor]}-stable-ee"
when 'ce', 'omnibus', 'runner'
"#{version[:major]}-#{version[:minor]}-stable"
else
'master'
end
else
ENV.fetch("BRANCH_#{slug.upcase}", 'master')
end
end
def git_workdir_dirty?
status = `git status --porcelain`
!status.empty?
end
|