ordu 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/Rakefile +4 -4
- data/bin/console +3 -3
- data/lib/ordu.rb +7 -7
- data/ordu.gemspec +2 -1
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e05c5d3642068b8538b577c8039936aa37e1bffa
|
4
|
+
data.tar.gz: c346f74c2787f223e18df07f206a414a9ac433be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cf8eec15076520ddaaf6b55e952e46ba91a5e2110df0ece1a59f5475001c4fba964004693d90071bc13da8ccf6b78744834c4c77b635cb49c2d89fea184059a5
|
7
|
+
data.tar.gz: 3196f4c93e887e2eba62b7cc5d52c75afb30623bf026ef6c79fc0a806a8cf9529c46afd7dfb3542b7f9200361e68388cfa7c313171a4d757ac9cbeec5d358754
|
data/README.md
CHANGED
@@ -3,6 +3,8 @@
|
|
3
3
|
Another command-line interface library for Ruby. This one is based entirely on
|
4
4
|
the venerable and built-in `OptionParser` class.
|
5
5
|
|
6
|
+
[![Build Status](https://travis-ci.org/bjjb/ordu.svg?branch=master)](https://travis-ci.org/bjjb/ordu)
|
7
|
+
|
6
8
|
## Installation
|
7
9
|
|
8
10
|
Add this line to your application's Gemfile:
|
data/Rakefile
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rake/testtask'
|
3
3
|
|
4
4
|
Rake::TestTask.new(:test) do |t|
|
5
|
-
t.libs <<
|
6
|
-
t.libs <<
|
5
|
+
t.libs << 'test'
|
6
|
+
t.libs << 'lib'
|
7
7
|
t.test_files = FileList['test/**/*_test.rb']
|
8
8
|
end
|
9
9
|
|
data/bin/console
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'ordu'
|
5
5
|
|
6
6
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
7
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +10,5 @@ require "ordu"
|
|
10
10
|
# require "pry"
|
11
11
|
# Pry.start
|
12
12
|
|
13
|
-
require
|
13
|
+
require 'irb'
|
14
14
|
IRB.start
|
data/lib/ordu.rb
CHANGED
@@ -36,9 +36,7 @@ class Ordu < OptionParser
|
|
36
36
|
def parse!(args)
|
37
37
|
args = order!(args)
|
38
38
|
unless args.empty?
|
39
|
-
if commands.key?(args.first)
|
40
|
-
return commands[args.shift].parse!(args)
|
41
|
-
end
|
39
|
+
return commands[args.shift].parse!(args) if commands.key?(args.first)
|
42
40
|
end
|
43
41
|
run(*args)
|
44
42
|
end
|
@@ -47,7 +45,7 @@ class Ordu < OptionParser
|
|
47
45
|
def command_summary
|
48
46
|
return if commands.empty?
|
49
47
|
w = commands.keys.map(&:length).max
|
50
|
-
lines = [
|
48
|
+
lines = ['Available commands:']
|
51
49
|
lines += commands.map { |k, v| " %-#{w}s %s" % [k, v.desc] }
|
52
50
|
lines.join("\n")
|
53
51
|
end
|
@@ -70,11 +68,13 @@ class Ordu < OptionParser
|
|
70
68
|
end
|
71
69
|
|
72
70
|
def self.name(name = nil)
|
73
|
-
|
71
|
+
@name = name if name
|
72
|
+
@name if instance_variable_defined?(:@name)
|
74
73
|
end
|
75
74
|
|
76
75
|
def self.desc(desc = nil)
|
77
|
-
|
76
|
+
@desc = desc if desc
|
77
|
+
@desc if instance_variable_defined?(:@desc)
|
78
78
|
end
|
79
79
|
|
80
80
|
# Runs the action for this Ordu instance.
|
@@ -129,6 +129,6 @@ class Ordu < OptionParser
|
|
129
129
|
# Defines the action to be run once parsing is finished.
|
130
130
|
def self.action(&block)
|
131
131
|
@action = block if block_given?
|
132
|
-
@action ||= lambda { }
|
132
|
+
@action ||= lambda { |*args| }
|
133
133
|
end
|
134
134
|
end
|
data/ordu.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'ordu'
|
7
|
-
spec.version = '0.0.
|
7
|
+
spec.version = '0.0.4'
|
8
8
|
spec.authors = ['JJ Buckley']
|
9
9
|
spec.email = ['jj@bjjb.org']
|
10
10
|
|
@@ -24,4 +24,5 @@ dependencies, and allows you to specify subcommands.
|
|
24
24
|
spec.add_development_dependency 'bundler', '~> 1.12'
|
25
25
|
spec.add_development_dependency 'rake', '~> 10.0'
|
26
26
|
spec.add_development_dependency 'minitest', '~> 5.0'
|
27
|
+
spec.add_development_dependency 'simplecov', '~> 0.12'
|
27
28
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ordu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JJ Buckley
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '5.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: simplecov
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0.12'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0.12'
|
55
69
|
description: |
|
56
70
|
A small library to simplify writing command-line interfaces. It has no
|
57
71
|
dependencies, and allows you to specify subcommands.
|