circus-deployment 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. data/LICENSE +23 -0
  2. data/README.md +0 -0
  3. data/bin/circus +24 -0
  4. data/lib/bundler/circus_bundler.rb +24 -0
  5. data/lib/bundler/circus_util.rb +43 -0
  6. data/lib/bundler/patches.rb +18 -0
  7. data/lib/circus/act.rb +74 -0
  8. data/lib/circus/actstore_client.rb +30 -0
  9. data/lib/circus/agents/agent.rb +59 -0
  10. data/lib/circus/agents/client.rb +77 -0
  11. data/lib/circus/agents/connection.rb +76 -0
  12. data/lib/circus/agents/conversation.rb +17 -0
  13. data/lib/circus/agents/dbus_connection.rb +85 -0
  14. data/lib/circus/agents/dbus_logger.rb +34 -0
  15. data/lib/circus/agents/encoding.rb +32 -0
  16. data/lib/circus/agents/logger.rb +52 -0
  17. data/lib/circus/agents/params.rb +47 -0
  18. data/lib/circus/agents/ssh_connection.rb +120 -0
  19. data/lib/circus/application.rb +99 -0
  20. data/lib/circus/booth_client.rb +25 -0
  21. data/lib/circus/booth_tool.rb +98 -0
  22. data/lib/circus/cli.rb +147 -0
  23. data/lib/circus/clown_client.rb +27 -0
  24. data/lib/circus/connection_builder.rb +32 -0
  25. data/lib/circus/external_util.rb +14 -0
  26. data/lib/circus/local_config.rb +65 -0
  27. data/lib/circus/profiles/base.rb +115 -0
  28. data/lib/circus/profiles/django.rb +90 -0
  29. data/lib/circus/profiles/jekyll.rb +90 -0
  30. data/lib/circus/profiles/make_base.rb +17 -0
  31. data/lib/circus/profiles/pure_py.rb +46 -0
  32. data/lib/circus/profiles/pure_rb.rb +48 -0
  33. data/lib/circus/profiles/python_base.rb +39 -0
  34. data/lib/circus/profiles/rack.rb +59 -0
  35. data/lib/circus/profiles/ruby_base.rb +52 -0
  36. data/lib/circus/profiles/shell.rb +46 -0
  37. data/lib/circus/profiles.rb +10 -0
  38. data/lib/circus/repos/git.rb +42 -0
  39. data/lib/circus/repos/mercurial.rb +42 -0
  40. data/lib/circus/repos.rb +16 -0
  41. data/lib/circus/resource_allocator_client.rb +19 -0
  42. data/lib/circus/stdout_logger.rb +11 -0
  43. data/lib/circus/version.rb +3 -0
  44. data/lib/circus.rb +9 -0
  45. data/vendor/ruby-dbus/COPYING +504 -0
  46. data/vendor/ruby-dbus/ChangeLog +782 -0
  47. data/vendor/ruby-dbus/HOWTO-RELEASE +14 -0
  48. data/vendor/ruby-dbus/NEWS +104 -0
  49. data/vendor/ruby-dbus/README +53 -0
  50. data/vendor/ruby-dbus/Rakefile +47 -0
  51. data/vendor/ruby-dbus/doc/tutorial/src/00.index.page +12 -0
  52. data/vendor/ruby-dbus/doc/tutorial/src/10.intro.page +127 -0
  53. data/vendor/ruby-dbus/doc/tutorial/src/20.basic_client.page +174 -0
  54. data/vendor/ruby-dbus/doc/tutorial/src/30.service.page +121 -0
  55. data/vendor/ruby-dbus/doc/tutorial/src/default.css +129 -0
  56. data/vendor/ruby-dbus/doc/tutorial/src/default.template +46 -0
  57. data/vendor/ruby-dbus/examples/gdbus/gdbus +255 -0
  58. data/vendor/ruby-dbus/examples/gdbus/gdbus.glade +184 -0
  59. data/vendor/ruby-dbus/examples/gdbus/launch.sh +4 -0
  60. data/vendor/ruby-dbus/examples/no-introspect/nm-test.rb +21 -0
  61. data/vendor/ruby-dbus/examples/no-introspect/tracker-test.rb +16 -0
  62. data/vendor/ruby-dbus/examples/rhythmbox/playpause.rb +25 -0
  63. data/vendor/ruby-dbus/examples/service/call_service.rb +25 -0
  64. data/vendor/ruby-dbus/examples/service/service_newapi.rb +51 -0
  65. data/vendor/ruby-dbus/examples/simple/call_introspect.rb +34 -0
  66. data/vendor/ruby-dbus/examples/utils/listnames.rb +11 -0
  67. data/vendor/ruby-dbus/examples/utils/notify.rb +19 -0
  68. data/vendor/ruby-dbus/lib/dbus/auth.rb +156 -0
  69. data/vendor/ruby-dbus/lib/dbus/bus.rb +750 -0
  70. data/vendor/ruby-dbus/lib/dbus/export.rb +133 -0
  71. data/vendor/ruby-dbus/lib/dbus/introspect.rb +544 -0
  72. data/vendor/ruby-dbus/lib/dbus/marshall.rb +443 -0
  73. data/vendor/ruby-dbus/lib/dbus/matchrule.rb +100 -0
  74. data/vendor/ruby-dbus/lib/dbus/message.rb +293 -0
  75. data/vendor/ruby-dbus/lib/dbus/type.rb +222 -0
  76. data/vendor/ruby-dbus/lib/dbus.rb +89 -0
  77. data/vendor/ruby-dbus/ruby-dbus.gemspec +28 -0
  78. data/vendor/ruby-dbus/setup.rb +1585 -0
  79. data/vendor/ruby-dbus/test/Makefile +4 -0
  80. data/vendor/ruby-dbus/test/bus_driver_test.rb +21 -0
  81. data/vendor/ruby-dbus/test/server_robustness_test.rb +41 -0
  82. data/vendor/ruby-dbus/test/server_test.rb +44 -0
  83. data/vendor/ruby-dbus/test/service_newapi.rb +99 -0
  84. data/vendor/ruby-dbus/test/session_bus_test_manual.rb +20 -0
  85. data/vendor/ruby-dbus/test/signal_test.rb +57 -0
  86. data/vendor/ruby-dbus/test/t1 +4 -0
  87. data/vendor/ruby-dbus/test/t2.rb +66 -0
  88. data/vendor/ruby-dbus/test/t3-ticket27.rb +18 -0
  89. data/vendor/ruby-dbus/test/t5-report-dbus-interface.rb +58 -0
  90. data/vendor/ruby-dbus/test/t6-loop.rb +85 -0
  91. data/vendor/ruby-dbus/test/test_all +26 -0
  92. data/vendor/ruby-dbus/test/test_server +74 -0
  93. data/vendor/ruby-dbus/test/variant_test.rb +66 -0
  94. 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,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'dbus'
4
+
5
+ d = if ARGV.member?("--system")
6
+ DBus::SystemBus.instance
7
+ else
8
+ DBus::SessionBus.instance
9
+ end
10
+ d.proxy.ListNames[0].each{ |n| puts "\t#{n}" }
11
+
@@ -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