ufo 3.5.2 → 3.5.3
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 +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +4 -4
- data/lib/ufo/docker/builder.rb +5 -1
- data/lib/ufo/dsl/task_definition.rb +44 -3
- data/lib/ufo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7338b5ba4ca3bb5d26dfa18ee50dba6f8ecd3d45834bcd89d8d3053811c28c78
|
4
|
+
data.tar.gz: a5d9590cc34d8a7929f1bb68ffebfb6e8625e2a6c55fa079d94a0393b864a882
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c4e12cd02e469e89cb2a514a3e377d3c60f16f99cd29ab32dc8ce5c5e03a9d8a215b9fdcaa98e10e4151234d6a9169e97a4a0ec62e63b51a1f181b5711c4904
|
7
|
+
data.tar.gz: 9e6858395d6689e321687f6dd948a43739ff70b08114b190919eef171bce0d1994959c7ed12eb372b131938f759c2b459cef9172fd8f45890aed7cfec32a22d5
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,13 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
This project *tries* to adhere to [Semantic Versioning](http://semver.org/), even before v1.0.
|
5
5
|
|
6
|
+
## [3.5.2]
|
7
|
+
- Merge pull request #36 from tongueroo/fix-shared-variables-in-task-definitions
|
8
|
+
- allow usage of shared variables in task_definition blocks again
|
9
|
+
- dont warn of instance variable collision for template scope variables
|
10
|
+
- improve builder error message
|
11
|
+
- improve user error message when task definition block fails to evaluate
|
12
|
+
|
6
13
|
## [3.5.2]
|
7
14
|
- add docs link to params.yml template
|
8
15
|
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ufo (3.
|
4
|
+
ufo (3.5.2)
|
5
5
|
aws-sdk-cloudwatchlogs
|
6
6
|
aws-sdk-ec2
|
7
7
|
aws-sdk-ecr
|
@@ -22,15 +22,15 @@ GEM
|
|
22
22
|
i18n (>= 0.7, < 2)
|
23
23
|
minitest (~> 5.1)
|
24
24
|
tzinfo (~> 1.1)
|
25
|
-
aws-partitions (1.
|
25
|
+
aws-partitions (1.84.0)
|
26
26
|
aws-sdk-cloudwatchlogs (1.3.0)
|
27
27
|
aws-sdk-core (~> 3)
|
28
28
|
aws-sigv4 (~> 1.0)
|
29
|
-
aws-sdk-core (3.20.
|
29
|
+
aws-sdk-core (3.20.2)
|
30
30
|
aws-partitions (~> 1.0)
|
31
31
|
aws-sigv4 (~> 1.0)
|
32
32
|
jmespath (~> 1.0)
|
33
|
-
aws-sdk-ec2 (1.
|
33
|
+
aws-sdk-ec2 (1.31.0)
|
34
34
|
aws-sdk-core (~> 3)
|
35
35
|
aws-sigv4 (~> 1.0)
|
36
36
|
aws-sdk-ecr (1.3.0)
|
data/lib/ufo/docker/builder.rb
CHANGED
@@ -32,7 +32,11 @@ class Ufo::Docker
|
|
32
32
|
command = "cd #{Ufo.root} && #{command}"
|
33
33
|
success = execute(command, use_system: true)
|
34
34
|
unless success
|
35
|
-
|
35
|
+
docker_version_success = system("docker version > /dev/null 2>&1")
|
36
|
+
unless docker_version_success
|
37
|
+
docker_version_message = " Are you sure the docker daemon is available? Try running: docker version."
|
38
|
+
end
|
39
|
+
puts "ERROR: The docker image fail to build.#{docker_version_message}".colorize(:red)
|
36
40
|
exit 1
|
37
41
|
end
|
38
42
|
|
@@ -22,24 +22,65 @@ module Ufo
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def build
|
25
|
-
|
25
|
+
copy_instance_variables
|
26
|
+
begin
|
27
|
+
instance_eval(&@block)
|
28
|
+
rescue Exception => e
|
29
|
+
build_error_info(e)
|
30
|
+
raise
|
31
|
+
end
|
26
32
|
RenderMePretty.result(source_path, context: template_scope)
|
27
33
|
end
|
28
34
|
|
29
|
-
#
|
35
|
+
# Provide a slightly better error message to user when the task definition
|
36
|
+
# code block is not evaluated successfully.
|
37
|
+
def build_error_info(e)
|
38
|
+
puts "ERROR: evaluating block for task_definition #{@task_definition_name}".colorize(:red)
|
39
|
+
# The first line of the backtrace has the info of the file name. Example:
|
40
|
+
# ./.ufo/task_definitions.rb:24:in `block in evaluate_template_definitions'
|
41
|
+
info = e.backtrace[0]
|
42
|
+
filename = info.split(':')[0..1].join(':')
|
43
|
+
puts "Filename: #{filename}".colorize(:red)
|
44
|
+
end
|
45
|
+
|
46
|
+
|
47
|
+
# Copy the instance variables from TemplateScope to TaskDefinition
|
48
|
+
# so that config/variables are available in the task_definition blocks also.
|
49
|
+
# Example:
|
50
|
+
#
|
51
|
+
# task_definition "my-app" do
|
52
|
+
# # make config/variables available here also
|
53
|
+
# end
|
54
|
+
#
|
55
|
+
# This allows possible collision but think it is worth it to have
|
56
|
+
# variables available.
|
57
|
+
def copy_instance_variables
|
58
|
+
template_scope.instance_variables.each do |var|
|
59
|
+
val = template_scope.instance_variable_get(var)
|
60
|
+
instance_variable_set(var, val)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
# At this point instance_eval has been called and source has been possibly called
|
30
65
|
def source(name)
|
31
66
|
@source = name
|
32
67
|
end
|
33
68
|
|
34
69
|
def variables(vars={})
|
35
70
|
vars.each do |var,value|
|
36
|
-
|
71
|
+
# Warn when variable collides with internal variable, but dont warn
|
72
|
+
# template_scope variables collision.
|
73
|
+
if instance_variable_defined?("@#{var}") && !template_scope_instance_variable?(var)
|
37
74
|
puts "WARNING: The instance variable @#{var} is already used internally with ufo. Please name you variable another name!"
|
38
75
|
end
|
39
76
|
template_scope.instance_variable_set("@#{var}", value)
|
40
77
|
end
|
41
78
|
end
|
42
79
|
|
80
|
+
def template_scope_instance_variable?(var)
|
81
|
+
template_scope.instance_variables.include?("@#{var}".to_sym)
|
82
|
+
end
|
83
|
+
|
43
84
|
def source_path
|
44
85
|
if @source # this means that source has been called
|
45
86
|
path = "#{Ufo.root}/.ufo/templates/#{@source}.json.erb"
|
data/lib/ufo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ufo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.5.
|
4
|
+
version: 3.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tung Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-cloudwatchlogs
|