Class: Runner
- Inherits:
-
Thor
- Object
- Thor
- Runner
- Defined in:
- lib/runner.rb
Instance Method Summary collapse
- #doctor ⇒ Object
- #index(*files) ⇒ Object
- #list ⇒ Object
- #search(term) ⇒ Object
- #watch(*directories) ⇒ Object
Instance Method Details
#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([:f], file, [:force]) end end |
#list ⇒ Object
14 15 16 17 18 19 |
# File 'lib/runner.rb', line 14 def list files = ScanDex::documents([: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([: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([:f], file, true) end end end |