Class: Backy::CLI
- Inherits:
-
Thor
- Object
- Thor
- Backy::CLI
- Defined in:
- lib/backy/cli.rb
Instance Method Summary collapse
- #download ⇒ Object
- #dump ⇒ Object
-
#initialize(*args) ⇒ CLI
constructor
A new instance of CLI.
- #list ⇒ Object
- #push ⇒ Object
- #restore ⇒ Object
- #upload ⇒ Object
Constructor Details
Instance Method Details
#download ⇒ Object
37 38 39 40 41 42 |
# File 'lib/backy/cli.rb', line 37 def download file_name = [:file] validate_file!(file_name, should_exist: false) load_from_s3_if_missing(file_name) Logger.success("File downloaded from S3.") end |
#dump ⇒ Object
13 14 15 16 |
# File 'lib/backy/cli.rb', line 13 def dump Backy::PgDump.new.call Logger.success("Database dumped successfully.") end |
#list ⇒ Object
45 46 47 48 49 |
# File 'lib/backy/cli.rb', line 45 def list list = Backy::List.new.call list.each { |item| say "#{item.local? ? "local" : " "} #{item.remote? ? "remote" : " "} : #{item.dump_file}", :yellow } say_instructions_if_any(list) end |
#push ⇒ Object
19 20 21 22 23 24 |
# File 'lib/backy/cli.rb', line 19 def push file_name = Backy::PgDump.new.call save_to_s3(file_name) File.delete(file_name) if File.exist?(file_name) Logger.success("Dump pushed to S3 and local file deleted.") end |