main 5.2.0 → 5.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/Rakefile +25 -39
- data/a.rb +3 -0
- data/lib/main.rb +8 -3
- data/lib/main/cast.rb +14 -4
- data/lib/main/program/instance_methods.rb +7 -0
- data/main.gemspec +6 -13
- metadata +10 -76
- data/db +0 -0
- data/out +0 -9
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YmY5MThkMTIyNDA4YzI1OTczMDFlYTA2NTFiNmY0OTM4MzFlYTM2MA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZDRlOGNjYThhMTVkMWUyNDdkMTY4MTZjYTMzOWQ0Yzk4ZDM2NGZlOQ==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MTA4YWQyZTk0ZTcwYmI0MGE3N2RkMjMzNGQ2MmNkNWRjMjFjZjJjMzc4NWJj
|
10
|
+
MDIzMWEwMTY3YTcxZjkzMGUzZjcwZDEzOGQ4MTRlZjMyOTU1MGRiYWY0MzI5
|
11
|
+
NWQzOTQ3YmU2Mjk2ZTkzYmYzMGUyMjFiZGY1NjNhNmU1NDE0Y2Q=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MDNmMWYyYWE1ZWY4OGIxYTIzMDAxZGQxYThiOGI4MmVkYTljMDNhYmUyMGJj
|
14
|
+
NTdmNDZmYjI3MGExZGQzMjdjODllMjVkNDI2MzU0YzM2MjA1ZjVkNzFmZTZm
|
15
|
+
OTY2NjI5ODJlNjdhYmY1M2MyNTAyYzlmMGI4MmI0MmVlZTQyNWM=
|
data/Rakefile
CHANGED
@@ -3,6 +3,9 @@ This.author = "Ara T. Howard"
|
|
3
3
|
This.email = "ara.t.howard@gmail.com"
|
4
4
|
This.homepage = "https://github.com/ahoward/#{ This.lib }"
|
5
5
|
|
6
|
+
task :license do
|
7
|
+
open('LICENSE', 'w'){|fd| fd.puts "same as ruby's"}
|
8
|
+
end
|
6
9
|
|
7
10
|
task :default do
|
8
11
|
puts((Rake::Task.tasks.map{|task| task.name.gsub(/::/,':')} - ['default']).sort)
|
@@ -29,7 +32,7 @@ def run_tests!(which = nil)
|
|
29
32
|
|
30
33
|
test_rbs.each_with_index do |test_rb, index|
|
31
34
|
testno = index + 1
|
32
|
-
command = "#{ This.ruby } -I ./lib -I ./test/lib #{ test_rb }"
|
35
|
+
command = "#{ This.ruby } -w -I ./lib -I ./test/lib #{ test_rb }"
|
33
36
|
|
34
37
|
puts
|
35
38
|
say(div, :color => :cyan, :bold => true)
|
@@ -60,7 +63,7 @@ end
|
|
60
63
|
task :gemspec do
|
61
64
|
ignore_extensions = ['git', 'svn', 'tmp', /sw./, 'bak', 'gem']
|
62
65
|
ignore_directories = ['pkg']
|
63
|
-
ignore_files = ['test/log'
|
66
|
+
ignore_files = ['test/log']
|
64
67
|
|
65
68
|
shiteless =
|
66
69
|
lambda do |list|
|
@@ -87,9 +90,10 @@ task :gemspec do
|
|
87
90
|
files = shiteless[Dir::glob("**/**")]
|
88
91
|
executables = shiteless[Dir::glob("bin/*")].map{|exe| File.basename(exe)}
|
89
92
|
#has_rdoc = true #File.exist?('doc')
|
90
|
-
test_files =
|
93
|
+
test_files = "test/#{ lib }.rb" if File.file?("test/#{ lib }.rb")
|
91
94
|
summary = object.respond_to?(:summary) ? object.summary : "summary: #{ lib } kicks the ass"
|
92
95
|
description = object.respond_to?(:description) ? object.description : "description: #{ lib } kicks the ass"
|
96
|
+
license = object.respond_to?(:license) ? object.license : "same as ruby's"
|
93
97
|
|
94
98
|
if This.extensions.nil?
|
95
99
|
This.extensions = []
|
@@ -100,51 +104,39 @@ task :gemspec do
|
|
100
104
|
end
|
101
105
|
extensions = [extensions].flatten.compact
|
102
106
|
|
103
|
-
# TODO
|
104
|
-
if This.dependencies.nil?
|
105
|
-
dependencies = []
|
106
|
-
else
|
107
|
-
case This.dependencies
|
108
|
-
when Hash
|
109
|
-
dependencies = This.dependencies.values
|
110
|
-
when Array
|
111
|
-
dependencies = This.dependencies
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
107
|
template =
|
116
108
|
if test(?e, 'gemspec.erb')
|
117
109
|
Template{ IO.read('gemspec.erb') }
|
118
110
|
else
|
119
111
|
Template {
|
120
112
|
<<-__
|
121
|
-
##
|
113
|
+
## #{ lib }.gemspec
|
122
114
|
#
|
123
115
|
|
124
116
|
Gem::Specification::new do |spec|
|
125
|
-
spec.name =
|
126
|
-
spec.version =
|
117
|
+
spec.name = #{ lib.inspect }
|
118
|
+
spec.version = #{ version.inspect }
|
127
119
|
spec.platform = Gem::Platform::RUBY
|
128
|
-
spec.summary =
|
129
|
-
spec.description =
|
120
|
+
spec.summary = #{ lib.inspect }
|
121
|
+
spec.description = #{ description.inspect }
|
122
|
+
spec.license = #{ license.inspect }
|
130
123
|
|
131
|
-
spec.files =\n
|
132
|
-
spec.executables =
|
124
|
+
spec.files =\n#{ files.sort.pretty_inspect }
|
125
|
+
spec.executables = #{ executables.inspect }
|
133
126
|
|
134
127
|
spec.require_path = "lib"
|
135
128
|
|
136
|
-
spec.test_files =
|
129
|
+
spec.test_files = #{ test_files.inspect }
|
137
130
|
|
138
|
-
|
139
|
-
|
140
|
-
<% end %>
|
131
|
+
### spec.add_dependency 'lib', '>= version'
|
132
|
+
#### spec.add_dependency 'map'
|
141
133
|
|
142
|
-
spec.extensions.push(
|
134
|
+
spec.extensions.push(*#{ extensions.inspect })
|
143
135
|
|
144
|
-
spec.rubyforge_project =
|
145
|
-
spec.author =
|
146
|
-
spec.email =
|
147
|
-
spec.homepage =
|
136
|
+
spec.rubyforge_project = #{ This.rubyforge_project.inspect }
|
137
|
+
spec.author = #{ This.author.inspect }
|
138
|
+
spec.email = #{ This.email.inspect }
|
139
|
+
spec.homepage = #{ This.homepage.inspect }
|
148
140
|
end
|
149
141
|
__
|
150
142
|
}
|
@@ -188,8 +180,8 @@ task :readme do
|
|
188
180
|
end
|
189
181
|
|
190
182
|
template =
|
191
|
-
if test(?e, '
|
192
|
-
Template{ IO.read('
|
183
|
+
if test(?e, 'README.erb')
|
184
|
+
Template{ IO.read('README.erb') }
|
193
185
|
else
|
194
186
|
Template {
|
195
187
|
<<-__
|
@@ -280,12 +272,6 @@ BEGIN {
|
|
280
272
|
end
|
281
273
|
This.version = version
|
282
274
|
|
283
|
-
# see if dependencies are export by the module
|
284
|
-
#
|
285
|
-
if This.object.respond_to?(:dependencies)
|
286
|
-
This.dependencies = This.object.dependencies
|
287
|
-
end
|
288
|
-
|
289
275
|
# we need to know the name of the lib an it's version
|
290
276
|
#
|
291
277
|
abort('no lib') unless This.lib
|
data/lib/main.rb
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
module Main
|
2
2
|
# top level constants
|
3
3
|
#
|
4
|
-
Main::VERSION = '5.
|
4
|
+
Main::VERSION = '5.3.1' unless
|
5
5
|
defined? Main::VERSION
|
6
|
-
def
|
6
|
+
def Main.version() Main::VERSION end
|
7
|
+
|
8
|
+
def Main.description
|
9
|
+
'a class factory and dsl for generating command line programs real quick'
|
10
|
+
end
|
7
11
|
|
8
12
|
Main::LIBDIR = File.join(File.dirname(File.expand_path(__FILE__)), self.name.downcase, '') unless
|
9
13
|
defined? Main::LIBDIR
|
@@ -21,7 +25,8 @@ module Main
|
|
21
25
|
'chronic' => [ 'chronic' , '>= 0.6.2' ] ,
|
22
26
|
'fattr' => [ 'fattr' , '>= 2.2.0' ] ,
|
23
27
|
'arrayfields' => [ 'arrayfields' , '>= 4.7.4' ] ,
|
24
|
-
'map' => [ 'map' , '>= 5.1.0' ]
|
28
|
+
'map' => [ 'map' , '>= 5.1.0' ] ,
|
29
|
+
'pry' => [ 'pry' , '>= 0.9' ] ,
|
25
30
|
}
|
26
31
|
end
|
27
32
|
|
data/lib/main/cast.rb
CHANGED
@@ -68,9 +68,10 @@ module Main
|
|
68
68
|
File.expand_path(obj.to_s)
|
69
69
|
end
|
70
70
|
|
71
|
-
|
71
|
+
stdin = proc do |obj|
|
72
|
+
require 'fattr' unless defined?(Fattr)
|
72
73
|
case obj.to_s
|
73
|
-
when '-'
|
74
|
+
when '-', 'stdin'
|
74
75
|
io = STDIN.dup
|
75
76
|
io.fattr(:path){ '/dev/stdin' }
|
76
77
|
io
|
@@ -80,10 +81,13 @@ module Main
|
|
80
81
|
io
|
81
82
|
end
|
82
83
|
end
|
84
|
+
cast(:stdin, &stdin)
|
85
|
+
cast(:input, &stdin)
|
83
86
|
|
84
|
-
|
87
|
+
stdout = proc do |obj|
|
88
|
+
require 'fattr' unless defined?(Fattr)
|
85
89
|
case obj.to_s
|
86
|
-
when '-'
|
90
|
+
when '-', 'stdout'
|
87
91
|
io = STDOUT.dup
|
88
92
|
io.fattr(:path){ '/dev/stdout' }
|
89
93
|
io
|
@@ -93,6 +97,8 @@ module Main
|
|
93
97
|
io
|
94
98
|
end
|
95
99
|
end
|
100
|
+
cast(:stdout, &stdout)
|
101
|
+
cast(:output, &stdout)
|
96
102
|
|
97
103
|
cast :slug do |obj|
|
98
104
|
string = [obj].flatten.compact.join('-')
|
@@ -149,5 +155,9 @@ module Main
|
|
149
155
|
this = self
|
150
156
|
lambda{|obj| method(m).call obj}
|
151
157
|
end
|
158
|
+
|
159
|
+
def Cast.cast(which, *args, &block)
|
160
|
+
Cast.send(which, *args, &block)
|
161
|
+
end
|
152
162
|
end
|
153
163
|
end
|
@@ -203,6 +203,13 @@ module Main
|
|
203
203
|
(params['help'] and params['help'].given?) or argv.first == 'help'
|
204
204
|
end
|
205
205
|
|
206
|
+
def shell!
|
207
|
+
Pry.hooks.clear_all
|
208
|
+
prompt = "#{ name } > "
|
209
|
+
Pry.config.prompt = proc{|*a| prompt }
|
210
|
+
binding.pry
|
211
|
+
end
|
212
|
+
|
206
213
|
def abort(message = 'exit')
|
207
214
|
raise SystemExit.new(message)
|
208
215
|
end
|
data/main.gemspec
CHANGED
@@ -3,10 +3,11 @@
|
|
3
3
|
|
4
4
|
Gem::Specification::new do |spec|
|
5
5
|
spec.name = "main"
|
6
|
-
spec.version = "5.
|
6
|
+
spec.version = "5.3.1"
|
7
7
|
spec.platform = Gem::Platform::RUBY
|
8
8
|
spec.summary = "main"
|
9
|
-
spec.description = "
|
9
|
+
spec.description = "a class factory and dsl for generating command line programs real quick"
|
10
|
+
spec.license = "same as ruby's"
|
10
11
|
|
11
12
|
spec.files =
|
12
13
|
["LICENSE",
|
@@ -14,7 +15,7 @@ Gem::Specification::new do |spec|
|
|
14
15
|
"README.erb",
|
15
16
|
"Rakefile",
|
16
17
|
"TODO",
|
17
|
-
"
|
18
|
+
"a.rb",
|
18
19
|
"lib",
|
19
20
|
"lib/main",
|
20
21
|
"lib/main.rb",
|
@@ -35,7 +36,6 @@ Gem::Specification::new do |spec|
|
|
35
36
|
"lib/main/usage.rb",
|
36
37
|
"lib/main/util.rb",
|
37
38
|
"main.gemspec",
|
38
|
-
"out",
|
39
39
|
"samples",
|
40
40
|
"samples/a.rb",
|
41
41
|
"samples/b.rb",
|
@@ -55,15 +55,8 @@ Gem::Specification::new do |spec|
|
|
55
55
|
|
56
56
|
spec.test_files = nil
|
57
57
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
spec.add_dependency(*["fattr", ">= 2.2.0"])
|
62
|
-
|
63
|
-
spec.add_dependency(*["arrayfields", ">= 4.7.4"])
|
64
|
-
|
65
|
-
spec.add_dependency(*["map", ">= 5.1.0"])
|
66
|
-
|
58
|
+
### spec.add_dependency 'lib', '>= version'
|
59
|
+
#### spec.add_dependency 'map'
|
67
60
|
|
68
61
|
spec.extensions.push(*[])
|
69
62
|
|
metadata
CHANGED
@@ -1,81 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: main
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
5
|
-
prerelease:
|
4
|
+
version: 5.3.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Ara T. Howard
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
dependencies:
|
14
|
-
|
15
|
-
name: chronic
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ! '>='
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 0.6.2
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
|
-
requirements:
|
27
|
-
- - ! '>='
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: 0.6.2
|
30
|
-
- !ruby/object:Gem::Dependency
|
31
|
-
name: fattr
|
32
|
-
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ! '>='
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: 2.2.0
|
38
|
-
type: :runtime
|
39
|
-
prerelease: false
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
|
-
requirements:
|
43
|
-
- - ! '>='
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
version: 2.2.0
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: arrayfields
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - ! '>='
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: 4.7.4
|
54
|
-
type: :runtime
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ! '>='
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 4.7.4
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: map
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
|
-
requirements:
|
67
|
-
- - ! '>='
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: 5.1.0
|
70
|
-
type: :runtime
|
71
|
-
prerelease: false
|
72
|
-
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
|
-
requirements:
|
75
|
-
- - ! '>='
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: 5.1.0
|
78
|
-
description: ! 'description: main kicks the ass'
|
11
|
+
date: 2014-02-15 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: a class factory and dsl for generating command line programs real quick
|
79
14
|
email: ara.t.howard@gmail.com
|
80
15
|
executables: []
|
81
16
|
extensions: []
|
@@ -86,7 +21,7 @@ files:
|
|
86
21
|
- README.erb
|
87
22
|
- Rakefile
|
88
23
|
- TODO
|
89
|
-
-
|
24
|
+
- a.rb
|
90
25
|
- lib/main.rb
|
91
26
|
- lib/main/cast.rb
|
92
27
|
- lib/main/dsl.rb
|
@@ -104,7 +39,6 @@ files:
|
|
104
39
|
- lib/main/usage.rb
|
105
40
|
- lib/main/util.rb
|
106
41
|
- main.gemspec
|
107
|
-
- out
|
108
42
|
- samples/a.rb
|
109
43
|
- samples/b.rb
|
110
44
|
- samples/c.rb
|
@@ -116,27 +50,27 @@ files:
|
|
116
50
|
- samples/j.rb
|
117
51
|
- test/main_test.rb
|
118
52
|
homepage: https://github.com/ahoward/main
|
119
|
-
licenses:
|
53
|
+
licenses:
|
54
|
+
- same as ruby's
|
55
|
+
metadata: {}
|
120
56
|
post_install_message:
|
121
57
|
rdoc_options: []
|
122
58
|
require_paths:
|
123
59
|
- lib
|
124
60
|
required_ruby_version: !ruby/object:Gem::Requirement
|
125
|
-
none: false
|
126
61
|
requirements:
|
127
62
|
- - ! '>='
|
128
63
|
- !ruby/object:Gem::Version
|
129
64
|
version: '0'
|
130
65
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
|
-
none: false
|
132
66
|
requirements:
|
133
67
|
- - ! '>='
|
134
68
|
- !ruby/object:Gem::Version
|
135
69
|
version: '0'
|
136
70
|
requirements: []
|
137
71
|
rubyforge_project: codeforpeople
|
138
|
-
rubygems_version:
|
72
|
+
rubygems_version: 2.0.3
|
139
73
|
signing_key:
|
140
|
-
specification_version:
|
74
|
+
specification_version: 4
|
141
75
|
summary: main
|
142
76
|
test_files: []
|
data/db
DELETED
File without changes
|