command-line-flunky 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/command-line-flunky.gemspec +68 -0
- data/lib/command-line-flunky.rb +38 -4
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 11f74a3bcbea6c555860d50aa86e81ea9fcb573a
|
4
|
+
data.tar.gz: e0e7e1321953980e21766c2dc3d75fc8db0f2b09
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 338c789db19667439e38b86cbad22c8688ee5ec44eb5f43c4e8373caeca925831f97a4fcb12fe3c0fa99a993e81b159b9d83d323c46ee08a9ef95b2a4fe3e802
|
7
|
+
data.tar.gz: a25460be109768ba8437ebc96b1e4def10d995c6e1962e38a004a362ae0e6dca1a0ced39357363b537bf1b2aae94286eaceecfd8a2ab98b50f62d758ec1b103c
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.1
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: command-line-flunky 1.0.1 ruby lib
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "command-line-flunky"
|
9
|
+
s.version = "1.0.1"
|
10
|
+
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
13
|
+
s.authors = ["Edmund Highcock"]
|
14
|
+
s.date = "2014-06-11"
|
15
|
+
s.description = "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."
|
16
|
+
s.email = "edmundhighcock@users.sourceforge.net"
|
17
|
+
s.executables = ["commandlineflunkytestutility"]
|
18
|
+
s.extra_rdoc_files = [
|
19
|
+
"LICENSE.txt",
|
20
|
+
"README.rdoc"
|
21
|
+
]
|
22
|
+
s.files = [
|
23
|
+
".document",
|
24
|
+
"Gemfile",
|
25
|
+
"LICENSE.txt",
|
26
|
+
"README.rdoc",
|
27
|
+
"Rakefile",
|
28
|
+
"VERSION",
|
29
|
+
"bin/commandlineflunkytestutility",
|
30
|
+
"command-line-flunky.gemspec",
|
31
|
+
"lib/command-line-flunky-test-utility.rb",
|
32
|
+
"lib/command-line-flunky.rb",
|
33
|
+
"test/helper.rb",
|
34
|
+
"test/test_command-line-flunky.rb"
|
35
|
+
]
|
36
|
+
s.homepage = "http://github.com/edmundhighcock/command-line-flunky"
|
37
|
+
s.licenses = ["GPLv3"]
|
38
|
+
s.rubygems_version = "2.2.2"
|
39
|
+
s.summary = "A framework for quickly creating a command line tool and manual."
|
40
|
+
|
41
|
+
if s.respond_to? :specification_version then
|
42
|
+
s.specification_version = 4
|
43
|
+
|
44
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
45
|
+
s.add_runtime_dependency(%q<rubyhacks>, [">= 0.1.4"])
|
46
|
+
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
47
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
48
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
49
|
+
s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
|
50
|
+
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
51
|
+
else
|
52
|
+
s.add_dependency(%q<rubyhacks>, [">= 0.1.4"])
|
53
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
54
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
55
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
56
|
+
s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
|
57
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
58
|
+
end
|
59
|
+
else
|
60
|
+
s.add_dependency(%q<rubyhacks>, [">= 0.1.4"])
|
61
|
+
s.add_dependency(%q<shoulda>, [">= 0"])
|
62
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
63
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
64
|
+
s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
|
65
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
data/lib/command-line-flunky.rb
CHANGED
@@ -3,7 +3,7 @@ if RUBY_VERSION.to_f < 1.9
|
|
3
3
|
raise "Ruby version 1.9 or greater required (current version is #{RUBY_VERSION})"
|
4
4
|
end
|
5
5
|
module CommandLineFlunky
|
6
|
-
|
6
|
+
$stderr.puts STARTUP_MESSAGE unless $has_put_startup_message
|
7
7
|
|
8
8
|
COMMAND_FOLDER = Dir.pwd
|
9
9
|
SCRIPT_FOLDER = File.dirname(File.expand_path(SCRIPT_FILE)) #i.e. where the script using command line flunky is
|
@@ -121,12 +121,13 @@ CommandLineFlunky::COMMANDS.each do |command|
|
|
121
121
|
eval("def #\{command[1]}(*args)
|
122
122
|
CommandLineFlunky.send(#\{command[0].to_sym.inspect}, *args)
|
123
123
|
end")
|
124
|
+
end
|
124
125
|
|
125
126
|
EOF
|
126
127
|
|
127
128
|
def self.interactive_mode(copts={})
|
128
129
|
# process_command_options(copts)
|
129
|
-
unless
|
130
|
+
unless FileTest.exist? (ENV['HOME'] + "/.#{PROJECT_NAME}_interactive_options.rb")
|
130
131
|
File.open(ENV['HOME'] + "/.#{PROJECT_NAME}_interactive_options.rb", 'w') do |file|
|
131
132
|
file.puts <<EOF
|
132
133
|
$has_put_startup_message = true #please leave!
|
@@ -162,16 +163,49 @@ EOF
|
|
162
163
|
end"
|
163
164
|
file.puts CommandLineFlunky::INTERACTIVE_METHODS
|
164
165
|
end
|
165
|
-
exec %[#{
|
166
|
+
exec %[#{RbConfig::CONFIG['bindir']}/irb#{RbConfig::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
167
|
end
|
167
168
|
|
168
169
|
|
169
170
|
def self.run_script
|
171
|
+
do_profile = (ENV[key = %[#{PROJECT_NAME.upcase}_PROFILE]] and ENV[key].size > 0) ? ENV[key] : false
|
172
|
+
if do_profile
|
173
|
+
begin
|
174
|
+
require 'ruby-prof'
|
175
|
+
rescue LoadError
|
176
|
+
eputs "Please install ruby-prof using ' $ gem install ruby-prof'"
|
177
|
+
exit
|
178
|
+
end
|
179
|
+
|
180
|
+
# Profile the code
|
181
|
+
RubyProf.start
|
182
|
+
end
|
183
|
+
set_default_command_options_from_command_line
|
170
184
|
setup(DEFAULT_COMMAND_OPTIONS)
|
171
185
|
return if $command_line_flunky_interactive_mode
|
172
186
|
command = COMMANDS.find{|com| com.slice(0..1).include? ARGV[0]}
|
173
187
|
raise "Command #{ARGV[0]} not found" unless command
|
174
188
|
send(command[0].to_sym, *ARGV.slice(1...(1+command[2])), DEFAULT_COMMAND_OPTIONS)
|
189
|
+
if do_profile
|
190
|
+
result = RubyProf.stop
|
191
|
+
if ENV[key2 = %[#{PROJECT_NAME.upcase}_PROFILE_EXCLUDE]] and ENV[key2].size > 0
|
192
|
+
result.eliminate_methods!(eval(ENV[key2]))
|
193
|
+
end
|
194
|
+
|
195
|
+
# Print a flat profile to text
|
196
|
+
case ENV[key]
|
197
|
+
when /html/i
|
198
|
+
printer = RubyProf::GraphHtmlPrinter.new(result)
|
199
|
+
when /graph/i
|
200
|
+
printer = RubyProf::GraphPrinter.new(result)
|
201
|
+
when /txt/i
|
202
|
+
printer = RubyProf::FlatPrinter.new(result)
|
203
|
+
else
|
204
|
+
raise "#{key} should be 'html', 'graph' or 'txt'"
|
205
|
+
end
|
206
|
+
|
207
|
+
printer.print($stdout, {})
|
208
|
+
end
|
175
209
|
end
|
176
210
|
def self.manual(copts={})
|
177
211
|
help = <<EOF
|
@@ -203,7 +237,7 @@ EOF
|
|
203
237
|
end
|
204
238
|
end
|
205
239
|
|
206
|
-
CommandLineFlunky.set_default_command_options_from_command_line
|
240
|
+
#CommandLineFlunky.set_default_command_options_from_command_line
|
207
241
|
|
208
242
|
####################
|
209
243
|
# CommandLineFlunky.run_script unles
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: command-line-flunky
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Edmund Highcock
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubyhacks
|
@@ -112,6 +112,7 @@ files:
|
|
112
112
|
- Rakefile
|
113
113
|
- VERSION
|
114
114
|
- bin/commandlineflunkytestutility
|
115
|
+
- command-line-flunky.gemspec
|
115
116
|
- lib/command-line-flunky-test-utility.rb
|
116
117
|
- lib/command-line-flunky.rb
|
117
118
|
- test/helper.rb
|
@@ -136,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
137
|
version: '0'
|
137
138
|
requirements: []
|
138
139
|
rubyforge_project:
|
139
|
-
rubygems_version: 2.2.
|
140
|
+
rubygems_version: 2.2.2
|
140
141
|
signing_key:
|
141
142
|
specification_version: 4
|
142
143
|
summary: A framework for quickly creating a command line tool and manual.
|