firetower 0.0.4 → 0.0.5
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/.rvmrc +1 -0
- data/History.txt +5 -0
- data/Rakefile +4 -1
- data/bin/firetower +21 -4
- data/lib/firetower/accounts.rb +38 -0
- data/lib/firetower/plugins/core/growl_plugin.rb +17 -0
- data/lib/firetower/plugins/core/init_v1.rb +1 -1
- data/lib/firetower/plugins/core/{growl.rb → notifier_common.rb} +25 -14
- data/lib/firetower/plugins/core/notify_plugin.rb +5 -35
- data/lib/firetower/plugins/yamfire/init_v1.rb +81 -0
- data/lib/firetower/plugins/yamfire/yamfire.rb +23 -0
- data/lib/firetower/rooms.rb +9 -0
- data/lib/firetower/session.rb +8 -13
- data/meme.out +0 -0
- data/spec/firetower_spec.rb +104 -1
- data/tags +83 -0
- data/version.txt +1 -1
- metadata +90 -14
- data/.gitignore +0 -1
- data/README.html +0 -406
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use --create ree@firetower
|
data/History.txt
CHANGED
data/Rakefile
CHANGED
@@ -24,7 +24,10 @@ Bones {
|
|
24
24
|
depend_on 'addressable', '~> 2.1'
|
25
25
|
depend_on 'main', '~> 4.2'
|
26
26
|
depend_on 'servolux', '~> 0.9.4'
|
27
|
-
depend_on 'hookr', '~> 1.
|
27
|
+
depend_on 'hookr', '~> 1.1'
|
28
28
|
depend_on 'highline', '~> 1.5'
|
29
|
+
depend_on 'yammer4r', '~> 0.1.5'
|
30
|
+
depend_on 'oauth', '~> 0.4.3'
|
31
|
+
depend_on 'launchy'
|
29
32
|
}
|
30
33
|
|
data/bin/firetower
CHANGED
@@ -4,6 +4,15 @@ require File.expand_path(
|
|
4
4
|
File.join(File.dirname(__FILE__), %w[.. lib firetower]))
|
5
5
|
|
6
6
|
Main do
|
7
|
+
$:.unshift(File.expand_path('../lib', File.dirname(__FILE__)))
|
8
|
+
plugin_pattern = File.expand_path('../lib/firetower/plugins/*/init_v1.rb', File.dirname(__FILE__))
|
9
|
+
Dir.glob(plugin_pattern).each do |file|
|
10
|
+
eval(File.read(file))
|
11
|
+
end
|
12
|
+
Gem.find_files('firetower/plugins/*/init_v1.rb') do |file|
|
13
|
+
eval(File.read(file))
|
14
|
+
end
|
15
|
+
|
7
16
|
description <<-"END"
|
8
17
|
A command-line interface to Campfire chats.
|
9
18
|
|
@@ -94,7 +103,15 @@ Main do
|
|
94
103
|
mixin :address
|
95
104
|
argument :text do
|
96
105
|
optional
|
97
|
-
attr
|
106
|
+
attr do |text|
|
107
|
+
if text.given?
|
108
|
+
text.value
|
109
|
+
else
|
110
|
+
stdin = $stdin.read
|
111
|
+
# get rid of trailing newline if there's just one of them. this avoid pasting to the room instead of saying when piping output
|
112
|
+
stdin.chomp if stdin.scan(/\n/).size == 1
|
113
|
+
end
|
114
|
+
end
|
98
115
|
end
|
99
116
|
|
100
117
|
def run
|
@@ -241,7 +258,7 @@ A configuration already exists at #{config_path}. Are you sure you want to
|
|
241
258
|
overwrite it?
|
242
259
|
EOS
|
243
260
|
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
|
261
|
+
You must first install growlnotify from the Growl package installer and ensure
|
245
262
|
'Listen for incoming notifications' is checked in the Preference pane.
|
246
263
|
EOS
|
247
264
|
subdomain = hl.ask <<EOS
|
@@ -254,7 +271,7 @@ Please enter your Campfire API token. You can find your token at
|
|
254
271
|
http://#{subdomain}.campfirenow.com/member/edit
|
255
272
|
EOS
|
256
273
|
use_ssl = hl.agree("Use SSL when connecting to Campfire?")
|
257
|
-
rooms_url = "http#{use_ssl ? '
|
274
|
+
rooms_url = "http#{use_ssl ? 's' : ''}://#{subdomain}.campfirenow.com/rooms.json"
|
258
275
|
response = open(rooms_url, :http_basic_authentication => [token, 'x']).read
|
259
276
|
room_list = JSON.parse(response)['rooms']
|
260
277
|
room_names = []
|
@@ -343,7 +360,7 @@ EOS
|
|
343
360
|
|
344
361
|
def before_run
|
345
362
|
self.logger.level = ::Logger::INFO
|
346
|
-
load_plugins!
|
363
|
+
# load_plugins!
|
347
364
|
dir.mkpath
|
348
365
|
end
|
349
366
|
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Firetower
|
2
|
+
module Accounts
|
3
|
+
fattr(:account_fetcher) {
|
4
|
+
Account.method(:new)
|
5
|
+
}
|
6
|
+
fattr(:accounts) {
|
7
|
+
Hash.new do |hash, subdomain|
|
8
|
+
raise "Unknown subdomain '#{subdomain}'"
|
9
|
+
end
|
10
|
+
}
|
11
|
+
|
12
|
+
# Eventually advances to HookR will render all this reduundant
|
13
|
+
def self.extended(other)
|
14
|
+
class << other
|
15
|
+
include HookR::Hooks
|
16
|
+
define_hook :new_account, :subdomain, :token, :options
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.included(other)
|
21
|
+
other.module_eval do
|
22
|
+
include HookR::Hooks
|
23
|
+
define_hook :new_account, :subdomain, :token, :options
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# Declare an account
|
28
|
+
def account(subdomain, token, options={})
|
29
|
+
execute_hook(:new_account, subdomain, token, options)
|
30
|
+
accounts[subdomain] = account_fetcher.call(subdomain, token, self, options)
|
31
|
+
end
|
32
|
+
|
33
|
+
def find_room(subdomain, room_name)
|
34
|
+
accounts[subdomain].rooms[room_name]
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'firetower/plugins/core/notifier_common'
|
2
|
+
|
3
|
+
module Firetower
|
4
|
+
module Plugins
|
5
|
+
class GrowlPlugin < Firetower::Session::Listener
|
6
|
+
include NotifierCommon
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def notify(*args)
|
11
|
+
system('growlnotify', '-t', (args[2].nil? ? args[0] : "#{args[0]} - #{args[2]}"),
|
12
|
+
'-m', args[1], '--image', CAMPFIRE_LOGO) \
|
13
|
+
or raise "Growl notification failed"
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -1,2 +1,2 @@
|
|
1
1
|
require 'firetower/plugins/core/notify_plugin.rb'
|
2
|
-
require 'firetower/plugins/core/
|
2
|
+
require 'firetower/plugins/core/growl_plugin.rb'
|
@@ -1,7 +1,20 @@
|
|
1
1
|
module Firetower
|
2
2
|
module Plugins
|
3
|
-
|
4
|
-
|
3
|
+
|
4
|
+
module NotifierCommon
|
5
|
+
|
6
|
+
CAMPFIRE_LOGO = File.expand_path('campfire-logo-for-fluid.png', File.dirname(__FILE__))
|
7
|
+
|
8
|
+
def initialize(options={})
|
9
|
+
@notifier = options.fetch(:notifier) { method(:notify) }
|
10
|
+
@ignore_list = options.fetch(:ignore_list) { [] }
|
11
|
+
end
|
12
|
+
|
13
|
+
def error(session, error)
|
14
|
+
notify("Campfire Error", error.message, 'Error')
|
15
|
+
end
|
16
|
+
|
17
|
+
def startup(session)
|
5
18
|
if session.kind == :server
|
6
19
|
notify("Firetower", "Firetower is vigilantly scanning the treetops")
|
7
20
|
end
|
@@ -19,24 +32,22 @@ module Firetower
|
|
19
32
|
case event['type']
|
20
33
|
when "TextMessage"
|
21
34
|
user = event.room.account.users[event['user_id']]
|
22
|
-
|
35
|
+
@notifier.call(user['name'], event['body'], event.room.name) unless ignored?(user['name'])
|
36
|
+
when "EnterMessage"
|
37
|
+
user = event.room.account.users[event['user_id']]
|
38
|
+
@notifier.call(user['name'], 'joined the room', event.room.name) unless ignored?(user['name'])
|
23
39
|
else
|
24
40
|
# NOOP
|
25
41
|
end
|
26
42
|
end
|
27
|
-
|
28
|
-
def error(session, error)
|
29
|
-
notify("Campfire Error", error.message, 'Error')
|
30
|
-
end
|
31
|
-
|
43
|
+
|
32
44
|
private
|
33
|
-
|
34
|
-
|
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"
|
45
|
+
def ignored?(user_name)
|
46
|
+
!@ignore_list.grep(user_name).empty?
|
39
47
|
end
|
48
|
+
|
49
|
+
|
40
50
|
end
|
51
|
+
|
41
52
|
end
|
42
53
|
end
|
@@ -1,44 +1,14 @@
|
|
1
|
+
require 'firetower/plugins/core/notifier_common'
|
2
|
+
|
1
3
|
module Firetower
|
2
4
|
module Plugins
|
3
5
|
class NotifyPlugin < Firetower::Session::Listener
|
4
|
-
|
5
|
-
def startup(session)
|
6
|
-
if session.kind == :server
|
7
|
-
notify("Firetower", "Firetower is vigilantly scanning the treetops")
|
8
|
-
end
|
9
|
-
end
|
10
|
-
|
11
|
-
def join(session, room)
|
12
|
-
notify("Firetower", "Joined room \"#{room.name}\"")
|
13
|
-
end
|
14
|
-
|
15
|
-
def leave(session, room)
|
16
|
-
notify("Firetower", "Left room \"#{room.name}\"")
|
17
|
-
end
|
18
|
-
|
19
|
-
def receive(session, event)
|
20
|
-
case event['type']
|
21
|
-
when "TextMessage"
|
22
|
-
user = event.room.account.users[event['user_id']]
|
23
|
-
notify(user['name'], event['body'])
|
24
|
-
else
|
25
|
-
# NOOP
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
def error(session, error)
|
30
|
-
notify("Campfire Error", error.message)
|
31
|
-
end
|
6
|
+
include NotifierCommon
|
32
7
|
|
33
8
|
private
|
34
|
-
|
35
9
|
def notify(*args)
|
36
|
-
system('notify-send', '--icon',
|
37
|
-
|
38
|
-
'campfire-logo-for-fluid.png',
|
39
|
-
File.dirname(__FILE__)),
|
40
|
-
'-c', 'Firetower',
|
41
|
-
*args) or raise "Desktop notification failed"
|
10
|
+
system('notify-send', '--icon', CAMPFIRE_LOGO,
|
11
|
+
'-c', 'Firetower', *args) or raise "Desktop notification failed"
|
42
12
|
end
|
43
13
|
end
|
44
14
|
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'firetower/plugins/yamfire/yamfire.rb'
|
2
|
+
require 'yaml/store'
|
3
|
+
require 'launchy'
|
4
|
+
require 'oauth/signature/plaintext'
|
5
|
+
|
6
|
+
mode "yammer" do
|
7
|
+
fattr(:yammer_config_path) { dir + "yammer.conf" }
|
8
|
+
fattr(:yammer_config) {
|
9
|
+
YAML::Store.new(yammer_config_path.to_s)
|
10
|
+
}
|
11
|
+
fattr(:yammer_client) {
|
12
|
+
yammer_config.transaction(true) do |config|
|
13
|
+
Yammer::Client.new(
|
14
|
+
:consumer => {
|
15
|
+
:key => Firetower::Plugins::Yamfire::CONSUMER_KEY,
|
16
|
+
:secret => Firetower::Plugins::Yamfire::CONSUMER_SECRET
|
17
|
+
},
|
18
|
+
:access => {
|
19
|
+
:token => config[:credentials][:token],
|
20
|
+
:secret => config[:credentials][:secret]
|
21
|
+
})
|
22
|
+
end
|
23
|
+
}
|
24
|
+
fattr(:yammer_user_cache) {
|
25
|
+
Hash.new do |hash, key|
|
26
|
+
hash[key] = yammer_client.user(key)
|
27
|
+
end
|
28
|
+
}
|
29
|
+
|
30
|
+
def yammer_username(user_id)
|
31
|
+
yammer_user_cache[user_id].name
|
32
|
+
end
|
33
|
+
|
34
|
+
description "Yammer integration"
|
35
|
+
mode "auth" do
|
36
|
+
description "Authorize with Yammer"
|
37
|
+
def run
|
38
|
+
hl = HighLine.new
|
39
|
+
yammer_config.transaction do |yammer_config|
|
40
|
+
consumer = OAuth::Consumer.new(
|
41
|
+
Firetower::Plugins::Yamfire::CONSUMER_KEY,
|
42
|
+
Firetower::Plugins::Yamfire::CONSUMER_SECRET,
|
43
|
+
:site => "https://www.yammer.com",
|
44
|
+
:request_token_path => "/oauth/request_token",
|
45
|
+
:access_token_path => "/oauth/access_token",
|
46
|
+
:authorize_path => "/oauth/authorize",
|
47
|
+
:http_method => :post,
|
48
|
+
:signature_method => "HMAC-SHA1")
|
49
|
+
request_token = consumer.get_request_token
|
50
|
+
hl.say "Please authorize Firetower to access your Yammer account"
|
51
|
+
Launchy.open(request_token.authorize_url)
|
52
|
+
callback_token = hl.ask "Enter the 4-digit code from the Yammer website"
|
53
|
+
access_token =
|
54
|
+
request_token.get_access_token(:oauth_verifier => callback_token)
|
55
|
+
yammer_config[:credentials] = {
|
56
|
+
:token => access_token.token,
|
57
|
+
:secret => access_token.secret,
|
58
|
+
}
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
mode "messages" do
|
64
|
+
description "Show the last few messages from Yammer"
|
65
|
+
|
66
|
+
def run
|
67
|
+
yammer_client.messages.each do |message|
|
68
|
+
puts "#{yammer_username(message.sender_id)}: #{message.body.parsed}"
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
mode "post" do
|
74
|
+
description "Post a status update to Yammer"
|
75
|
+
argument "body"
|
76
|
+
|
77
|
+
def run
|
78
|
+
yammer_client.message(:post, :body => params["body"].value)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'yammer4r'
|
2
|
+
require 'oauth'
|
3
|
+
|
4
|
+
# OAuth details for Yamfire
|
5
|
+
|
6
|
+
# Consumer (Application) Key
|
7
|
+
# nZ2KdW4zxEHNAkfnxnMJA
|
8
|
+
# Consumer (Application) Secret
|
9
|
+
# jO4ILOhKjf8IIFG0m4cStu9BTvovWQXghpOYuNHbk
|
10
|
+
# Request Token URL
|
11
|
+
# https://www.yammer.com/oauth/request_token
|
12
|
+
# Access Token URL
|
13
|
+
# https://www.yammer.com/oauth/access_token
|
14
|
+
# Authorize URL
|
15
|
+
# https://www.yammer.com/oauth/access_token
|
16
|
+
|
17
|
+
module Firetower::Plugins
|
18
|
+
class Yamfire < Firetower::Session::Listener
|
19
|
+
CONSUMER_KEY = "nZ2KdW4zxEHNAkfnxnMJA"
|
20
|
+
CONSUMER_SECRET = "jO4ILOhKjf8IIFG0m4cStu9BTvovWQXghpOYuNHbk"
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
data/lib/firetower/session.rb
CHANGED
@@ -1,17 +1,20 @@
|
|
1
|
+
require 'firetower/accounts'
|
2
|
+
|
1
3
|
module Firetower
|
2
4
|
module Plugins
|
3
5
|
end
|
4
6
|
|
5
7
|
class Session
|
6
8
|
include ::Firetower::Plugins
|
7
|
-
|
8
9
|
include HookR::Hooks
|
10
|
+
include Firetower::Accounts
|
11
|
+
include Firetower::Rooms
|
9
12
|
|
10
|
-
attr_reader :accounts
|
11
13
|
attr_reader :connections
|
12
14
|
attr_reader :subscribed_rooms
|
13
15
|
attr_reader :kind
|
14
16
|
attr_reader :default_room
|
17
|
+
attr_reader :ignore_list
|
15
18
|
|
16
19
|
attr_accessor :logger
|
17
20
|
|
@@ -25,9 +28,7 @@ module Firetower
|
|
25
28
|
define_hook :shutdown, :session
|
26
29
|
|
27
30
|
def initialize(kind=:command, options={})
|
28
|
-
@
|
29
|
-
raise "Unknown subdomain '#{subdomain}'"
|
30
|
-
end
|
31
|
+
@ignore_list = []
|
31
32
|
@connections = Hash.new do |hash, subdomain|
|
32
33
|
connection =
|
33
34
|
if accounts[subdomain].ssl?
|
@@ -45,11 +46,9 @@ module Firetower
|
|
45
46
|
@logger = options.fetch(:logger) { ::Logger.new($stderr) }
|
46
47
|
end
|
47
48
|
|
48
|
-
|
49
|
-
|
50
|
-
accounts[subdomain] = Account.new(subdomain, token, self, options)
|
49
|
+
def ignore(*names)
|
50
|
+
@ignore_list.concat names
|
51
51
|
end
|
52
|
-
|
53
52
|
# Enable a plugin or extension
|
54
53
|
def use(class_or_instance, *args)
|
55
54
|
case class_or_instance
|
@@ -58,10 +57,6 @@ module Firetower
|
|
58
57
|
end
|
59
58
|
end
|
60
59
|
|
61
|
-
def join(subdomain, room_name)
|
62
|
-
@subscribed_rooms << accounts[subdomain].rooms[room_name]
|
63
|
-
end
|
64
|
-
|
65
60
|
# Set default room
|
66
61
|
def default(subdomain, room_name)
|
67
62
|
@default_room = accounts[subdomain].rooms[room_name]
|
data/meme.out
ADDED
Binary file
|
data/spec/firetower_spec.rb
CHANGED
@@ -1,6 +1,109 @@
|
|
1
|
-
|
2
1
|
require File.join(File.dirname(__FILE__), %w[spec_helper])
|
2
|
+
require File.join(File.dirname(__FILE__), %w[.. lib firetower plugins core notify_plugin])
|
3
|
+
require File.join(File.dirname(__FILE__), %w[.. lib firetower plugins core growl_plugin])
|
3
4
|
|
4
5
|
describe Firetower do
|
6
|
+
|
7
|
+
describe Firetower::Accounts do
|
8
|
+
subject {
|
9
|
+
it = Object.new; it.extend(Firetower::Accounts); it
|
10
|
+
}
|
11
|
+
|
12
|
+
it "should be able to add a new account" do
|
13
|
+
expect { subject.account "example.com", "XXXX" }.
|
14
|
+
to change{subject.accounts.size}.by(1)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should remember account settings" do
|
18
|
+
subject.account "example.com", "XXXX", :ssl => true
|
19
|
+
subject.accounts.values.last.subdomain.should == "example.com"
|
20
|
+
subject.accounts.values.last.token.should == "XXXX"
|
21
|
+
subject.accounts.values.last.should be_ssl
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should fire :new_account when an account is added" do
|
25
|
+
listener = Firetower::Session::Listener.new
|
26
|
+
listener.should_receive(:new_account).with("example.com", "XYZZY", :foo => :bar)
|
27
|
+
subject.add_listener(listener)
|
28
|
+
subject.account "example.com", "XYZZY", :foo => :bar
|
29
|
+
end
|
30
|
+
|
31
|
+
context "given an account fetcher" do
|
32
|
+
let(:room1) { stub("Room 1")}
|
33
|
+
let(:account) {stub("Account", :rooms => {"room1" => room1})}
|
34
|
+
before do
|
35
|
+
subject.account_fetcher = lambda { account }
|
36
|
+
subject.account "example.com", "XXXX"
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should be able to fetch rooms" do
|
40
|
+
subject.find_room("example.com", "room1").should equal(room1)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
describe Firetower::Rooms do
|
46
|
+
subject {
|
47
|
+
it = Object.new; it.extend(Firetower::Rooms); it
|
48
|
+
}
|
49
|
+
|
50
|
+
context "given an account" do
|
51
|
+
let(:room1) { stub("Room 1") }
|
52
|
+
|
53
|
+
before do
|
54
|
+
subject.stub!(:find_room).with("example.com", "room1").
|
55
|
+
and_return(room1)
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should be able to add a room subscription" do
|
59
|
+
expect { subject.join_room "example.com", "room1" }.
|
60
|
+
to change{subject.subscribed_rooms.size}.by(1)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
shared_examples_for "Notifier Plugins" do
|
66
|
+
|
67
|
+
context "given an ignore list" do
|
68
|
+
let(:ignore_list) { ["avdi"] }
|
69
|
+
let(:notifier) { stub("notifier") }
|
70
|
+
let(:event) do
|
71
|
+
users = {123 => {"name" => "lake"},
|
72
|
+
456 => {"name" => "avdi"} }
|
73
|
+
event = {"user_id" => 123,
|
74
|
+
"type" => "TextMessage"}
|
75
|
+
event.stub_chain(:room, :account, :users).and_return(users)
|
76
|
+
event.stub_chain(:room, :name).and_return('test room')
|
77
|
+
|
78
|
+
event
|
79
|
+
end
|
80
|
+
|
81
|
+
it "should notify on message from unignored user" do
|
82
|
+
notifier.should_receive(:call)
|
83
|
+
subject.receive(nil,event)
|
84
|
+
end
|
85
|
+
it "should not notify on message from ignored user" do
|
86
|
+
notifier.should_not_receive(:call)
|
87
|
+
event["user_id"] = 456
|
88
|
+
subject.receive(nil,event)
|
89
|
+
end
|
90
|
+
it "should notify on unignored user join" do
|
91
|
+
notifier.should_receive(:call)
|
92
|
+
event['type'] = 'EnterMessage'
|
93
|
+
subject.receive(nil,event)
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
describe Firetower::Plugins::NotifyPlugin do
|
99
|
+
subject { Firetower::Plugins::NotifyPlugin.new(:ignore_list => ignore_list, :notifier => notifier) }
|
100
|
+
it_should_behave_like "Notifier Plugins"
|
101
|
+
end
|
102
|
+
|
103
|
+
describe Firetower::Plugins::GrowlPlugin do
|
104
|
+
subject { Firetower::Plugins::GrowlPlugin.new(:ignore_list => ignore_list, :notifier => notifier) }
|
105
|
+
it_should_behave_like "Notifier Plugins"
|
106
|
+
end
|
107
|
+
|
5
108
|
end
|
6
109
|
|
data/tags
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
|
2
|
+
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
|
3
|
+
!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/
|
4
|
+
!_TAG_PROGRAM_NAME Exuberant Ctags //
|
5
|
+
!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/
|
6
|
+
!_TAG_PROGRAM_VERSION 5.8 //
|
7
|
+
Account lib/firetower/account.rb /^ class Account$/;" c class:Firetower
|
8
|
+
Accounts lib/firetower/accounts.rb /^ module Accounts$/;" m class:Firetower
|
9
|
+
Firetower lib/firetower.rb /^module Firetower$/;" m
|
10
|
+
Firetower lib/firetower/account.rb /^module Firetower$/;" m
|
11
|
+
Firetower lib/firetower/accounts.rb /^module Firetower$/;" m
|
12
|
+
Firetower lib/firetower/plugins/core/growl_plugin.rb /^module Firetower$/;" m
|
13
|
+
Firetower lib/firetower/plugins/core/notifier_common.rb /^module Firetower$/;" m
|
14
|
+
Firetower lib/firetower/plugins/core/notify_plugin.rb /^module Firetower$/;" m
|
15
|
+
Firetower lib/firetower/plugins/yamfire/yamfire.rb /^module Firetower::Plugins$/;" m
|
16
|
+
Firetower lib/firetower/room.rb /^module Firetower$/;" m
|
17
|
+
Firetower lib/firetower/rooms.rb /^module Firetower$/;" m
|
18
|
+
Firetower lib/firetower/server.rb /^module Firetower$/;" m
|
19
|
+
Firetower lib/firetower/session.rb /^module Firetower$/;" m
|
20
|
+
GrowlPlugin lib/firetower/plugins/core/growl_plugin.rb /^ class GrowlPlugin < Firetower::Session::Listener$/;" c class:Firetower.Plugins
|
21
|
+
NotifierCommon lib/firetower/plugins/core/notifier_common.rb /^ module NotifierCommon$/;" m class:Firetower.Plugins
|
22
|
+
NotifyPlugin lib/firetower/plugins/core/notify_plugin.rb /^ class NotifyPlugin < Firetower::Session::Listener$/;" c class:Firetower.Plugins
|
23
|
+
Plugins lib/firetower/plugins/core/growl_plugin.rb /^ module Plugins$/;" m class:Firetower
|
24
|
+
Plugins lib/firetower/plugins/core/notifier_common.rb /^ module Plugins$/;" m class:Firetower
|
25
|
+
Plugins lib/firetower/plugins/core/notify_plugin.rb /^ module Plugins$/;" m class:Firetower
|
26
|
+
Plugins lib/firetower/session.rb /^ module Plugins$/;" m class:Firetower
|
27
|
+
Room lib/firetower/room.rb /^ class Room$/;" c class:Firetower
|
28
|
+
Rooms lib/firetower/rooms.rb /^ module Rooms$/;" m class:Firetower
|
29
|
+
Server lib/firetower/server.rb /^ class Server$/;" c class:Firetower
|
30
|
+
Session lib/firetower/session.rb /^ class Session$/;" c class:Firetower
|
31
|
+
Yamfire lib/firetower/plugins/yamfire/yamfire.rb /^ class Yamfire < Firetower::Session::Listener$/;" c class:Firetower
|
32
|
+
account lib/firetower/accounts.rb /^ def account(subdomain, token, options={})$/;" f class:Firetower
|
33
|
+
before_run bin/firetower /^ def before_run$/;" f
|
34
|
+
close! lib/firetower/account.rb /^ def close!$/;" f class:Firetower.Account
|
35
|
+
close! lib/firetower/session.rb /^ def close!$/;" f class:Firetower.Session
|
36
|
+
default lib/firetower/session.rb /^ def default(subdomain, room_name)$/;" f class:Firetower.Session
|
37
|
+
default_room lib/firetower/session.rb /^ def default_room$/;" f class:Firetower.Session
|
38
|
+
error lib/firetower/plugins/core/notifier_common.rb /^ def error(session, error)$/;" f class:Firetower.Plugins.NotifierCommon
|
39
|
+
extended lib/firetower/accounts.rb /^ def self.extended(other)$/;" F class:Firetower.Accounts
|
40
|
+
find_room lib/firetower/accounts.rb /^ def find_room(subdomain, room_name)$/;" f class:Firetower
|
41
|
+
firetower_daemon bin/firetower /^ def firetower_daemon$/;" f
|
42
|
+
get lib/firetower/session.rb /^ def get(subdomain, path)$/;" f class:Firetower.Session
|
43
|
+
ignore lib/firetower/session.rb /^ def ignore(*names)$/;" f class:Firetower.Session
|
44
|
+
ignored? lib/firetower/plugins/core/notifier_common.rb /^ def ignored?(user_name)$/;" f class:Firetower.Plugins.NotifierCommon
|
45
|
+
included lib/firetower/accounts.rb /^ def self.included(other)$/;" F class:Firetower
|
46
|
+
initialize lib/firetower/account.rb /^ def initialize(subdomain, token, session, options = {})$/;" f class:Firetower.Account
|
47
|
+
initialize lib/firetower/plugins/core/notifier_common.rb /^ def initialize(options={})$/;" f class:Firetower.Plugins.NotifierCommon
|
48
|
+
initialize lib/firetower/room.rb /^ def initialize(account, attributes={})$/;" f class:Firetower.Room
|
49
|
+
initialize lib/firetower/server.rb /^ def initialize(session, options={})$/;" f class:Firetower.Server
|
50
|
+
initialize lib/firetower/session.rb /^ def initialize(kind=:command, options={})$/;" f class:Firetower.Session
|
51
|
+
join lib/firetower/plugins/core/notifier_common.rb /^ def join(session, room)$/;" f class:Firetower.Plugins.NotifierCommon
|
52
|
+
join! lib/firetower/account.rb /^ def join!(room_name)$/;" f class:Firetower.Account
|
53
|
+
join_room lib/firetower/rooms.rb /^ def join_room(subdomain, room_name)$/;" f class:Firetower.Rooms
|
54
|
+
leave lib/firetower/plugins/core/notifier_common.rb /^ def leave(session, room)$/;" f class:Firetower.Plugins.NotifierCommon
|
55
|
+
leave! lib/firetower/account.rb /^ def leave!(room_name)$/;" f class:Firetower.Account
|
56
|
+
libpath lib/firetower.rb /^ def self.libpath( *args, &block )$/;" F class:Firetower
|
57
|
+
load_plugins! bin/firetower /^ def load_plugins!$/;" f
|
58
|
+
notify lib/firetower/plugins/core/growl_plugin.rb /^ def notify(*args)$/;" f class:Firetower.Plugins.GrowlPlugin
|
59
|
+
notify lib/firetower/plugins/core/notify_plugin.rb /^ def notify(*args)$/;" f class:Firetower.Plugins.NotifyPlugin
|
60
|
+
paste! lib/firetower/account.rb /^ def paste!(room_name, text)$/;" f class:Firetower.Account
|
61
|
+
path lib/firetower.rb /^ def self.path( *args, &block )$/;" F class:Firetower
|
62
|
+
perform_request lib/firetower/session.rb /^ def perform_request(subdomain, request)$/;" f class:Firetower.Session
|
63
|
+
post lib/firetower/session.rb /^ def post(subdomain, path, data=nil)$/;" f class:Firetower.Session
|
64
|
+
receive lib/firetower/plugins/core/notifier_common.rb /^ def receive(session, event)$/;" f class:Firetower.Plugins.NotifierCommon
|
65
|
+
require_all_libs_relative_to lib/firetower.rb /^ def self.require_all_libs_relative_to( fname, dir = nil )$/;" F class:Firetower
|
66
|
+
rooms lib/firetower/account.rb /^ def rooms$/;" f class:Firetower.Account
|
67
|
+
run bin/firetower /^ def run$/;" f
|
68
|
+
run bin/firetower /^ def run$/;" f
|
69
|
+
run bin/firetower /^ def run$/;" f
|
70
|
+
run lib/firetower/plugins/yamfire/init_v1.rb /^ def run$/;" f
|
71
|
+
run lib/firetower/server.rb /^ def run$/;" f class:Firetower.Server
|
72
|
+
say! lib/firetower/account.rb /^ def say!(room_name, text)$/;" f class:Firetower.Account
|
73
|
+
selected_room bin/firetower /^ def selected_room(session)$/;" f
|
74
|
+
ssl? lib/firetower/account.rb /^ def ssl?$/;" f class:Firetower.Account
|
75
|
+
start_server bin/firetower /^ def start_server(options={})$/;" f
|
76
|
+
startup lib/firetower/plugins/core/notifier_common.rb /^ def startup(session)$/;" f class:Firetower.Plugins.NotifierCommon
|
77
|
+
subscribe_to_room lib/firetower/server.rb /^ def subscribe_to_room(room)$/;" f class:Firetower.Server
|
78
|
+
text bin/firetower /^ def text$/;" f
|
79
|
+
to_s lib/firetower/room.rb /^ def to_s$/;" f class:Firetower.Room
|
80
|
+
use lib/firetower/session.rb /^ def use(class_or_instance, *args)$/;" f class:Firetower.Session
|
81
|
+
version lib/firetower.rb /^ def self.version$/;" F class:Firetower
|
82
|
+
with_session bin/firetower /^ def with_session(kind=:command, options={})$/;" f
|
83
|
+
yammer_username lib/firetower/plugins/yamfire/init_v1.rb /^ def yammer_username(user_id)$/;" f
|
data/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.5
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: firetower
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 21
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Avdi Grimm
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date:
|
18
|
+
date: 2011-07-06 00:00:00 -04:00
|
18
19
|
default_executable:
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: twitter-stream
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ~>
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 23
|
27
30
|
segments:
|
28
31
|
- 0
|
29
32
|
- 1
|
@@ -35,9 +38,11 @@ dependencies:
|
|
35
38
|
name: eventmachine
|
36
39
|
prerelease: false
|
37
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
38
42
|
requirements:
|
39
43
|
- - ~>
|
40
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 59
|
41
46
|
segments:
|
42
47
|
- 0
|
43
48
|
- 12
|
@@ -49,9 +54,11 @@ dependencies:
|
|
49
54
|
name: json
|
50
55
|
prerelease: false
|
51
56
|
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
52
58
|
requirements:
|
53
59
|
- - ~>
|
54
60
|
- !ruby/object:Gem::Version
|
61
|
+
hash: 7
|
55
62
|
segments:
|
56
63
|
- 1
|
57
64
|
- 4
|
@@ -62,9 +69,11 @@ dependencies:
|
|
62
69
|
name: addressable
|
63
70
|
prerelease: false
|
64
71
|
requirement: &id004 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
65
73
|
requirements:
|
66
74
|
- - ~>
|
67
75
|
- !ruby/object:Gem::Version
|
76
|
+
hash: 1
|
68
77
|
segments:
|
69
78
|
- 2
|
70
79
|
- 1
|
@@ -75,9 +84,11 @@ dependencies:
|
|
75
84
|
name: main
|
76
85
|
prerelease: false
|
77
86
|
requirement: &id005 !ruby/object:Gem::Requirement
|
87
|
+
none: false
|
78
88
|
requirements:
|
79
89
|
- - ~>
|
80
90
|
- !ruby/object:Gem::Version
|
91
|
+
hash: 31
|
81
92
|
segments:
|
82
93
|
- 4
|
83
94
|
- 2
|
@@ -88,9 +99,11 @@ dependencies:
|
|
88
99
|
name: servolux
|
89
100
|
prerelease: false
|
90
101
|
requirement: &id006 !ruby/object:Gem::Requirement
|
102
|
+
none: false
|
91
103
|
requirements:
|
92
104
|
- - ~>
|
93
105
|
- !ruby/object:Gem::Version
|
106
|
+
hash: 51
|
94
107
|
segments:
|
95
108
|
- 0
|
96
109
|
- 9
|
@@ -102,22 +115,26 @@ dependencies:
|
|
102
115
|
name: hookr
|
103
116
|
prerelease: false
|
104
117
|
requirement: &id007 !ruby/object:Gem::Requirement
|
118
|
+
none: false
|
105
119
|
requirements:
|
106
120
|
- - ~>
|
107
121
|
- !ruby/object:Gem::Version
|
122
|
+
hash: 13
|
108
123
|
segments:
|
109
124
|
- 1
|
110
|
-
-
|
111
|
-
version: "1.
|
125
|
+
- 1
|
126
|
+
version: "1.1"
|
112
127
|
type: :runtime
|
113
128
|
version_requirements: *id007
|
114
129
|
- !ruby/object:Gem::Dependency
|
115
130
|
name: highline
|
116
131
|
prerelease: false
|
117
132
|
requirement: &id008 !ruby/object:Gem::Requirement
|
133
|
+
none: false
|
118
134
|
requirements:
|
119
135
|
- - ~>
|
120
136
|
- !ruby/object:Gem::Version
|
137
|
+
hash: 5
|
121
138
|
segments:
|
122
139
|
- 1
|
123
140
|
- 5
|
@@ -125,19 +142,69 @@ dependencies:
|
|
125
142
|
type: :runtime
|
126
143
|
version_requirements: *id008
|
127
144
|
- !ruby/object:Gem::Dependency
|
128
|
-
name:
|
145
|
+
name: yammer4r
|
129
146
|
prerelease: false
|
130
147
|
requirement: &id009 !ruby/object:Gem::Requirement
|
148
|
+
none: false
|
149
|
+
requirements:
|
150
|
+
- - ~>
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
hash: 17
|
153
|
+
segments:
|
154
|
+
- 0
|
155
|
+
- 1
|
156
|
+
- 5
|
157
|
+
version: 0.1.5
|
158
|
+
type: :runtime
|
159
|
+
version_requirements: *id009
|
160
|
+
- !ruby/object:Gem::Dependency
|
161
|
+
name: oauth
|
162
|
+
prerelease: false
|
163
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
164
|
+
none: false
|
165
|
+
requirements:
|
166
|
+
- - ~>
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
hash: 9
|
169
|
+
segments:
|
170
|
+
- 0
|
171
|
+
- 4
|
172
|
+
- 3
|
173
|
+
version: 0.4.3
|
174
|
+
type: :runtime
|
175
|
+
version_requirements: *id010
|
176
|
+
- !ruby/object:Gem::Dependency
|
177
|
+
name: launchy
|
178
|
+
prerelease: false
|
179
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
180
|
+
none: false
|
131
181
|
requirements:
|
132
182
|
- - ">="
|
133
183
|
- !ruby/object:Gem::Version
|
184
|
+
hash: 29
|
134
185
|
segments:
|
186
|
+
- 0
|
135
187
|
- 3
|
136
|
-
- 4
|
137
188
|
- 7
|
138
|
-
version: 3.
|
189
|
+
version: 0.3.7
|
190
|
+
type: :runtime
|
191
|
+
version_requirements: *id011
|
192
|
+
- !ruby/object:Gem::Dependency
|
193
|
+
name: bones
|
194
|
+
prerelease: false
|
195
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
196
|
+
none: false
|
197
|
+
requirements:
|
198
|
+
- - ">="
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
hash: 27
|
201
|
+
segments:
|
202
|
+
- 3
|
203
|
+
- 7
|
204
|
+
- 0
|
205
|
+
version: 3.7.0
|
139
206
|
type: :development
|
140
|
-
version_requirements: *
|
207
|
+
version_requirements: *id012
|
141
208
|
description: ""
|
142
209
|
email: avdi@avdi.org
|
143
210
|
executables:
|
@@ -149,11 +216,9 @@ extra_rdoc_files:
|
|
149
216
|
- bin/firetower
|
150
217
|
- lib/firetower/firetower.conf.erb
|
151
218
|
- lib/firetower/plugins/core/campfire-logo-for-fluid.png
|
152
|
-
- version.txt
|
153
219
|
files:
|
154
|
-
- .
|
220
|
+
- .rvmrc
|
155
221
|
- History.txt
|
156
|
-
- README.html
|
157
222
|
- README.org
|
158
223
|
- Rakefile
|
159
224
|
- bin/firetower
|
@@ -161,16 +226,23 @@ files:
|
|
161
226
|
- images/BaldMountainLookout.jpg
|
162
227
|
- lib/firetower.rb
|
163
228
|
- lib/firetower/account.rb
|
229
|
+
- lib/firetower/accounts.rb
|
164
230
|
- lib/firetower/firetower.conf.erb
|
165
231
|
- lib/firetower/plugins/core/campfire-logo-for-fluid.png
|
166
|
-
- lib/firetower/plugins/core/
|
232
|
+
- lib/firetower/plugins/core/growl_plugin.rb
|
167
233
|
- lib/firetower/plugins/core/init_v1.rb
|
234
|
+
- lib/firetower/plugins/core/notifier_common.rb
|
168
235
|
- lib/firetower/plugins/core/notify_plugin.rb
|
236
|
+
- lib/firetower/plugins/yamfire/init_v1.rb
|
237
|
+
- lib/firetower/plugins/yamfire/yamfire.rb
|
169
238
|
- lib/firetower/room.rb
|
239
|
+
- lib/firetower/rooms.rb
|
170
240
|
- lib/firetower/server.rb
|
171
241
|
- lib/firetower/session.rb
|
242
|
+
- meme.out
|
172
243
|
- spec/firetower_spec.rb
|
173
244
|
- spec/spec_helper.rb
|
245
|
+
- tags
|
174
246
|
- test/test_firetower.rb
|
175
247
|
- version.txt
|
176
248
|
has_rdoc: true
|
@@ -184,23 +256,27 @@ rdoc_options:
|
|
184
256
|
require_paths:
|
185
257
|
- lib
|
186
258
|
required_ruby_version: !ruby/object:Gem::Requirement
|
259
|
+
none: false
|
187
260
|
requirements:
|
188
261
|
- - ">="
|
189
262
|
- !ruby/object:Gem::Version
|
263
|
+
hash: 3
|
190
264
|
segments:
|
191
265
|
- 0
|
192
266
|
version: "0"
|
193
267
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
268
|
+
none: false
|
194
269
|
requirements:
|
195
270
|
- - ">="
|
196
271
|
- !ruby/object:Gem::Version
|
272
|
+
hash: 3
|
197
273
|
segments:
|
198
274
|
- 0
|
199
275
|
version: "0"
|
200
276
|
requirements: []
|
201
277
|
|
202
278
|
rubyforge_project: firetower
|
203
|
-
rubygems_version: 1.3.
|
279
|
+
rubygems_version: 1.3.7
|
204
280
|
signing_key:
|
205
281
|
specification_version: 3
|
206
282
|
summary: A command-line interface to Campfire chats
|
data/.gitignore
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
pkg
|
data/README.html
DELETED
@@ -1,406 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
3
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml"
|
5
|
-
lang="en" xml:lang="en">
|
6
|
-
<head>
|
7
|
-
<title>Firetower README</title>
|
8
|
-
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"/>
|
9
|
-
<meta name="generator" content="Org-mode"/>
|
10
|
-
<meta name="generated" content="2010-07-11 23:51:09 EDT"/>
|
11
|
-
<meta name="author" content="Avdi Grimm"/>
|
12
|
-
<meta name="description" content=""/>
|
13
|
-
<meta name="keywords" content=""/>
|
14
|
-
<style type="text/css">
|
15
|
-
<!--/*--><![CDATA[/*><!--*/
|
16
|
-
html { font-family: Times, serif; font-size: 12pt; }
|
17
|
-
.title { text-align: center; }
|
18
|
-
.todo { color: red; }
|
19
|
-
.done { color: green; }
|
20
|
-
.tag { background-color: #add8e6; font-weight:normal }
|
21
|
-
.target { }
|
22
|
-
.timestamp { color: #bebebe; }
|
23
|
-
.timestamp-kwd { color: #5f9ea0; }
|
24
|
-
p.verse { margin-left: 3% }
|
25
|
-
pre {
|
26
|
-
border: 1pt solid #AEBDCC;
|
27
|
-
background-color: #F3F5F7;
|
28
|
-
padding: 5pt;
|
29
|
-
font-family: courier, monospace;
|
30
|
-
font-size: 90%;
|
31
|
-
overflow:auto;
|
32
|
-
}
|
33
|
-
table { border-collapse: collapse; }
|
34
|
-
td, th { vertical-align: top; }
|
35
|
-
dt { font-weight: bold; }
|
36
|
-
div.figure { padding: 0.5em; }
|
37
|
-
div.figure p { text-align: center; }
|
38
|
-
.linenr { font-size:smaller }
|
39
|
-
.code-highlighted {background-color:#ffff00;}
|
40
|
-
.org-info-js_info-navigation { border-style:none; }
|
41
|
-
#org-info-js_console-label { font-size:10px; font-weight:bold;
|
42
|
-
white-space:nowrap; }
|
43
|
-
.org-info-js_search-highlight {background-color:#ffff00; color:#000000;
|
44
|
-
font-weight:bold; }
|
45
|
-
/*]]>*/-->
|
46
|
-
</style>
|
47
|
-
<script type="text/javascript">
|
48
|
-
<!--/*--><![CDATA[/*><!--*/
|
49
|
-
function CodeHighlightOn(elem, id)
|
50
|
-
{
|
51
|
-
var target = document.getElementById(id);
|
52
|
-
if(null != target) {
|
53
|
-
elem.cacheClassElem = elem.className;
|
54
|
-
elem.cacheClassTarget = target.className;
|
55
|
-
target.className = "code-highlighted";
|
56
|
-
elem.className = "code-highlighted";
|
57
|
-
}
|
58
|
-
}
|
59
|
-
function CodeHighlightOff(elem, id)
|
60
|
-
{
|
61
|
-
var target = document.getElementById(id);
|
62
|
-
if(elem.cacheClassElem)
|
63
|
-
elem.className = elem.cacheClassElem;
|
64
|
-
if(elem.cacheClassTarget)
|
65
|
-
target.className = elem.cacheClassTarget;
|
66
|
-
}
|
67
|
-
/*]]>*///-->
|
68
|
-
</script>
|
69
|
-
</head>
|
70
|
-
<body>
|
71
|
-
<div id="content">
|
72
|
-
|
73
|
-
<h1 class="title">Firetower README</h1>
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
<div id="table-of-contents">
|
78
|
-
<h2>Table of Contents</h2>
|
79
|
-
<div id="text-table-of-contents">
|
80
|
-
<ul>
|
81
|
-
<li><a href="#sec-1">1 Firetower </a>
|
82
|
-
<ul>
|
83
|
-
<li><a href="#sec-1.1">1.1 Requirements </a></li>
|
84
|
-
<li><a href="#sec-1.2">1.2 Install </a></li>
|
85
|
-
<li><a href="#sec-1.3">1.3 Configuration </a>
|
86
|
-
<ul>
|
87
|
-
<li><a href="#sec-1.3.1">1.3.1 A simple bot </a></li>
|
88
|
-
</ul>
|
89
|
-
</li>
|
90
|
-
<li><a href="#sec-1.4">1.4 Usage </a>
|
91
|
-
<ul>
|
92
|
-
<li><a href="#sec-1.4.1">1.4.1 Say something in campfire </a></li>
|
93
|
-
<li><a href="#sec-1.4.2">1.4.2 Say something to a non-default room </a></li>
|
94
|
-
<li><a href="#sec-1.4.3">1.4.3 Paste a code snippet into campfire </a></li>
|
95
|
-
<li><a href="#sec-1.4.4">1.4.4 Paste from the clipboaord </a></li>
|
96
|
-
<li><a href="#sec-1.4.5">1.4.5 Paste the selected text </a></li>
|
97
|
-
<li><a href="#sec-1.4.6">1.4.6 Start server (for notifications, bots, etc.) </a></li>
|
98
|
-
<li><a href="#sec-1.4.7">1.4.7 Stop server </a></li>
|
99
|
-
</ul>
|
100
|
-
</li>
|
101
|
-
<li><a href="#sec-1.5">1.5 Plugin API </a></li>
|
102
|
-
<li><a href="#sec-1.6">1.6 License </a></li>
|
103
|
-
</ul>
|
104
|
-
</li>
|
105
|
-
</ul>
|
106
|
-
</div>
|
107
|
-
</div>
|
108
|
-
|
109
|
-
<div id="outline-container-1" class="outline-2">
|
110
|
-
<h2 id="sec-1"><span class="section-number-2">1</span> Firetower </h2>
|
111
|
-
<div class="outline-text-2" id="text-1">
|
112
|
-
|
113
|
-
|
114
|
-
<p>
|
115
|
-
<img src="images/BaldMountainLookout.jpg" alt="images/BaldMountainLookout.jpg" />
|
116
|
-
</p>
|
117
|
-
<p>
|
118
|
-
A command-line interface to the Campfire API
|
119
|
-
(<a href="http://developer.37signals.com/campfire/">http://developer.37signals.com/campfire/</a>) by <a href="mailto:avdi@avdi.org">Avdi Grimm</a>
|
120
|
-
</p>
|
121
|
-
<p>
|
122
|
-
URL: <a href="http://github.com/avdi/firetower">http://github.com/avdi/firetower</a>
|
123
|
-
</p>
|
124
|
-
|
125
|
-
</div>
|
126
|
-
|
127
|
-
<div id="outline-container-1.1" class="outline-3">
|
128
|
-
<h3 id="sec-1.1"><span class="section-number-3">1.1</span> Requirements </h3>
|
129
|
-
<div class="outline-text-3" id="text-1.1">
|
130
|
-
|
131
|
-
|
132
|
-
<ul>
|
133
|
-
<li>
|
134
|
-
Linux (somebody please port this to OS X)
|
135
|
-
</li>
|
136
|
-
<li>
|
137
|
-
<a href="http://www.kfish.org/software/xsel/">xsel</a>
|
138
|
-
</li>
|
139
|
-
<li>
|
140
|
-
<a href="#apt:libnotify-bin">libnotify-bin</a>
|
141
|
-
|
142
|
-
</li>
|
143
|
-
</ul>
|
144
|
-
</div>
|
145
|
-
|
146
|
-
</div>
|
147
|
-
|
148
|
-
<div id="outline-container-1.2" class="outline-3">
|
149
|
-
<h3 id="sec-1.2"><span class="section-number-3">1.2</span> Install </h3>
|
150
|
-
<div class="outline-text-3" id="text-1.2">
|
151
|
-
|
152
|
-
|
153
|
-
<pre class="example">
|
154
|
-
sudo gem install firetower
|
155
|
-
firetower setup
|
156
|
-
</pre>
|
157
|
-
|
158
|
-
|
159
|
-
</div>
|
160
|
-
|
161
|
-
</div>
|
162
|
-
|
163
|
-
<div id="outline-container-1.3" class="outline-3">
|
164
|
-
<h3 id="sec-1.3"><span class="section-number-3">1.3</span> Configuration </h3>
|
165
|
-
<div class="outline-text-3" id="text-1.3">
|
166
|
-
|
167
|
-
<p>Edit $HOME/.firetower/firetower.conf
|
168
|
-
</p>
|
169
|
-
<p>
|
170
|
-
All configuration is done in Ruby. The context is a Firetower::Sesson
|
171
|
-
object. You can add handlers for events:
|
172
|
-
</p>
|
173
|
-
<pre class="example">
|
174
|
-
receive do |session, event| ... end
|
175
|
-
</pre>
|
176
|
-
|
177
|
-
|
178
|
-
<p>
|
179
|
-
Or enable plugins:
|
180
|
-
</p>
|
181
|
-
<pre class="example">
|
182
|
-
use NotifyPlugin
|
183
|
-
</pre>
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
</div>
|
188
|
-
|
189
|
-
<div id="outline-container-1.3.1" class="outline-4">
|
190
|
-
<h4 id="sec-1.3.1"><span class="section-number-4">1.3.1</span> A simple bot </h4>
|
191
|
-
<div class="outline-text-4" id="text-1.3.1">
|
192
|
-
|
193
|
-
<p>Drop this in ~/.firetower/firetower.conf for a simple (and VERY UNSAFE!) demo
|
194
|
-
of a Campfire bot which will eval arbitrary Ruby code:
|
195
|
-
</p>
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
<pre class="src src-ruby">receive <span style="color: #CC7832; font-weight: bold;">do</span> |session, event|
|
200
|
-
<span style="color: #CC7832; font-weight: bold;">if</span> event[<span style="color: #A5F26E;">'type'</span>] == <span style="color: #A5F26E;">'TextMessage'</span> && event[<span style="color: #A5F26E;">'body'</span>] =~ <span style="color: #A5F26E;">/^!eval (.*)$/</span>
|
201
|
-
event.room.account.paste!(event.room.name, <span style="color: #A5F26E;">"Eval result:\n"</span> + eval(<span style="color: #D0D0F3;">$1</span>).to_s)
|
202
|
-
<span style="color: #CC7832; font-weight: bold;">end</span>
|
203
|
-
<span style="color: #CC7832; font-weight: bold;">end</span>
|
204
|
-
</pre>
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
</div>
|
210
|
-
</div>
|
211
|
-
|
212
|
-
</div>
|
213
|
-
|
214
|
-
<div id="outline-container-1.4" class="outline-3">
|
215
|
-
<h3 id="sec-1.4"><span class="section-number-3">1.4</span> Usage </h3>
|
216
|
-
<div class="outline-text-3" id="text-1.4">
|
217
|
-
|
218
|
-
|
219
|
-
</div>
|
220
|
-
|
221
|
-
<div id="outline-container-1.4.1" class="outline-4">
|
222
|
-
<h4 id="sec-1.4.1"><span class="section-number-4">1.4.1</span> Say something in campfire </h4>
|
223
|
-
<div class="outline-text-4" id="text-1.4.1">
|
224
|
-
|
225
|
-
<pre class="example">
|
226
|
-
firetower say 'blah blah blah'
|
227
|
-
</pre>
|
228
|
-
|
229
|
-
</div>
|
230
|
-
|
231
|
-
</div>
|
232
|
-
|
233
|
-
<div id="outline-container-1.4.2" class="outline-4">
|
234
|
-
<h4 id="sec-1.4.2"><span class="section-number-4">1.4.2</span> Say something to a non-default room </h4>
|
235
|
-
<div class="outline-text-4" id="text-1.4.2">
|
236
|
-
|
237
|
-
<pre class="example">
|
238
|
-
firetower say subdomain='mycompany' room='Water Cooler' 'blah blah blah'
|
239
|
-
</pre>
|
240
|
-
|
241
|
-
</div>
|
242
|
-
|
243
|
-
</div>
|
244
|
-
|
245
|
-
<div id="outline-container-1.4.3" class="outline-4">
|
246
|
-
<h4 id="sec-1.4.3"><span class="section-number-4">1.4.3</span> Paste a code snippet into campfire </h4>
|
247
|
-
<div class="outline-text-4" id="text-1.4.3">
|
248
|
-
|
249
|
-
<pre class="example">
|
250
|
-
firetower paste < hello.rb
|
251
|
-
</pre>
|
252
|
-
|
253
|
-
</div>
|
254
|
-
|
255
|
-
</div>
|
256
|
-
|
257
|
-
<div id="outline-container-1.4.4" class="outline-4">
|
258
|
-
<h4 id="sec-1.4.4"><span class="section-number-4">1.4.4</span> Paste from the clipboaord </h4>
|
259
|
-
<div class="outline-text-4" id="text-1.4.4">
|
260
|
-
|
261
|
-
<pre class="example">
|
262
|
-
firetower paste --from=clip
|
263
|
-
</pre>
|
264
|
-
|
265
|
-
</div>
|
266
|
-
|
267
|
-
</div>
|
268
|
-
|
269
|
-
<div id="outline-container-1.4.5" class="outline-4">
|
270
|
-
<h4 id="sec-1.4.5"><span class="section-number-4">1.4.5</span> Paste the selected text </h4>
|
271
|
-
<div class="outline-text-4" id="text-1.4.5">
|
272
|
-
|
273
|
-
<pre class="example">
|
274
|
-
firetower paste --from=sel
|
275
|
-
</pre>
|
276
|
-
|
277
|
-
</div>
|
278
|
-
|
279
|
-
</div>
|
280
|
-
|
281
|
-
<div id="outline-container-1.4.6" class="outline-4">
|
282
|
-
<h4 id="sec-1.4.6"><span class="section-number-4">1.4.6</span> Start server (for notifications, bots, etc.) </h4>
|
283
|
-
<div class="outline-text-4" id="text-1.4.6">
|
284
|
-
|
285
|
-
<pre class="example">
|
286
|
-
firetower start
|
287
|
-
</pre>
|
288
|
-
|
289
|
-
</div>
|
290
|
-
|
291
|
-
</div>
|
292
|
-
|
293
|
-
<div id="outline-container-1.4.7" class="outline-4">
|
294
|
-
<h4 id="sec-1.4.7"><span class="section-number-4">1.4.7</span> Stop server </h4>
|
295
|
-
<div class="outline-text-4" id="text-1.4.7">
|
296
|
-
|
297
|
-
<pre class="example">
|
298
|
-
firetower stop
|
299
|
-
</pre>
|
300
|
-
|
301
|
-
|
302
|
-
</div>
|
303
|
-
</div>
|
304
|
-
|
305
|
-
</div>
|
306
|
-
|
307
|
-
<div id="outline-container-1.5" class="outline-3">
|
308
|
-
<h3 id="sec-1.5"><span class="section-number-3">1.5</span> Plugin API </h3>
|
309
|
-
<div class="outline-text-3" id="text-1.5">
|
310
|
-
|
311
|
-
<p>If you want to write your own Firetower plugins, you should create a gem
|
312
|
-
that contains a path something like this:
|
313
|
-
</p>
|
314
|
-
<pre class="example">
|
315
|
-
lib/firetower/plugins/my_awesome_plugin/init_v1.rb
|
316
|
-
</pre>
|
317
|
-
|
318
|
-
|
319
|
-
<p>
|
320
|
-
Firetower will load the init<sub>v1</sub>.rb file on startup. Typically, a plugin
|
321
|
-
will define a Firetower::Session::Listener class (or more than one) in the
|
322
|
-
Firetower::Plugins namespace:
|
323
|
-
</p>
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
<pre class="src src-ruby"><span style="color: #CC7832; font-weight: bold;">module</span> <span style="color: #8888ff; font-weight: bold;">Firetower</span>
|
328
|
-
<span style="color: #CC7832; font-weight: bold;">module</span> <span style="color: #8888ff; font-weight: bold;">Plugins</span>
|
329
|
-
<span style="color: #CC7832; font-weight: bold;">class</span> <span style="color: #8888ff; font-weight: bold;">MyAwesomePlugin</span> < <span style="color: #8888ff; font-weight: bold;">Firetower::Session::Listener</span>
|
330
|
-
<span style="color: #CC7832; font-weight: bold;">def</span> <span style="color: #E8BF6A; font-weight: bold;">startup</span>(session)
|
331
|
-
<span style="color: #888888;"># </span><span style="color: #B150E7; font-style: italic;">Some one-time startup code...
|
332
|
-
</span> <span style="color: #CC7832; font-weight: bold;">end</span>
|
333
|
-
|
334
|
-
<span style="color: #CC7832; font-weight: bold;">def</span> <span style="color: #E8BF6A; font-weight: bold;">receive</span>(session, event)
|
335
|
-
<span style="color: #888888;"># </span><span style="color: #B150E7; font-style: italic;">Some event-handling code...
|
336
|
-
</span> <span style="color: #CC7832; font-weight: bold;">end</span>
|
337
|
-
<span style="color: #CC7832; font-weight: bold;">end</span>
|
338
|
-
<span style="color: #CC7832; font-weight: bold;">end</span>
|
339
|
-
<span style="color: #CC7832; font-weight: bold;">end</span>
|
340
|
-
</pre>
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
<p>
|
346
|
-
Users can then enable your plugin by installing your gem and adding a line
|
347
|
-
line to their firetower.conf:
|
348
|
-
</p>
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
<pre class="src src-ruby">use <span style="color: #8888ff; font-weight: bold;">MyAwesomePlugin</span>
|
353
|
-
</pre>
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
</div>
|
359
|
-
|
360
|
-
</div>
|
361
|
-
|
362
|
-
<div id="outline-container-1.6" class="outline-3">
|
363
|
-
<h3 id="sec-1.6"><span class="section-number-3">1.6</span> License </h3>
|
364
|
-
<div class="outline-text-3" id="text-1.6">
|
365
|
-
|
366
|
-
|
367
|
-
<p>
|
368
|
-
(The MIT License)
|
369
|
-
</p>
|
370
|
-
<p>
|
371
|
-
Copyright (c) 2010 Avdi Grimm
|
372
|
-
</p>
|
373
|
-
<p>
|
374
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
375
|
-
a copy of this software and associated documentation files (the
|
376
|
-
'Software'), to deal in the Software without restriction, including
|
377
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
378
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
379
|
-
permit persons to whom the Software is furnished to do so, subject to
|
380
|
-
the following conditions:
|
381
|
-
</p>
|
382
|
-
<p>
|
383
|
-
The above copyright notice and this permission notice shall be
|
384
|
-
included in all copies or substantial portions of the Software.
|
385
|
-
</p>
|
386
|
-
<p>
|
387
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
388
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
389
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
390
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
391
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
392
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
393
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
394
|
-
</p></div>
|
395
|
-
</div>
|
396
|
-
</div>
|
397
|
-
<div id="postamble">
|
398
|
-
<p class="author"> Author: Avdi Grimm
|
399
|
-
<a href="mailto:avdi@avdi.org"><avdi@avdi.org></a>
|
400
|
-
</p>
|
401
|
-
<p class="date"> Date: 2010-07-11 23:51:09 EDT</p>
|
402
|
-
<p class="creator">HTML generated by org-mode 6.33trans in emacs 23</p>
|
403
|
-
</div>
|
404
|
-
</div>
|
405
|
-
</body>
|
406
|
-
</html>
|