semi 0.6.1 → 0.7.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: 460c60b317fcb0549c4689b8108ee87e55f4c3fa
4
- data.tar.gz: af259c0b045da43fb35a1e40a9debbb8bc9b646b
3
+ metadata.gz: 166865ef0a7ec6160d098a1c36c115e07ee61847
4
+ data.tar.gz: bdf2ff02a0f270c5f0e5e3e77b67d3a2d910fd3c
5
5
  SHA512:
6
- metadata.gz: d18ce74f1a25975ee872a5d7f66f1b5566e62c59009b86775a34ea9a124584e302abd540dbce2e05981b06bff6bd706af0698e420764d83f9bd4eafb91c5cf0a
7
- data.tar.gz: 83189b09244e3c5a36fa9f1c04e022b49f1fc948b12f83d1123a38817e5caf5702d77b1ab355669815feb9c9278e3a4dc43b43615d409033ad56fa51f8584595
6
+ metadata.gz: 8104ebb97b8f485c6a3a9098c37c8a86f183a7299925702a013dcfd297252faf0d98dfa3d44523d249428e6d2056e5ceddd2cbf3846a9b43d408e5e37dea4bd2
7
+ data.tar.gz: b2fbf40d912fdb43a695cdc99cc1f09f14665dfda3fe2ca825180a1b1892e09ce41d004f1e19c5d51aadb75470bed501ad762924614868d9083cc551a3fb5c70
data/README.md CHANGED
@@ -42,7 +42,7 @@ Validators
42
42
  Validators allow one to insure that the value of a variable is within a
43
43
  specified range. Each key of the validate section is a name of a variable
44
44
  that can be used in the ERB templates. The values are one or more
45
- validation expressions to test the values against. The values may be
45
+ validation expressions to test the values against. The values may be
46
46
  specified as a comma seperated string or as an array.
47
47
 
48
48
  * required
@@ -82,7 +82,7 @@ Commands
82
82
  --------
83
83
  Additional commands can be added to the container in the commands section.
84
84
  This is useful for adding automation and providing simple commands to
85
- activate more complex commands in the container.
85
+ activate more complex commands in the container.
86
86
 
87
87
  There is one special value (default) that will be used when the entrypoint
88
88
  is not provided any arguements.
@@ -91,4 +91,13 @@ Templates
91
91
  ---------
92
92
  Configuration files are marked up using standard ERB template statements.
93
93
 
94
- All variables used in ERB templates need to be specified as lower case.
94
+ All variables used in ERB templates need to be specified as lower case.
95
+
96
+ Debugging
97
+ ---------
98
+ Simple debugging output can be enabled by defining the environmental
99
+ variable $SEMI_DEBUG. As long as the variable is set to any value, debug
100
+ statements will be sent to the stdout file handle.
101
+
102
+ At this time the only real debug output is the command that will be
103
+ executed by semi.
data/lib/semi/config.rb CHANGED
@@ -2,7 +2,7 @@ require 'yaml'
2
2
 
3
3
  module Semi
4
4
  class Config
5
-
5
+
6
6
  attr_reader :defaults
7
7
  attr_reader :files
8
8
  attr_reader :validators
@@ -36,7 +36,7 @@ module Semi
36
36
  if data.key? 'commands'
37
37
  @commands = data['commands']
38
38
  end
39
-
39
+
40
40
  return data
41
41
  end
42
42
 
data/lib/semi/driver.rb CHANGED
@@ -72,11 +72,24 @@ module Semi
72
72
  elsif @config.commands.include? args[0]
73
73
  args = @config.commands[args[0]]
74
74
  end
75
-
76
75
 
77
76
  # Execute the command line
78
- #puts "Executing: #{args}"
79
- exec([args].flatten.join(' '))
77
+ if os.environ['SEMI_DEBUG']
78
+ puts "Semi debug:: executing: #{args}"
79
+ end
80
+ begin
81
+ exec([args].flatten.join(' '))
82
+ rescue SystemCallError => e
83
+ if e.errno == Errno::ENOENT
84
+ puts "Command not found: executing: #{args}"
85
+ else
86
+ puts "Unknown system call failure: #{e.inspect}"
87
+ end
88
+ exit(e.errno)
89
+ rescue Exception => e
90
+ puts "Unknown exception: #{e.inspect}"
91
+ exit(99)
92
+ end
80
93
  end
81
94
 
82
95
  end
data/lib/semi/variable.rb CHANGED
@@ -8,7 +8,7 @@ require 'semi/variables/url'
8
8
 
9
9
  module Semi
10
10
 
11
- class VariableError < RuntimeError; end
11
+ class VariableError < RuntimeError; end
12
12
 
13
13
  module Variable
14
14
 
@@ -27,7 +27,7 @@ module Semi
27
27
  return @@var_types[hints[0]].new(val)
28
28
  end
29
29
  end
30
-
30
+
31
31
  # look for the obsure patterns before returning a string var
32
32
  case
33
33
  when Semi::Variables::Url::validate(val)
@@ -55,7 +55,7 @@ module Semi
55
55
  unless ['Semi::Variables::String', 'String'].include? val.class.to_s
56
56
  return val
57
57
  end
58
-
58
+
59
59
  check = true
60
60
  while check
61
61
  # Look for simple variable expansion
@@ -68,7 +68,7 @@ module Semi
68
68
  check = false
69
69
  end
70
70
  end
71
-
71
+
72
72
  return val
73
73
  end
74
74
 
@@ -18,7 +18,7 @@ module Semi
18
18
  def value
19
19
  @value
20
20
  end
21
-
21
+
22
22
  def &(other)
23
23
  return @value & other
24
24
  end
@@ -67,7 +67,7 @@ module Semi
67
67
  def method_missing(m, *args, &block)
68
68
  @value.to_s.send(m, *args, &block)
69
69
  end
70
-
70
+
71
71
  end
72
72
  end
73
73
  end
@@ -31,7 +31,7 @@ module Semi::Variables
31
31
  if value.class == Semi::Variables::Boolean
32
32
  value = value.to_s
33
33
  end
34
-
34
+
35
35
  # test to see if the value is a common true value
36
36
  if value =~ /true|yes|on|enable/i
37
37
  real_value = true
@@ -17,7 +17,7 @@ module Semi::Variables
17
17
  def validate
18
18
  self.validate(@value)
19
19
  end
20
-
20
+
21
21
  def self.validate(value)
22
22
  if value.class == Fixnum
23
23
  return true
@@ -17,7 +17,7 @@ module Semi::Variables
17
17
  def validate
18
18
  self.validate(@value)
19
19
  end
20
-
20
+
21
21
  def self.validate(value)
22
22
  if ['String', 'Semi::Variables::Path'].include? value.class.to_s
23
23
  if @@path_re.match(value.to_s)
@@ -28,10 +28,10 @@ module Semi::Variables
28
28
  end
29
29
  false
30
30
  end
31
-
31
+
32
32
  # provide a simple scoring method to assist in identifying
33
33
  # a string as a path. 0.0 is a pure string with no path
34
- # markers,
34
+ # markers,
35
35
  def self.path_score(path)
36
36
  return 0.0 if path.empty?
37
37
 
@@ -41,17 +41,17 @@ module Semi::Variables
41
41
  #puts "#{path} m/p/s = #{metach}/#{plen}/#{1.0 - (((plen - metach) * 1.0) / (plen + metach))}"
42
42
  1.0 - (((plen - metach)*1.0) / (plen + metach))
43
43
  end
44
-
44
+
45
45
  def path
46
46
  match = @@path_re.match(@value)
47
- if match
47
+ if match
48
48
  match['path']
49
49
  end
50
50
  end
51
51
 
52
52
  def file
53
53
  match = @@path_re.match(@value)
54
- if match
54
+ if match
55
55
  match['file']
56
56
  end
57
57
  end
@@ -13,6 +13,6 @@ module Semi::Variables
13
13
  end
14
14
  false
15
15
  end
16
-
16
+
17
17
  end
18
18
  end
@@ -29,42 +29,42 @@ module Semi::Variables
29
29
 
30
30
  def proto
31
31
  match = @@url_re.match(@value)
32
- if match
32
+ if match
33
33
  match['proto']
34
34
  end
35
35
  end
36
-
36
+
37
37
  def host
38
38
  match = @@url_re.match(@value)
39
- if match
39
+ if match
40
40
  match['host']
41
41
  end
42
42
  end
43
43
 
44
44
  def port
45
45
  match = @@url_re.match(@value)
46
- if match
46
+ if match
47
47
  match['port']
48
48
  end
49
49
  end
50
50
 
51
51
  def path
52
52
  match = @@url_re.match(@value)
53
- if match
53
+ if match
54
54
  match['path']
55
55
  end
56
56
  end
57
57
 
58
58
  def file
59
59
  match = @@url_re.match(@value)
60
- if match
60
+ if match
61
61
  match['file']
62
62
  end
63
63
  end
64
64
 
65
65
  def params
66
66
  match = @@url_re.match(@value)
67
- if match
67
+ if match
68
68
  match['params']
69
69
  end
70
70
  end
data/lib/semi/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Semi
2
- version = '0.6.1'
2
+ version = '0.7.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: semi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerard Hickey