Class: RedashBackup::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/redash_backup/base.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dir) ⇒ Base

Returns a new instance of Base.



6
7
8
9
# File 'lib/redash_backup/base.rb', line 6

def initialize(dir)
  @dir = dir
  require 'redash_backup/model'
end

Class Method Details

.export!(dir) ⇒ Object



2
3
4
# File 'lib/redash_backup/base.rb', line 2

def self.export!(dir)
  new(dir).export
end

Instance Method Details

#exportObject



11
12
13
14
15
16
# File 'lib/redash_backup/base.rb', line 11

def export
  FileUtils.rm_r(@dir) if Dir.exist? @dir
  Dir.mkdir(@dir)
  Dashboard.active.all.find_each { |board| export_by_board!(board) }
  export_unused_queries!
end