Class: Locd::CLI::Command::Proxy
- Inherits:
-
Agent
- Object
- Thor
- Base
- Agent
- Locd::CLI::Command::Proxy
show all
- Defined in:
- lib/locd/cli/command/proxy.rb
Overview
CLI interface using the thor gem.
Class Method Summary
collapse
-
.agent_class ⇒ Object
Helpers ============================================================================.
Instance Method Summary
collapse
Methods inherited from Agent
agent_type, #ls, #open, #tail, #truncate_logs, #update
Class Method Details
.agent_class ⇒ Object
50
51
52
|
# File 'lib/locd/cli/command/proxy.rb', line 50
def self.agent_class
Locd::Agent::Proxy
end
|
Instance Method Details
#add ⇒ Object
90
91
92
93
94
95
96
97
98
|
# File 'lib/locd/cli/command/proxy.rb', line 90
def add
agent = agent_class.add **option_kwds( groups: :write )
logger.info "`#{ agent.label }` agent created."
agent.reload if options[:load]
respond agent
end
|
#plist ⇒ Object
153
154
155
156
157
158
159
160
161
|
# File 'lib/locd/cli/command/proxy.rb', line 153
def plist
agent = proxy
if options[:json] || options[:yaml]
respond agent.plist
else
respond agent.path.read
end
end
|
#port ⇒ Object
125
126
127
|
# File 'lib/locd/cli/command/proxy.rb', line 125
def port
respond Locd::Proxy.port
end
|
#restart ⇒ Object
189
190
191
|
# File 'lib/locd/cli/command/proxy.rb', line 189
def restart
proxy.restart **option_kwds( groups: [ :start, :stop ] )
end
|
#rm ⇒ Object
146
147
148
|
# File 'lib/locd/cli/command/proxy.rb', line 146
def rm
proxy.remove
end
|
#run_ ⇒ Object
115
116
117
118
119
|
# File 'lib/locd/cli/command/proxy.rb', line 115
def run_
Locd::Proxy.serve \
bind: options[:bind],
port: options[:port]
end
|
#start ⇒ Object
167
168
169
|
# File 'lib/locd/cli/command/proxy.rb', line 167
def start
proxy.start **option_kwds( groups: :start )
end
|
#status ⇒ Object
135
136
137
138
139
140
|
# File 'lib/locd/cli/command/proxy.rb', line 135
def status
respond \
label: proxy.label,
port: proxy.port,
status: proxy.status
end
|
#stop ⇒ Object
178
179
180
|
# File 'lib/locd/cli/command/proxy.rb', line 178
def stop
proxy.stop **option_kwds( groups: :stop )
end
|