Class: Runner

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

Instance Method Summary collapse

Instance Method Details

#doctorObject



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

def doctor
    ScanDex::doctor()
end

#index(*files) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/runner.rb', line 23

def index(*files)
    # If doctor fails then there is no point in even trying
    if !ScanDex::doctor()
        return
    end
    files.each do |file|
        ScanDex::index_and_store(options[:f], file, options[:force])
   end
end

#listObject



14
15
16
17
18
19
# File 'lib/runner.rb', line 14

def list
    files = ScanDex::documents(options[:f])
    files.each do |file|
        puts "#{file[0]} #{file[1]}"
    end
end

#search(term) ⇒ Object



34
35
36
37
38
39
# File 'lib/runner.rb', line 34

def search(term)
    files = ScanDex::search_documents(options[:f], term)
    files.each do |file|
        puts "#{file[0]} #{file[1]}"
    end
end

#watch(*directories) ⇒ Object



42
43
44
45
46
47
48
# File 'lib/runner.rb', line 42

def watch(*directories)
    FileWatcher.new(directories).watch do |file, event|
        if (event == :changed || event == :new)
            ScanDex::index_and_store(options[:f], file, true)
        end
    end
end