commander 4.1.3 → 4.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +2 -1
- data/History.rdoc +6 -0
- data/README.rdoc +3 -6
- data/Rakefile +1 -1
- data/lib/commander/help_formatters.rb +6 -1
- data/lib/commander/help_formatters/terminal/command_help.erb +1 -1
- data/lib/commander/help_formatters/terminal/help.erb +1 -1
- data/lib/commander/user_interaction.rb +8 -5
- data/lib/commander/version.rb +1 -1
- data/spec/runner_spec.rb +12 -6
- data/spec/spec_helper.rb +21 -5
- metadata +2 -2
data/.gitignore
CHANGED
data/History.rdoc
CHANGED
data/README.rdoc
CHANGED
@@ -72,7 +72,7 @@ as well as an object, specifying a method to call, so view the RDoc for more inf
|
|
72
72
|
$ foobar bar
|
73
73
|
# => (bar)
|
74
74
|
|
75
|
-
$ foobar bar --suffix '
|
75
|
+
$ foobar bar --suffix '}' --prefix '{'
|
76
76
|
# => {bar}
|
77
77
|
|
78
78
|
== HighLine
|
@@ -159,6 +159,7 @@ following methods to simplify common tasks:
|
|
159
159
|
speak 'What is your favorite food? '
|
160
160
|
food = ask 'favorite food?: '
|
161
161
|
speak "Wow, I like #{food} too. We have so much in common."
|
162
|
+
speak "I like #{food} as well!", "Victoria", 190
|
162
163
|
|
163
164
|
# Execute arbitrary applescript
|
164
165
|
applescript 'foo'
|
@@ -192,16 +193,12 @@ growl is auto-imported by Commander when available, no need to require.
|
|
192
193
|
# Display an 'ok' status notification
|
193
194
|
notify_ok 'Gems updated'
|
194
195
|
|
195
|
-
# Display a 'warning' status notification
|
196
|
+
# Display a 'warning' status notification
|
196
197
|
notify_warning '1 gem failed installation'
|
197
198
|
|
198
199
|
# Display an 'error' status notification
|
199
200
|
notify_error "Gem #{name} failed"
|
200
201
|
|
201
|
-
growlnotify can also be installed via homebrew[http://mxcl.github.com/homebrew/]:
|
202
|
-
|
203
|
-
$ brew install growlnotify
|
204
|
-
|
205
202
|
== Commander Goodies
|
206
203
|
|
207
204
|
=== Option Defaults
|
data/Rakefile
CHANGED
@@ -4,5 +4,10 @@ module Commander
|
|
4
4
|
autoload :Base, 'commander/help_formatters/base'
|
5
5
|
autoload :Terminal, 'commander/help_formatters/terminal'
|
6
6
|
autoload :TerminalCompact, 'commander/help_formatters/terminal_compact'
|
7
|
+
|
8
|
+
module_function
|
9
|
+
def indent amount, text
|
10
|
+
text.gsub("\n", "\n" + (' ' * amount))
|
11
|
+
end
|
7
12
|
end
|
8
|
-
end
|
13
|
+
end
|
@@ -119,22 +119,25 @@ module Commander
|
|
119
119
|
end
|
120
120
|
|
121
121
|
##
|
122
|
-
# Speak _message_ using _voice_
|
123
|
-
#
|
122
|
+
# Speak _message_ using _voice_ at a speaking rate of _rate_
|
123
|
+
#
|
124
|
+
# Voice defaults to 'Alex', which is one of the better voices.
|
125
|
+
# Speaking rate defaults to 175 words per minute
|
124
126
|
#
|
125
127
|
# === Examples
|
126
128
|
#
|
127
129
|
# speak 'What is your favorite food? '
|
128
130
|
# food = ask 'favorite food?: '
|
129
|
-
# speak "
|
131
|
+
# speak "Wow, I like #{food} too. We have so much in common."
|
132
|
+
# speak "I like #{food} as well!", "Victoria", 190
|
130
133
|
#
|
131
134
|
# === Notes
|
132
135
|
#
|
133
136
|
# * MacOS only
|
134
137
|
#
|
135
138
|
|
136
|
-
def speak message, voice = :Alex
|
137
|
-
Thread.new { applescript "say #{message.inspect} using #{voice.to_s.inspect}" }
|
139
|
+
def speak message, voice = :Alex, rate = 175
|
140
|
+
Thread.new { applescript "say #{message.inspect} using #{voice.to_s.inspect} speaking rate #{rate}" }
|
138
141
|
end
|
139
142
|
|
140
143
|
##
|
data/lib/commander/version.rb
CHANGED
data/spec/runner_spec.rb
CHANGED
@@ -353,18 +353,24 @@ describe Commander do
|
|
353
353
|
|
354
354
|
describe "#valid_command_names_from" do
|
355
355
|
it "should return array of valid command names" do
|
356
|
-
|
357
|
-
|
358
|
-
|
356
|
+
new_command_runner do
|
357
|
+
command('foo bar') {}
|
358
|
+
command('foo bar foo') {}
|
359
|
+
command_runner.valid_command_names_from('foo', 'bar', 'foo').sort.should eq(['foo bar', 'foo bar foo'])
|
360
|
+
end
|
359
361
|
end
|
360
362
|
|
361
363
|
it "should return empty array when no possible command names exist" do
|
362
|
-
|
364
|
+
new_command_runner do
|
365
|
+
command_runner.valid_command_names_from('fake', 'command', 'name').should eq([])
|
366
|
+
end
|
363
367
|
end
|
364
368
|
|
365
369
|
it "should match exact commands only" do
|
366
|
-
|
367
|
-
|
370
|
+
new_command_runner do
|
371
|
+
command('foo') {}
|
372
|
+
command_runner.valid_command_names_from('foobar').should eq([])
|
373
|
+
end
|
368
374
|
end
|
369
375
|
end
|
370
376
|
|
data/spec/spec_helper.rb
CHANGED
@@ -1,13 +1,29 @@
|
|
1
1
|
require 'rubygems'
|
2
|
+
require 'stringio'
|
2
3
|
require 'simplecov'
|
3
4
|
SimpleCov.start
|
4
5
|
|
5
|
-
#
|
6
|
-
ENV['PAGER'] = 'cat'
|
7
|
-
|
6
|
+
# Unshift so that local files load instead of something in gems
|
8
7
|
$:.unshift File.dirname(__FILE__) + '/../lib'
|
9
|
-
|
10
|
-
require '
|
8
|
+
|
9
|
+
# This basically replicates the behavior of `require 'commander/import'`
|
10
|
+
# but without adding an `at_exit` hook, which interferes with exit code
|
11
|
+
require 'commander'
|
12
|
+
require 'commander/delegates'
|
13
|
+
|
14
|
+
include Commander::UI
|
15
|
+
include Commander::UI::AskForClass
|
16
|
+
include Commander::Delegates
|
17
|
+
|
18
|
+
# prevent paging from actually occurring in test environment
|
19
|
+
|
20
|
+
module Commander
|
21
|
+
module UI
|
22
|
+
def enable_paging
|
23
|
+
return
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
11
27
|
|
12
28
|
# Mock terminal IO streams so we can spec against them
|
13
29
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: commander
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.1.
|
4
|
+
version: 4.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2013-07-21 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: highline
|