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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9e4f6e3bd44d356d5f9af8102a6ba93e632e7a9f
4
- data.tar.gz: fbe07a7e4ecd15eb8db4212fdf0f581c768aa3e4
3
+ metadata.gz: 55b3140197955790078f136079197dc4aeaf73dc
4
+ data.tar.gz: fe2e1b04e130ddff9a3827d878d8a419799d37ed
5
5
  SHA512:
6
- metadata.gz: 8787689b87cca5ef1e9465b03cbd8e3be47295afcf9a9237a22fac07cf0089a221d650fd7261256e8e5191139f2578ea75993e2584eb3ac0767049391df789a4
7
- data.tar.gz: 861f04b5fc8eae3105c0c58c66730faca06636d6f3c6e9bfceb0397cd77333c1c7841f5b2f14a4614548e5006a2ca5649b221133ed31a3d32bc067fadc7eb301
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
- #puts "Executing: #{args}"
79
+ puts "Executing: #{args}"
81
80
  exec([args].flatten.join(' '))
82
81
  end
83
82
 
@@ -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)
@@ -45,6 +45,7 @@ module Semi::Variables
45
45
  false
46
46
  end
47
47
 
48
+
48
49
  def onoff
49
50
  if @value
50
51
  'on'
data/lib/semi/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Semi
2
- version = '0.3.6'
2
+ version = '0.4.0'
3
3
  end
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.3.6
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-16 00:00:00.000000000 Z
11
+ date: 2017-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake