circus-deployment 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +23 -0
- data/README.md +0 -0
- data/bin/circus +24 -0
- data/lib/bundler/circus_bundler.rb +24 -0
- data/lib/bundler/circus_util.rb +43 -0
- data/lib/bundler/patches.rb +18 -0
- data/lib/circus/act.rb +74 -0
- data/lib/circus/actstore_client.rb +30 -0
- data/lib/circus/agents/agent.rb +59 -0
- data/lib/circus/agents/client.rb +77 -0
- data/lib/circus/agents/connection.rb +76 -0
- data/lib/circus/agents/conversation.rb +17 -0
- data/lib/circus/agents/dbus_connection.rb +85 -0
- data/lib/circus/agents/dbus_logger.rb +34 -0
- data/lib/circus/agents/encoding.rb +32 -0
- data/lib/circus/agents/logger.rb +52 -0
- data/lib/circus/agents/params.rb +47 -0
- data/lib/circus/agents/ssh_connection.rb +120 -0
- data/lib/circus/application.rb +99 -0
- data/lib/circus/booth_client.rb +25 -0
- data/lib/circus/booth_tool.rb +98 -0
- data/lib/circus/cli.rb +147 -0
- data/lib/circus/clown_client.rb +27 -0
- data/lib/circus/connection_builder.rb +32 -0
- data/lib/circus/external_util.rb +14 -0
- data/lib/circus/local_config.rb +65 -0
- data/lib/circus/profiles/base.rb +115 -0
- data/lib/circus/profiles/django.rb +90 -0
- data/lib/circus/profiles/jekyll.rb +90 -0
- data/lib/circus/profiles/make_base.rb +17 -0
- data/lib/circus/profiles/pure_py.rb +46 -0
- data/lib/circus/profiles/pure_rb.rb +48 -0
- data/lib/circus/profiles/python_base.rb +39 -0
- data/lib/circus/profiles/rack.rb +59 -0
- data/lib/circus/profiles/ruby_base.rb +52 -0
- data/lib/circus/profiles/shell.rb +46 -0
- data/lib/circus/profiles.rb +10 -0
- data/lib/circus/repos/git.rb +42 -0
- data/lib/circus/repos/mercurial.rb +42 -0
- data/lib/circus/repos.rb +16 -0
- data/lib/circus/resource_allocator_client.rb +19 -0
- data/lib/circus/stdout_logger.rb +11 -0
- data/lib/circus/version.rb +3 -0
- data/lib/circus.rb +9 -0
- data/vendor/ruby-dbus/COPYING +504 -0
- data/vendor/ruby-dbus/ChangeLog +782 -0
- data/vendor/ruby-dbus/HOWTO-RELEASE +14 -0
- data/vendor/ruby-dbus/NEWS +104 -0
- data/vendor/ruby-dbus/README +53 -0
- data/vendor/ruby-dbus/Rakefile +47 -0
- data/vendor/ruby-dbus/doc/tutorial/src/00.index.page +12 -0
- data/vendor/ruby-dbus/doc/tutorial/src/10.intro.page +127 -0
- data/vendor/ruby-dbus/doc/tutorial/src/20.basic_client.page +174 -0
- data/vendor/ruby-dbus/doc/tutorial/src/30.service.page +121 -0
- data/vendor/ruby-dbus/doc/tutorial/src/default.css +129 -0
- data/vendor/ruby-dbus/doc/tutorial/src/default.template +46 -0
- data/vendor/ruby-dbus/examples/gdbus/gdbus +255 -0
- data/vendor/ruby-dbus/examples/gdbus/gdbus.glade +184 -0
- data/vendor/ruby-dbus/examples/gdbus/launch.sh +4 -0
- data/vendor/ruby-dbus/examples/no-introspect/nm-test.rb +21 -0
- data/vendor/ruby-dbus/examples/no-introspect/tracker-test.rb +16 -0
- data/vendor/ruby-dbus/examples/rhythmbox/playpause.rb +25 -0
- data/vendor/ruby-dbus/examples/service/call_service.rb +25 -0
- data/vendor/ruby-dbus/examples/service/service_newapi.rb +51 -0
- data/vendor/ruby-dbus/examples/simple/call_introspect.rb +34 -0
- data/vendor/ruby-dbus/examples/utils/listnames.rb +11 -0
- data/vendor/ruby-dbus/examples/utils/notify.rb +19 -0
- data/vendor/ruby-dbus/lib/dbus/auth.rb +156 -0
- data/vendor/ruby-dbus/lib/dbus/bus.rb +750 -0
- data/vendor/ruby-dbus/lib/dbus/export.rb +133 -0
- data/vendor/ruby-dbus/lib/dbus/introspect.rb +544 -0
- data/vendor/ruby-dbus/lib/dbus/marshall.rb +443 -0
- data/vendor/ruby-dbus/lib/dbus/matchrule.rb +100 -0
- data/vendor/ruby-dbus/lib/dbus/message.rb +293 -0
- data/vendor/ruby-dbus/lib/dbus/type.rb +222 -0
- data/vendor/ruby-dbus/lib/dbus.rb +89 -0
- data/vendor/ruby-dbus/ruby-dbus.gemspec +28 -0
- data/vendor/ruby-dbus/setup.rb +1585 -0
- data/vendor/ruby-dbus/test/Makefile +4 -0
- data/vendor/ruby-dbus/test/bus_driver_test.rb +21 -0
- data/vendor/ruby-dbus/test/server_robustness_test.rb +41 -0
- data/vendor/ruby-dbus/test/server_test.rb +44 -0
- data/vendor/ruby-dbus/test/service_newapi.rb +99 -0
- data/vendor/ruby-dbus/test/session_bus_test_manual.rb +20 -0
- data/vendor/ruby-dbus/test/signal_test.rb +57 -0
- data/vendor/ruby-dbus/test/t1 +4 -0
- data/vendor/ruby-dbus/test/t2.rb +66 -0
- data/vendor/ruby-dbus/test/t3-ticket27.rb +18 -0
- data/vendor/ruby-dbus/test/t5-report-dbus-interface.rb +58 -0
- data/vendor/ruby-dbus/test/t6-loop.rb +85 -0
- data/vendor/ruby-dbus/test/test_all +26 -0
- data/vendor/ruby-dbus/test/test_server +74 -0
- data/vendor/ruby-dbus/test/variant_test.rb +66 -0
- metadata +225 -0
@@ -0,0 +1,25 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "dbus"
|
4
|
+
|
5
|
+
session_bus = DBus::SessionBus.instance
|
6
|
+
|
7
|
+
ruby_srv = session_bus.service("org.ruby.service")
|
8
|
+
|
9
|
+
# Get the object from this service
|
10
|
+
player = ruby_srv.object("/org/ruby/MyInstance")
|
11
|
+
|
12
|
+
# Introspect it
|
13
|
+
puts player.introspect
|
14
|
+
player.default_iface = "org.ruby.SampleInterface"
|
15
|
+
player.test_variant(["s", "coucou"])
|
16
|
+
player.on_signal("SomethingJustHappened") do |u, v|
|
17
|
+
puts "SomethingJustHappened: #{u} #{v}"
|
18
|
+
end
|
19
|
+
player.hello("8=======D", "(_._)")
|
20
|
+
p player["org.ruby.AnotherInterface"].Reverse("Hello world!")
|
21
|
+
|
22
|
+
main = DBus::Main.new
|
23
|
+
main << session_bus
|
24
|
+
main.run
|
25
|
+
|
@@ -0,0 +1,51 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'dbus'
|
4
|
+
require 'thread'
|
5
|
+
Thread.abort_on_exception = true
|
6
|
+
|
7
|
+
class Test < DBus::Object
|
8
|
+
# Create an interface aggregating all upcoming dbus_method defines.
|
9
|
+
dbus_interface "org.ruby.SampleInterface" do
|
10
|
+
dbus_method :hello, "in name:s, in name2:s" do |name, name2|
|
11
|
+
puts "hello(#{name}, #{name2})"
|
12
|
+
end
|
13
|
+
|
14
|
+
dbus_method :test_variant, "in stuff:v" do |variant|
|
15
|
+
p variant
|
16
|
+
end
|
17
|
+
|
18
|
+
dbus_signal :SomethingJustHappened, "toto:s, tutu:u"
|
19
|
+
end
|
20
|
+
|
21
|
+
dbus_interface "org.ruby.AnotherInterface" do
|
22
|
+
dbus_method :ThatsALongMethodNameIThink do
|
23
|
+
puts "ThatsALongMethodNameIThink"
|
24
|
+
end
|
25
|
+
dbus_method :Reverse, "in instr:s, out outstr:s" do |instr|
|
26
|
+
outstr = instr.split(//).reverse.join
|
27
|
+
puts "got: #{instr}, replying: #{outstr}"
|
28
|
+
[outstr]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
bus = DBus::SessionBus.instance
|
34
|
+
service = bus.request_service("org.ruby.service")
|
35
|
+
myobj = Test.new("/org/ruby/MyInstance")
|
36
|
+
service.export(myobj)
|
37
|
+
|
38
|
+
Thread.new do
|
39
|
+
i = 0
|
40
|
+
loop do
|
41
|
+
# Signal emission
|
42
|
+
myobj.SomethingJustHappened("hey", i += 1)
|
43
|
+
sleep(0.5)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
puts "listening"
|
48
|
+
main = DBus::Main.new
|
49
|
+
main << bus
|
50
|
+
main.run
|
51
|
+
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "dbus"
|
4
|
+
|
5
|
+
session_bus = DBus::SessionBus.instance
|
6
|
+
|
7
|
+
# Get the Rhythmbox service
|
8
|
+
rhythmbox = session_bus.service("org.gnome.Rhythmbox")
|
9
|
+
|
10
|
+
# Get the object from this service
|
11
|
+
player = rhythmbox.object("/org/gnome/Rhythmbox/Player")
|
12
|
+
|
13
|
+
# Introspect it
|
14
|
+
player.introspect
|
15
|
+
if player.has_iface? "org.gnome.Rhythmbox.Player"
|
16
|
+
puts "We have Rhythmbox Player interface"
|
17
|
+
end
|
18
|
+
|
19
|
+
player_with_iface = player["org.gnome.Rhythmbox.Player"]
|
20
|
+
p player_with_iface.getPlayingUri
|
21
|
+
|
22
|
+
# Maybe support default_iface=(iface_str) on an ProxyObject, so
|
23
|
+
# that this is possible?
|
24
|
+
player.default_iface = "org.gnome.Rhythmbox.Player"
|
25
|
+
puts "default_iface test:"
|
26
|
+
p player.getPlayingUri
|
27
|
+
player.on_signal("elapsedChanged") do |u|
|
28
|
+
puts "elapsedChanged: #{u}"
|
29
|
+
end
|
30
|
+
|
31
|
+
main = DBus::Main.new
|
32
|
+
main << session_bus
|
33
|
+
main.run
|
34
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'dbus'
|
4
|
+
|
5
|
+
if ARGV.size < 2
|
6
|
+
puts "Usage:"
|
7
|
+
puts "notify.rb \"title\" \"body\""
|
8
|
+
exit
|
9
|
+
end
|
10
|
+
|
11
|
+
d = DBus::SessionBus.instance
|
12
|
+
o = d.service("org.freedesktop.Notifications").object("/org/freedesktop/Notifications")
|
13
|
+
o.introspect
|
14
|
+
|
15
|
+
i = o["org.freedesktop.Notifications"]
|
16
|
+
|
17
|
+
i.Notify('notify.rb', 0, 'info', ARGV[0], ARGV[1], [], {}, 2000) do |ret, param|
|
18
|
+
end
|
19
|
+
|
@@ -0,0 +1,156 @@
|
|
1
|
+
# This file is part of the ruby-dbus project
|
2
|
+
# Copyright (C) 2007 Arnaud Cornet and Paul van Tilburg
|
3
|
+
#
|
4
|
+
# This library is free software; you can redistribute it and/or
|
5
|
+
# modify it under the terms of the GNU Lesser General Public
|
6
|
+
# License, version 2.1 as published by the Free Software Foundation.
|
7
|
+
# See the file "COPYING" for the exact licensing terms.
|
8
|
+
|
9
|
+
module DBus
|
10
|
+
# Exception raised when authentication fails somehow.
|
11
|
+
class AuthenticationFailed < Exception
|
12
|
+
end
|
13
|
+
|
14
|
+
# = General class for authentication.
|
15
|
+
class Authenticator
|
16
|
+
# Returns the name of the authenticator.
|
17
|
+
def name
|
18
|
+
self.class.to_s.upcase.sub(/.*::/, "")
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# = External authentication class
|
23
|
+
#
|
24
|
+
# Class for 'external' type authentication.
|
25
|
+
class External < Authenticator
|
26
|
+
# Performs the authentication.
|
27
|
+
def authenticate
|
28
|
+
# Take the user id (eg integer 1000) make a string out of it "1000", take
|
29
|
+
# each character and determin hex value "1" => 0x31, "0" => 0x30. You
|
30
|
+
# obtain for "1000" => 31303030 This is what the server is expecting.
|
31
|
+
# Why? I dunno. How did I come to that conclusion? by looking at rbus
|
32
|
+
# code. I have no idea how he found that out.
|
33
|
+
return Process.uid.to_s.split(//).collect { |a| "%x" % a[0].ord }.join
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# Note: this following stuff is tested with External authenticator only!
|
38
|
+
|
39
|
+
# = Authentication client class.
|
40
|
+
#
|
41
|
+
# Class tha performs the actional authentication.
|
42
|
+
class Client
|
43
|
+
# Create a new authentication client.
|
44
|
+
def initialize(socket)
|
45
|
+
@socket = socket
|
46
|
+
@state = nil
|
47
|
+
@auth_list = [External]
|
48
|
+
end
|
49
|
+
|
50
|
+
# Start the authentication process.
|
51
|
+
def authenticate
|
52
|
+
@socket.write(0.chr)
|
53
|
+
next_authenticator
|
54
|
+
@state = :Starting
|
55
|
+
while @state != :Authenticated
|
56
|
+
r = next_state
|
57
|
+
return r if not r
|
58
|
+
end
|
59
|
+
true
|
60
|
+
end
|
61
|
+
|
62
|
+
##########
|
63
|
+
private
|
64
|
+
##########
|
65
|
+
|
66
|
+
# Send an authentication method _meth_ with arguments _args_ to the
|
67
|
+
# server.
|
68
|
+
def send(meth, *args)
|
69
|
+
o = ([meth] + args).join(" ")
|
70
|
+
@socket.write(o + "\r\n")
|
71
|
+
end
|
72
|
+
|
73
|
+
# Try authentication using the next authenticator.
|
74
|
+
def next_authenticator
|
75
|
+
raise AuthenticationFailed if @auth_list.size == 0
|
76
|
+
@authenticator = @auth_list.shift.new
|
77
|
+
send("AUTH", @authenticator.name, @authenticator.authenticate)
|
78
|
+
end
|
79
|
+
|
80
|
+
|
81
|
+
# Read data (a buffer) from the bus until CR LF is encountered.
|
82
|
+
# Return the buffer without the CR LF characters.
|
83
|
+
def next_msg
|
84
|
+
@socket.readline.chomp.split(" ")
|
85
|
+
end
|
86
|
+
|
87
|
+
# Try to reach the next state based on the current state.
|
88
|
+
def next_state
|
89
|
+
msg = next_msg
|
90
|
+
if @state == :Starting
|
91
|
+
case msg[0]
|
92
|
+
when "CONTINUE"
|
93
|
+
@state = :WaitingForData
|
94
|
+
when "OK"
|
95
|
+
@state = :WaitingForOk
|
96
|
+
end
|
97
|
+
end
|
98
|
+
case @state
|
99
|
+
when :WaitingForData
|
100
|
+
case msg[0]
|
101
|
+
when "DATA"
|
102
|
+
chall = msg[1]
|
103
|
+
resp, chall = @authenticator.data(chall)
|
104
|
+
case resp
|
105
|
+
when :AuthContinue
|
106
|
+
send("DATA", chall)
|
107
|
+
@state = :WaitingForData
|
108
|
+
when :AuthOk
|
109
|
+
send("DATA", chall)
|
110
|
+
@state = :WaitingForOk
|
111
|
+
when :AuthError
|
112
|
+
send("ERROR")
|
113
|
+
@state = :WaitingForData
|
114
|
+
end
|
115
|
+
when "REJECTED"
|
116
|
+
next_authenticator
|
117
|
+
@state = :WaitingForData
|
118
|
+
when "ERROR"
|
119
|
+
send("CANCEL")
|
120
|
+
@state = :WaitingForReject
|
121
|
+
when "OK"
|
122
|
+
send("BEGIN")
|
123
|
+
@state = :Authenticated
|
124
|
+
else
|
125
|
+
send("ERROR")
|
126
|
+
@state = :WaitingForData
|
127
|
+
end
|
128
|
+
when :WaitingForOk
|
129
|
+
case msg[0]
|
130
|
+
when "OK"
|
131
|
+
send("BEGIN")
|
132
|
+
@state = :Authenticated
|
133
|
+
when "REJECT"
|
134
|
+
next_authenticator
|
135
|
+
@state = :WaitingForData
|
136
|
+
when "DATA", "ERROR"
|
137
|
+
send("CANCEL")
|
138
|
+
@state = :WaitingForReject
|
139
|
+
else
|
140
|
+
send("ERROR")
|
141
|
+
@state = :WaitingForOk
|
142
|
+
end
|
143
|
+
when :WaitingForReject
|
144
|
+
case msg[0]
|
145
|
+
when "REJECT"
|
146
|
+
next_authenticator
|
147
|
+
@state = :WaitingForOk
|
148
|
+
else
|
149
|
+
@socket.close
|
150
|
+
return false
|
151
|
+
end
|
152
|
+
end
|
153
|
+
return true
|
154
|
+
end # def next_state
|
155
|
+
end # class Client
|
156
|
+
end # module D-Bus
|