Class: Findrr::Command

Inherits:
Thor
  • Object
show all
Defined in:
lib/findrr/command.rb

Instance Method Summary collapse

Instance Method Details

#collect(path) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/findrr/command.rb', line 14

def collect(path)
  Config.new.save(path)
  begin
    Database.new.collect(path)
  rescue => e
    $stderr.puts <<-END_OF_MESSAGE
#{e.class}: #{e.message}
Hint: table schema might be changed. Please try `findrr destroy` command.
    END_OF_MESSAGE
  end
end

#destroyObject



39
40
41
# File 'lib/findrr/command.rb', line 39

def destroy
  Database.new.destroy
end

#search(part_of_filename) ⇒ Object



27
28
29
30
31
32
33
34
35
36
# File 'lib/findrr/command.rb', line 27

def search(part_of_filename)
  begin
    Database.new.search(part_of_filename)
  rescue => e
    $stderr.puts <<-END_OF_MESSAGE
#{e.class}: #{e.message}
Hint: database probably isn't created. Please try `findrr collect` command.
    END_OF_MESSAGE
  end
end

#versionObject



9
10
11
# File 'lib/findrr/command.rb', line 9

def version
  puts VERSION
end