optix 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE +25 -0
- data/README.md +431 -0
- data/Rakefile +30 -0
- data/examples/filetool.rb +188 -0
- data/examples/printer.rb +43 -0
- data/lib/optix/trollop.rb +814 -0
- data/lib/optix/version.rb +3 -0
- data/lib/optix.rb +276 -0
- data/optix.gemspec +20 -0
- data/spec/optix_spec.rb +988 -0
- data/spec/spec_helper.rb +30 -0
- metadata +83 -0
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
SimpleCov.start
|
3
|
+
|
4
|
+
RSpec::Matchers.define :have_stdout do |regex|
|
5
|
+
define_method :has_stdout? do |actual|
|
6
|
+
regex = /^#{Regexp.escape(regex)}$/ if regex.is_a?(String)
|
7
|
+
|
8
|
+
$stdout = StringIO.new
|
9
|
+
actual.call
|
10
|
+
$stdout.rewind
|
11
|
+
captured = $stdout.read
|
12
|
+
|
13
|
+
$stdout = STDOUT
|
14
|
+
captured =~ regex
|
15
|
+
end
|
16
|
+
match { |actual| has_stdout?(actual) }
|
17
|
+
end
|
18
|
+
|
19
|
+
|
20
|
+
def capture_streams(stdin_str = '')
|
21
|
+
begin
|
22
|
+
require 'stringio'
|
23
|
+
$o_stdin, $o_stdout, $o_stderr = $stdin, $stdout, $stderr
|
24
|
+
$stdin, $stdout, $stderr = StringIO.new(stdin_str), StringIO.new, StringIO.new
|
25
|
+
yield
|
26
|
+
{:stdout => $stdout.string, :stderr => $stderr.string}
|
27
|
+
ensure
|
28
|
+
$stdin, $stdout, $stderr = $o_stdin, $o_stdout, $o_stderr
|
29
|
+
end
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: optix
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Moe
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-07-09 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: chronic
|
16
|
+
requirement: &10911160 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *10911160
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: simplecov
|
27
|
+
requirement: &10907920 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *10907920
|
36
|
+
description: Optix is an unobtrusive, composable command line parser.
|
37
|
+
email:
|
38
|
+
- moe@busyloop.net
|
39
|
+
executables: []
|
40
|
+
extensions: []
|
41
|
+
extra_rdoc_files: []
|
42
|
+
files:
|
43
|
+
- .gitignore
|
44
|
+
- Gemfile
|
45
|
+
- LICENSE
|
46
|
+
- README.md
|
47
|
+
- Rakefile
|
48
|
+
- examples/filetool.rb
|
49
|
+
- examples/printer.rb
|
50
|
+
- lib/optix.rb
|
51
|
+
- lib/optix/trollop.rb
|
52
|
+
- lib/optix/version.rb
|
53
|
+
- optix.gemspec
|
54
|
+
- spec/optix_spec.rb
|
55
|
+
- spec/spec_helper.rb
|
56
|
+
homepage: ''
|
57
|
+
licenses: []
|
58
|
+
post_install_message:
|
59
|
+
rdoc_options: []
|
60
|
+
require_paths:
|
61
|
+
- lib
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
none: false
|
64
|
+
requirements:
|
65
|
+
- - ! '>='
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
|
+
requirements:
|
71
|
+
- - ! '>='
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
requirements: []
|
75
|
+
rubyforge_project:
|
76
|
+
rubygems_version: 1.8.10
|
77
|
+
signing_key:
|
78
|
+
specification_version: 3
|
79
|
+
summary: Optix is an unobtrusive, composable command line parser.
|
80
|
+
test_files:
|
81
|
+
- spec/optix_spec.rb
|
82
|
+
- spec/spec_helper.rb
|
83
|
+
has_rdoc:
|