lib/mite-backup.rb in mite-backup-0.1.0 vs lib/mite-backup.rb in mite-backup-0.1.1
- old
+ new
@@ -12,11 +12,11 @@
USER_AGENT = "mite-backup/#{MiteBackup::VERSION}"
def initialize(options={})
@options = options
self.class.clear_config if options["clear_config"]
- @account = options["account"] || config["account"]
+ @account = correct_account(options["account"] || config["account"])
@email = options["email"] || config["email"]
@password = options["password"] || config["password"]
end
def run
@@ -103,7 +103,11 @@
exit(1)
end
def config
@config ||= File.exist?(CONFIG_FILE) && YAML::load( File.open( CONFIG_FILE ) ) || {}
+ end
+
+ def correct_account(account)
+ account.split(/\/\//, 2)[-1].split(/\./, 2)[0] if account
end
end