magellan-cli 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/magellan/cli/resources/authority.rb +13 -0
- data/lib/magellan/cli/resources/base.rb +16 -2
- data/lib/magellan/cli/version.rb +1 -1
- 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: 0c9fd96d822f098ec4cbc9f250db006636748436
|
4
|
+
data.tar.gz: 14eadd862a3a35ed7279472125bcc0643380e86b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86f0d246d8f39d103bf840b05c8d12038a7ef2b5bf4cdc886785b47df83b14ca58fae9c01fb9f9220077344a9d7fbd2729e9f10f4a056ef154f086dee092584a
|
7
|
+
data.tar.gz: 22847a8bb4790fb70ebf4e7886d93e3b4ba71a59193cc4baa2b996832549a38658cc65e4e7a5975a1ec95efce05e23ba345a6091437b32bc5022ce0c1ca8730a
|
data/Gemfile.lock
CHANGED
@@ -12,6 +12,19 @@ module Magellan
|
|
12
12
|
self.field_associations = {"team_id" => {name: "team", class: "Team"},
|
13
13
|
"auth_id" => {name: "project", class: "Project"} }
|
14
14
|
|
15
|
+
filter_field :stage_type do |stype|
|
16
|
+
case stype
|
17
|
+
when 1, "1", "development"
|
18
|
+
"development"
|
19
|
+
when 2, "2", "staging"
|
20
|
+
"development, staging"
|
21
|
+
when 3..9, "3".."9", "production"
|
22
|
+
"development, staging, production"
|
23
|
+
else
|
24
|
+
stype
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
15
28
|
desc "update ATTRIBUTES", I18n.t(:update, scope: [:resources, :common, :cmd], resource_name: resource_name)
|
16
29
|
def update(attrs)
|
17
30
|
s = load_selection!(self.class)
|
@@ -120,7 +120,11 @@ module Magellan
|
|
120
120
|
selected_id = (load_selections[ parameter_name ] || {})["id"]
|
121
121
|
res1.each do |r|
|
122
122
|
row = original_fields.map do |f|
|
123
|
-
|
123
|
+
if self.class.filtered_fields and self.class.filtered_fields[f.to_s]
|
124
|
+
self.class.filtered_fields[f.to_s].call(r[f])
|
125
|
+
else
|
126
|
+
association_get(associations, r, f)
|
127
|
+
end
|
124
128
|
end
|
125
129
|
row.unshift(r["id"] == selected_id ? "*" : " ")
|
126
130
|
t.rows << row
|
@@ -139,7 +143,11 @@ module Magellan
|
|
139
143
|
table_fields = r.keys - (self.class.multiline_fields || [])
|
140
144
|
associations = association_map(table_fields.dup)
|
141
145
|
table_fields.each do |f|
|
142
|
-
|
146
|
+
if self.class.filtered_fields and self.class.filtered_fields[f.to_s]
|
147
|
+
t.rows << [f, self.class.filtered_fields[f.to_s].call(r[f])]
|
148
|
+
else
|
149
|
+
t.rows << [f, association_get(associations, r, f)]
|
150
|
+
end
|
143
151
|
end
|
144
152
|
$stdout.puts t.to_s
|
145
153
|
|
@@ -223,6 +231,7 @@ module Magellan
|
|
223
231
|
cattr_accessor :resource_dependency
|
224
232
|
cattr_accessor :field_associations
|
225
233
|
cattr_accessor :hidden_fields, :multiline_fields
|
234
|
+
cattr_accessor :filtered_fields
|
226
235
|
cattr_accessor :caption_attr
|
227
236
|
self.caption_attr = "name"
|
228
237
|
|
@@ -235,6 +244,11 @@ module Magellan
|
|
235
244
|
def self.model_class_name
|
236
245
|
resource_key.split(/~/).map(&:camelize).join('::')
|
237
246
|
end
|
247
|
+
|
248
|
+
def self.filter_field(field, &blk)
|
249
|
+
@@filtered_fields ||= {}
|
250
|
+
@@filtered_fields[field.to_s] = blk
|
251
|
+
end
|
238
252
|
end
|
239
253
|
|
240
254
|
desc "list", "#{I18n.t(:list, scope: [:resources, :common, :cmd], res_names: res_name.pluralize)}"
|
data/lib/magellan/cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: magellan-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- akm2000
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|