semi 0.3.6 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/semi/driver.rb +5 -6
- data/lib/semi/variables/base.rb +45 -0
- data/lib/semi/variables/boolean.rb +1 -0
- data/lib/semi/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: 55b3140197955790078f136079197dc4aeaf73dc
|
4
|
+
data.tar.gz: fe2e1b04e130ddff9a3827d878d8a419799d37ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82141279b74989cd5d7d7db3e56b4a917edee58e57196756d377f717e2e7ee601609683f5c3a6233d9c110f4e027ff9399a6951be54b2ddb87bf40fb4c4d4c90
|
7
|
+
data.tar.gz: 1cd20d26abb58aaf4577aac85d4b089616182a766f5000ce291b92231c3ab2e20c224892d6a4a512146df721494870db5f1edd071c8029c270e490dd6214dce3
|
data/lib/semi/driver.rb
CHANGED
@@ -12,22 +12,20 @@ module Semi
|
|
12
12
|
# Initialize the dictionary with the defaults
|
13
13
|
@dictionary = {}
|
14
14
|
@config.defaults.each_pair do |name,val|
|
15
|
-
name.downcase!
|
16
15
|
hints = @config.validators[name] || nil
|
17
|
-
@dictionary[name] = Semi::Variable.import(val, hints)
|
16
|
+
@dictionary[name.downcase] = Semi::Variable.import(val, hints)
|
18
17
|
end
|
19
18
|
|
20
19
|
# Now manually merge in the env vars
|
21
20
|
ENV.each_pair do |name, val|
|
22
|
-
name.downcase!
|
23
21
|
hints = @config.validators[name] || nil
|
24
|
-
@dictionary[name] = Semi::Variable.import(val, hints)
|
22
|
+
@dictionary[name.downcase] = Semi::Variable.import(val, hints)
|
25
23
|
end
|
26
24
|
|
27
25
|
# Check any validations being asserted
|
28
26
|
@config.validators.each_key { |key|
|
29
27
|
begin
|
30
|
-
Semi::validate(@dictionary[key], @config.validators[key])
|
28
|
+
Semi::validate(@dictionary[key.downcase], @config.validators[key])
|
31
29
|
rescue Semi::ValidationError => err
|
32
30
|
if @dictionary.include? key
|
33
31
|
puts "Can not validate #{key}: #{err}"
|
@@ -59,6 +57,7 @@ module Semi
|
|
59
57
|
|
60
58
|
# Check for pre-defined commands
|
61
59
|
args = ARGV
|
60
|
+
puts args.inspect
|
62
61
|
if args.count == 0 and @config.commands.include? 'default'
|
63
62
|
args = @config.commands['default']
|
64
63
|
elsif args.count == 1 and args[0] == 'help'
|
@@ -77,7 +76,7 @@ module Semi
|
|
77
76
|
|
78
77
|
|
79
78
|
# Execute the command line
|
80
|
-
|
79
|
+
puts "Executing: #{args}"
|
81
80
|
exec([args].flatten.join(' '))
|
82
81
|
end
|
83
82
|
|
data/lib/semi/variables/base.rb
CHANGED
@@ -18,6 +18,51 @@ module Semi
|
|
18
18
|
def value
|
19
19
|
@value
|
20
20
|
end
|
21
|
+
|
22
|
+
def &(other)
|
23
|
+
return @value & other
|
24
|
+
end
|
25
|
+
|
26
|
+
def |(other)
|
27
|
+
return @value | other
|
28
|
+
end
|
29
|
+
|
30
|
+
def <=>(other)
|
31
|
+
return @value <=> other
|
32
|
+
end
|
33
|
+
|
34
|
+
def eql?(other)
|
35
|
+
return @value.eql? other
|
36
|
+
end
|
37
|
+
|
38
|
+
def equal?(other)
|
39
|
+
return @value.equal? other
|
40
|
+
end
|
41
|
+
|
42
|
+
def ^(other)
|
43
|
+
return @value ^ other
|
44
|
+
end
|
45
|
+
|
46
|
+
def !=(other)
|
47
|
+
return @value != other
|
48
|
+
end
|
49
|
+
|
50
|
+
def ==(other)
|
51
|
+
return @value == other
|
52
|
+
end
|
53
|
+
|
54
|
+
def ===(other)
|
55
|
+
return @value === other
|
56
|
+
end
|
57
|
+
|
58
|
+
def =~(other)
|
59
|
+
return @value =~ other
|
60
|
+
end
|
61
|
+
|
62
|
+
def !~(other)
|
63
|
+
return @value != other
|
64
|
+
end
|
65
|
+
|
21
66
|
|
22
67
|
def method_missing(m, *args, &block)
|
23
68
|
@value.to_s.send(m, *args, &block)
|
data/lib/semi/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: semi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerard Hickey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|