engineyard-serverside 2.0.4 → 2.0.5.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. data/lib/engineyard-serverside.rb +2 -1
  2. data/lib/engineyard-serverside/about.rb +37 -0
  3. data/lib/engineyard-serverside/cli.rb +2 -49
  4. data/lib/engineyard-serverside/configuration.rb +1 -0
  5. data/lib/engineyard-serverside/deploy.rb +5 -8
  6. data/lib/engineyard-serverside/propagator.rb +75 -0
  7. data/lib/engineyard-serverside/server.rb +3 -2
  8. data/lib/engineyard-serverside/servers.rb +28 -14
  9. data/lib/engineyard-serverside/shell.rb +6 -6
  10. data/lib/engineyard-serverside/shell/command_result.rb +1 -1
  11. data/lib/engineyard-serverside/strategies/git.rb +9 -4
  12. data/lib/engineyard-serverside/version.rb +1 -1
  13. data/spec/propagator_spec.rb +95 -0
  14. data/spec/spec_helper.rb +1 -1
  15. metadata +47 -68
  16. data/lib/engineyard-serverside/future.rb +0 -35
  17. data/lib/engineyard-serverside/futures/celluloid.rb +0 -15
  18. data/lib/engineyard-serverside/futures/dataflow.rb +0 -26
  19. data/lib/vendor/celluloid/lib/celluloid.rb +0 -261
  20. data/lib/vendor/celluloid/lib/celluloid/actor.rb +0 -242
  21. data/lib/vendor/celluloid/lib/celluloid/actor_pool.rb +0 -54
  22. data/lib/vendor/celluloid/lib/celluloid/actor_proxy.rb +0 -75
  23. data/lib/vendor/celluloid/lib/celluloid/application.rb +0 -78
  24. data/lib/vendor/celluloid/lib/celluloid/calls.rb +0 -93
  25. data/lib/vendor/celluloid/lib/celluloid/core_ext.rb +0 -14
  26. data/lib/vendor/celluloid/lib/celluloid/events.rb +0 -14
  27. data/lib/vendor/celluloid/lib/celluloid/fiber.rb +0 -33
  28. data/lib/vendor/celluloid/lib/celluloid/fsm.rb +0 -141
  29. data/lib/vendor/celluloid/lib/celluloid/future.rb +0 -60
  30. data/lib/vendor/celluloid/lib/celluloid/links.rb +0 -61
  31. data/lib/vendor/celluloid/lib/celluloid/logger.rb +0 -32
  32. data/lib/vendor/celluloid/lib/celluloid/mailbox.rb +0 -124
  33. data/lib/vendor/celluloid/lib/celluloid/receivers.rb +0 -66
  34. data/lib/vendor/celluloid/lib/celluloid/registry.rb +0 -33
  35. data/lib/vendor/celluloid/lib/celluloid/responses.rb +0 -26
  36. data/lib/vendor/celluloid/lib/celluloid/rspec.rb +0 -2
  37. data/lib/vendor/celluloid/lib/celluloid/signals.rb +0 -50
  38. data/lib/vendor/celluloid/lib/celluloid/supervisor.rb +0 -57
  39. data/lib/vendor/celluloid/lib/celluloid/task.rb +0 -73
  40. data/lib/vendor/celluloid/lib/celluloid/tcp_server.rb +0 -33
  41. data/lib/vendor/celluloid/lib/celluloid/timers.rb +0 -109
  42. data/lib/vendor/celluloid/lib/celluloid/version.rb +0 -4
  43. data/lib/vendor/dataflow/HISTORY +0 -52
  44. data/lib/vendor/dataflow/LICENSE +0 -19
  45. data/lib/vendor/dataflow/README.textile +0 -290
  46. data/lib/vendor/dataflow/Rakefile +0 -36
  47. data/lib/vendor/dataflow/dataflow.rb +0 -124
  48. data/lib/vendor/dataflow/dataflow/actor.rb +0 -22
  49. data/lib/vendor/dataflow/dataflow/equality.rb +0 -44
  50. data/lib/vendor/dataflow/dataflow/future_queue.rb +0 -24
  51. data/lib/vendor/dataflow/dataflow/port.rb +0 -54
  52. data/lib/vendor/dataflow/examples/barrier.rb +0 -9
  53. data/lib/vendor/dataflow/examples/data_driven.rb +0 -17
  54. data/lib/vendor/dataflow/examples/dataflow_http_gets.rb +0 -13
  55. data/lib/vendor/dataflow/examples/flow.rb +0 -20
  56. data/lib/vendor/dataflow/examples/future_http_gets.rb +0 -12
  57. data/lib/vendor/dataflow/examples/future_queue.rb +0 -11
  58. data/lib/vendor/dataflow/examples/instance_variables.rb +0 -15
  59. data/lib/vendor/dataflow/examples/laziness.rb +0 -9
  60. data/lib/vendor/dataflow/examples/local_variables.rb +0 -11
  61. data/lib/vendor/dataflow/examples/messages.rb +0 -26
  62. data/lib/vendor/dataflow/examples/port_http_gets.rb +0 -13
  63. data/lib/vendor/dataflow/examples/port_send.rb +0 -10
  64. data/lib/vendor/dataflow/examples/ring.rb +0 -21
  65. data/lib/vendor/dataflow/spec/actor_spec.rb +0 -28
  66. data/lib/vendor/dataflow/spec/anonymous_variables_spec.rb +0 -21
  67. data/lib/vendor/dataflow/spec/barrier_spec.rb +0 -25
  68. data/lib/vendor/dataflow/spec/by_need_spec.rb +0 -55
  69. data/lib/vendor/dataflow/spec/dataflow_spec.rb +0 -151
  70. data/lib/vendor/dataflow/spec/equality_spec.rb +0 -40
  71. data/lib/vendor/dataflow/spec/flow_spec.rb +0 -25
  72. data/lib/vendor/dataflow/spec/forker_spec.rb +0 -28
  73. data/lib/vendor/dataflow/spec/future_queue_spec.rb +0 -31
  74. data/lib/vendor/dataflow/spec/inspect_spec.rb +0 -19
  75. data/lib/vendor/dataflow/spec/need_later_spec.rb +0 -12
  76. data/lib/vendor/dataflow/spec/port_spec.rb +0 -26
  77. data/lib/vendor/dataflow/spec/spec.opts +0 -1
  78. data/lib/vendor/dataflow/spec/spec_helper.rb +0 -10
@@ -1,109 +0,0 @@
1
- module Celluloid
2
- # Low precision timers implemented in pure Ruby
3
- class Timers
4
- def initialize
5
- @timers = []
6
- end
7
-
8
- # Call the given block after the given interval
9
- def add(interval, &block)
10
- Timer.new(self, interval, block)
11
- end
12
-
13
- # Wait for the next timer and fire it
14
- def wait
15
- return if @timers.empty?
16
-
17
- interval = wait_interval
18
- sleep interval if interval >= Timer::QUANTUM
19
- fire
20
- end
21
-
22
- # Interval to wait until when the next timer will fire
23
- def wait_interval
24
- @timers.first.time - Time.now unless empty?
25
- end
26
-
27
- # Fire all timers that are ready
28
- def fire
29
- return if @timers.empty?
30
-
31
- time = Time.now + Timer::QUANTUM
32
- while not empty? and time > @timers.first.time
33
- timer = @timers.shift
34
- timer.call
35
- end
36
- end
37
-
38
- # Insert a timer into the active timers
39
- def insert(timer)
40
- @timers.insert(index(timer), timer)
41
- end
42
-
43
- # Remove a given timer from the set we're monitoring
44
- def cancel(timer)
45
- @timers.delete timer
46
- end
47
-
48
- # Are there any timers pending?
49
- def empty?
50
- @timers.empty?
51
- end
52
-
53
- # Index where a timer would be located in the sorted timers array
54
- def index(timer)
55
- l, r = 0, @timers.size - 1
56
-
57
- while l <= r
58
- m = (r + l) / 2
59
- if timer < @timers.at(m)
60
- r = m - 1
61
- else
62
- l = m + 1
63
- end
64
- end
65
- l
66
- end
67
- end
68
-
69
- # An individual timer set to fire a given proc at a given time
70
- class Timer
71
- include Comparable
72
-
73
- # The timer system is guaranteed (at least by the specs) to be this precise
74
- # during normal operation. Long blocking calls within actors will delay the
75
- # firing of timers
76
- QUANTUM = 0.02
77
-
78
- attr_reader :interval, :time
79
-
80
- def initialize(timers, interval, block)
81
- @timers, @interval = timers, interval
82
- @block = block
83
-
84
- reset
85
- end
86
-
87
- def <=>(other)
88
- @time <=> other.time
89
- end
90
-
91
- # Cancel this timer
92
- def cancel
93
- @timers.cancel self
94
- end
95
-
96
- # Reset this timer
97
- def reset
98
- @timers.cancel self if defined?(@time)
99
- @time = Time.now + @interval
100
- @timers.insert self
101
- end
102
-
103
- # Fire the block
104
- def fire
105
- @block.call
106
- end
107
- alias_method :call, :fire
108
- end
109
- end
@@ -1,4 +0,0 @@
1
- module Celluloid
2
- VERSION = '0.7.1'
3
- def self.version; VERSION; end
4
- end
@@ -1,52 +0,0 @@
1
- == 0.3.0 / 2009-08-29
2
-
3
- * Major enhancements
4
-
5
- * "flow" abstraction for threading (use it to create threads and optionally
6
- pass it a variable to be bound output, or override it to modify need_later
7
- for other threading strategies such as thread pools)
8
-
9
- * Dataflow::FutureQueue
10
-
11
- * Nested binding through variables possible
12
-
13
- * Minor enhancements
14
-
15
- * Better #inspect and UnificationError debugging output
16
-
17
- * "barrier" abstraction for manually preventing execution until variable
18
- arguments have been bound
19
-
20
- * Use mixin methods as class/module methods optionally
21
- e.g. Dataflow.local {|v| v }
22
-
23
- == 0.2.1 / 2009-07-29
24
-
25
- * Minor enhancements
26
-
27
- * Leave __send__ and __id__ alone when acting as a proxy
28
-
29
- == 0.2.0 / 2009-07-09
30
-
31
- * Major enhancements
32
-
33
- * Made equality between objects and dataflow variables more transparent
34
- (load equality changes with: require 'dataflow/equality')
35
-
36
- * Minor enhancements
37
-
38
- * Made #inspect work with unbound variables to not crash deubggers/repls/etc
39
-
40
- * Made relationship between lazy and dataflow behavior more strict
41
-
42
- == 0.1.1 / 2009-06-13
43
-
44
- * Minor enhancements
45
-
46
- * Got the "require_path" set correctly so rubygems can be used =)
47
-
48
- == 0.1.0 / 2009-06-13
49
-
50
- * 1 major enhancement
51
-
52
- * Birthday!
@@ -1,19 +0,0 @@
1
- Copyright (c) 2009 Larry Diehl
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy
4
- of this software and associated documentation files (the "Software"), to deal
5
- in the Software without restriction, including without limitation the rights
6
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
- copies of the Software, and to permit persons to whom the Software is
8
- furnished to do so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in
11
- all copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
- THE SOFTWARE.
@@ -1,290 +0,0 @@
1
- h1. What's this?
2
-
3
- A Ruby library that adds Dataflow variables (inspired by the Oz
4
- language). Dataflow variables have the property that they can only
5
- be bound/assigned to once, or have an equivalent value as an existing
6
- assignment (see "unification").
7
-
8
- Dataflow variables must be declared before they are used, and can be
9
- passed around as data without actually being bound. If the variable
10
- gets used (in this library this means a method call) while being
11
- unbound then the currently executing thread will suspend.
12
-
13
- h1. What's the point?
14
-
15
- Ruby is Object Oriented (with the ability to mutate local, instance,
16
- class, and global variables, and even constants), and on top of that
17
- it has powerful reflection and meta-programming abilities. While these
18
- features are useful for certain problems, they are not within the
19
- declarative model. Staying in the declarative model gives one 2 advantages:
20
- # It is easy to reason about what the program does
21
- # Simple but powerful concurrency is possible
22
-
23
- Ruby, like many other OO languages, is facing the hurdles of taking
24
- advantage of the increase of processor cores within a simple parallel
25
- programming model. This library lets you program Ruby in the
26
- declarative concurrent model when you need to take advantage of multiple cores
27
- (assuming a Ruby implementation that uses native threads in one way or
28
- another).
29
-
30
- The trick to this kind of programming is binding variables from other
31
- threads. The nice thing is that many existing
32
- libraries/classes/methods can still be used, just avoid
33
- side-effects. Use regular Ruby threading to create threads, use
34
- "local" or "declare" to create new variables, and use "unify" to bind
35
- variables.
36
-
37
- h1. Install
38
-
39
- To install the latest release as a gem:
40
- <pre>sudo gem install dataflow</pre>
41
-
42
- h1. IRC
43
-
44
- <pre>#dataflow-gem @ freenode.net</pre>
45
-
46
- h1. Examples
47
-
48
- <pre>
49
- # Local variables
50
- include Dataflow
51
-
52
- local do |x, y, z|
53
- # notice how the order automatically gets resolved
54
- Thread.new { unify y, x + 2 }
55
- Thread.new { unify z, y + 3 }
56
- Thread.new { unify x, 1 }
57
- z #=> 6
58
- end
59
- </pre>
60
-
61
- <pre>
62
- # Module methods version
63
-
64
- Dataflow.local do |x, y, z|
65
- # notice how the order automatically gets resolved
66
- Thread.new { Dataflow.unify y, x + 2 }
67
- Thread.new { Dataflow.unify z, y + 3 }
68
- Thread.new { Dataflow.unify x, 1 }
69
- z #=> 6
70
- end
71
-
72
- # Note that a gobal Dataflow.declare is not supported
73
- </pre>
74
-
75
- <pre>
76
- # Instance variables
77
- class AnimalHouse
78
- include Dataflow
79
- declare :small_cat, :big_cat
80
-
81
- def fetch_big_cat
82
- Thread.new { unify big_cat, small_cat.upcase }
83
- unify small_cat, 'cat'
84
- big_cat
85
- end
86
- end
87
-
88
- AnimalHouse.new.fetch_big_cat #=> 'CAT'
89
- </pre>
90
-
91
- <pre>
92
- # Data-driven concurrency
93
- include Dataflow
94
-
95
- local do |stream, doubles, triples, squares|
96
- unify stream, Array.new(5) { Dataflow::Variable.new }
97
-
98
- Thread.new { unify doubles, stream.map {|n| n*2 } }
99
- Thread.new { unify triples, stream.map {|n| n*3 } }
100
- Thread.new { unify squares, stream.map {|n| n**2 } }
101
-
102
- Thread.new { stream.each {|x| unify x, rand(100) } }
103
-
104
- puts "original: #{stream.inspect}"
105
- puts "doubles: #{doubles.inspect}"
106
- puts "triples: #{triples.inspect}"
107
- puts "squares: #{squares.inspect}"
108
- end
109
- </pre>
110
-
111
- <pre>
112
- # By-need trigger laziness
113
- include Dataflow
114
-
115
- local do |x, y, z|
116
- Thread.new { unify y, by_need { 4 } }
117
- Thread.new { unify z, x + y }
118
- Thread.new { unify x, by_need { 3 } }
119
- z #=> 7
120
- end
121
- </pre>
122
-
123
- <pre>
124
- # Need-later future expressions
125
- include Dataflow
126
-
127
- local do |x, y, z|
128
- unify y, need_later { 4 }
129
- unify z, need_later { x + y }
130
- unify x, need_later { 3 }
131
- z #=> 7
132
- end
133
- </pre>
134
-
135
- <pre>
136
- include Dataflow
137
-
138
- # flow without parameters
139
- local do |x|
140
- flow do
141
- # other stuff
142
- unify x, 1337
143
- end
144
- x #=> 1337
145
- end
146
-
147
- # flow with an output parameter
148
- local do |x|
149
- flow(x) do
150
- # other stuff
151
- 1337
152
- end
153
- x #=> 1337
154
- end
155
- </pre>
156
-
157
- <pre>
158
- # barrier
159
- include Dataflow
160
-
161
- local do |lock1, lock2|
162
- flow { unify lock1, :unlocked }
163
- flow { unify lock2, :unlocked }
164
- barrier lock1, lock2
165
- puts "Barrier broken!"
166
- end
167
- </pre>
168
-
169
- <pre>
170
- # FutureQueue
171
- include Dataflow
172
-
173
- local do |queue, first, second|
174
- unify queue, Dataflow::FutureQueue.new
175
- queue.pop first
176
- queue.push 1
177
- queue.push 2
178
- queue.pop second
179
- first #=> 1
180
- second #=> 2
181
- end
182
- </pre>
183
-
184
- h1. Anonymous variables
185
-
186
- Sometimes you may want to pack a data structure with variables that do not need to be referenced with labels. For those cases anonymous variables are a good choice, here are some options:
187
-
188
- <pre>
189
- include Dataflow
190
- Array.new(3) { Dataflow::Variable.new }
191
- Array.new(3) { Dataflow.local }
192
- Array.new(3) { local }
193
- # and technically not anonymous
194
- Array.new(3) { local {|v| v } }
195
- </pre>
196
-
197
- h1. Debugging
198
-
199
- If you are having trouble and need to debug dataflow variables, simply call #inspect.
200
-
201
- If the variable has already been bound, it call inspect on its bound value like normal.However, if the variable is not bound yet then you will get a special string that contains the proxies #__id__ that you can use to track down which proxy objects are being passed around to which parts of your program:
202
- <pre>
203
- include Dataflow
204
- local do |my_var|
205
- my_var.inspect # => #<Dataflow::Variable:2637860 unbound>
206
- end
207
- </pre>
208
-
209
- h1. Fork method customization
210
-
211
- By default both #flow and #need_later use Thread.fork as their fork method. Youc an access the fork method via Dataflow.forker.
212
-
213
- If you would like to use a custom forker, simple set it to an object that responds to #call and internally calls a block passed to it (for an example of a synchronous forker, see spec/forker_spec.rb):
214
- <pre>
215
- Dataflow.forker = MyClass.method(:fork_with_threadpool)
216
- </pre>
217
-
218
- Also note that #flow is used interally by #need_later, in case you want to override that specifically.
219
-
220
- h1. Ports using Dataflow
221
-
222
- Ports are an extension of the declarative concurrent model to support nondeterministic behavior. They accomplish this through the use of a single state variable. Ports are also inspired by the Oz language.
223
-
224
- An Actor class in the style of Erlang message-passing processes is also provided. It makes use of the asynchronous behavior of ports, but otherwise uses no state variables.
225
-
226
- h1. Examples using Ports
227
-
228
- <pre>
229
- include Dataflow
230
-
231
- local do |port, stream|
232
- unify port, Dataflow::Port.new(stream)
233
- Thread.new {port.send 2}
234
- Thread.new {port.send 8}
235
- Thread.new {port.send 1024}
236
- stream.take(3).sort #=> [2, 8, 1024]
237
- end
238
- </pre>
239
-
240
- h1. Examples using Actors
241
-
242
- <pre>
243
- include Dataflow
244
-
245
- Ping = Actor.new {
246
- 3.times {
247
- case receive
248
- when "Ping"
249
- puts "Ping"
250
- Pong.send "Pong"
251
- end
252
- }
253
- }
254
-
255
- Pong = Actor.new {
256
- 3.times {
257
- case receive
258
- when "Pong"
259
- puts "Pong"
260
- Ping.send "Ping"
261
- end
262
- }
263
- }
264
-
265
- Actor.new { Ping.send "Ping" }
266
-
267
- Ping.join
268
- Pong.join
269
- </pre>
270
-
271
- h1. Equality
272
-
273
- Most Ruby implmentations will not use method calls for equality
274
- operations in base types/classes. This means equality between dataflow
275
- variables and those base types will not behave as expected. Require
276
- the following to get equality on base types that uses method calls,
277
- while still passing rubyspec:
278
-
279
- <pre>require "dataflow/equality"</pre>
280
-
281
- h1. References
282
-
283
- The basis of dataflow variables around a language is not common among
284
- popular languages and may be confusing to some. For an in-depth
285
- introduction to the Oz language and the techniques used in this
286
- library (including by_need triggers, port objects, and comparisons to Erlang message passing) see the book "Concepts, Techniques, and Models of Computer Programming":http://en.wikipedia.org/wiki/Concepts,_Techniques,_and_Models_of_Computer_Programming
287
-
288
- h1. Contributors
289
-
290
- larrytheliquid, amiller