usd 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +24 -22
  3. data/bin/rusdc +8 -1
  4. data/change_log.md +20 -1
  5. data/usd.gemspec +2 -2
  6. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 321fb82b164595bcb7c2ff73cb7e9f1ed9fe6306b9517c1c236ae30aaa713aaa
4
- data.tar.gz: ea63b6a5116370391d19c4b2c6d9d82768fb0fd9af709dd9a971829fd9a3db74
3
+ metadata.gz: 479f24c444d94d2e4a9402658fd5936248c31a0495340bc9d763079d6705b389
4
+ data.tar.gz: 74b7001f18af2803ca5f819ec0919ac74c549fa4ce577f06843228c15b079ab3
5
5
  SHA512:
6
- metadata.gz: 28255500c9fcee00e8d62361f8ec06a12e4617f653f8c4aa255655d7fd37a76b429440922511d4af9288fd67670c7a5346eceb358514ddaf087bcb73e07a157e
7
- data.tar.gz: a726a7585b18c684ce71153b2c964100cd3b52ce62f1d9b0b78581e9b591947951b04a5b6990afbe12daa4ef7c088f6dd17ef99fd0a199b32ce4792d8a15ac6b
6
+ metadata.gz: acf5a1aa250215e678a4c5e7cb3292c7a1fdcdf8935a146e25bbef98c734135d8427accc680965312bcd9d9da7fda11a653b3d51a65c9fa479ffef7b20945edd
7
+ data.tar.gz: b02d7b8e452854a215e88515f964b6cb1bd683e0326350601b87210b00d44e9f076dbf2b79f2efaa6953e7e780909ff4cc50a8d4b5962ea2d84d9df015b7f307
data/README.md CHANGED
@@ -32,28 +32,30 @@ Place the `mlr`-binary in a path, which is in your PATH-Environment. Download-Ur
32
32
  # functions from the commandline-tool `rusdc`
33
33
 
34
34
  ```
35
- rusdc
36
- Commands:
37
- rusdc chg_add_nr <co> <ci> # add a CI to a changeorder
38
- rusdc chg_list_nr <co> # list all CIs of one changeorder
39
- rusdc create # pipe json-data to create object
40
- rusdc field_names <object-type> # list all fields of an object including its format
41
- rusdc find <object-type> [where-clause] [fields, comma separated] [options] # finds each object which meets the wc-condition
42
- rusdc get <object-type> <common_name> # shows one object
43
- rusdc get_attachment_of_ci <ci_name> <filename> # download an attachment of a CI and print it out on stdout
44
- rusdc get_attachment_of_co <co_name> <filename> # download an attachment of a changeorder and print it out on stdout
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
47
- rusdc list_attachments_of_ci <ci_name> # list all attachments of a CI
48
- rusdc list_attachments_of_co <co_name> # list all attachments of a changeorder
49
- rusdc nr_add_child <nr-name> <child-name> # add one child CI to another CI
50
- rusdc nr_changes <nr> [inactive-too] # list all open changeorders of one CI
51
- rusdc nr_childs <ci-name> # lists all childs CIs of a specific CI
52
- rusdc nr_incidents <nr> [inactive-too] # lists all incident of a specific CI
53
- rusdc nr_parents <ci-name> # lists all parent CIs of a specific CI
54
- rusdc update # pipe json-data to update object
55
- rusdc update_attr <obj> <common_name> <key> <value> # updates a direct (not referenced) attribute of one object.
56
- rusdc update_ref_attr <obj> <common_name> <key> <value> # updates a referenced attribute of one object.
35
+ rusdc chg_add_nr <co> <ci> # add a CI to a changeorder
36
+ rusdc chg_list_nr <co> # list all CIs of one changeorder
37
+ rusdc create # pipe json-data to create object
38
+ rusdc field_names <object-type> [wc] # list all fields of an object including its format
39
+ rusdc find <object-type> [where-clause] [fields, comma separated] [options] # finds each object which meets the wc-condition
40
+ rusdc get <object-type> <common_name|id> # shows one object by name or id
41
+ rusdc get_all_attachments_of_co <co_name> # get all attachments of a changeorder and save all these to current folder
42
+ rusdc get_attachment_of_ci <ci_name> <filename> # download an attachment of a CI and print it out on stdout
43
+ rusdc get_attachment_of_co <co_name> <filename> # download an attachment of a changeorder and print it out on stdout
44
+ rusdc help [COMMAND] # Describe available commands or one specific command
45
+ rusdc in_add_2_chg <changeorder> <incident> # add incident to changeorder
46
+ rusdc in_list_child_ins <in> # list all child-incidents of one incident
47
+ rusdc list_attachments_of_ci <ci_name> # list all attachments of a CI
48
+ rusdc list_attachments_of_co <co_name> # list all attachments of a changeorder
49
+ rusdc nr_add_child <nr-name> <child-name> # add one child CI to another CI
50
+ rusdc nr_changes <nr> [inactive-too] # list all open changeorders of one CI
51
+ rusdc nr_childs <ci-name> # lists all childs CIs of a specific CI
52
+ rusdc nr_incidents <nr> [inactive-too] # lists all incident of a specific CI
53
+ rusdc nr_parents <ci-name> # lists all parent CIs of a specific CI
54
+ rusdc update # pipe json-data to update object
55
+ rusdc update_attr <obj> <common_name|wc> <key> <value> # updates a direct (not referenced) attribute of one or more objects.
56
+ rusdc update_attr_by_id <obj> <id> <key> <value> # updates a plain attribute of one object by id, does not work
57
+ rusdc update_ref_attr <obj> <common_name> <key> <value> # updates a referenced attribute of one object.
58
+ rusdc update_ref_attr_by_id <obj> <id> <key> <value_id> # updates a referenced attribute of one object_id by value-id
57
59
  ```
58
60
 
59
61
  # environment-variables
data/bin/rusdc CHANGED
@@ -89,6 +89,7 @@ class Rusdc < Thor
89
89
  option :nice_time, :type => :boolean, :default => true,:banner => "[true|false]"
90
90
  option :debug, :type => :boolean, :default => false,:banner => "[true|false]"
91
91
  def find(object, wc="", fields="@COMMON_NAME")
92
+ exitcode=0
92
93
  unless (fields =~ /^[\w\_,@]+$/)
93
94
  puts "fields-problem: there must be only letters, numbers, comma, the @-sign or underscore, nothing else!"
94
95
  else
@@ -96,6 +97,7 @@ class Rusdc < Thor
96
97
  mlr_array = []
97
98
  con.debug = options[:debug]
98
99
  e = con.search(object,{'fields' => fields,"wc" => wc})
100
+ exitcode=1 if e.count == 0
99
101
  fields_array=fields.split(/,/)
100
102
  e.each do |elem|
101
103
  # init all requested keys with empty strings, better for mlr format and needed for fields-order
@@ -125,9 +127,11 @@ class Rusdc < Thor
125
127
  case options[:format]
126
128
  when "json"
127
129
  puts mlr
130
+ exit exitcode
128
131
  when "yaml"
129
132
  # keys not sorted, maybe a todo
130
133
  puts e.to_yaml
134
+ exit exitcode
131
135
  when "mlr"
132
136
  # hierfuer muss mlr verfuegbar sein
133
137
  file = Tempfile.new('json')
@@ -136,8 +140,10 @@ class Rusdc < Thor
136
140
  file.close
137
141
  puts `#{cmd}`
138
142
  file.unlink
143
+ exit exitcode
139
144
  else
140
145
  puts "das Format #{options[:format]} ist nicht hinterlegt. Es gibt nur json, yaml oder mlr."
146
+ exit 2
141
147
  end
142
148
  end # fields check
143
149
  end
@@ -166,7 +172,8 @@ class Rusdc < Thor
166
172
  chg_id=loadcon.request("/caisd-rest/chg/COMMON_NAME-#{coname}")["chg"]["@id"]
167
173
  att_nr = loadcon.search("lrel_attachments_changes",{'fields' => "attmnt","wc" => "chg = #{chg_id}"})
168
174
  att_nr.each do |att|
169
- attmnt = loadcon.request("/caisd-rest/attmnt/COMMON_NAME-#{att["attmnt"]["@COMMON_NAME"]}")["attmnt"]
175
+ #attmnt = loadcon.request("/caisd-rest/attmnt/COMMON_NAME-#{att["attmnt"]["@COMMON_NAME"]}")["attmnt"]
176
+ attmnt = loadcon.request("/caisd-rest/attmnt/#{att["attmnt"]["@id"]}")["attmnt"]
170
177
  filename = attmnt["orig_file_name"]
171
178
  puts "save #{filename}"
172
179
  f = File.open(filename, 'w')
data/change_log.md CHANGED
@@ -1,4 +1,23 @@
1
- # changelog
1
+ # rusdc changelog
2
+
3
+ ## 0.2.4 - coming soon
4
+
5
+ - find function has exitcode > 0 if no records has been found
6
+
7
+ ```
8
+ $ rusdc find nr "name = 'not_here'" || echo 'i am not here, please create me'
9
+ []
10
+ i am not here, please create me
11
+ $ rusdc find cnt "last_name = 'Gaida'" && echo 'i am here, you may update me'
12
+ [{
13
+ "@COMMON_NAME": "Gaida, Oliver "
14
+ }]
15
+ i am here, you may update me
16
+ ```
17
+
18
+ ### fixes
19
+
20
+ - attachment with spaces in path could not be downloaded
2
21
 
3
22
  ## 0.2.3
4
23
 
data/usd.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'usd'
3
- spec.version = '0.2.3'
4
- spec.date = '2019-12-06'
3
+ spec.version = '0.2.4'
4
+ spec.date = '2020-01-28'
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.2.3
4
+ version: 0.2.4
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-12-06 00:00:00.000000000 Z
11
+ date: 2020-01-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor