Class: Afterlife::Cdn::Cli
- Inherits:
-
Thor
- Object
- Thor
- Afterlife::Cdn::Cli
show all
- Includes:
- BaseCli
- Defined in:
- lib/afterlife/cdn/cli.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from BaseCli
#fatal!, #log_error, #log_info, #log_interrupted, #log_success, #sure?
Class Method Details
.exit_on_failure? ⇒ Boolean
9
10
11
|
# File 'lib/afterlife/cdn/cli.rb', line 9
def self.exit_on_failure?
true
end
|
Instance Method Details
#link ⇒ Object
54
55
56
57
|
# File 'lib/afterlife/cdn/cli.rb', line 54
def link
Cdn.link
log_success('Repos successfully linked to local CDN path')
end
|
#logs ⇒ Object
48
49
50
|
# File 'lib/afterlife/cdn/cli.rb', line 48
def logs
exec("tail -f #{Afterlife::Cdn.log_path}")
end
|
#restart ⇒ Object
42
43
44
45
|
# File 'lib/afterlife/cdn/cli.rb', line 42
def restart
invoke :stop if Server.running?
invoke :start
end
|
#start ⇒ Object
22
23
24
25
26
27
28
29
30
|
# File 'lib/afterlife/cdn/cli.rb', line 22
def start
assert_rackup_dependency
Cdn.link unless options['no-link']
say_status 'Starting', "http://localhost:#{options[:port]}"
Cdn::Server.start(options.slice('port', 'foreground'))
log_success "The server started at http://localhost:#{options[:port]}"
rescue Afterlife::Error => e
log_error(e)
end
|
#stop ⇒ Object
33
34
35
36
37
38
39
|
# File 'lib/afterlife/cdn/cli.rb', line 33
def stop
say_status 'Stopping', nil
Server.kill
log_success 'The server stopped'
rescue Afterlife::Error => e
log_error(e)
end
|