rdoba 0.9.3 → 0.9.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +4 -4
- data/README.md +21 -27
- data/Rakefile +21 -19
- data/features/step_definitions/mixin_steps.rb +237 -198
- data/features/support/env.rb +26 -160
- data/features/support/mixin_support.rb +13 -9
- data/lib/rdoba/_version_.rb +3 -1
- data/lib/rdoba/a.rb +44 -42
- data/lib/rdoba/bcd.rb +43 -26
- data/lib/rdoba/blank.rb +14 -0
- data/lib/rdoba/combinations.rb +17 -15
- data/lib/rdoba/common.rb +53 -53
- data/lib/rdoba/debug.rb +7 -5
- data/lib/rdoba/deploy.rb +55 -50
- data/lib/rdoba/dup.rb +31 -31
- data/lib/rdoba/fe.rb +6 -5
- data/lib/rdoba/gem.rb +33 -29
- data/lib/rdoba/hashorder.rb +24 -24
- data/lib/rdoba/io.rb +81 -74
- data/lib/rdoba/merge.rb +16 -16
- data/lib/rdoba/mixin/time.rb +13 -7
- data/lib/rdoba/mixin/try.rb +10 -5
- data/lib/rdoba/mixin/try_1_9_0.rb +8 -3
- data/lib/rdoba/mixin/wait_if.rb +24 -18
- data/lib/rdoba/mixin.rb +363 -306
- data/lib/rdoba/numeric.rb +19 -17
- data/lib/rdoba/os.rb +127 -0
- data/lib/rdoba/re.rb +4 -4
- data/lib/rdoba/require.rb +24 -19
- data/lib/rdoba/roman.rb +47 -35
- data/lib/rdoba/strings.rb +5 -6
- data/lib/rdoba/yaml.rb +20 -18
- data/lib/rdoba.rb +53 -44
- data/rdoba.gemspec +10 -9
- metadata +44 -46
- data/features/log.feature +0 -277
- data/features/step_definitions/log_steps.rb +0 -200
- data/features/support/fulltest_as_log.rb.in +0 -143
- data/features/support/fulltest_as_self.rb.in +0 -144
- data/lib/rdoba/log.rb +0 -419
data/lib/rdoba/numeric.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
1
|
#!/usr/bin/ruby -KU
|
2
|
-
#
|
2
|
+
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require 'rdoba/common'
|
5
5
|
require 'rdoba/strings'
|
6
6
|
|
7
7
|
class String
|
8
|
-
alias
|
8
|
+
alias _rdoba_to_i to_i
|
9
9
|
def to_i(base = 10, *opts)
|
10
10
|
v = parse_opts(opts)
|
11
11
|
if v[:be]
|
12
|
-
|
12
|
+
str, sign, num = (match /\s*(-?)([0-9a-fx]+)/u).to_a
|
13
13
|
if str
|
14
|
-
|
15
|
-
|
14
|
+
n = num.reverse._rdoba_to_i(base)
|
15
|
+
sign.empty? && n || -n
|
16
16
|
else
|
17
|
-
|
17
|
+
0
|
18
18
|
end
|
19
19
|
else
|
20
20
|
_rdoba_to_i(base)
|
@@ -22,8 +22,8 @@ class String
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
class
|
26
|
-
alias
|
25
|
+
class Integer
|
26
|
+
alias _rdoba_to_s to_s
|
27
27
|
def to_s(base = 10, *opts)
|
28
28
|
v = parse_opts(opts)
|
29
29
|
|
@@ -31,8 +31,10 @@ class Fixnum
|
|
31
31
|
|
32
32
|
raise "Base of number can't be equal or less then zero" if base <= 0
|
33
33
|
raise "Padding count numberr can't be equal or less then zero" if v[:padding] <= 0
|
34
|
+
|
34
35
|
value = self
|
35
|
-
minus =
|
36
|
+
minus =
|
37
|
+
if value < 0
|
36
38
|
value = -value
|
37
39
|
true
|
38
40
|
end
|
@@ -42,7 +44,7 @@ class Fixnum
|
|
42
44
|
rem += 0x40 - 0x39 if rem >= 10
|
43
45
|
res += (0x30 + rem).chr
|
44
46
|
end
|
45
|
-
res +=
|
47
|
+
res += '0' * (v[:padding].to_i - res.size) if res.size < v[:padding].to_i
|
46
48
|
res += 'x0' if v[:style_formatting] and base == 16
|
47
49
|
res += '-' if minus
|
48
50
|
res.reverse
|
@@ -54,7 +56,8 @@ class Numeric
|
|
54
56
|
v = parse_opts(opts)
|
55
57
|
|
56
58
|
value = self
|
57
|
-
minus =
|
59
|
+
minus =
|
60
|
+
if value < 0
|
58
61
|
value = -value
|
59
62
|
true
|
60
63
|
end
|
@@ -64,12 +67,14 @@ class Numeric
|
|
64
67
|
res += rem.chr
|
65
68
|
end
|
66
69
|
|
67
|
-
pad_char =
|
70
|
+
pad_char =
|
71
|
+
if minus
|
68
72
|
negres += ''
|
69
73
|
over = 1
|
70
74
|
res.each_byte do |byte|
|
71
75
|
negbyte = 255 - byte + over
|
72
|
-
negres +=
|
76
|
+
negres +=
|
77
|
+
if negbyte > 255
|
73
78
|
over = 1
|
74
79
|
0
|
75
80
|
else
|
@@ -85,9 +90,6 @@ class Numeric
|
|
85
90
|
|
86
91
|
res += pad_char * (v[:padding].to_i - res.size) if res.size < v[:padding].to_i
|
87
92
|
|
88
|
-
|
89
|
-
plain
|
93
|
+
(v[:be] ? res.reverse(String::ByteByByte) : res).to_p
|
90
94
|
end
|
91
95
|
end
|
92
|
-
|
93
|
-
|
data/lib/rdoba/os.rb
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
require 'ostruct'
|
2
|
+
|
3
|
+
require 'rdoba/blank'
|
4
|
+
|
5
|
+
class Object
|
6
|
+
def to_os
|
7
|
+
OpenStruct.new(self.to_h.map {|(x, y)| [x.to_s, [Hash, Array].include?(y.class) && y.to_os || y] }.to_h)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
class Array
|
12
|
+
def to_os
|
13
|
+
OpenStruct.new(self.map.with_index {|y, x| [x.to_s, [Hash, Array].include?(y.class) && y.to_os || y] }.to_h)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
class Integer
|
18
|
+
def to_sym
|
19
|
+
to_s.to_sym
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class OpenStruct
|
24
|
+
def merge_to other
|
25
|
+
OpenStruct.new(other.to_h.merge(self.to_h))
|
26
|
+
end
|
27
|
+
|
28
|
+
def merge other
|
29
|
+
OpenStruct.new(self.to_h.merge(other.to_h))
|
30
|
+
end
|
31
|
+
|
32
|
+
def map *args, &block
|
33
|
+
res = self.class.new
|
34
|
+
|
35
|
+
self.each_pair do |key, value|
|
36
|
+
res[key] = block[key, value]
|
37
|
+
end
|
38
|
+
|
39
|
+
res
|
40
|
+
end
|
41
|
+
|
42
|
+
def select &block
|
43
|
+
res = self.class.new
|
44
|
+
|
45
|
+
self.each_pair do |key, value|
|
46
|
+
res[key] = value if block[key, value]
|
47
|
+
end
|
48
|
+
|
49
|
+
res
|
50
|
+
end
|
51
|
+
|
52
|
+
def compact
|
53
|
+
select { |_, value| !value.blank? }
|
54
|
+
end
|
55
|
+
|
56
|
+
def each *args, &block
|
57
|
+
self.each_pair(*args, &block)
|
58
|
+
end
|
59
|
+
|
60
|
+
def reduce default = nil, &block
|
61
|
+
res = default
|
62
|
+
|
63
|
+
self.each_pair do |key, value|
|
64
|
+
res = block[res, key, value]
|
65
|
+
end
|
66
|
+
|
67
|
+
res
|
68
|
+
end
|
69
|
+
|
70
|
+
# +deep_merge+ deeply merges the Open Struct hash structure with the +other_in+ enumerating it key by key.
|
71
|
+
# +options+ are the options to change behaviour of the method. It allows two keys: :mode, and :dedup
|
72
|
+
# :mode key can be :append, :prepend, or :replace, defaulting to :append, when mode is to append, it combines duplicated
|
73
|
+
# keys' values into an array, when :prepend it prepends an other value before previously stored one unlike for :append mode,
|
74
|
+
# when :replace it replace duplicate values with a last ones.
|
75
|
+
# :dedup key can be true, or false. It allows to deduplicate values when appending or prepending values.
|
76
|
+
# Examples:
|
77
|
+
# open_struct.deep_merge(other_open_struct)
|
78
|
+
# open_struct.deep_merge(other_open_struct, :prepend)
|
79
|
+
#
|
80
|
+
def deep_merge other_in, options_in = {}
|
81
|
+
return self if other_in.nil? or other_in.blank?
|
82
|
+
|
83
|
+
options = { mode: :append }.merge(options_in)
|
84
|
+
|
85
|
+
other =
|
86
|
+
if other_in.is_a?(OpenStruct)
|
87
|
+
other_in.dup
|
88
|
+
elsif other_in.is_a?(Hash)
|
89
|
+
other_in.to_os
|
90
|
+
else
|
91
|
+
OpenStruct.new(nil => other_in)
|
92
|
+
end
|
93
|
+
|
94
|
+
self.reduce(other) do |res, key, value|
|
95
|
+
res[key] =
|
96
|
+
if res.table.keys.include?(key)
|
97
|
+
case value
|
98
|
+
when Hash, OpenStruct
|
99
|
+
value.deep_merge(res[key], options)
|
100
|
+
when Array
|
101
|
+
value.concat([res[key]].compact.flatten(1))
|
102
|
+
when NilClass
|
103
|
+
res[key]
|
104
|
+
else
|
105
|
+
value_out =
|
106
|
+
if options[:mode] == :append
|
107
|
+
[res[key], value].compact.flatten(1)
|
108
|
+
elsif options[:mode] == :prepend
|
109
|
+
[value, res[key]].compact.flatten(1)
|
110
|
+
else
|
111
|
+
value
|
112
|
+
end
|
113
|
+
|
114
|
+
if value_out.is_a?(Array) && options[:dedup]
|
115
|
+
value_out.uniq
|
116
|
+
else
|
117
|
+
value_out
|
118
|
+
end
|
119
|
+
end
|
120
|
+
else
|
121
|
+
value
|
122
|
+
end
|
123
|
+
|
124
|
+
res
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
data/lib/rdoba/re.rb
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
#!/usr/bin/ruby -KU
|
2
|
-
#
|
2
|
+
# frozen_string_literal: true
|
3
3
|
|
4
4
|
class String
|
5
5
|
def to_res
|
6
|
-
ostr =
|
6
|
+
ostr = dup
|
7
7
|
res = ''
|
8
8
|
while true
|
9
|
-
m = ostr.match(
|
9
|
+
m = ostr.match(%r{(?:([+\[\]\\().*?{}^$/|])|«([^«]*)»)}u)
|
10
10
|
break unless m
|
11
|
+
|
11
12
|
res += m.pre_match + (m[2] || m[1] && ('\\' + m[1]))
|
12
13
|
ostr = m.post_match
|
13
14
|
end
|
@@ -19,4 +20,3 @@ class String
|
|
19
20
|
/#{to_res}/ui
|
20
21
|
end
|
21
22
|
end
|
22
|
-
|
data/lib/rdoba/require.rb
CHANGED
@@ -1,56 +1,62 @@
|
|
1
1
|
#!/usr/bin/ruby -KU
|
2
|
-
#
|
2
|
+
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require 'rdoba/common'
|
5
5
|
require 'rdoba/debug'
|
6
6
|
|
7
7
|
module Kernel
|
8
|
-
private
|
8
|
+
private
|
9
|
+
|
9
10
|
def require_dir(dir, name)
|
10
11
|
dbp11 "[require_dir] <<< dir = #{dir}, name = #{name}"
|
11
12
|
begin
|
12
13
|
rdir = File.join(dir, name)
|
13
14
|
return false unless File.directory?(rdir)
|
15
|
+
|
14
16
|
rdir = File.join(dir, name)
|
15
17
|
$: << rdir unless $:.include?(rdir)
|
16
18
|
dbp14 "[require_dir]> Found dir #{rdir}"
|
17
19
|
Dir.foreach(rdir) do |file|
|
18
20
|
next unless file =~ /(.*)\.(rb|so)$/
|
19
|
-
|
20
|
-
|
21
|
+
|
22
|
+
dbp14 "[require_dir]> Loading ... #{Regexp.last_match(1)}"
|
23
|
+
require Regexp.last_match(1)
|
21
24
|
end
|
22
25
|
true
|
23
|
-
rescue
|
26
|
+
rescue StandardError
|
24
27
|
false
|
25
28
|
end
|
26
29
|
end
|
27
30
|
|
28
31
|
def sub_require(name)
|
29
32
|
dbp11 "[sub_require] <<< name = #{name} "
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
33
|
+
unless $".include?(name)
|
34
|
+
$:.each do |dir|
|
35
|
+
begin
|
36
|
+
Dir.foreach(dir) do |file|
|
37
|
+
next unless /^#{name}\.(rb|so)$/.match?(file)
|
38
|
+
|
39
|
+
dbp14 "[sub_require]> Require Dir #{dir}/#{name} for #{file}"
|
40
|
+
r1 = require_dir(dir, name + '.modules')
|
41
|
+
r2 = require_dir(dir, name)
|
42
|
+
dbp14 "[sub_require]> Require Dir #{(r1 || r2) && 'passed' || 'failed'} ... #{name}"
|
43
|
+
end
|
44
|
+
rescue StandardError
|
38
45
|
end
|
39
|
-
rescue
|
40
46
|
end
|
41
|
-
end
|
47
|
+
end
|
42
48
|
true
|
43
49
|
end
|
44
50
|
|
45
|
-
public
|
51
|
+
public
|
46
52
|
|
47
|
-
alias
|
53
|
+
alias __require__ require
|
48
54
|
def require(name, *opts)
|
49
55
|
v = parse_opts(opts)
|
50
56
|
dbp11 "[require] <<< name = #{name}"
|
51
57
|
begin
|
52
58
|
res = __require__ name
|
53
|
-
rescue =>
|
59
|
+
rescue StandardError => e
|
54
60
|
puts "Lib internal error: #{$!.class} -> #{$!}\n\t#{$@.join("\n\t")}"
|
55
61
|
exit
|
56
62
|
end
|
@@ -59,4 +65,3 @@ public
|
|
59
65
|
res
|
60
66
|
end
|
61
67
|
end
|
62
|
-
|
data/lib/rdoba/roman.rb
CHANGED
@@ -1,43 +1,55 @@
|
|
1
1
|
#!/usr/bin/ruby -KU
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
class Numeric
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
5
|
+
Roman = {
|
6
|
+
1 => 'I',
|
7
|
+
4 => 'IV',
|
8
|
+
5 => 'V',
|
9
|
+
9 => 'IX',
|
10
|
+
10 => 'X',
|
11
|
+
40 => 'XL',
|
12
|
+
50 => 'L',
|
13
|
+
90 => 'XC',
|
14
|
+
100 => 'C',
|
15
|
+
400 => 'CD',
|
16
|
+
500 => 'D',
|
17
|
+
900 => 'CM',
|
18
|
+
1000 => 'M'
|
19
|
+
}
|
20
|
+
RomanNumbers = Roman.keys.sort
|
21
|
+
RomanToInteger = Roman.invert
|
22
|
+
RomanDigits = RomanToInteger.keys.sort { |x, y| x.size < y.size ? 1 : x.size > y.size ? -1 : x <=> y }
|
20
23
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
24
|
+
def to_rom
|
25
|
+
res = ''
|
26
|
+
num = self
|
27
|
+
i = RomanNumbers.size - 1
|
25
28
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
while num > 0
|
30
|
+
if num >= RomanNumbers[i]
|
31
|
+
res << Roman[RomanNumbers[i]]
|
32
|
+
num -= RomanNumbers[i]
|
33
|
+
else
|
34
|
+
i -= 1
|
35
|
+
end
|
36
|
+
end
|
37
|
+
res
|
38
|
+
end
|
39
|
+
end
|
33
40
|
|
34
41
|
class String
|
35
|
-
|
42
|
+
RomanRe = /(#{Numeric::RomanDigits.join('|')})/
|
36
43
|
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
+
def rom
|
45
|
+
numbers = upcase.scan(RomanRe).flatten.map { |x| Numeric::RomanToInteger[x] }
|
46
|
+
numbers.sort do |x, y|
|
47
|
+
if x < y
|
48
|
+
raise 'Invalid roman number'
|
49
|
+
end
|
50
|
+
|
51
|
+
0
|
52
|
+
end
|
53
|
+
numbers.sum
|
54
|
+
end
|
55
|
+
end
|
data/lib/rdoba/strings.rb
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
#!/usr/bin/ruby -KU
|
2
|
-
#
|
2
|
+
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
warn "Warning: the module 'string' has kept only for backward " \
|
5
|
+
"compatibility\nPlease use 'rdoba :mixin' form instead"
|
6
6
|
|
7
7
|
class String
|
8
|
-
alias
|
8
|
+
alias to_p to_s
|
9
9
|
end
|
10
10
|
|
11
|
-
rdoba :
|
12
|
-
|
11
|
+
rdoba mixin: %i[case reverse compare]
|
data/lib/rdoba/yaml.rb
CHANGED
@@ -1,48 +1,50 @@
|
|
1
1
|
#!/usr/bin/ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require 'rdoba/common'
|
4
5
|
|
5
6
|
class Object
|
6
|
-
def to_yml(
|
7
|
+
def to_yml(o = {})
|
7
8
|
level = o[:level] || 0
|
8
9
|
res = ''
|
9
10
|
res += '---' if level == 0
|
10
|
-
res +=
|
11
|
+
res +=
|
12
|
+
case self.class.to_sym
|
11
13
|
when :Hash
|
12
14
|
rs = ''
|
13
|
-
|
14
|
-
|
15
|
+
keys.sort do |x, y|
|
16
|
+
ix, iy = o[:order] ? [o[:order].index(x), o[:order].index(y)] : [nil, nil]
|
15
17
|
(ix and iy) ? ix <=> iy : (ix ? -1 : (iy ? 1 : x <=> y))
|
16
18
|
end.each do |key|
|
17
19
|
value = self[key]
|
18
|
-
rs += "\n" + ' ' * level * 2 + key.to_yml(
|
19
|
-
rs += ': ' + value.to_yml(
|
20
|
+
rs += "\n" + ' ' * level * 2 + key.to_yml({ level: level + 1, order: o[:order] })
|
21
|
+
rs += ': ' + value.to_yml({ level: level + 1, order: o[:order] })
|
20
22
|
end
|
21
|
-
rs.empty? and
|
23
|
+
rs.empty? and '{}' or rs
|
22
24
|
when :Array
|
23
25
|
rs = ''
|
24
|
-
|
25
|
-
rs += "\n" + ' ' * level * 2 + '- ' + value.to_yml(
|
26
|
+
each do |value|
|
27
|
+
rs += "\n" + ' ' * level * 2 + '- ' + value.to_yml({ level: level + 1, order: o[:order] })
|
26
28
|
end
|
27
|
-
rs.empty? and
|
29
|
+
rs.empty? and '[]' or rs
|
28
30
|
when :Fixnum
|
29
|
-
|
31
|
+
to_s
|
30
32
|
when :String
|
31
33
|
if self =~ /^["'\-:!#={}\[\]~]/ or self =~ /\s+$/ or self =~ /:\s/
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
if count("'") < count('"')
|
35
|
+
"'#{gsub("'", "\\'")}'"
|
36
|
+
else
|
37
|
+
"\"#{gsub('"', '\"')}\""
|
38
|
+
end
|
37
39
|
else
|
38
40
|
self
|
39
41
|
end
|
40
42
|
when :NilClass
|
41
43
|
''
|
42
44
|
else
|
43
|
-
|
45
|
+
warn "Unsupported class #{self.class} to export to yml"
|
46
|
+
''
|
44
47
|
end
|
45
48
|
res
|
46
49
|
end
|
47
50
|
end
|
48
|
-
|
data/lib/rdoba.rb
CHANGED
@@ -1,51 +1,60 @@
|
|
1
|
-
#
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Kernel
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
4
|
+
Modules = %i[bcd mixin log debug]
|
5
|
+
|
6
|
+
def rdoba(*options)
|
7
|
+
options.each do |option|
|
8
|
+
(option.is_a?(Hash) && option || { option.to_s.to_sym => {} }).each_pair do |key, value|
|
9
|
+
next unless Modules.include? key
|
10
|
+
|
11
|
+
require "rdoba/#{key}"
|
12
|
+
next unless Rdoba.methods.include? key
|
13
|
+
|
14
|
+
unless value.is_a? Hash
|
15
|
+
value = { value: value }
|
16
|
+
end
|
17
|
+
value.replace({ self: self }.merge(value))
|
18
|
+
Rdoba.send key, value
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
18
23
|
|
19
24
|
require 'rbconfig'
|
20
25
|
|
21
26
|
module Rdoba
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
@@os ||= (
|
31
|
-
host_os = RbConfig::CONFIG['host_os']
|
32
|
-
case host_os
|
33
|
-
when /(mswin|msys|mingw|cygwin|bccwin|wince|emc)/
|
34
|
-
plat = $1 == 'mswin' && 'native' || $1
|
35
|
-
out = `ver`.encode( 'US-ASCII',
|
36
|
-
:invalid => :replace, :undef => :replace )
|
37
|
-
if out =~ /\[.* (\d+)\.([\d\.]+)\]/
|
38
|
-
"windows-#{plat}-#{$1 == '5' && 'xp' || 'vista'}-#{$1}.#{$2}"
|
39
|
-
else
|
40
|
-
"windows-#{plat}" ; end
|
41
|
-
when /darwin|mac os/
|
42
|
-
'macosx'
|
43
|
-
when /linux/
|
44
|
-
'linux'
|
45
|
-
when /(solaris|bsd)/
|
46
|
-
"unix-#{$1}"
|
47
|
-
else
|
48
|
-
raise "unknown os: #{host_os.inspect}"
|
49
|
-
end)
|
50
|
-
end ; end
|
27
|
+
def self.gemroot(name = nil, path = '')
|
28
|
+
unless gem(name)
|
29
|
+
raise "Invalid gem named as #{name.inspect}"
|
30
|
+
end
|
31
|
+
|
32
|
+
g = Gem::Specification.find_by_name(name)
|
33
|
+
File.join g.full_gem_path, path
|
34
|
+
end
|
51
35
|
|
36
|
+
def self.os
|
37
|
+
@@os ||=
|
38
|
+
begin
|
39
|
+
host_os = RbConfig::CONFIG['host_os']
|
40
|
+
case host_os
|
41
|
+
when /(mswin|msys|mingw|cygwin|bccwin|wince|emc)/
|
42
|
+
plat = Regexp.last_match(1) == 'mswin' && 'native' || Regexp.last_match(1)
|
43
|
+
out = `ver`.encode('US-ASCII', invalid: :replace, undef: :replace)
|
44
|
+
if out =~ /\[.* (\d+)\.([\d.]+)\]/
|
45
|
+
"windows-#{plat}-#{Regexp.last_match(1) == '5' && 'xp' || 'vista'}-#{Regexp.last_match(1)}.#{Regexp.last_match(2)}"
|
46
|
+
else
|
47
|
+
"windows-#{plat}"
|
48
|
+
end
|
49
|
+
when /darwin|mac os/
|
50
|
+
'macosx'
|
51
|
+
when /linux/
|
52
|
+
'linux'
|
53
|
+
when /(solaris|bsd)/
|
54
|
+
"unix-#{Regexp.last_match(1)}"
|
55
|
+
else
|
56
|
+
raise "unknown os: #{host_os.inspect}"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
data/rdoba.gemspec
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
$:.push File.expand_path('lib', __dir__)
|
3
4
|
require "rdoba/_version_"
|
4
5
|
|
5
6
|
Gem::Specification.new do |s|
|
@@ -23,16 +24,16 @@ Gem::Specification.new do |s|
|
|
23
24
|
s.extra_rdoc_files = [ 'README.md', 'LICENSE', 'CHANGES.md' ] |
|
24
25
|
`find html/`.split( "\n" )
|
25
26
|
|
26
|
-
s.add_development_dependency '
|
27
|
-
s.add_development_dependency '
|
28
|
-
s.add_development_dependency 'rake', '~> 0'
|
29
|
-
s.add_development_dependency 'bundler', '~> 1.5'
|
27
|
+
s.add_development_dependency 'bundler', '~> 2.0'
|
28
|
+
s.add_development_dependency 'coveralls'
|
30
29
|
s.add_development_dependency 'cucumber', '~> 1.3'
|
31
|
-
s.add_development_dependency '
|
30
|
+
s.add_development_dependency 'ffi-stat', '~> 0.4'
|
31
|
+
s.add_development_dependency 'rake', '~> 12.0', '>= 12.3.3'
|
32
32
|
s.add_development_dependency 'rdiscount', '~> 2.1'
|
33
|
-
s.add_development_dependency 'rdoc', '~>
|
33
|
+
s.add_development_dependency 'rdoc', '~> 6.2'
|
34
34
|
s.add_development_dependency 'rspec-expectations', '~> 3.3'
|
35
|
-
s.add_development_dependency '
|
35
|
+
s.add_development_dependency 'simplecov', '~> 0'
|
36
|
+
s.add_development_dependency 'tddium', '~> 1.25'
|
36
37
|
|
37
38
|
s.required_rubygems_version = '>= 1.6.0'
|
38
39
|
s.required_ruby_version = '>= 1.9.0' ; end
|