wash 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/wash/entry.rb +24 -0
  3. data/lib/wash/method.rb +5 -1
  4. metadata +4 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0efbc4193e251302ab30ff5c4129b3c4fadfbe3bdad702a4ed15d1cbee4b6b3
4
- data.tar.gz: 79a8f082569acfa7f2afb967ebd0d28297d69245d74ab531760d2536f293e4de
3
+ metadata.gz: 564995e2e64780be1da143efd49c1814123eae654acd381e245b6e59738104d4
4
+ data.tar.gz: 870a5691d24dfcf51dadd3b5b67e2fa963c58a45c8e362bd3a9d01ba57358467
5
5
  SHA512:
6
- metadata.gz: c13c4d83e6da4c7894eb6a7afac17faf1dbaa935658f389a9d0d813085f929c55c04245916028ee37e3efd0214f0ff0b885930469691dccfef34fa72a593c263
7
- data.tar.gz: ba0d5f0ecc23364ed9e5dbce6d1af2596bbc1e85174a770b6b9ba25e4c092dd263eb0d5c852d516934e48dc3554c7acef8fd23daac6976921e5807d515d154a1
6
+ metadata.gz: 02245abc3f32840842da57d9238768a477b981af2ba1a485a9ca23d6baa1b5d22de1d856bb9b3d5daeba79e2ff6aad979f9d9242c05781858c84e8894d1691c5
7
+ data.tar.gz: 4dd768b920b3121d5652770111448bf1bf701366aa6745a3b9bcc42ea2248099107be84f2c4b0007840edaccc0049809dc5db12dea8e40a025fe2e13d7ef260d
@@ -108,6 +108,18 @@ module Wash
108
108
  @description = description
109
109
  end
110
110
 
111
+ # signal adds the given signal to the entry's list of supported signals. It is a helper
112
+ # for Entry schemas.
113
+ def signal(name, description)
114
+ add_signal_schema(name, '', description)
115
+ end
116
+
117
+ # signal_group adds the given signal group to the entry's list of supported signals. It is
118
+ # a helper for Entry schemas.
119
+ def signal_group(name, regex, description)
120
+ add_signal_schema(name, regex, description)
121
+ end
122
+
111
123
  # meta_attribute_schema sets the meta attribute's schema to schema. It is a helper
112
124
  # for Entry schemas.
113
125
  #
@@ -166,6 +178,7 @@ module Wash
166
178
  methods: methods,
167
179
  singleton: @singleton,
168
180
  description: @description,
181
+ signals: @signals,
169
182
  meta_attribute_schema: @meta_attribute_schema,
170
183
  metadata_schema: @metadata_schema,
171
184
  }
@@ -211,6 +224,17 @@ module Wash
211
224
  end
212
225
  fields
213
226
  end
227
+
228
+ def add_signal_schema(name, regex, description)
229
+ signal = {
230
+ name: name,
231
+ description: description
232
+ }
233
+ signal[:regex] = regex unless regex.empty?
234
+
235
+ @signals ||= []
236
+ @signals.push(signal)
237
+ end
214
238
  end
215
239
 
216
240
  # All entries have a name. Note that the name is always
@@ -20,7 +20,9 @@ module Wash
20
20
  unless block
21
21
  block = lambda do |entry, *args|
22
22
  result = entry.send(name, *args)
23
- Wash.send(:print_json, result)
23
+ unless result == nil
24
+ Wash.send(:print_json, result)
25
+ end
24
26
  end
25
27
  end
26
28
  @methods ||= {}
@@ -31,6 +33,8 @@ module Wash
31
33
  method(:list)
32
34
  method(:metadata)
33
35
  method(:schema)
36
+ method(:delete)
37
+ method(:signal)
34
38
 
35
39
  method(:read) do |entry, _|
36
40
  STDOUT.print(entry.read)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-10-08 00:00:00.000000000 Z
11
+ date: 2019-11-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A library for building Wash external plugins
14
14
  email:
@@ -40,7 +40,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
40
40
  - !ruby/object:Gem::Version
41
41
  version: '0'
42
42
  requirements: []
43
- rubygems_version: 3.0.4
43
+ rubyforge_project:
44
+ rubygems_version: 2.7.10
44
45
  signing_key:
45
46
  specification_version: 4
46
47
  summary: A library for building Wash external plugins