real-growl 0.5.2 → 0.6.0

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.
Files changed (3) hide show
  1. data/bin/realgrowl +31 -11
  2. data/lib/real_growl.rb +1 -1
  3. metadata +4 -4
data/bin/realgrowl CHANGED
@@ -4,16 +4,36 @@ require 'rubygems'
4
4
  require 'real_growl'
5
5
  require 'slop'
6
6
 
7
- opts = Slop.parse do
8
- on :s, :sticky, :default => true
9
- on :t, :title, :optional => true, :default => "Alert"
10
- on :d, :description, :optional => true, :default => "New Growl notification."
11
- on :i, :icon, :optional => true, :default => RealGrowl::icon
12
- on :p, :priority, :optional => true, :default => 0
7
+ slop = Slop.new(:strict => true, :help => true) do
8
+ on :s, :sticky, "Sticky notification. Default is true", :default => true
9
+ on :t, :title, "Title", :optional => false
10
+ on :d, :description, "Description", :optional => false
11
+ on :i, :icon, "Icon URL or Path", :optional => true, :default => RealGrowl::icon
12
+ on :p, :priority, "Priority. Default is 0", :optional => true, :default => 0
13
+ on :a, :app, "Application Name. Default is RealGrowl", :optional => true, :default => "RealGrowl"
14
+ banner "Usage: #{File.basename(__FILE__)} -t <title> -d <description>"
13
15
  end
14
16
 
15
- args = {}
16
- opts.to_hash.each { |k, v| args[k.to_sym] = v }
17
-
18
- app = RealGrowl::Application.new(args[:title])
19
- app.notify args
17
+ begin
18
+ values = slop.parse
19
+ if values.empty?
20
+ puts slop
21
+ exit
22
+ end
23
+
24
+ if !slop.to_hash["help"]
25
+ if RealGrowl.running?
26
+ args = {}
27
+ slop.to_hash.each { |k, v| args[k.to_sym] = v }
28
+ app = RealGrowl::Application.new(args[:app])
29
+ app.notify args
30
+ else
31
+ puts "It appears Growl is either not installed or is has been stopped."
32
+ exit 1
33
+ end
34
+ end
35
+ rescue Slop::InvalidOptionError => e
36
+ puts "\n#{e.message}\n\n"
37
+ puts slop
38
+ exit
39
+ end
data/lib/real_growl.rb CHANGED
@@ -4,7 +4,7 @@ require 'pp'
4
4
  module RealGrowl
5
5
  class<<self
6
6
  attr_accessor :sticky, :priority, :icon
7
-
7
+
8
8
  def growl(*args)
9
9
  self.priority ||= 0
10
10
  self.sticky = true if self.sticky.nil?
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: real-growl
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 7
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 5
9
- - 2
10
- version: 0.5.2
8
+ - 6
9
+ - 0
10
+ version: 0.6.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Justin DeWind