visionmedia-commander 3.2.6 → 3.2.7

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/History.rdoc CHANGED
@@ -1,4 +1,9 @@
1
1
 
2
+ === 3.2.7 / 2009-04-08
3
+
4
+ * Added #notify, #notify_ok, #notify_warning, #notify_info and #notify_error
5
+ These methods all utilize the MacOS growlnotify binary, very cool stuff check it out!
6
+
2
7
  === 3.2.6 / 2009-04-08
3
8
 
4
9
  * Added Commander::UI::AskForClass
data/Manifest CHANGED
@@ -15,6 +15,10 @@ lib/commander/help_formatters/terminal_compact/command_help.erb
15
15
  lib/commander/help_formatters/terminal_compact/help.erb
16
16
  lib/commander/help_formatters/terminal_compact.rb
17
17
  lib/commander/help_formatters.rb
18
+ lib/commander/images/error.png
19
+ lib/commander/images/info.png
20
+ lib/commander/images/ok.png
21
+ lib/commander/images/warning.png
18
22
  lib/commander/runner.rb
19
23
  lib/commander/user_interaction.rb
20
24
  lib/commander/version.rb
data/README.rdoc CHANGED
@@ -21,6 +21,7 @@ features, and an elegant API.
21
21
  * Multi-word command name support such as 'drupal module install MOD', rather than 'drupal module_install MOD'
22
22
  * Sexy paging for long bodies of text
23
23
  * Sub-command aliasing (very powerful, as both switches and arguments can be used)
24
+ * Support for MacOS Growl notifications
24
25
  * Use the 'commander' executable to initialize a commander driven program
25
26
 
26
27
  == Example
@@ -153,6 +154,21 @@ simplify common tasks using the following methods:
153
154
  # Ask editor, supplying initial text
154
155
  ask_editor 'previous data to update'
155
156
 
157
+ # Display a generic Growl notification r
158
+ notify 'Something happened'
159
+
160
+ # Display an 'info' status notification
161
+ notify_info 'You have #{emails.length} new email(s)'
162
+
163
+ # Display an 'ok' status notification
164
+ notify_ok 'Gems updated'
165
+
166
+ # Display a 'warning' status notification
167
+ notify_warning '1 gem failed installation'
168
+
169
+ # Display an 'error' status notification
170
+ notify_error "Gem #{name} failed"
171
+
156
172
  == Commander Goodies
157
173
 
158
174
  === Option Defaults
@@ -283,6 +299,11 @@ http://github.com/visionmedia/terminal-table
283
299
  | | | | | get it while its hot! |
284
300
  +----------+-------+----+--------+-----------------------+
285
301
 
302
+ == Growl Notifications
303
+
304
+ To utilize the #notify and #notify_STATUS methods you need to install
305
+ http://github.com/visionmedia/growl which utilizes the 'growlnotify' executable.
306
+
286
307
  == Contrib
287
308
 
288
309
  Feel free to fork and request a pull, or submit a ticket
data/commander.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{commander}
5
- s.version = "3.2.6"
5
+ s.version = "3.2.7"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["TJ Holowaychuk"]
@@ -11,8 +11,8 @@ Gem::Specification.new do |s|
11
11
  s.description = %q{The complete solution for Ruby command-line executables}
12
12
  s.email = %q{tj@vision-media.ca}
13
13
  s.executables = ["commander"]
14
- s.extra_rdoc_files = ["bin/commander", "lib/commander/blank.rb", "lib/commander/command.rb", "lib/commander/core_ext/array.rb", "lib/commander/core_ext/object.rb", "lib/commander/core_ext/string.rb", "lib/commander/core_ext.rb", "lib/commander/help_formatters/base.rb", "lib/commander/help_formatters/terminal/command_help.erb", "lib/commander/help_formatters/terminal/help.erb", "lib/commander/help_formatters/terminal.rb", "lib/commander/help_formatters/terminal_compact/command_help.erb", "lib/commander/help_formatters/terminal_compact/help.erb", "lib/commander/help_formatters/terminal_compact.rb", "lib/commander/help_formatters.rb", "lib/commander/runner.rb", "lib/commander/user_interaction.rb", "lib/commander/version.rb", "lib/commander.rb", "README.rdoc", "tasks/docs.rake", "tasks/gemspec.rake", "tasks/spec.rake"]
15
- s.files = ["bin/commander", "commander.gemspec", "History.rdoc", "lib/commander/blank.rb", "lib/commander/command.rb", "lib/commander/core_ext/array.rb", "lib/commander/core_ext/object.rb", "lib/commander/core_ext/string.rb", "lib/commander/core_ext.rb", "lib/commander/help_formatters/base.rb", "lib/commander/help_formatters/terminal/command_help.erb", "lib/commander/help_formatters/terminal/help.erb", "lib/commander/help_formatters/terminal.rb", "lib/commander/help_formatters/terminal_compact/command_help.erb", "lib/commander/help_formatters/terminal_compact/help.erb", "lib/commander/help_formatters/terminal_compact.rb", "lib/commander/help_formatters.rb", "lib/commander/runner.rb", "lib/commander/user_interaction.rb", "lib/commander/version.rb", "lib/commander.rb", "Manifest", "Rakefile", "README.rdoc", "spec/command_spec.rb", "spec/core_ext/array_spec.rb", "spec/core_ext/object_spec.rb", "spec/core_ext/string_spec.rb", "spec/help_formatters/base_spec.rb", "spec/help_formatters/terminal_spec.rb", "spec/runner_spec.rb", "spec/spec_helper.rb", "tasks/docs.rake", "tasks/gemspec.rake", "tasks/spec.rake"]
14
+ s.extra_rdoc_files = ["bin/commander", "lib/commander/blank.rb", "lib/commander/command.rb", "lib/commander/core_ext/array.rb", "lib/commander/core_ext/object.rb", "lib/commander/core_ext/string.rb", "lib/commander/core_ext.rb", "lib/commander/help_formatters/base.rb", "lib/commander/help_formatters/terminal/command_help.erb", "lib/commander/help_formatters/terminal/help.erb", "lib/commander/help_formatters/terminal.rb", "lib/commander/help_formatters/terminal_compact/command_help.erb", "lib/commander/help_formatters/terminal_compact/help.erb", "lib/commander/help_formatters/terminal_compact.rb", "lib/commander/help_formatters.rb", "lib/commander/images/error.png", "lib/commander/images/info.png", "lib/commander/images/ok.png", "lib/commander/images/warning.png", "lib/commander/runner.rb", "lib/commander/user_interaction.rb", "lib/commander/version.rb", "lib/commander.rb", "README.rdoc", "tasks/docs.rake", "tasks/gemspec.rake", "tasks/spec.rake"]
15
+ s.files = ["bin/commander", "commander.gemspec", "History.rdoc", "lib/commander/blank.rb", "lib/commander/command.rb", "lib/commander/core_ext/array.rb", "lib/commander/core_ext/object.rb", "lib/commander/core_ext/string.rb", "lib/commander/core_ext.rb", "lib/commander/help_formatters/base.rb", "lib/commander/help_formatters/terminal/command_help.erb", "lib/commander/help_formatters/terminal/help.erb", "lib/commander/help_formatters/terminal.rb", "lib/commander/help_formatters/terminal_compact/command_help.erb", "lib/commander/help_formatters/terminal_compact/help.erb", "lib/commander/help_formatters/terminal_compact.rb", "lib/commander/help_formatters.rb", "lib/commander/images/error.png", "lib/commander/images/info.png", "lib/commander/images/ok.png", "lib/commander/images/warning.png", "lib/commander/runner.rb", "lib/commander/user_interaction.rb", "lib/commander/version.rb", "lib/commander.rb", "Manifest", "Rakefile", "README.rdoc", "spec/command_spec.rb", "spec/core_ext/array_spec.rb", "spec/core_ext/object_spec.rb", "spec/core_ext/string_spec.rb", "spec/help_formatters/base_spec.rb", "spec/help_formatters/terminal_spec.rb", "spec/runner_spec.rb", "spec/spec_helper.rb", "tasks/docs.rake", "tasks/gemspec.rake", "tasks/spec.rake"]
16
16
  s.has_rdoc = true
17
17
  s.homepage = %q{http://visionmedia.github.com/commander}
18
18
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Commander", "--main", "README.rdoc"]
Binary file
Binary file
Binary file
Binary file
@@ -79,6 +79,32 @@ module Commander
79
79
  end
80
80
  end
81
81
 
82
+ ##
83
+ # Send a Growl notification +message+. This method
84
+ # requires that visionmedia-growl is installed and in the
85
+ # loadpath stack.
86
+ #
87
+ # === Examples
88
+ #
89
+ # notify 'You have a new email', :title => 'Email'
90
+ # notify_ok 'Gems updated'
91
+ # notify_warning "Gem #{name} failed to install"
92
+ # notify_error 'Failed to update gems'
93
+ #
94
+
95
+ def notify message, options = {}
96
+ require 'growl'
97
+ Growl({ :message => message.to_s, :title => program(:name) }.merge(options))
98
+ end
99
+
100
+ %w( ok info warning error ).each do |type|
101
+ define_method :"notify_#{type}" do |message, *args|
102
+ options = args.first || {}
103
+ image = File.join File.expand_path(File.dirname(__FILE__)), 'images', "#{type}.png"
104
+ notify message, options.merge(:image => image)
105
+ end
106
+ end
107
+
82
108
  ##
83
109
  # Implements ask_for_CLASS methods.
84
110
 
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Commander
3
- VERSION = '3.2.6'
3
+ VERSION = '3.2.7'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: visionmedia-commander
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.6
4
+ version: 3.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - TJ Holowaychuk
@@ -44,6 +44,10 @@ extra_rdoc_files:
44
44
  - lib/commander/help_formatters/terminal_compact/help.erb
45
45
  - lib/commander/help_formatters/terminal_compact.rb
46
46
  - lib/commander/help_formatters.rb
47
+ - lib/commander/images/error.png
48
+ - lib/commander/images/info.png
49
+ - lib/commander/images/ok.png
50
+ - lib/commander/images/warning.png
47
51
  - lib/commander/runner.rb
48
52
  - lib/commander/user_interaction.rb
49
53
  - lib/commander/version.rb
@@ -70,6 +74,10 @@ files:
70
74
  - lib/commander/help_formatters/terminal_compact/help.erb
71
75
  - lib/commander/help_formatters/terminal_compact.rb
72
76
  - lib/commander/help_formatters.rb
77
+ - lib/commander/images/error.png
78
+ - lib/commander/images/info.png
79
+ - lib/commander/images/ok.png
80
+ - lib/commander/images/warning.png
73
81
  - lib/commander/runner.rb
74
82
  - lib/commander/user_interaction.rb
75
83
  - lib/commander/version.rb