firetower 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,4 +1,9 @@
1
- == 1.0.0 / 2010-06-02
1
+ == 0.0.4 / 2010-08-18
2
+
3
+ * 1 major enhancement
4
+ * Mac/Growl support (davidrogers)
5
+
6
+ == 0.0.1 / 2010-06-02
2
7
 
3
8
  * 1 major enhancement
4
9
  * Birthday!
data/README.org CHANGED
@@ -18,10 +18,14 @@
18
18
 
19
19
  *** Requirements
20
20
 
21
- - Linux (somebody please port this to OS X)
21
+ Linux
22
22
  - [[http://www.kfish.org/software/xsel/][xsel]]
23
23
  - [[apt:libnotify-bin][libnotify-bin]]
24
24
 
25
+ OS X
26
+ - growlnotify package from the Extras folder in Growl-1.x.y.dmg
27
+ - 'Listen for incoming notifications' is checked in the Growl Preference Pane
28
+
25
29
  *** Install
26
30
 
27
31
  : sudo gem install firetower
data/bin/firetower CHANGED
@@ -75,14 +75,14 @@ Main do
75
75
  optional
76
76
  attr
77
77
  end
78
- keyword :room_name do
78
+ keyword :room do
79
79
  optional
80
80
  attr
81
81
  end
82
82
 
83
83
  def selected_room(session)
84
- if params[:subdomain].given? && params[:room_name].given?
85
- session.accounts[subdomain].rooms[room_name]
84
+ if params[:subdomain].given? && params[:room].given?
85
+ session.accounts[subdomain].rooms[params[:room].values[0]]
86
86
  else
87
87
  session.default_room
88
88
  end
@@ -239,6 +239,10 @@ Main do
239
239
  exit_failure unless !config_path.exist? || hl.ask(<<"EOS")
240
240
  A configuration already exists at #{config_path}. Are you sure you want to
241
241
  overwrite it?
242
+ EOS
243
+ exit_failure if RUBY_PLATFORM =~ /darwin/ and !system('growlnotify -v') and !(puts(<<"EOS"))
244
+ You must first install growlnotify from the Growl package installer and ensure
245
+ 'Listen for incoming notifications' is checked in the Preference pane.
242
246
  EOS
243
247
  subdomain = hl.ask <<EOS
244
248
  What is your Campfire subdomain? If your Campfire address is
@@ -280,6 +284,26 @@ EOS
280
284
  end
281
285
  end
282
286
 
287
+ mode :log do
288
+ mode :tail do
289
+ description "Live view of the server log"
290
+
291
+ def run
292
+ exec('tail', '-f', log_path.to_s)
293
+ end
294
+ end
295
+
296
+ mode :view do
297
+ description "Open server log in $PAGER"
298
+
299
+ def run
300
+ exec(
301
+ ENV.fetch('PAGER'){ENV.fetch('EDITOR'){'less'}},
302
+ log_path.to_s)
303
+ end
304
+ end
305
+ end
306
+
283
307
  def run
284
308
  help!
285
309
  end
@@ -19,4 +19,8 @@ join '<%= subdomain %>', '<%= room_name %>'
19
19
  default '<%= subdomain %>', '<%= room_names.first %>'
20
20
 
21
21
  # Plugins
22
- use NotifyPlugin
22
+ <% if RUBY_PLATFORM =~ /darwin/ %>
23
+ use GrowlPlugin
24
+ <% else %>
25
+ use NotifyPlugin
26
+ <% end %>
@@ -0,0 +1,42 @@
1
+ module Firetower
2
+ module Plugins
3
+ class GrowlPlugin < Firetower::Session::Listener
4
+ def startup(session)
5
+ if session.kind == :server
6
+ notify("Firetower", "Firetower is vigilantly scanning the treetops")
7
+ end
8
+ end
9
+
10
+ def join(session, room)
11
+ notify("Firetower", "Joined room \"#{room.name}\"", room.name)
12
+ end
13
+
14
+ def leave(session, room)
15
+ notify("Firetower", "Left room \"#{room.name}\"", room.name)
16
+ end
17
+
18
+ def receive(session, event)
19
+ case event['type']
20
+ when "TextMessage"
21
+ user = event.room.account.users[event['user_id']]
22
+ notify(user['name'], event['body'], event.room.name)
23
+ else
24
+ # NOOP
25
+ end
26
+ end
27
+
28
+ def error(session, error)
29
+ notify("Campfire Error", error.message, 'Error')
30
+ end
31
+
32
+ private
33
+
34
+ def notify(*args)
35
+ system('growlnotify', '-t', (args[2].nil? ? args[0] : "#{args[0]} - #{args[2]}"),
36
+ '-m', args[1],
37
+ '--image', File.expand_path('campfire-logo-for-fluid.png', File.dirname(__FILE__))) \
38
+ or raise "Growl notification failed"
39
+ end
40
+ end
41
+ end
42
+ end
@@ -1 +1,2 @@
1
1
  require 'firetower/plugins/core/notify_plugin.rb'
2
+ require 'firetower/plugins/core/growl.rb'
data/version.txt CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 3
9
- version: 0.0.3
8
+ - 4
9
+ version: 0.0.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Avdi Grimm
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-07-13 00:00:00 -04:00
17
+ date: 2010-08-18 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -151,7 +151,6 @@ extra_rdoc_files:
151
151
  - lib/firetower/plugins/core/campfire-logo-for-fluid.png
152
152
  - version.txt
153
153
  files:
154
- - .bnsignore
155
154
  - .gitignore
156
155
  - History.txt
157
156
  - README.html
@@ -164,6 +163,7 @@ files:
164
163
  - lib/firetower/account.rb
165
164
  - lib/firetower/firetower.conf.erb
166
165
  - lib/firetower/plugins/core/campfire-logo-for-fluid.png
166
+ - lib/firetower/plugins/core/growl.rb
167
167
  - lib/firetower/plugins/core/init_v1.rb
168
168
  - lib/firetower/plugins/core/notify_plugin.rb
169
169
  - lib/firetower/room.rb
data/.bnsignore DELETED
@@ -1,18 +0,0 @@
1
- # The list of files that should be ignored by Mr Bones.
2
- # Lines that start with '#' are comments.
3
- #
4
- # A .gitignore file can be used instead by setting it as the ignore
5
- # file in your Rakefile:
6
- #
7
- # Bones {
8
- # ignore_file '.gitignore'
9
- # }
10
- #
11
- # For a project with a C extension, the following would be a good set of
12
- # exclude patterns (uncomment them if you want to use them):
13
- # *.[oa]
14
- # *~
15
- announcement.txt
16
- coverage
17
- doc
18
- pkg