main 6.2.3 → 6.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +0 -8
- data/lib/main/program/class_methods.rb +13 -0
- data/lib/main/program/instance_methods.rb +9 -16
- data/lib/main.rb +5 -5
- data/main.gemspec +5 -6
- metadata +30 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b6289d780438645efdd78c3c1dd205d93af94185ee591e7abbccd7f9092637f
|
4
|
+
data.tar.gz: 566196b12fb4268421df5f0a87ed1fdafb46424688b62bfedae86f477bb8a610
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcf296c3b1d49b6f4c001ac582d108cda0a12547827ef63c3310ff52342fca6c4b9c73556c19e68e7933cc688c74fd83cae3631f1b0fa3d576a1aabbd6f1205c
|
7
|
+
data.tar.gz: e064f2590b78ac9a900716f09771254599084d307356d5c8ffca51acf69790f62068d561bb3d98d7210b71737d896b47d7f30392585212a295ac2d3c13aa58c2
|
data/Rakefile
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
This.rubyforge_project = 'codeforpeople'
|
2
1
|
This.author = "Ara T. Howard"
|
3
2
|
This.email = "ara.t.howard@gmail.com"
|
4
3
|
This.homepage = "https://github.com/ahoward/#{ This.lib }"
|
@@ -145,7 +144,6 @@ task :gemspec do
|
|
145
144
|
|
146
145
|
spec.extensions.push(*<%= extensions.inspect %>)
|
147
146
|
|
148
|
-
spec.rubyforge_project = <%= This.rubyforge_project.inspect %>
|
149
147
|
spec.author = <%= This.author.inspect %>
|
150
148
|
spec.email = <%= This.email.inspect %>
|
151
149
|
spec.homepage = <%= This.homepage.inspect %>
|
@@ -230,12 +228,6 @@ task :release => [:clean, :gemspec, :gem] do
|
|
230
228
|
puts
|
231
229
|
system(cmd)
|
232
230
|
abort("cmd(#{ cmd }) failed with (#{ $?.inspect })") unless $?.exitstatus.zero?
|
233
|
-
|
234
|
-
cmd = "rubyforge login && rubyforge add_release #{ This.rubyforge_project } #{ This.lib } #{ This.version } #{ This.gem }"
|
235
|
-
puts cmd
|
236
|
-
puts
|
237
|
-
system(cmd)
|
238
|
-
abort("cmd(#{ cmd }) failed with (#{ $?.inspect })") unless $?.exitstatus.zero?
|
239
231
|
end
|
240
232
|
|
241
233
|
|
@@ -71,6 +71,7 @@ module Main
|
|
71
71
|
define_method(:run, &block) if block
|
72
72
|
wrap_run!
|
73
73
|
end
|
74
|
+
|
74
75
|
program
|
75
76
|
end
|
76
77
|
|
@@ -78,6 +79,9 @@ module Main
|
|
78
79
|
|
79
80
|
def new()
|
80
81
|
instance = allocate
|
82
|
+
|
83
|
+
setup_finalizers(instance)
|
84
|
+
|
81
85
|
instance.instance_eval do
|
82
86
|
pre_initialize()
|
83
87
|
before_initialize()
|
@@ -86,9 +90,18 @@ module Main
|
|
86
90
|
after_initialize()
|
87
91
|
post_initialize()
|
88
92
|
end
|
93
|
+
|
89
94
|
instance
|
90
95
|
end
|
91
96
|
|
97
|
+
def setup_finalizers(instance)
|
98
|
+
instance.finalizers = (finalizers = [])
|
99
|
+
|
100
|
+
ObjectSpace.define_finalizer(instance) do
|
101
|
+
while((f = finalizers.pop)); f.call; end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
92
105
|
def params
|
93
106
|
parameters
|
94
107
|
end
|
@@ -12,8 +12,8 @@ module Main
|
|
12
12
|
fattr('stderr'){ main.stderr }
|
13
13
|
fattr('logger'){ main.logger }
|
14
14
|
fattr('script'){ main.script }
|
15
|
-
fattr('params')
|
16
|
-
fattr('finalizers')
|
15
|
+
fattr('params'){ Parameter::Table.new }
|
16
|
+
fattr('finalizers'){ [] }
|
17
17
|
|
18
18
|
%w(
|
19
19
|
program name synopsis description author version
|
@@ -51,16 +51,11 @@ module Main
|
|
51
51
|
def post_initialize() :hook end
|
52
52
|
|
53
53
|
def setup_finalizers
|
54
|
-
|
55
|
-
finalizers = @finalizers
|
56
|
-
ObjectSpace.define_finalizer(self) do
|
57
|
-
while((f = finalizers.pop)); f.call; end
|
58
|
-
end
|
54
|
+
self.class.setup_finalizers(self)
|
59
55
|
end
|
60
56
|
|
61
57
|
def finalize
|
62
|
-
|
63
|
-
while((f = @finalizers.pop)); f.call; end
|
58
|
+
while((f = finalizers.pop)); f.call; end
|
64
59
|
end
|
65
60
|
|
66
61
|
def setup_io_redirection
|
@@ -92,10 +87,9 @@ module Main
|
|
92
87
|
end
|
93
88
|
|
94
89
|
def setup_io_restoration
|
95
|
-
@finalizers ||= []
|
96
90
|
[STDIN, STDOUT, STDERR].each do |io|
|
97
91
|
dup = io.dup
|
98
|
-
|
92
|
+
finalizers.push(
|
99
93
|
lambda do
|
100
94
|
io.reopen(dup)
|
101
95
|
end
|
@@ -111,7 +105,7 @@ module Main
|
|
111
105
|
io
|
112
106
|
else
|
113
107
|
fd = open(io.to_s, 'r+')
|
114
|
-
|
108
|
+
finalizers.push(lambda{ fd.close })
|
115
109
|
fd
|
116
110
|
end
|
117
111
|
begin
|
@@ -132,7 +126,7 @@ module Main
|
|
132
126
|
io
|
133
127
|
else
|
134
128
|
fd = open(io.to_s, 'w+')
|
135
|
-
|
129
|
+
finalizers.push(lambda{ fd.close })
|
136
130
|
fd
|
137
131
|
end
|
138
132
|
begin
|
@@ -153,7 +147,7 @@ module Main
|
|
153
147
|
io
|
154
148
|
else
|
155
149
|
fd = open(io.to_s, 'w+')
|
156
|
-
|
150
|
+
finalizers.push(lambda{ fd.close })
|
157
151
|
fd
|
158
152
|
end
|
159
153
|
begin
|
@@ -173,8 +167,7 @@ module Main
|
|
173
167
|
before_parse_parameters
|
174
168
|
|
175
169
|
self.class.parameters.parse(self)
|
176
|
-
|
177
|
-
self.class.parameters.each{|p| @params[p.name.to_s] = p}
|
170
|
+
self.class.parameters.each{|p| params[p.name.to_s] = p}
|
178
171
|
|
179
172
|
after_parse_parameters
|
180
173
|
post_parse_parameters
|
data/lib/main.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Main
|
2
2
|
# top level constants
|
3
3
|
#
|
4
|
-
Main::VERSION = '6.
|
4
|
+
Main::VERSION = '6.3.0' unless
|
5
5
|
defined? Main::VERSION
|
6
6
|
def Main.version() Main::VERSION end
|
7
7
|
|
@@ -21,10 +21,10 @@ module Main
|
|
21
21
|
#
|
22
22
|
def Main.dependencies
|
23
23
|
{
|
24
|
-
'chronic' => [ 'chronic', '~> 0.
|
25
|
-
'fattr' => [ 'fattr', '~> 2.
|
26
|
-
'arrayfields' => [ 'arrayfields', '~> 4.
|
27
|
-
'map' => [ 'map', '~> 6.
|
24
|
+
'chronic' => [ 'chronic', '~> 0.10', '>= 0.10.2' ] ,
|
25
|
+
'fattr' => [ 'fattr', '~> 2.4', '>= 2.4.0' ] ,
|
26
|
+
'arrayfields' => [ 'arrayfields', '~> 4.9', '>= 4.9.2' ] ,
|
27
|
+
'map' => [ 'map', '~> 6.6', '>= 6.6.0' ] ,
|
28
28
|
}
|
29
29
|
end
|
30
30
|
|
data/main.gemspec
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
|
4
4
|
Gem::Specification::new do |spec|
|
5
5
|
spec.name = "main"
|
6
|
-
spec.version = "6.
|
6
|
+
spec.version = "6.3.0"
|
7
7
|
spec.platform = Gem::Platform::RUBY
|
8
8
|
spec.summary = "main"
|
9
9
|
spec.description = "a class factory and dsl for generating command line programs real quick"
|
@@ -55,18 +55,17 @@ Gem::Specification::new do |spec|
|
|
55
55
|
spec.test_files = nil
|
56
56
|
|
57
57
|
|
58
|
-
spec.add_dependency(*["chronic", "~> 0.
|
58
|
+
spec.add_dependency(*["chronic", "~> 0.10", ">= 0.10.2"])
|
59
59
|
|
60
|
-
spec.add_dependency(*["fattr", "~> 2.
|
60
|
+
spec.add_dependency(*["fattr", "~> 2.4", ">= 2.4.0"])
|
61
61
|
|
62
|
-
spec.add_dependency(*["arrayfields", "~> 4.
|
62
|
+
spec.add_dependency(*["arrayfields", "~> 4.9", ">= 4.9.2"])
|
63
63
|
|
64
|
-
spec.add_dependency(*["map", "~> 6.
|
64
|
+
spec.add_dependency(*["map", "~> 6.6", ">= 6.6.0"])
|
65
65
|
|
66
66
|
|
67
67
|
spec.extensions.push(*[])
|
68
68
|
|
69
|
-
spec.rubyforge_project = "codeforpeople"
|
70
69
|
spec.author = "Ara T. Howard"
|
71
70
|
spec.email = "ara.t.howard@gmail.com"
|
72
71
|
spec.homepage = "https://github.com/ahoward/main"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: main
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.
|
4
|
+
version: 6.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ara T. Howard
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chronic
|
@@ -16,80 +16,80 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.10'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.
|
22
|
+
version: 0.10.2
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '0.
|
29
|
+
version: '0.10'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.
|
32
|
+
version: 0.10.2
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: fattr
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - ">="
|
38
|
-
- !ruby/object:Gem::Version
|
39
|
-
version: 2.2.0
|
40
37
|
- - "~>"
|
41
38
|
- !ruby/object:Gem::Version
|
42
|
-
version: '2.
|
39
|
+
version: '2.4'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 2.4.0
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- - ">="
|
48
|
-
- !ruby/object:Gem::Version
|
49
|
-
version: 2.2.0
|
50
47
|
- - "~>"
|
51
48
|
- !ruby/object:Gem::Version
|
52
|
-
version: '2.
|
49
|
+
version: '2.4'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 2.4.0
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: arrayfields
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
57
|
- - "~>"
|
58
58
|
- !ruby/object:Gem::Version
|
59
|
-
version: '4.
|
59
|
+
version: '4.9'
|
60
60
|
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 4.
|
62
|
+
version: 4.9.2
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: '4.
|
69
|
+
version: '4.9'
|
70
70
|
- - ">="
|
71
71
|
- !ruby/object:Gem::Version
|
72
|
-
version: 4.
|
72
|
+
version: 4.9.2
|
73
73
|
- !ruby/object:Gem::Dependency
|
74
74
|
name: map
|
75
75
|
requirement: !ruby/object:Gem::Requirement
|
76
76
|
requirements:
|
77
|
-
- - ">="
|
78
|
-
- !ruby/object:Gem::Version
|
79
|
-
version: 6.1.0
|
80
77
|
- - "~>"
|
81
78
|
- !ruby/object:Gem::Version
|
82
|
-
version: '6.
|
79
|
+
version: '6.6'
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 6.6.0
|
83
83
|
type: :runtime
|
84
84
|
prerelease: false
|
85
85
|
version_requirements: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: 6.1.0
|
90
87
|
- - "~>"
|
91
88
|
- !ruby/object:Gem::Version
|
92
|
-
version: '6.
|
89
|
+
version: '6.6'
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: 6.6.0
|
93
93
|
description: a class factory and dsl for generating command line programs real quick
|
94
94
|
email: ara.t.howard@gmail.com
|
95
95
|
executables: []
|
@@ -132,7 +132,7 @@ homepage: https://github.com/ahoward/main
|
|
132
132
|
licenses:
|
133
133
|
- Ruby
|
134
134
|
metadata: {}
|
135
|
-
post_install_message:
|
135
|
+
post_install_message:
|
136
136
|
rdoc_options: []
|
137
137
|
require_paths:
|
138
138
|
- lib
|
@@ -147,8 +147,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
147
147
|
- !ruby/object:Gem::Version
|
148
148
|
version: '0'
|
149
149
|
requirements: []
|
150
|
-
rubygems_version: 3.
|
151
|
-
signing_key:
|
150
|
+
rubygems_version: 3.3.7
|
151
|
+
signing_key:
|
152
152
|
specification_version: 4
|
153
153
|
summary: main
|
154
154
|
test_files: []
|