circus-deployment 0.0.1 → 0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/bundler/circus_util.rb +1 -2
- data/lib/bundler/gem_cacher.rb +46 -0
- data/lib/circus.rb +2 -1
- data/lib/circus/act.rb +29 -6
- data/lib/circus/application.rb +49 -6
- data/lib/circus/booth_tool.rb +14 -1
- data/lib/circus/cli.rb +21 -2
- data/lib/circus/clown_client.rb +4 -0
- data/lib/circus/external_util.rb +10 -0
- data/lib/circus/processes/daemontools.rb +65 -0
- data/lib/circus/profiles.rb +2 -0
- data/lib/circus/profiles/base.rb +20 -1
- data/lib/circus/profiles/chef_stack.rb +75 -0
- data/lib/circus/profiles/make_base.rb +4 -1
- data/lib/circus/profiles/maven_webapp.rb +117 -0
- data/lib/circus/profiles/maven_webapp_jetty.xml.erb +74 -0
- data/lib/circus/profiles/maven_webapp_jetty_app.xml.erb +56 -0
- data/lib/circus/profiles/python_base.rb +5 -5
- data/lib/circus/profiles/rack.rb +11 -7
- data/lib/circus/profiles/ruby_base.rb +13 -4
- data/lib/circus/repos/git.rb +2 -1
- data/lib/circus/version.rb +1 -1
- metadata +106 -72
- data/lib/circus/agents/agent.rb +0 -59
- data/lib/circus/agents/logger.rb +0 -52
data/lib/circus/agents/agent.rb
DELETED
@@ -1,59 +0,0 @@
|
|
1
|
-
require 'blather/client/dsl'
|
2
|
-
require 'circus/agents/params'
|
3
|
-
require 'circus/agents/logger'
|
4
|
-
require 'circus/agents/connection'
|
5
|
-
|
6
|
-
module Circus
|
7
|
-
module Agents
|
8
|
-
class Agent
|
9
|
-
include Blather::DSL
|
10
|
-
|
11
|
-
class <<self
|
12
|
-
def commands
|
13
|
-
@commands ||= []
|
14
|
-
end
|
15
|
-
|
16
|
-
def command(name, &body)
|
17
|
-
commands << name
|
18
|
-
|
19
|
-
define_method("command_#{name}", &body)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def initialize(connection = nil)
|
24
|
-
@client = (connection || Connection.new)
|
25
|
-
|
26
|
-
# Approve all subscription requests
|
27
|
-
subscription :request? do |s|
|
28
|
-
write_to_stream s.approve!
|
29
|
-
end
|
30
|
-
|
31
|
-
# Add a handler for each chat command
|
32
|
-
self.class.commands.each do |name|
|
33
|
-
message :chat?, :body => /^#{name}( .*)?$/ do |m|
|
34
|
-
# begin
|
35
|
-
params = CommandParams.new(m.body[(name.length + 1)..-1])
|
36
|
-
logger = XMPPLogger.new(m.from, m.thread || m.id, lambda { |msg| write_to_stream(msg) })
|
37
|
-
|
38
|
-
send("command_#{name}", params, logger)
|
39
|
-
# rescue
|
40
|
-
# puts $!, $@
|
41
|
-
# end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
disconnected do
|
46
|
-
puts "Disconnected"
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def configure!(config)
|
51
|
-
client.configure!(config)
|
52
|
-
end
|
53
|
-
|
54
|
-
def run
|
55
|
-
client.run
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
data/lib/circus/agents/logger.rb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
require 'circus/agents/encoding'
|
2
|
-
require 'circus/agents/conversation'
|
3
|
-
|
4
|
-
module Circus
|
5
|
-
module Agents
|
6
|
-
class XMPPLogger
|
7
|
-
def initialize(to, thread, writer)
|
8
|
-
@to = to
|
9
|
-
@thread = thread || "thread#{Blather::Stanza.next_id}"
|
10
|
-
@writer = writer
|
11
|
-
end
|
12
|
-
|
13
|
-
def info(content)
|
14
|
-
write("#{content}")
|
15
|
-
end
|
16
|
-
|
17
|
-
|
18
|
-
def error(content)
|
19
|
-
write("ERROR: #{content}")
|
20
|
-
end
|
21
|
-
|
22
|
-
def failed(msg)
|
23
|
-
write("failed #{msg}")
|
24
|
-
gone
|
25
|
-
end
|
26
|
-
|
27
|
-
def complete(res = nil)
|
28
|
-
if res
|
29
|
-
write("ok #{Encoding.encode(res)}")
|
30
|
-
else
|
31
|
-
write('ok')
|
32
|
-
end
|
33
|
-
gone
|
34
|
-
end
|
35
|
-
|
36
|
-
private
|
37
|
-
def write(content)
|
38
|
-
msg = Blather::Stanza::Message.new @to, content
|
39
|
-
msg.thread = @thread
|
40
|
-
@writer.call(msg)
|
41
|
-
end
|
42
|
-
|
43
|
-
def gone
|
44
|
-
msg = Blather::Stanza::Message.new @to, nil
|
45
|
-
msg.thread = @thread
|
46
|
-
|
47
|
-
Conversation.end(msg)
|
48
|
-
@writer.call(msg)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|