command-line-flunky 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/Gemfile +15 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +19 -0
- data/Rakefile +51 -0
- data/VERSION +1 -0
- data/bin/commandlineflunkytestutility +10 -0
- data/lib/command-line-flunky-test-utility.rb +101 -0
- data/lib/command-line-flunky.rb +212 -0
- data/test/helper.rb +34 -0
- data/test/test_command-line-flunky.rb +9 -0
- metadata +143 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 99237ec939fb18b1666b3ed840e0ab32f320403e
|
4
|
+
data.tar.gz: d5c93b593ac010cb8bc24c4aa45ff2860c55a4cb
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5bf7db0ca30a51a61b00a9b526501cee92208cc57f5040385ba0ca00bbc2b7900fed8ace3d37cfff2ee005cea6970d8454ac85a228141429552d54260b3a34a8
|
7
|
+
data.tar.gz: 89e7e0cc72bd938cddef40b0045c921e74cc0d2391bf0ad9b4ab8bf61009ca7db340c3c6512c308e5af05f13303ed7c462875e750a3cb881e504fc1f7ccaa8a0
|
data/.document
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
# Add dependencies required to use your gem here.
|
3
|
+
# Example:
|
4
|
+
# gem "activesupport", ">= 2.3.5"
|
5
|
+
gem "rubyhacks", ">= 0.1.4"
|
6
|
+
|
7
|
+
# Add dependencies to develop your gem here.
|
8
|
+
# Include everything needed to run rake, tests, features, etc.
|
9
|
+
group :development do
|
10
|
+
gem "shoulda", ">= 0"
|
11
|
+
gem "rdoc", "~> 3.12"
|
12
|
+
gem "bundler", "~> 1.0"
|
13
|
+
gem "jeweler", "~> 2.0.1"
|
14
|
+
gem "simplecov", ">= 0"
|
15
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2014 Edmund Highcock
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
= command-line-flunky
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Contributing to command-line-flunky
|
6
|
+
|
7
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
8
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
9
|
+
* Fork the project.
|
10
|
+
* Start a feature/bugfix branch.
|
11
|
+
* Commit and push until you are happy with your contribution.
|
12
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
13
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2014 Edmund Highcock. See LICENSE.txt for
|
18
|
+
further details.
|
19
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
|
17
|
+
gem.name = "command-line-flunky"
|
18
|
+
gem.homepage = "http://github.com/edmundhighcock/command-line-flunky"
|
19
|
+
gem.license = "GPLv3"
|
20
|
+
gem.summary = %Q{A framework for quickly creating a command line tool and manual.}
|
21
|
+
gem.description = %Q{A framework for quickly creating a command line tool and manual. Coherently and simply links a Ruby class/module interface to a set of command line commands and options. A comprehensive example is in the test folder.}
|
22
|
+
gem.email = "edmundhighcock@users.sourceforge.net"
|
23
|
+
gem.authors = ["Edmund Highcock"]
|
24
|
+
# dependencies defined in Gemfile
|
25
|
+
end
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
27
|
+
|
28
|
+
require 'rake/testtask'
|
29
|
+
Rake::TestTask.new(:test) do |test|
|
30
|
+
test.libs << 'lib' << 'test'
|
31
|
+
test.pattern = 'test/**/test_*.rb'
|
32
|
+
test.verbose = true
|
33
|
+
end
|
34
|
+
|
35
|
+
desc "Code coverage detail"
|
36
|
+
task :simplecov do
|
37
|
+
ENV['COVERAGE'] = "true"
|
38
|
+
Rake::Task['test'].execute
|
39
|
+
end
|
40
|
+
|
41
|
+
task :default => :test
|
42
|
+
|
43
|
+
require 'rdoc/task'
|
44
|
+
Rake::RDocTask.new do |rdoc|
|
45
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
46
|
+
|
47
|
+
rdoc.rdoc_dir = 'rdoc'
|
48
|
+
rdoc.title = "command-line-flunky #{version}"
|
49
|
+
rdoc.rdoc_files.include('README*')
|
50
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
51
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
@@ -0,0 +1,101 @@
|
|
1
|
+
# This is a complete example of how to use command-line-flunky
|
2
|
+
# which also used for testing
|
3
|
+
|
4
|
+
require 'getoptlong'
|
5
|
+
|
6
|
+
module CommandLineFlunky
|
7
|
+
|
8
|
+
STARTUP_MESSAGE = "\n------Test Utility------"
|
9
|
+
|
10
|
+
MANUAL_HEADER = <<EOF
|
11
|
+
|
12
|
+
-------------Test Utility Manual---------------
|
13
|
+
|
14
|
+
Written by Edmund Highcock (2014)
|
15
|
+
|
16
|
+
NAME
|
17
|
+
|
18
|
+
test_utility
|
19
|
+
|
20
|
+
|
21
|
+
SYNOPSIS
|
22
|
+
|
23
|
+
test_utility <command> [arguments] [options]
|
24
|
+
|
25
|
+
|
26
|
+
DESCRIPTION
|
27
|
+
|
28
|
+
This test utility is written to test the command-line-flunky gem.
|
29
|
+
|
30
|
+
EXAMPLES
|
31
|
+
|
32
|
+
$ test_utility hello_world
|
33
|
+
|
34
|
+
$ test_utility test_bool -b
|
35
|
+
|
36
|
+
EOF
|
37
|
+
|
38
|
+
COMMANDS_WITH_HELP = [
|
39
|
+
['hello_world', 'hello', 0, 'Say hello to the world', [], []],
|
40
|
+
['test_bool', 'tbool', 0, 'Test whether the boolean flag works', [], [:b]],
|
41
|
+
['test_arguments', 'args', 1, 'Test passing an argument to a command and an argument to an option', ['command_argument'], [:a]],
|
42
|
+
|
43
|
+
]
|
44
|
+
|
45
|
+
COMMAND_LINE_FLAGS_WITH_HELP = [
|
46
|
+
['--boolean', '-b', GetoptLong::NO_ARGUMENT, 'A boolean option'],
|
47
|
+
['--argument', '-a', GetoptLong::REQUIRED_ARGUMENT, 'An option which requires an argument '],
|
48
|
+
|
49
|
+
]
|
50
|
+
|
51
|
+
LONG_COMMAND_LINE_OPTIONS = [
|
52
|
+
["--no-short-form", "", GetoptLong::NO_ARGUMENT, %[This boolean option has no short form]],
|
53
|
+
]
|
54
|
+
|
55
|
+
# specifying flag sets a bool to be true
|
56
|
+
|
57
|
+
CLF_BOOLS = [:b, :no_short_form]
|
58
|
+
|
59
|
+
CLF_INVERSE_BOOLS = [] # specifying flag sets a bool to be false
|
60
|
+
|
61
|
+
PROJECT_NAME = 'command_line_flunky_test_utility'
|
62
|
+
|
63
|
+
def self.method_missing(method, *args)
|
64
|
+
# p method, args
|
65
|
+
CommandLineFlunkyTestUtility.send(method, *args)
|
66
|
+
end
|
67
|
+
|
68
|
+
#def self.setup(copts)
|
69
|
+
#CommandLineFlunkyTestUtility.setup(copts)
|
70
|
+
#end
|
71
|
+
|
72
|
+
SCRIPT_FILE = __FILE__
|
73
|
+
end
|
74
|
+
|
75
|
+
class CommandLineFlunkyTestUtility
|
76
|
+
class << self
|
77
|
+
def hello_world(copts)
|
78
|
+
puts "Hello World"
|
79
|
+
end
|
80
|
+
def test_bool(copts)
|
81
|
+
puts "Bool is #{copts[:b]}"
|
82
|
+
puts "no-short-form is #{copts[:no_short_form]}"
|
83
|
+
end
|
84
|
+
def test_arguments(argument, copts)
|
85
|
+
puts "command argument was #{argument} and option argument was #{copts[:a]}"
|
86
|
+
end
|
87
|
+
# This function gets called before every command
|
88
|
+
# and allows arbitrary manipulation of the command
|
89
|
+
# options (copts) hash
|
90
|
+
def setup(copts)
|
91
|
+
# None neededed
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
|
97
|
+
######################################
|
98
|
+
# This must be at the end of the file
|
99
|
+
#
|
100
|
+
require 'command-line-flunky'
|
101
|
+
###############################
|
@@ -0,0 +1,212 @@
|
|
1
|
+
|
2
|
+
if RUBY_VERSION.to_f < 1.9
|
3
|
+
raise "Ruby version 1.9 or greater required (current version is #{RUBY_VERSION})"
|
4
|
+
end
|
5
|
+
module CommandLineFlunky
|
6
|
+
# $stderr.puts STARTUP_MESSAGE unless $has_put_startup_message
|
7
|
+
|
8
|
+
COMMAND_FOLDER = Dir.pwd
|
9
|
+
SCRIPT_FOLDER = File.dirname(File.expand_path(SCRIPT_FILE)) #i.e. where the script using command line flunky is
|
10
|
+
SYS = (ENV['COMMAND_LINE_FLUNKY_SYSTEM'] or "genericlinux")
|
11
|
+
@@sys = SYS
|
12
|
+
def gets #No reading from the command line thank you very much!
|
13
|
+
$stdin.gets
|
14
|
+
end
|
15
|
+
def self.gets
|
16
|
+
$stdin.gets
|
17
|
+
end
|
18
|
+
end
|
19
|
+
CommandLineFlunky::GLOBAL_BINDING = binding
|
20
|
+
|
21
|
+
# $stderr.print 'Loading libraries...' unless $has_put_startup_message
|
22
|
+
require 'getoptlong'
|
23
|
+
require 'rubyhacks'
|
24
|
+
# $stderr.puts unless $has_put_startup_message
|
25
|
+
$has_put_startup_message = true
|
26
|
+
|
27
|
+
# Log.log_file = nil
|
28
|
+
|
29
|
+
|
30
|
+
module CommandLineFlunky
|
31
|
+
# CLF = COMMAND_LINE_FLAGS = []
|
32
|
+
CLF = COMMAND_LINE_FLAGS = COMMAND_LINE_FLAGS_WITH_HELP.map{|arr| arr.slice(0..2)}
|
33
|
+
LONG_COMMAND_LINE_FLAGS = LONG_COMMAND_LINE_OPTIONS.map{|arr| [arr[0], arr[2]]}
|
34
|
+
#
|
35
|
+
# This lists all the commands available on the command line. The first two items in each array indicate the long and short form of the command, and the third indicates the number of arguments the command takes. They are all implemented as Code Runner class methods (the method is named after the long form). The short form of the command is available as a global method in Code Runner interactive mode.
|
36
|
+
|
37
|
+
COMMANDS_WITH_HELP.push ['manual', 'man', 0, 'Print out command line manual', [], []]
|
38
|
+
COMMANDS_WITH_HELP.push ["interactive_mode", "im", 0, 'Launch an interactive terminal. Any command line flags specified set the defaults for the session. Commands must be given in the short form, e.g. man. Options are given as a ruby hash.', [], []]
|
39
|
+
|
40
|
+
|
41
|
+
COMMANDS = COMMANDS_WITH_HELP.map{|arr| arr.slice(0..2)}
|
42
|
+
|
43
|
+
|
44
|
+
# A lookup hash which gives the appropriate short command option (copt) key for a given long command flag
|
45
|
+
|
46
|
+
CLF_TO_SHORT_COPTS = COMMAND_LINE_FLAGS.inject({}) do |hash, arr|
|
47
|
+
unless arr.size == 2
|
48
|
+
long, short, req = arr
|
49
|
+
letter = short[1,1]
|
50
|
+
hash[long] = letter.to_sym
|
51
|
+
end
|
52
|
+
hash
|
53
|
+
end
|
54
|
+
|
55
|
+
CLF_TO_LONG = LONG_COMMAND_LINE_OPTIONS.inject({}) do |hash, (long, short, req, help)|
|
56
|
+
option = long[2, long.size].gsub(/\-/, '_').to_sym
|
57
|
+
hash[long] = option
|
58
|
+
hash
|
59
|
+
end
|
60
|
+
|
61
|
+
# specifying flag sets a bool to be true
|
62
|
+
|
63
|
+
# CLF_BOOLS = [:H, :U, :u, :A, :a, :T, :N, :q, :z, :d]
|
64
|
+
# CLF_BOOLS = [:s, :r, :D, :H, :U, :u, :L, :l, :A, :a, :T, :N,:V, :q, :z, :d] #
|
65
|
+
|
66
|
+
|
67
|
+
# a look up hash that converts the long form of the command options to the short form (NB command options e.g. use_large_cache have a different form from command line flags e.g. --use-large-cache)
|
68
|
+
|
69
|
+
LONG_TO_SHORT = COMMAND_LINE_FLAGS.inject({}) do |hash, arr|
|
70
|
+
unless arr.size == 2 #No short version
|
71
|
+
long, short, req = arr
|
72
|
+
letter = short[1,1]
|
73
|
+
hash[long[2, long.size].gsub(/\-/, '_').to_sym] = letter.to_sym
|
74
|
+
end
|
75
|
+
hash
|
76
|
+
end
|
77
|
+
|
78
|
+
#Converts a command line flag opt with value arg to a command option which is stored in copts
|
79
|
+
|
80
|
+
def self.process_command_line_option(opt, arg, copts)
|
81
|
+
if CLF_BOOLS.include? CLF_TO_SHORT_COPTS[opt]
|
82
|
+
copts[CLF_TO_SHORT_COPTS[opt]] = true
|
83
|
+
elsif CLF_INVERSE_BOOLS.include? CLF_TO_SHORT_COPTS[opt]
|
84
|
+
copts[CLF_TO_SHORT_COPTS[opt]] = false
|
85
|
+
elsif CLF_TO_SHORT_COPTS[opt] # Applies to most options
|
86
|
+
copts[CLF_TO_SHORT_COPTS[opt]] = arg
|
87
|
+
elsif CLF_BOOLS.include? CLF_TO_LONG[opt]
|
88
|
+
copts[CLF_TO_LONG[opt]] = true
|
89
|
+
elsif CLF_INVERSE_BOOLS.include? CLF_TO_LONG[opt]
|
90
|
+
copts[CLF_TO_LONG[opt]] = false
|
91
|
+
elsif CLF_TO_LONG[opt]
|
92
|
+
copts[CLF_TO_LONG[opt]] = arg
|
93
|
+
else
|
94
|
+
raise "Unknown command line argument: #{opt}"
|
95
|
+
end
|
96
|
+
copts
|
97
|
+
end
|
98
|
+
|
99
|
+
# Default command options; they are usually determined by the command line flags, but can be set independently
|
100
|
+
|
101
|
+
DEFAULT_COMMAND_OPTIONS = {}
|
102
|
+
|
103
|
+
def self.set_default_command_options_from_command_line
|
104
|
+
opts = GetoptLong.new(*(COMMAND_LINE_FLAGS + LONG_COMMAND_LINE_FLAGS))
|
105
|
+
opts.each do |opt, arg|
|
106
|
+
process_command_line_option(opt, arg, DEFAULT_COMMAND_OPTIONS)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
module CommandLineFlunky
|
112
|
+
def self.read_default_command_options(copts)
|
113
|
+
DEFAULT_COMMAND_OPTIONS.each do |key, value|
|
114
|
+
copts[key] ||= value
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
|
119
|
+
INTERACTIVE_METHODS = <<EOF
|
120
|
+
CommandLineFlunky::COMMANDS.each do |command|
|
121
|
+
eval("def #\{command[1]}(*args)
|
122
|
+
CommandLineFlunky.send(#\{command[0].to_sym.inspect}, *args)
|
123
|
+
end")
|
124
|
+
|
125
|
+
EOF
|
126
|
+
|
127
|
+
def self.interactive_mode(copts={})
|
128
|
+
# process_command_options(copts)
|
129
|
+
unless false and FileTest.exist? (ENV['HOME'] + "/.#{PROJECT_NAME}_interactive_options.rb")
|
130
|
+
File.open(ENV['HOME'] + "/.#{PROJECT_NAME}_interactive_options.rb", 'w') do |file|
|
131
|
+
file.puts <<EOF
|
132
|
+
$has_put_startup_message = true #please leave!
|
133
|
+
$command_line_flunky_interactive_mode = true #please leave!
|
134
|
+
require 'yaml'
|
135
|
+
|
136
|
+
def reset
|
137
|
+
Dispatcher.reset_application!
|
138
|
+
end
|
139
|
+
|
140
|
+
IRB.conf[:AUTO_INDENT] = true
|
141
|
+
IRB.conf[:USE_READLINE] = true
|
142
|
+
IRB.conf[:LOAD_MODULES] = [] unless IRB.conf.key?(:LOAD_MODULES)
|
143
|
+
unless IRB.conf[:LOAD_MODULES].include?('irb/completion')
|
144
|
+
IRB.conf[:LOAD_MODULES] << 'irb/completion'
|
145
|
+
end
|
146
|
+
|
147
|
+
|
148
|
+
require 'irb/completion'
|
149
|
+
require 'irb/ext/save-history'
|
150
|
+
IRB.conf[:PROMPT_MODE] = :SIMPLE
|
151
|
+
IRB.conf[:SAVE_HISTORY] = 100
|
152
|
+
IRB.conf[:HISTORY_FILE] = "\#\{ENV['HOME']}/.#{PROJECT_NAME}_irb_save_history"
|
153
|
+
IRB.conf[:INSPECT_MODE] = false
|
154
|
+
|
155
|
+
|
156
|
+
EOF
|
157
|
+
end
|
158
|
+
end
|
159
|
+
File.open(".int.tmp.rb", 'w')do |file|
|
160
|
+
file.puts "#{copts.inspect}.each do |key, val|
|
161
|
+
CommandLineFlunky::DEFAULT_COMMAND_OPTIONS[key] = val
|
162
|
+
end"
|
163
|
+
file.puts CommandLineFlunky::INTERACTIVE_METHODS
|
164
|
+
end
|
165
|
+
exec %[#{Config::CONFIG['bindir']}/irb#{Config::CONFIG['ruby_install_name'].sub(/ruby/, '')} -f -I '#{SCRIPT_FOLDER}' -I '#{File.dirname(__FILE__)}' -I '#{Dir.pwd}' -I '#{ENV['HOME']}' -r '.#{PROJECT_NAME}_interactive_options' -r '#{File.basename(SCRIPT_FILE)}' -r .int.tmp ]
|
166
|
+
end
|
167
|
+
|
168
|
+
|
169
|
+
def self.run_script
|
170
|
+
setup(DEFAULT_COMMAND_OPTIONS)
|
171
|
+
return if $command_line_flunky_interactive_mode
|
172
|
+
command = COMMANDS.find{|com| com.slice(0..1).include? ARGV[0]}
|
173
|
+
raise "Command #{ARGV[0]} not found" unless command
|
174
|
+
send(command[0].to_sym, *ARGV.slice(1...(1+command[2])), DEFAULT_COMMAND_OPTIONS)
|
175
|
+
end
|
176
|
+
def self.manual(copts={})
|
177
|
+
help = <<EOF
|
178
|
+
|
179
|
+
|
180
|
+
#{MANUAL_HEADER}
|
181
|
+
|
182
|
+
COMMANDS
|
183
|
+
|
184
|
+
Either the long or the short form of the command may be used, except in interactive mode, where only short form can be used.
|
185
|
+
|
186
|
+
Long(Short) <Arguments> (Meaningful Options)
|
187
|
+
---------------------------------------------
|
188
|
+
|
189
|
+
#{(COMMANDS_WITH_HELP.sort_by{|arr| arr[0]}.map do |arr|
|
190
|
+
sprintf(" %s %s(%s) \n\t%s", "#{arr[0]}(#{arr[1]})", arr[4].map{|arg| "<#{arg}>"}.join(' ').sub(/(.)$/, '\1 '), arr[5].map{|op| op.to_s}.join(','), arr[3], )
|
191
|
+
end).join("\n\n")}
|
192
|
+
|
193
|
+
OPTIONS
|
194
|
+
|
195
|
+
#{((COMMAND_LINE_FLAGS_WITH_HELP + LONG_COMMAND_LINE_OPTIONS).map do |arr|
|
196
|
+
sprintf("%-15s %-2s\n\t%s", arr[0], arr[1], arr[3])
|
197
|
+
end).join("\n\n")
|
198
|
+
}
|
199
|
+
|
200
|
+
EOF
|
201
|
+
#help.gsub(/(.{63,73} |.{73})/){"#$1\n\t"}.paginate
|
202
|
+
help.paginate
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
206
|
+
CommandLineFlunky.set_default_command_options_from_command_line
|
207
|
+
|
208
|
+
####################
|
209
|
+
# CommandLineFlunky.run_script unles
|
210
|
+
###################
|
211
|
+
|
212
|
+
|
data/test/helper.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
|
3
|
+
module SimpleCov::Configuration
|
4
|
+
def clean_filters
|
5
|
+
@filters = []
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
SimpleCov.configure do
|
10
|
+
clean_filters
|
11
|
+
load_adapter 'test_frameworks'
|
12
|
+
end
|
13
|
+
|
14
|
+
ENV["COVERAGE"] && SimpleCov.start do
|
15
|
+
add_filter "/.rvm/"
|
16
|
+
end
|
17
|
+
require 'rubygems'
|
18
|
+
require 'bundler'
|
19
|
+
begin
|
20
|
+
Bundler.setup(:default, :development)
|
21
|
+
rescue Bundler::BundlerError => e
|
22
|
+
$stderr.puts e.message
|
23
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
24
|
+
exit e.status_code
|
25
|
+
end
|
26
|
+
require 'test/unit'
|
27
|
+
require 'shoulda'
|
28
|
+
|
29
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
30
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
31
|
+
#require 'command-line-flunky'
|
32
|
+
|
33
|
+
class Test::Unit::TestCase
|
34
|
+
end
|
metadata
ADDED
@@ -0,0 +1,143 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: command-line-flunky
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Edmund Highcock
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-03-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rubyhacks
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.1.4
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.1.4
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: shoulda
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rdoc
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.12'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.12'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bundler
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: jeweler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.0.1
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 2.0.1
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simplecov
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
description: A framework for quickly creating a command line tool and manual. Coherently
|
98
|
+
and simply links a Ruby class/module interface to a set of command line commands
|
99
|
+
and options. A comprehensive example is in the test folder.
|
100
|
+
email: edmundhighcock@users.sourceforge.net
|
101
|
+
executables:
|
102
|
+
- commandlineflunkytestutility
|
103
|
+
extensions: []
|
104
|
+
extra_rdoc_files:
|
105
|
+
- LICENSE.txt
|
106
|
+
- README.rdoc
|
107
|
+
files:
|
108
|
+
- ".document"
|
109
|
+
- Gemfile
|
110
|
+
- LICENSE.txt
|
111
|
+
- README.rdoc
|
112
|
+
- Rakefile
|
113
|
+
- VERSION
|
114
|
+
- bin/commandlineflunkytestutility
|
115
|
+
- lib/command-line-flunky-test-utility.rb
|
116
|
+
- lib/command-line-flunky.rb
|
117
|
+
- test/helper.rb
|
118
|
+
- test/test_command-line-flunky.rb
|
119
|
+
homepage: http://github.com/edmundhighcock/command-line-flunky
|
120
|
+
licenses:
|
121
|
+
- GPLv3
|
122
|
+
metadata: {}
|
123
|
+
post_install_message:
|
124
|
+
rdoc_options: []
|
125
|
+
require_paths:
|
126
|
+
- lib
|
127
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
requirements: []
|
138
|
+
rubyforge_project:
|
139
|
+
rubygems_version: 2.2.1
|
140
|
+
signing_key:
|
141
|
+
specification_version: 4
|
142
|
+
summary: A framework for quickly creating a command line tool and manual.
|
143
|
+
test_files: []
|