Class: MiteBackup
- Inherits:
-
Object
- Object
- MiteBackup
- Defined in:
- lib/mite-backup.rb,
lib/mite-backup/version.rb
Constant Summary collapse
- MAX_CHECKS =
30
- SLEEP_BEFORE_EACH_CHECK =
seconds
2
- CONFIG_FILE =
File.('~/.mite-backup.yml')
- USER_AGENT =
"mite-backup/#{MiteBackup::VERSION}"
- VERSION =
"0.1.3"
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ MiteBackup
constructor
A new instance of MiteBackup.
- #run ⇒ Object
- #setup ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ MiteBackup
Returns a new instance of MiteBackup.
14 15 16 17 18 19 20 |
# File 'lib/mite-backup.rb', line 14 def initialize(={}) = self.class.clear_config if ["clear_config"] @account = correct_account(["account"] || config["account"]) @email = ["email"] || config["email"] @password = ["password"] || config["password"] end |
Class Method Details
.clear_config ⇒ Object
43 44 45 |
# File 'lib/mite-backup.rb', line 43 def self.clear_config File.exist?(CONFIG_FILE) && File.delete(CONFIG_FILE) end |
Instance Method Details
#run ⇒ Object
22 23 24 25 26 27 |
# File 'lib/mite-backup.rb', line 22 def run runnable? create check download end |
#setup ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/mite-backup.rb', line 29 def setup (config["account"] = @account) || config.delete("account") (config["email"] = @email) || config.delete("email") (config["password"] = @password) || config.delete("password") if config.size == 0 self.class.clear_config else File.open(CONFIG_FILE, "w") do |f| f.write(YAML::dump(config)) end end end |