Class: SelfSDK::StorageMigrator
- Inherits:
-
Object
- Object
- SelfSDK::StorageMigrator
- Defined in:
- lib/storage.rb
Instance Method Summary collapse
-
#initialize(db, storage_folder, app_id) ⇒ StorageMigrator
constructor
A new instance of StorageMigrator.
- #migrate ⇒ Object
Constructor Details
#initialize(db, storage_folder, app_id) ⇒ StorageMigrator
Returns a new instance of StorageMigrator.
151 152 153 154 155 156 157 |
# File 'lib/storage.rb', line 151 def initialize(db, storage_folder, app_id) @db = db # Old versions of the sdk using that same storage folder shouldn't be affected in any way @base_path = "#{storage_folder}/#{app_id.split(':').first}" @app_id = app_id end |
Instance Method Details
#migrate ⇒ Object
159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/storage.rb', line 159 def migrate return unless File.exist?(@base_path) # Parse the account information. accounts = parse_accounts persist_accounts(accounts) # Depreciate the base path. File.rename("#{@base_path}", "#{@base_path}-depreciated") end |