expedite 0.0.2 → 0.1.1
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.
- checksums.yaml +4 -4
- data/README.md +37 -30
- data/lib/expedite/{command/basic.rb → action/block.rb} +2 -2
- data/lib/expedite/{command → action}/boot.rb +6 -6
- data/lib/expedite/{commands.rb → actions.rb} +13 -13
- data/lib/expedite/agents.rb +101 -0
- data/lib/expedite/cli/server.rb +2 -2
- data/lib/expedite/cli/status.rb +34 -0
- data/lib/expedite/cli/stop.rb +3 -3
- data/lib/expedite/cli.rb +8 -2
- data/lib/expedite/client/exec.rb +124 -0
- data/lib/expedite/client/invoke.rb +155 -0
- data/lib/expedite/env.rb +2 -1
- data/lib/expedite/errors.rb +6 -0
- data/lib/expedite/helper/rails.rb +14 -0
- data/lib/expedite/protocol.rb +20 -0
- data/lib/expedite/server/agent.rb +322 -0
- data/lib/expedite/{application/boot.rb → server/agent_boot.rb} +3 -3
- data/lib/expedite/server/agent_manager.rb +192 -0
- data/lib/expedite/server/controller.rb +247 -0
- data/lib/expedite/syntax.rb +26 -0
- data/lib/expedite/version.rb +1 -1
- data/lib/expedite.rb +25 -11
- metadata +17 -14
- data/lib/expedite/application.rb +0 -316
- data/lib/expedite/application_manager.rb +0 -187
- data/lib/expedite/client.rb +0 -235
- data/lib/expedite/command/info.rb +0 -49
- data/lib/expedite/send_json.rb +0 -10
- data/lib/expedite/server.rb +0 -188
- data/lib/expedite/variants.rb +0 -99
data/lib/expedite/variants.rb
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
module Expedite
|
|
3
|
-
class Variant
|
|
4
|
-
##
|
|
5
|
-
# Name of the parent variant. This allows you to create variants from
|
|
6
|
-
# an existing variant.
|
|
7
|
-
# Defaults to nil.
|
|
8
|
-
attr_accessor :parent
|
|
9
|
-
|
|
10
|
-
##
|
|
11
|
-
# If set to true, variant will be restarted automatically if it is killed.
|
|
12
|
-
# Defaults to false.
|
|
13
|
-
attr_accessor :keep_alive
|
|
14
|
-
|
|
15
|
-
##
|
|
16
|
-
# [parent] Name of parent variant.
|
|
17
|
-
# [after_fork] Block is executed when variant is first preloaded.
|
|
18
|
-
def initialize(parent: nil, keep_alive: false, &after_fork)
|
|
19
|
-
@parent = parent
|
|
20
|
-
@keep_alive = keep_alive
|
|
21
|
-
@after_fork_proc = after_fork
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
##
|
|
25
|
-
# Called when variant if first preloaded. This version calls the after_fork
|
|
26
|
-
# block provided in the initializer.
|
|
27
|
-
def after_fork(variant)
|
|
28
|
-
@after_fork_proc&.call(variant)
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
class Variants
|
|
33
|
-
Registration = Struct.new(:matcher, :variant) do
|
|
34
|
-
def match?(name)
|
|
35
|
-
File.fnmatch?(matcher, name)
|
|
36
|
-
end
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def self.current
|
|
40
|
-
@current ||= Variants.new
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
##
|
|
44
|
-
# Retrieves the specified variant
|
|
45
|
-
def self.lookup(variant)
|
|
46
|
-
self.current.lookup(variant)
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
##
|
|
50
|
-
# Registers a variant. Variants are matched in the
|
|
51
|
-
# order they are registered.
|
|
52
|
-
#
|
|
53
|
-
# [matcher] Wildcard to match a name against.
|
|
54
|
-
# [named_options] Variant options.
|
|
55
|
-
# [after_fork] Optional block that is called when
|
|
56
|
-
# variant is preloaded.
|
|
57
|
-
#
|
|
58
|
-
# = Example
|
|
59
|
-
# Expedite::Variants.register('base' do |name|
|
|
60
|
-
# puts "Base #{name} started"
|
|
61
|
-
# end
|
|
62
|
-
# Expedite::Variants.register('development/abc', parent: 'base') do |name|
|
|
63
|
-
# puts "Variant #{name} started"
|
|
64
|
-
# end
|
|
65
|
-
def self.register(matcher, **named_options, &after_fork)
|
|
66
|
-
self.current.register(matcher, **named_options, &after_fork)
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
##
|
|
70
|
-
# Resets registrations to default
|
|
71
|
-
def self.reset
|
|
72
|
-
self.current.reset
|
|
73
|
-
end
|
|
74
|
-
|
|
75
|
-
def initialize
|
|
76
|
-
@registrations = []
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
def lookup(variant)
|
|
80
|
-
ret = @registrations.find do |r|
|
|
81
|
-
r.match?(variant)
|
|
82
|
-
end
|
|
83
|
-
raise NotImplementedError, "Variant #{variant.inspect} not found" if ret.nil?
|
|
84
|
-
ret.variant
|
|
85
|
-
end
|
|
86
|
-
|
|
87
|
-
def register(matcher, **named_options, &after_fork)
|
|
88
|
-
@registrations << Registration.new(
|
|
89
|
-
matcher,
|
|
90
|
-
Variant.new(**named_options, &after_fork)
|
|
91
|
-
)
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
def reset
|
|
95
|
-
@registrations = []
|
|
96
|
-
nil
|
|
97
|
-
end
|
|
98
|
-
end
|
|
99
|
-
end
|