terragov 0.2.0 → 0.2.1
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/lib/terragov/cli.rb +49 -67
- data/lib/terragov/version.rb +1 -1
- data/terragov.gemspec +2 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8eeeed1f01e2992de5ea9148713142c55d55a4ed
|
4
|
+
data.tar.gz: 7f226cfef4d9be1f52c84395a80dbcf30ebf4038
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 52f00a1308725247148750c67bab42f4daef588c7e0d6e8716420403734d56deb8cd0eff66166162cb5fd874fe60458f02780953e65a9f10d0edb69ea5abaa09
|
7
|
+
data.tar.gz: 9dc2c6a7cf98f0bb0b15c5f8a53f7900bd3541bfbbc85a04ea727ca650cb712b57f5de65412a835c0f2e4b1868d61f55e27ca438f5b162ed0ad1cfe97e01adcf
|
data/lib/terragov/cli.rb
CHANGED
@@ -52,94 +52,76 @@ module Terragov
|
|
52
52
|
|
53
53
|
end
|
54
54
|
|
55
|
-
def load_config_file
|
56
|
-
if $config_file || ENV['TERRAGOV_CONFIG_FILE']
|
57
|
-
file = $config_file || ENV['TERRAGOV_CONFIG_FILE']
|
58
|
-
$values = YAML.load_file(File.expand_path(file))
|
59
|
-
return $values
|
60
|
-
else
|
61
|
-
return false
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
55
|
def data_dir
|
66
|
-
|
67
|
-
if $data_dir
|
68
|
-
return File.expand_path($data_dir)
|
69
|
-
elsif ENV['TERRAGOV_DATA_DIR']
|
70
|
-
return File.expand_path(ENV['TERRAGOV_DATA_DIR'])
|
71
|
-
elsif load_config_file
|
72
|
-
return File.expand_path(load_config_file['data_dir'])
|
73
|
-
else
|
74
|
-
abort(error_message)
|
75
|
-
end
|
56
|
+
return $data_dir ? $data_dir : false
|
76
57
|
end
|
77
58
|
|
78
59
|
def environment
|
79
|
-
|
80
|
-
if $environment
|
81
|
-
return $environment
|
82
|
-
elsif ENV['TERRAGOV_ENVIRONMENT']
|
83
|
-
return ENV['TERRAGOV_ENVIRONMENT']
|
84
|
-
elsif load_config_file
|
85
|
-
return load_config_file['environment']
|
86
|
-
else
|
87
|
-
abort(error_message)
|
88
|
-
end
|
60
|
+
return $environment ? $environment : false
|
89
61
|
end
|
90
62
|
|
91
63
|
def project
|
92
|
-
|
93
|
-
|
94
|
-
if $project
|
95
|
-
return $project
|
96
|
-
elsif ENV['TERRAGOV_PROJECT']
|
97
|
-
return ENV['TERRAGOV_PROJECT']
|
98
|
-
elsif load_config_file
|
99
|
-
return load_config_file['project']
|
100
|
-
else
|
101
|
-
abort(error_message)
|
102
|
-
end
|
64
|
+
return $project ? $project : false
|
103
65
|
end
|
104
66
|
|
105
67
|
def repo_dir
|
106
|
-
|
107
|
-
if $repo_dir
|
108
|
-
return File.expand_path($repo_dir)
|
109
|
-
elsif ENV['TERRAGOV_REPO_DIR']
|
110
|
-
return File.expand_path(ENV['TERRAGOV_REPO_DIR'])
|
111
|
-
elsif load_config_file
|
112
|
-
return File.expand_path(load_config_file['repo_dir'])
|
113
|
-
else
|
114
|
-
return File.expand_path('.')
|
115
|
-
end
|
68
|
+
return $repo_dir ? $repo_dir : false
|
116
69
|
end
|
117
70
|
|
118
71
|
def stack
|
119
|
-
|
120
|
-
|
121
|
-
if $stack
|
122
|
-
return $stack
|
123
|
-
elsif ENV['TERRAGOV_STACK']
|
124
|
-
return ENV['TERRAGOV_STACK']
|
125
|
-
elsif load_config_file
|
126
|
-
return load_config_file['stack']
|
127
|
-
else
|
128
|
-
abort(error_message)
|
129
|
-
end
|
72
|
+
return $stack ? $stack : false
|
130
73
|
end
|
131
74
|
|
132
75
|
def extra
|
133
76
|
return $extra if $extra
|
134
77
|
end
|
135
78
|
|
79
|
+
def load_config_file
|
80
|
+
if $config_file || ENV['TERRAGOV_CONFIG_FILE']
|
81
|
+
file = $config_file || ENV['TERRAGOV_CONFIG_FILE']
|
82
|
+
$values = YAML.load_file(File.expand_path(file))
|
83
|
+
return $values
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def config(option, file=false)
|
88
|
+
env_var = "TERRAGOV_#{option.upcase}"
|
89
|
+
error_message = "Must set #{option}. Use --help for details."
|
90
|
+
#require 'pry'; binding.pry
|
91
|
+
if public_send(option)
|
92
|
+
if file
|
93
|
+
return File.expand_path(public_send(option))
|
94
|
+
else
|
95
|
+
return public_send(option)
|
96
|
+
end
|
97
|
+
elsif ENV[env_var]
|
98
|
+
if file
|
99
|
+
return File.expand_path(ENV[env_var])
|
100
|
+
else
|
101
|
+
return ENV[env_var]
|
102
|
+
end
|
103
|
+
elsif !load_config_file.nil?
|
104
|
+
unless load_config_file[option].nil?
|
105
|
+
if file
|
106
|
+
return File.expand_path(load_config_file[option])
|
107
|
+
else
|
108
|
+
return load_config_file[option]
|
109
|
+
end
|
110
|
+
else
|
111
|
+
abort(error_message)
|
112
|
+
end
|
113
|
+
else
|
114
|
+
abort(error_message)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
136
118
|
def cmd_options
|
137
119
|
cmd_options_hash = {
|
138
|
-
"environment" => environment,
|
139
|
-
"data_dir" => data_dir,
|
140
|
-
"project" => project,
|
141
|
-
"stack" => stack,
|
142
|
-
"repo_dir" => repo_dir,
|
120
|
+
"environment" => config('environment'),
|
121
|
+
"data_dir" => config('data_dir', true),
|
122
|
+
"project" => config('project'),
|
123
|
+
"stack" => config('stack'),
|
124
|
+
"repo_dir" => config('repo_dir', true),
|
143
125
|
"extra" => extra,
|
144
126
|
}
|
145
127
|
return cmd_options_hash
|
data/lib/terragov/version.rb
CHANGED
data/terragov.gemspec
CHANGED
@@ -14,6 +14,8 @@ Gem::Specification.new do |spec|
|
|
14
14
|
spec.homepage = "https://github.com/surminus/terragov"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
|
+
spec.required_ruby_version = '>= 2.2.2'
|
18
|
+
|
17
19
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
18
20
|
f.match(%r{^(test|spec|features)/})
|
19
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: terragov
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Laura Martin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|
@@ -121,7 +121,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
121
121
|
requirements:
|
122
122
|
- - ">="
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: 2.2.2
|
125
125
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
126
|
requirements:
|
127
127
|
- - ">="
|
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
129
|
version: '0'
|
130
130
|
requirements: []
|
131
131
|
rubyforge_project:
|
132
|
-
rubygems_version: 2.
|
132
|
+
rubygems_version: 2.6.8
|
133
133
|
signing_key:
|
134
134
|
specification_version: 4
|
135
135
|
summary: Wrapper for GOV.UK Terraform deployments.
|