Class: TreeRb::SqliteOutput

Inherits:
Object
  • Object
show all
Defined in:
lib/tree_rb/output_plugins/sqlite/sqlite_output.rb

Instance Method Summary collapse

Instance Method Details

#run(directory_tree_walker, output, options) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/tree_rb/output_plugins/sqlite/sqlite_output.rb', line 6

def run(directory_tree_walker, output, options)

  begin
    require 'sqlite3'
    require 'tree_rb/output_plugins/sqlite/sqlite_dir_tree_visitor'
  rescue LoadError
    $stderr.puts 'You must gem install sqlite3 to use this output format'
    exit(1)
  end

  unless options[:output]
    $stderr.puts 'need to specify the -o options'
  else
    output.close
    filename = options[:output]
    visitor  = SqliteDirTreeVisitor.new(filename)
    #start = Time.now
    #me    = self
    #bytes = 0
    directory_tree_walker.run(visitor)
  end

end