rprogram 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -0
- data/ChangeLog.md +4 -0
- data/Rakefile +20 -28
- data/gemspec.yml +20 -0
- data/lib/rprogram/option.rb +5 -2
- data/lib/rprogram/version.rb +1 -1
- data/rprogram.gemspec +6 -100
- data/spec/option_spec.rb +8 -0
- data/spec/spec_helper.rb +2 -2
- metadata +51 -30
- data/.gitignore +0 -9
- data/.specopts +0 -1
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour --format documentation
|
data/ChangeLog.md
CHANGED
data/Rakefile
CHANGED
@@ -1,43 +1,35 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'rake'
|
3
|
-
require './lib/rprogram/version.rb'
|
4
3
|
|
5
4
|
begin
|
6
|
-
gem '
|
7
|
-
require '
|
5
|
+
gem 'ore-tasks', '~> 0.1.2'
|
6
|
+
require 'ore/tasks'
|
8
7
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
gem.description = %Q{RProgram is a library for creating wrappers around command-line programs. RProgram provides a Rubyful interface to programs and all their options or non-options. RProgram can also search for programs installed on a system.}
|
14
|
-
gem.email = 'postmodern.mod3@gmail.com'
|
15
|
-
gem.homepage = 'http://github.com/postmodern/rprogram'
|
16
|
-
gem.authors = ['Postmodern']
|
17
|
-
gem.add_development_dependency 'rspec', '>= 1.3.0'
|
18
|
-
gem.add_development_dependency 'yard', '>= 0.5.3'
|
19
|
-
gem.has_rdoc = 'yard'
|
20
|
-
end
|
21
|
-
Jeweler::GemcutterTasks.new
|
22
|
-
rescue LoadError
|
23
|
-
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
8
|
+
Ore::Tasks.new
|
9
|
+
rescue LoadError => e
|
10
|
+
STDERR.puts e.message
|
11
|
+
STDERR.puts "Run `gem install ore-tasks` to install 'ore/tasks'."
|
24
12
|
end
|
25
13
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
spec.spec_files = FileList['spec/**/*_spec.rb']
|
30
|
-
spec.spec_opts = ['--options', '.specopts']
|
31
|
-
end
|
14
|
+
begin
|
15
|
+
gem 'rspec', '~> 2.0.0'
|
16
|
+
require 'rspec/core/rake_task'
|
32
17
|
|
33
|
-
|
18
|
+
RSpec::Core::RakeTask.new
|
19
|
+
rescue LoadError => e
|
20
|
+
task :spec do
|
21
|
+
abort "Please run `gem install rspec` to install RSpec."
|
22
|
+
end
|
23
|
+
end
|
34
24
|
task :default => :spec
|
35
25
|
|
36
26
|
begin
|
27
|
+
gem 'yard', '~> 0.6.0'
|
37
28
|
require 'yard'
|
38
|
-
|
39
|
-
|
29
|
+
|
30
|
+
YARD::Rake::YardocTask.new
|
31
|
+
rescue LoadError => e
|
40
32
|
task :yard do
|
41
|
-
abort "
|
33
|
+
abort "Please run `gem install yard` to install YARD."
|
42
34
|
end
|
43
35
|
end
|
data/gemspec.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
name: rprogram
|
2
|
+
summary: A library for creating wrappers around command-line programs.
|
3
|
+
description:
|
4
|
+
RProgram is a library for creating wrappers around command-line programs.
|
5
|
+
RProgram provides a Rubyful interface to programs and all their options
|
6
|
+
or non-options. RProgram can also search for programs installed on a
|
7
|
+
system. files without having to use YAML or define classes named like
|
8
|
+
the file.
|
9
|
+
|
10
|
+
license: MIT
|
11
|
+
authors: Postmodern
|
12
|
+
email: postmodern.mod3@gmail.com
|
13
|
+
homepage: http://github.com/postmodern/rprogram
|
14
|
+
has_yard: true
|
15
|
+
|
16
|
+
development_dependencies:
|
17
|
+
ore: ~> 0.2.0
|
18
|
+
ore-tasks: ~> 0.1.2
|
19
|
+
rspec: ~> 2.0.0
|
20
|
+
yard: ~> 0.6.0
|
data/lib/rprogram/option.rb
CHANGED
@@ -110,12 +110,15 @@ module RProgram
|
|
110
110
|
|
111
111
|
if @multiple
|
112
112
|
return value.inject([]) do |args,value|
|
113
|
-
|
113
|
+
arg = @formatter.call(self,[value])
|
114
|
+
|
115
|
+
args += arg if arg
|
116
|
+
args
|
114
117
|
end
|
115
118
|
else
|
116
119
|
value = [value.join(@separator)] if @separator
|
117
120
|
|
118
|
-
return @formatter.call(self,value)
|
121
|
+
return (@formatter.call(self,value) || [])
|
119
122
|
end
|
120
123
|
end
|
121
124
|
|
data/lib/rprogram/version.rb
CHANGED
data/rprogram.gemspec
CHANGED
@@ -1,104 +1,10 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
1
|
# -*- encoding: utf-8 -*-
|
5
2
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Postmodern"]
|
12
|
-
s.date = %q{2010-10-03}
|
13
|
-
s.description = %q{RProgram is a library for creating wrappers around command-line programs. RProgram provides a Rubyful interface to programs and all their options or non-options. RProgram can also search for programs installed on a system.}
|
14
|
-
s.email = %q{postmodern.mod3@gmail.com}
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"ChangeLog.md",
|
17
|
-
"LICENSE.txt",
|
18
|
-
"README.md"
|
19
|
-
]
|
20
|
-
s.files = [
|
21
|
-
".gitignore",
|
22
|
-
".specopts",
|
23
|
-
".yardopts",
|
24
|
-
"ChangeLog.md",
|
25
|
-
"LICENSE.txt",
|
26
|
-
"README.md",
|
27
|
-
"Rakefile",
|
28
|
-
"lib/rprogram.rb",
|
29
|
-
"lib/rprogram/compat.rb",
|
30
|
-
"lib/rprogram/exceptions.rb",
|
31
|
-
"lib/rprogram/exceptions/program_not_found.rb",
|
32
|
-
"lib/rprogram/extensions.rb",
|
33
|
-
"lib/rprogram/nameable.rb",
|
34
|
-
"lib/rprogram/nameable/class_methods.rb",
|
35
|
-
"lib/rprogram/nameable/nameable.rb",
|
36
|
-
"lib/rprogram/non_option.rb",
|
37
|
-
"lib/rprogram/option.rb",
|
38
|
-
"lib/rprogram/option_list.rb",
|
39
|
-
"lib/rprogram/options.rb",
|
40
|
-
"lib/rprogram/options/class_methods.rb",
|
41
|
-
"lib/rprogram/options/options.rb",
|
42
|
-
"lib/rprogram/program.rb",
|
43
|
-
"lib/rprogram/rprogram.rb",
|
44
|
-
"lib/rprogram/task.rb",
|
45
|
-
"lib/rprogram/version.rb",
|
46
|
-
"lib/rprogram/yard.rb",
|
47
|
-
"rprogram.gemspec",
|
48
|
-
"spec/classes/aliased_program.rb",
|
49
|
-
"spec/classes/ls_program.rb",
|
50
|
-
"spec/classes/ls_selinux_task.rb",
|
51
|
-
"spec/classes/ls_task.rb",
|
52
|
-
"spec/classes/named_program.rb",
|
53
|
-
"spec/compat_spec.rb",
|
54
|
-
"spec/nameable_spec.rb",
|
55
|
-
"spec/non_option_spec.rb",
|
56
|
-
"spec/option_examples.rb",
|
57
|
-
"spec/option_list_spec.rb",
|
58
|
-
"spec/option_spec.rb",
|
59
|
-
"spec/program_spec.rb",
|
60
|
-
"spec/rprogram_spec.rb",
|
61
|
-
"spec/spec_helper.rb",
|
62
|
-
"spec/task_spec.rb"
|
63
|
-
]
|
64
|
-
s.has_rdoc = %q{yard}
|
65
|
-
s.homepage = %q{http://github.com/postmodern/rprogram}
|
66
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
67
|
-
s.require_paths = ["lib"]
|
68
|
-
s.rubygems_version = %q{1.3.7}
|
69
|
-
s.summary = %q{A library for creating wrappers around command-line programs.}
|
70
|
-
s.test_files = [
|
71
|
-
"spec/classes/ls_program.rb",
|
72
|
-
"spec/classes/named_program.rb",
|
73
|
-
"spec/classes/ls_selinux_task.rb",
|
74
|
-
"spec/classes/aliased_program.rb",
|
75
|
-
"spec/classes/ls_task.rb",
|
76
|
-
"spec/nameable_spec.rb",
|
77
|
-
"spec/program_spec.rb",
|
78
|
-
"spec/rprogram_spec.rb",
|
79
|
-
"spec/option_examples.rb",
|
80
|
-
"spec/non_option_spec.rb",
|
81
|
-
"spec/compat_spec.rb",
|
82
|
-
"spec/option_list_spec.rb",
|
83
|
-
"spec/spec_helper.rb",
|
84
|
-
"spec/option_spec.rb",
|
85
|
-
"spec/task_spec.rb"
|
86
|
-
]
|
87
|
-
|
88
|
-
if s.respond_to? :specification_version then
|
89
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
90
|
-
s.specification_version = 3
|
91
|
-
|
92
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
93
|
-
s.add_development_dependency(%q<rspec>, [">= 1.3.0"])
|
94
|
-
s.add_development_dependency(%q<yard>, [">= 0.5.3"])
|
95
|
-
else
|
96
|
-
s.add_dependency(%q<rspec>, [">= 1.3.0"])
|
97
|
-
s.add_dependency(%q<yard>, [">= 0.5.3"])
|
98
|
-
end
|
99
|
-
else
|
100
|
-
s.add_dependency(%q<rspec>, [">= 1.3.0"])
|
101
|
-
s.add_dependency(%q<yard>, [">= 0.5.3"])
|
3
|
+
begin
|
4
|
+
Ore::Specification.new do |gemspec|
|
5
|
+
# custom logic here
|
102
6
|
end
|
7
|
+
rescue NameError
|
8
|
+
STDERR.puts "The 'rprogram.gemspec' file requires Ore."
|
9
|
+
STDERR.puts "Run `gem install ore` to install Ore."
|
103
10
|
end
|
104
|
-
|
data/spec/option_spec.rb
CHANGED
@@ -4,6 +4,14 @@ require 'spec_helper'
|
|
4
4
|
require 'option_examples'
|
5
5
|
|
6
6
|
describe Option do
|
7
|
+
describe "custom formatting" do
|
8
|
+
it "should allow the format block to return nil" do
|
9
|
+
opt = Option.new(:flag => '-f') { |opt,value| }
|
10
|
+
|
11
|
+
opt.arguments('bla').should == []
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
7
15
|
describe "single flag" do
|
8
16
|
before(:all) do
|
9
17
|
@option = Option.new(:flag => '-f')
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 1
|
9
|
+
version: 0.2.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Postmodern
|
@@ -14,57 +14,85 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-10-
|
17
|
+
date: 2010-10-27 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
|
-
name:
|
21
|
+
name: ore
|
22
22
|
prerelease: false
|
23
23
|
requirement: &id001 !ruby/object:Gem::Requirement
|
24
24
|
none: false
|
25
25
|
requirements:
|
26
|
-
- -
|
26
|
+
- - ~>
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
segments:
|
29
|
-
- 1
|
30
|
-
- 3
|
31
29
|
- 0
|
32
|
-
|
30
|
+
- 2
|
31
|
+
- 0
|
32
|
+
version: 0.2.0
|
33
33
|
type: :development
|
34
34
|
version_requirements: *id001
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
|
-
name:
|
36
|
+
name: ore-tasks
|
37
37
|
prerelease: false
|
38
38
|
requirement: &id002 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
|
-
- -
|
41
|
+
- - ~>
|
42
42
|
- !ruby/object:Gem::Version
|
43
43
|
segments:
|
44
44
|
- 0
|
45
|
-
-
|
46
|
-
-
|
47
|
-
version: 0.
|
45
|
+
- 1
|
46
|
+
- 2
|
47
|
+
version: 0.1.2
|
48
48
|
type: :development
|
49
49
|
version_requirements: *id002
|
50
|
-
|
50
|
+
- !ruby/object:Gem::Dependency
|
51
|
+
name: rspec
|
52
|
+
prerelease: false
|
53
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
+
none: false
|
55
|
+
requirements:
|
56
|
+
- - ~>
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
segments:
|
59
|
+
- 2
|
60
|
+
- 0
|
61
|
+
- 0
|
62
|
+
version: 2.0.0
|
63
|
+
type: :development
|
64
|
+
version_requirements: *id003
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
name: yard
|
67
|
+
prerelease: false
|
68
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
|
+
requirements:
|
71
|
+
- - ~>
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
segments:
|
74
|
+
- 0
|
75
|
+
- 6
|
76
|
+
- 0
|
77
|
+
version: 0.6.0
|
78
|
+
type: :development
|
79
|
+
version_requirements: *id004
|
80
|
+
description: RProgram is a library for creating wrappers around command-line programs. RProgram provides a Rubyful interface to programs and all their options or non-options. RProgram can also search for programs installed on a system. files without having to use YAML or define classes named like the file.
|
51
81
|
email: postmodern.mod3@gmail.com
|
52
82
|
executables: []
|
53
83
|
|
54
84
|
extensions: []
|
55
85
|
|
56
86
|
extra_rdoc_files:
|
57
|
-
- ChangeLog.md
|
58
|
-
- LICENSE.txt
|
59
87
|
- README.md
|
60
88
|
files:
|
61
|
-
- .
|
62
|
-
- .specopts
|
89
|
+
- .rspec
|
63
90
|
- .yardopts
|
64
91
|
- ChangeLog.md
|
65
92
|
- LICENSE.txt
|
66
93
|
- README.md
|
67
94
|
- Rakefile
|
95
|
+
- gemspec.yml
|
68
96
|
- lib/rprogram.rb
|
69
97
|
- lib/rprogram/compat.rb
|
70
98
|
- lib/rprogram/exceptions.rb
|
@@ -102,11 +130,11 @@ files:
|
|
102
130
|
- spec/task_spec.rb
|
103
131
|
has_rdoc: yard
|
104
132
|
homepage: http://github.com/postmodern/rprogram
|
105
|
-
licenses:
|
106
|
-
|
133
|
+
licenses:
|
134
|
+
- MIT
|
107
135
|
post_install_message:
|
108
|
-
rdoc_options:
|
109
|
-
|
136
|
+
rdoc_options: []
|
137
|
+
|
110
138
|
require_paths:
|
111
139
|
- lib
|
112
140
|
required_ruby_version: !ruby/object:Gem::Requirement
|
@@ -127,24 +155,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
127
155
|
version: "0"
|
128
156
|
requirements: []
|
129
157
|
|
130
|
-
rubyforge_project:
|
158
|
+
rubyforge_project: rprogram
|
131
159
|
rubygems_version: 1.3.7
|
132
160
|
signing_key:
|
133
161
|
specification_version: 3
|
134
162
|
summary: A library for creating wrappers around command-line programs.
|
135
163
|
test_files:
|
136
|
-
- spec/classes/ls_program.rb
|
137
|
-
- spec/classes/named_program.rb
|
138
|
-
- spec/classes/ls_selinux_task.rb
|
139
|
-
- spec/classes/aliased_program.rb
|
140
|
-
- spec/classes/ls_task.rb
|
141
164
|
- spec/nameable_spec.rb
|
142
165
|
- spec/program_spec.rb
|
143
166
|
- spec/rprogram_spec.rb
|
144
|
-
- spec/option_examples.rb
|
145
167
|
- spec/non_option_spec.rb
|
146
168
|
- spec/compat_spec.rb
|
147
169
|
- spec/option_list_spec.rb
|
148
|
-
- spec/spec_helper.rb
|
149
170
|
- spec/option_spec.rb
|
150
171
|
- spec/task_spec.rb
|
data/.gitignore
DELETED
data/.specopts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--colour --format specdoc
|