mortar 0.15.43 → 0.15.44
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/mortar/command/config.rb +9 -54
- data/lib/mortar/version.rb +1 -1
- data/spec/mortar/command/config_spec.rb +7 -108
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69018fe3fcc68f124e0ce0956e95c119f0e95f0c
|
4
|
+
data.tar.gz: 1f87f69724e6d035058f424908e3fb4722e13dbc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c148ae56445cfe61e2abeb86329ad40404ea0959e1d38ed2eb04fbb5cfd1b8f002a101ab669984a0b3e2efee8ab4f470cce57fa9193711d1e5b241b3f7d82403
|
7
|
+
data.tar.gz: a06d738aca0278dd07867fa04c762e7282c8d5fa0a5acab31c5fedaa72de65382eae79306994a932f9fbfe3e0f5307b9f10e5884368ae532bfd06baf2e0c523a
|
@@ -25,23 +25,11 @@ class Mortar::Command::Config < Mortar::Command::Base
|
|
25
25
|
|
26
26
|
# config
|
27
27
|
#
|
28
|
-
# Display the config
|
29
|
-
#
|
30
|
-
# -s, --shell # output config vars in shell format.
|
31
|
-
#
|
28
|
+
# Display the config keys (but not values) for a project.
|
32
29
|
#
|
33
30
|
# $ mortar config
|
34
|
-
# A
|
35
|
-
# B
|
36
|
-
#
|
37
|
-
# == Project config settings overriden by user config
|
38
|
-
# B: two
|
39
|
-
#
|
40
|
-
#
|
41
|
-
# $ mortar config --shell
|
42
|
-
# A=one
|
43
|
-
# B=three
|
44
|
-
#
|
31
|
+
# A
|
32
|
+
# B
|
45
33
|
def index
|
46
34
|
validate_arguments!
|
47
35
|
project_name = options[:project] || project.name
|
@@ -51,49 +39,16 @@ class Mortar::Command::Config < Mortar::Command::Base
|
|
51
39
|
if vars.empty?
|
52
40
|
display("#{project_name} has no config vars.")
|
53
41
|
else
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
styled_header("#{project_name} Config Vars")
|
61
|
-
styled_hash(vars)
|
62
|
-
unless shadow_vars.empty?
|
63
|
-
shadow_vars.each {|key, value| shadow_vars[key] = value.to_s}
|
64
|
-
display("\n")
|
65
|
-
styled_header("Project config settings overriden by user config")
|
66
|
-
styled_hash(shadow_vars)
|
67
|
-
end
|
42
|
+
styled_header("#{project_name} Config Vars")
|
43
|
+
keys = vars.keys.sort
|
44
|
+
keys.each {|key| display("#{key}")}
|
45
|
+
unless shadow_vars.empty?
|
46
|
+
styled_header("Project config settings overriden by user config")
|
47
|
+
shadow_vars.each {|key, value| display("#{key}")}
|
68
48
|
end
|
69
49
|
end
|
70
50
|
end
|
71
|
-
|
72
|
-
# config:get KEY
|
73
|
-
#
|
74
|
-
# display a config var for a project
|
75
|
-
#
|
76
|
-
#Examples:
|
77
|
-
#
|
78
|
-
# $ mortar config:get MY_CONFIG_VAR
|
79
|
-
# one
|
80
|
-
#
|
81
|
-
def get
|
82
|
-
unless key = shift_argument
|
83
|
-
error("Usage: mortar config:get KEY\nMust specify KEY.")
|
84
|
-
end
|
85
|
-
validate_arguments!
|
86
|
-
project_name = options[:project] || project.name
|
87
51
|
|
88
|
-
vars = api.get_config_vars(project_name).body['config']
|
89
|
-
key_name, value = vars.detect {|k,v| k == key}
|
90
|
-
unless key_name
|
91
|
-
error("Config var #{key} is not defined for project #{project_name}.")
|
92
|
-
end
|
93
|
-
|
94
|
-
display(value.to_s)
|
95
|
-
end
|
96
|
-
|
97
52
|
# config:set KEY1=VALUE1 [KEY2=VALUE2 ...]
|
98
53
|
#
|
99
54
|
# Set one or more config vars
|
data/lib/mortar/version.rb
CHANGED
@@ -50,70 +50,12 @@ STDOUT
|
|
50
50
|
stderr, stdout = execute("config", p, @git)
|
51
51
|
stdout.should == <<-STDOUT
|
52
52
|
=== myproject Config Vars
|
53
|
-
BAR
|
54
|
-
foo
|
53
|
+
BAR
|
54
|
+
foo
|
55
55
|
STDOUT
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
|
-
it "does not trim long values" do
|
60
|
-
with_git_initialized_project do |p|
|
61
|
-
# stub api request
|
62
|
-
configs = {'LONG' => 'A' * 60 }
|
63
|
-
mock(Mortar::Auth.api).get_config_vars("myproject").returns(Excon::Response.new(:body => {"config" => configs}))
|
64
|
-
|
65
|
-
stderr, stdout = execute("config", p, @git)
|
66
|
-
stdout.should == <<-STDOUT
|
67
|
-
=== myproject Config Vars
|
68
|
-
LONG: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
|
69
|
-
STDOUT
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
it "handles when value is nil" do
|
74
|
-
with_git_initialized_project do |p|
|
75
|
-
# stub api request
|
76
|
-
configs = { 'FOO_BAR' => 'one', 'BAZ_QUX' => nil }
|
77
|
-
mock(Mortar::Auth.api).get_config_vars("myproject").returns(Excon::Response.new(:body => {"config" => configs}))
|
78
|
-
|
79
|
-
stderr, stdout = execute("config", p, @git)
|
80
|
-
stdout.should == <<-STDOUT
|
81
|
-
=== myproject Config Vars
|
82
|
-
BAZ_QUX:
|
83
|
-
FOO_BAR: one
|
84
|
-
STDOUT
|
85
|
-
end
|
86
|
-
end
|
87
|
-
|
88
|
-
it "handles when value is a boolean" do
|
89
|
-
with_git_initialized_project do |p|
|
90
|
-
# stub api request
|
91
|
-
configs = {'FOO_BAR' => 'one', 'BAZ_QUX' => true}
|
92
|
-
mock(Mortar::Auth.api).get_config_vars("myproject").returns(Excon::Response.new(:body => {"config" => configs}))
|
93
|
-
|
94
|
-
stderr, stdout = execute("config", p, @git)
|
95
|
-
stdout.should == <<-STDOUT
|
96
|
-
=== myproject Config Vars
|
97
|
-
BAZ_QUX: true
|
98
|
-
FOO_BAR: one
|
99
|
-
STDOUT
|
100
|
-
end
|
101
|
-
end
|
102
|
-
|
103
|
-
it "shows configs in a shell compatible format" do
|
104
|
-
with_git_initialized_project do |p|
|
105
|
-
# stub api request
|
106
|
-
configs = {'A' => 'one', 'B' => 'two three'}
|
107
|
-
mock(Mortar::Auth.api).get_config_vars("myproject").returns(Excon::Response.new(:body => {"config" => configs}))
|
108
|
-
|
109
|
-
stderr, stdout = execute("config --shell", p, @git)
|
110
|
-
stdout.should == <<-STDOUT
|
111
|
-
A=one
|
112
|
-
B=two three
|
113
|
-
STDOUT
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
59
|
it "shows shadowed config vars" do
|
118
60
|
with_git_initialized_project do |p|
|
119
61
|
# stup api request
|
@@ -124,60 +66,17 @@ STDOUT
|
|
124
66
|
stderr, stdout = execute("config", p, @git)
|
125
67
|
stdout.should == <<-STDOUT
|
126
68
|
=== myproject Config Vars
|
127
|
-
A
|
128
|
-
B
|
129
|
-
|
69
|
+
A
|
70
|
+
B
|
130
71
|
=== Project config settings overriden by user config
|
131
|
-
B
|
132
|
-
STDOUT
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
it "doesn't show shadowed config vars on shell output" do
|
137
|
-
with_git_initialized_project do |p|
|
138
|
-
# stup api request
|
139
|
-
config = {'A' => 'one', 'B' => 'two'}
|
140
|
-
shadow_config = {'B' => 'three'}
|
141
|
-
mock(Mortar::Auth.api).get_config_vars("myproject").returns(Excon::Response.new(:body => {"config" => config,"shadow_config" => shadow_config}))
|
142
|
-
|
143
|
-
stderr, stdout = execute("config --shell", p, @git)
|
144
|
-
stdout.should == <<-STDOUT
|
145
|
-
A=one
|
146
|
-
B=two
|
72
|
+
B
|
147
73
|
STDOUT
|
148
74
|
end
|
149
75
|
end
|
150
76
|
|
151
77
|
end
|
152
|
-
|
153
|
-
|
154
|
-
it "shows a single config for get" do
|
155
|
-
with_git_initialized_project do |p|
|
156
|
-
# stub api request
|
157
|
-
configs = {"foo" => "ABCDEFGHIJKLMNOP", "BAR" => "sheepdog"}
|
158
|
-
mock(Mortar::Auth.api).get_config_vars("myproject").returns(Excon::Response.new(:body => {"config" => configs}))
|
159
|
-
|
160
|
-
stderr, stdout = execute("config:get BAR", p, @git)
|
161
|
-
stdout.should == <<-STDOUT
|
162
|
-
sheepdog
|
163
|
-
STDOUT
|
164
|
-
end
|
165
|
-
end
|
166
|
-
|
167
|
-
it "errors when a config is missing" do
|
168
|
-
with_git_initialized_project do |p|
|
169
|
-
# stub api request
|
170
|
-
configs = {"foo" => "ABCDEFGHIJKLMNOP", "BAR" => "sheepdog"}
|
171
|
-
mock(Mortar::Auth.api).get_config_vars("myproject").returns(Excon::Response.new(:body => {"config" => configs}))
|
172
|
-
|
173
|
-
stderr, stdout = execute("config:get NOPE", p, @git)
|
174
|
-
stderr.should == <<-STDERR
|
175
|
-
! Config var NOPE is not defined for project myproject.
|
176
|
-
STDERR
|
177
|
-
end
|
178
|
-
end
|
179
|
-
end
|
180
|
-
|
78
|
+
|
79
|
+
|
181
80
|
context("set") do
|
182
81
|
it "sets config vars" do
|
183
82
|
with_git_initialized_project do |p|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mortar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.15.
|
4
|
+
version: 0.15.44
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mortar Data
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdoc
|