Class: StatusPageRubyCli
- Inherits:
-
Thor
- Object
- Thor
- StatusPageRubyCli
- Defined in:
- lib/status_page_ruby_cli.rb
Constant Summary collapse
- PULL_SECONDS =
10
Instance Method Summary collapse
- #backup ⇒ Object
- #history ⇒ Object
-
#initialize(*args) ⇒ StatusPageRubyCli
constructor
A new instance of StatusPageRubyCli.
- #live ⇒ Object
- #pull ⇒ Object
- #restore ⇒ Object
- #stats ⇒ Object
Constructor Details
#initialize(*args) ⇒ StatusPageRubyCli
Returns a new instance of StatusPageRubyCli.
4 5 6 7 8 9 10 11 |
# File 'lib/status_page_ruby_cli.rb', line 4 def initialize(*args) super(*args) data_file_path = File.join(ENV['HOME'], '.status_page_ruby_data.csv') create_data_file_if_needed(data_file_path) storage = StatusPageRuby::Storage.new(data_file_path) repository = StatusPageRuby::Repositories::Status.new(storage) setup_services(repository) end |
Instance Method Details
#backup ⇒ Object
42 43 44 |
# File 'lib/status_page_ruby_cli.rb', line 42 def backup backup_data.call([:path]) end |
#history ⇒ Object
30 31 32 |
# File 'lib/status_page_ruby_cli.rb', line 30 def history puts build_history_table.call([:service]) end |
#live ⇒ Object
21 22 23 24 25 26 |
# File 'lib/status_page_ruby_cli.rb', line 21 def live loop do puts build_log_table.call(pull_statuses.call) sleep PULL_SECONDS end end |
#pull ⇒ Object
15 16 17 18 |
# File 'lib/status_page_ruby_cli.rb', line 15 def pull records = pull_statuses.call puts build_log_table.call(records) if [:log] end |
#restore ⇒ Object
48 49 50 |
# File 'lib/status_page_ruby_cli.rb', line 48 def restore restore_data.call([:path]) end |
#stats ⇒ Object
36 37 38 |
# File 'lib/status_page_ruby_cli.rb', line 36 def stats puts build_stats_table.call([:service]) end |