Class: Findrr::Command

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

Instance Method Summary collapse

Instance Method Details

#collect(path) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/findrr/command.rb', line 7

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

#destroyObject



31
32
33
# File 'lib/findrr/command.rb', line 31

def destroy
  Database.new.destroy
end

#search(part_of_filename) ⇒ Object



19
20
21
22
23
24
25
26
27
28
# File 'lib/findrr/command.rb', line 19

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