dws-registry 0.4.1 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- checksums.yaml.gz.sig +0 -0
- data/lib/dws-registry.rb +71 -33
- data.tar.gz.sig +0 -0
- metadata +50 -26
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0d341ebac9fd10a3216588c7651caa6e2b4e28619fc3decbb4d6764c95d7f1c0
|
4
|
+
data.tar.gz: 613d9fc137c636f77043f4ebb58e5d1412b4f08d38f1fbf3e192e9eea1f3db14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 666c0c408e1b783b2b2da18a0843ed59350038f4493af5bbc21dd4928bb37d058e3237d7386561f0a1fcf11ef76663db1544ad9cc4f15d355ad3b9f384a79c39
|
7
|
+
data.tar.gz: 629d903bdc1a4d4e8cf70e9fe66937853398a04c9d58e3e9667e68ad99e1c7a9c578322a1bfcceaae7aa744b2ff6688f7f27d08c0f7b52f52809ca1540b1abfd
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/lib/dws-registry.rb
CHANGED
@@ -6,47 +6,76 @@ require 'time'
|
|
6
6
|
require 'xml-registry'
|
7
7
|
require 'rscript'
|
8
8
|
require 'json'
|
9
|
+
require 'requestor'
|
10
|
+
require 'rxfreader'
|
9
11
|
|
10
12
|
|
11
13
|
class DWSRegistry < XMLRegistry
|
12
|
-
include
|
13
|
-
|
14
|
-
def initialize(filename='registry.xml', autosave: true)
|
15
|
-
|
16
|
-
super()
|
17
|
-
|
18
|
-
@autosave = autosave
|
19
|
-
|
14
|
+
include RXFRead
|
15
|
+
|
16
|
+
def initialize(filename='registry.xml', autosave: true, debug: false)
|
17
|
+
|
18
|
+
super(debug: debug)
|
19
|
+
|
20
|
+
@autosave = autosave
|
21
|
+
|
20
22
|
if filename then
|
21
23
|
|
22
|
-
@filename = filename
|
23
|
-
|
24
|
+
@filename = filename
|
25
|
+
|
24
26
|
if FileX.exists? filename then
|
25
27
|
load_xml(filename)
|
26
28
|
else
|
27
29
|
save()
|
28
|
-
end
|
30
|
+
end
|
29
31
|
|
30
32
|
end
|
31
33
|
end
|
32
|
-
|
34
|
+
|
35
|
+
def gem_register(gemfile)
|
36
|
+
|
37
|
+
if gemfile =~ /^\w+\:\/\// then
|
38
|
+
|
39
|
+
code = Requestor.read(File.dirname(gemfile)) do |x|
|
40
|
+
x.require File.basename(gemfile)
|
41
|
+
end
|
42
|
+
|
43
|
+
eval code
|
44
|
+
|
45
|
+
else
|
46
|
+
|
47
|
+
require gemfile
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
if defined? RegGem::register then
|
52
|
+
|
53
|
+
self.import RegGem::register
|
54
|
+
true
|
55
|
+
|
56
|
+
else
|
57
|
+
nil
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
|
33
62
|
def get_key(path, auto_detect_type: false)
|
34
63
|
|
35
64
|
e = super path
|
36
65
|
|
37
66
|
return e unless auto_detect_type
|
38
|
-
|
67
|
+
|
39
68
|
raw_c = e.attributes[:type]
|
40
69
|
|
41
70
|
c = raw_c if raw_c
|
42
71
|
s = e.text
|
43
72
|
|
44
|
-
return e if e.elements.length > 0 or s.nil?
|
73
|
+
return e if e.elements.length > 0 or s.nil?
|
45
74
|
return s unless c
|
46
|
-
|
75
|
+
|
47
76
|
h = {
|
48
77
|
string: ->(x) {x},
|
49
|
-
boolean: ->(x){
|
78
|
+
boolean: ->(x){
|
50
79
|
case x
|
51
80
|
when 'true' then true
|
52
81
|
when 'false' then false
|
@@ -59,38 +88,45 @@ class DWSRegistry < XMLRegistry
|
|
59
88
|
time: ->(x) {Time.parse x},
|
60
89
|
json: ->(x) {JSON.parse x}
|
61
90
|
}
|
62
|
-
|
63
|
-
h[c.to_sym].call s
|
64
|
-
|
91
|
+
|
92
|
+
h[c.to_sym].call s
|
93
|
+
|
65
94
|
end
|
66
95
|
|
67
96
|
def set_key(path, value)
|
68
|
-
|
97
|
+
|
98
|
+
if @debug then
|
99
|
+
puts 'inside set_key path: ' + path.inspect
|
100
|
+
puts ' value: ' + value.inspect
|
101
|
+
puts ' value.class : ' + value.class.inspect
|
102
|
+
end
|
103
|
+
|
69
104
|
value, type = case value.class.to_s.downcase.to_sym
|
70
105
|
when :string then value
|
71
106
|
when :time then ["#%s#" % value.to_s, :time]
|
72
107
|
when :fixnum then [value.to_s, :number]
|
73
108
|
when :integer then [value.to_s, :number]
|
74
|
-
when :float then [value.to_s, :number]
|
109
|
+
when :float then [value.to_s, :number]
|
75
110
|
when :falseclass then [value.to_s, :boolean]
|
76
111
|
when :trueclass then [value.to_s, :boolean]
|
77
112
|
when :array then ["%s" % value.to_json, :json]
|
113
|
+
else value
|
78
114
|
end
|
79
|
-
|
80
|
-
e = super(path, value)
|
81
|
-
|
115
|
+
|
116
|
+
e = super(path, value)
|
117
|
+
|
82
118
|
type = find_type value unless type
|
83
119
|
e.attributes[:type] = type.to_s if type
|
84
120
|
e.parent.attributes[:last_modified] = Time.now.to_s
|
85
|
-
|
121
|
+
|
86
122
|
save() if @autosave
|
87
123
|
|
88
124
|
onchange = e.attributes[:onchange]
|
89
|
-
|
125
|
+
|
90
126
|
if onchange then
|
91
127
|
RScript.new.run onchange.sub('$value', value).split
|
92
128
|
end
|
93
|
-
|
129
|
+
|
94
130
|
e
|
95
131
|
end
|
96
132
|
|
@@ -104,25 +140,27 @@ class DWSRegistry < XMLRegistry
|
|
104
140
|
super(@filename)
|
105
141
|
end
|
106
142
|
|
107
|
-
def import(s)
|
143
|
+
def import(s)
|
108
144
|
super(s)
|
109
145
|
save() if @autosave
|
110
146
|
end
|
111
|
-
|
147
|
+
|
112
148
|
def refresh()
|
113
|
-
load_xml(@filename)
|
149
|
+
load_xml(@filename)
|
114
150
|
end
|
115
|
-
|
151
|
+
|
116
152
|
private
|
117
|
-
|
153
|
+
|
118
154
|
def add_value(key, value)
|
119
155
|
e = @doc.root.element(key)
|
120
156
|
e.text = value
|
121
157
|
return e
|
122
158
|
end
|
123
|
-
|
159
|
+
|
124
160
|
def find_type(v)
|
125
161
|
|
162
|
+
puts 'v: ' + v.inspect if @debug
|
163
|
+
|
126
164
|
if v[/^\d+$/] and v.to_i.to_s.length == v.length then :number
|
127
165
|
elsif v[/^\d+\.\d+$/] and v.to_f.to_s.length == v.length then :number
|
128
166
|
elsif v.downcase[/^(?:true|false|on|off|yes|no)$/] then :boolean
|
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dws-registry
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Robertson
|
@@ -10,30 +10,55 @@ bindir: bin
|
|
10
10
|
cert_chain:
|
11
11
|
- |
|
12
12
|
-----BEGIN CERTIFICATE-----
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
13
|
+
MIIEXjCCAsagAwIBAgIBATANBgkqhkiG9w0BAQsFADAsMSowKAYDVQQDDCFnZW1t
|
14
|
+
YXN0ZXIvREM9amFtZXNyb2JlcnRzb24vREM9ZXUwHhcNMjIwMjIzMTA1NzUxWhcN
|
15
|
+
MjMwMjIzMTA1NzUxWjAsMSowKAYDVQQDDCFnZW1tYXN0ZXIvREM9amFtZXNyb2Jl
|
16
|
+
cnRzb24vREM9ZXUwggGiMA0GCSqGSIb3DQEBAQUAA4IBjwAwggGKAoIBgQDTb0vH
|
17
|
+
MBuMaCXOK85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BxAULl
|
32
|
+
g1o/wESBNM84moSIsI8ifCGGr587eAoi7ee8f7gX6jIx86dmEktJk45hb2P4HFLh
|
33
|
+
JQtv79dblSdtDmOkSPmDno62VyyZ2WFYiRBcL1iOqduY+HxMee4Y58N2v+60g15y
|
34
|
+
zl3twGqOmIgxT6PlWIUhLXchNfPD2Y1E0ruwYOLYF8WkVYNaARxpXp4kEs2SPGFT
|
35
|
+
/ArK0zi1UbowqPGV8bDI5U/tQBYydUuDyqAjSF2aZ5XSherLHoK7aBGAaJKn2gwy
|
36
|
+
Zkhg8x25XmgmwWK1wohJdFY4
|
32
37
|
-----END CERTIFICATE-----
|
33
|
-
date:
|
38
|
+
date: 2022-02-23 00:00:00.000000000 Z
|
34
39
|
dependencies:
|
35
40
|
- !ruby/object:Gem::Dependency
|
36
41
|
name: xml-registry
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0.8'
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 0.8.0
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - "~>"
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0.8'
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 0.8.0
|
60
|
+
- !ruby/object:Gem::Dependency
|
61
|
+
name: requestor
|
37
62
|
requirement: !ruby/object:Gem::Requirement
|
38
63
|
requirements:
|
39
64
|
- - "~>"
|
@@ -41,7 +66,7 @@ dependencies:
|
|
41
66
|
version: '0.5'
|
42
67
|
- - ">="
|
43
68
|
- !ruby/object:Gem::Version
|
44
|
-
version: 0.5.
|
69
|
+
version: 0.5.0
|
45
70
|
type: :runtime
|
46
71
|
prerelease: false
|
47
72
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -51,9 +76,9 @@ dependencies:
|
|
51
76
|
version: '0.5'
|
52
77
|
- - ">="
|
53
78
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.5.
|
79
|
+
version: 0.5.0
|
55
80
|
description:
|
56
|
-
email:
|
81
|
+
email: digital.robertson@gmail.com
|
57
82
|
executables: []
|
58
83
|
extensions: []
|
59
84
|
extra_rdoc_files: []
|
@@ -78,8 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
103
|
- !ruby/object:Gem::Version
|
79
104
|
version: '0'
|
80
105
|
requirements: []
|
81
|
-
|
82
|
-
rubygems_version: 2.6.13
|
106
|
+
rubygems_version: 3.2.22
|
83
107
|
signing_key:
|
84
108
|
specification_version: 4
|
85
109
|
summary: An XML registry which stores the Ruby data type as well as the value
|
metadata.gz.sig
CHANGED
Binary file
|