usd 0.1.5 → 0.1.7
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/README.md +1 -2
- data/bin/rusdc +22 -18
- data/usd.gemspec +2 -2
- 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: a40de31eb7297c78b71fb376ff889a28c3f0acfc05438ccd479aac0f34449bef
|
|
4
|
+
data.tar.gz: 67ab3c12bfa279a46585d038f5cddba79a89d7d621dfe690e44ba27c92ac3aeb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a7f9424391b67229c60961a7d2faa0ef1427092ff563009caca0e833b214f75e350c7ba35df172c96578f7467412cda136872d93d0f2b70056fbe8543b19f3f7
|
|
7
|
+
data.tar.gz: 7ebe4cb38d95badc3b619afc0df2094005d30f0f07cdd587425af0a3366099f3ab9c7572223428a32edb324b01d15f878bc58142f7ec32e3a7574dc53a71a384
|
data/README.md
CHANGED
|
@@ -43,6 +43,7 @@ Commands:
|
|
|
43
43
|
rusdc get_attachment_of_ci # <ci_name> <filename>, download an attachment of a CI and print it out on stdout
|
|
44
44
|
rusdc get_attachment_of_co # <co_name> <filename>, download an attachment of a changeorder and print it out on stdout
|
|
45
45
|
rusdc help [COMMAND] # Describe available commands or one specific command
|
|
46
|
+
rusdc in_list_child_ins # <in> - list all child-incidents of one incident
|
|
46
47
|
rusdc list_attachments_of_ci # <ci_name>, list all attachments of a CI
|
|
47
48
|
rusdc list_attachments_of_co # <co_name>, list all attachments of a changeorder
|
|
48
49
|
rusdc nr_add_child # <nr-name> <child-name>, add one child CI to another CI
|
|
@@ -53,8 +54,6 @@ Commands:
|
|
|
53
54
|
rusdc update # pipe json-data to update object
|
|
54
55
|
```
|
|
55
56
|
|
|
56
|
-
the german text will be translated soon.
|
|
57
|
-
|
|
58
57
|
# environment-variables
|
|
59
58
|
|
|
60
59
|
rusdc needs some environment-variables. there are:
|
data/bin/rusdc
CHANGED
|
@@ -27,7 +27,7 @@ class Rusdc < Thor
|
|
|
27
27
|
|
|
28
28
|
desc "chg_list_nr", "<CO> - list all CIs of one changeorder"
|
|
29
29
|
def chg_list_nr(co)
|
|
30
|
-
invoke 'find', ['lrel_asset_chgnr', %(chg.chg_ref_num = '#{co}'), "nr"], {:format => "mlr"
|
|
30
|
+
invoke 'find', ['lrel_asset_chgnr', %(chg.chg_ref_num = '#{co}'), "nr"], {:format => "mlr"}
|
|
31
31
|
end
|
|
32
32
|
|
|
33
33
|
desc "create", "pipe json-data to create object"
|
|
@@ -88,11 +88,21 @@ class Rusdc < Thor
|
|
|
88
88
|
puts "fields-problem: there must be only letters, numbers, comma and underscore, nothing else!"
|
|
89
89
|
else
|
|
90
90
|
con = loadcon
|
|
91
|
+
mlr_array = []
|
|
91
92
|
con.debug = options[:debug]
|
|
92
93
|
e = con.search(object,{'fields' => fields,"wc" => wc})
|
|
93
94
|
fields_array=fields.split(/,/)
|
|
94
95
|
e.each do |elem|
|
|
96
|
+
# init all requested keys with empty strings, better for mlr format and needed for fields-order
|
|
97
|
+
fields_array.each do |elem_key|
|
|
98
|
+
elem[elem_key]="" unless elem.has_key?(elem_key)
|
|
99
|
+
end
|
|
95
100
|
elem.keys.each do |elem_key|
|
|
101
|
+
if options[:nice_time]
|
|
102
|
+
if elem_key =~ /(date|last_mod|warranty_start|warranty_end|time_stamp)$/
|
|
103
|
+
elem[elem_key]=Time.at(elem[elem_key]).to_s
|
|
104
|
+
end
|
|
105
|
+
end
|
|
96
106
|
if fields_array.include?(elem_key)
|
|
97
107
|
if elem[elem_key].class == Hash
|
|
98
108
|
elem_value = elem[elem_key]["@COMMON_NAME"]
|
|
@@ -103,32 +113,21 @@ class Rusdc < Thor
|
|
|
103
113
|
elem.delete(elem_key)
|
|
104
114
|
end
|
|
105
115
|
end
|
|
106
|
-
#
|
|
107
|
-
fields_array.
|
|
108
|
-
unless elem.has_key?(elem_key)
|
|
109
|
-
elem[elem_key]=""
|
|
110
|
-
end
|
|
111
|
-
end
|
|
112
|
-
end
|
|
113
|
-
if options[:nice_time]
|
|
114
|
-
e.each_index do |i|
|
|
115
|
-
e[i].keys.each do |key|
|
|
116
|
-
if key =~ /(date|last_mod|warranty_start|warranty_end|time_stamp)$/
|
|
117
|
-
e[i][key]=Time.at(e[i][key]).to_s
|
|
118
|
-
end
|
|
119
|
-
end
|
|
120
|
-
end
|
|
116
|
+
# sort the keys
|
|
117
|
+
mlr_array << Hash[fields_array.map {|k| [k, elem[k]]}].jp
|
|
121
118
|
end
|
|
119
|
+
mlr = "[" + mlr_array.join(",") + "]"
|
|
122
120
|
case options[:format]
|
|
123
121
|
when "json"
|
|
124
|
-
puts
|
|
122
|
+
puts mlr
|
|
125
123
|
when "yaml"
|
|
124
|
+
# keys not sorted, maybe a todo
|
|
126
125
|
puts e.to_yaml
|
|
127
126
|
when "mlr"
|
|
128
127
|
# hierfuer muss mlr verfuegbar sein
|
|
129
128
|
file = Tempfile.new('json')
|
|
130
129
|
cmd = %(mlr --ijson --o#{options[:mlr_format]} cat #{file.path})
|
|
131
|
-
file.write(
|
|
130
|
+
file.write(mlr)
|
|
132
131
|
file.close
|
|
133
132
|
puts `#{cmd}`
|
|
134
133
|
file.unlink
|
|
@@ -174,6 +173,11 @@ class Rusdc < Thor
|
|
|
174
173
|
end
|
|
175
174
|
end
|
|
176
175
|
|
|
176
|
+
desc "in_list_child_ins", "<in> - list all child-incidents of one incident"
|
|
177
|
+
def in_list_child_ins(incident)
|
|
178
|
+
invoke('find',['cr', "parent.ref_num = '#{incident}'", "ref_num"], {:format => "mlr"})
|
|
179
|
+
end
|
|
180
|
+
|
|
177
181
|
desc "list_attachments_of_ci", "<ci_name>, list all attachments of a CI"
|
|
178
182
|
def list_attachments_of_ci(ciname)
|
|
179
183
|
att_nr = loadcon.search("lrel_attachments_nr",{'fields' => "attmnt","wc" => "nr.name = '#{ciname}'"})
|
data/usd.gemspec
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Gem::Specification.new do |spec|
|
|
2
2
|
spec.name = 'usd'
|
|
3
|
-
spec.version = '0.1.
|
|
4
|
-
spec.date = '2019-
|
|
3
|
+
spec.version = '0.1.7'
|
|
4
|
+
spec.date = '2019-11-01'
|
|
5
5
|
spec.summary = "SDM REST-API-Calls"
|
|
6
6
|
spec.description = "a Ruby class and a commandlinetool for SDM REST-API-Calls"
|
|
7
7
|
spec.authors = ["Oliver Gaida"]
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: usd
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.7
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Oliver Gaida
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-
|
|
11
|
+
date: 2019-11-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: thor
|