Class: Guard::SublimeGemtags

Inherits:
Guard
  • Object
show all
Defined in:
lib/guard/sublime-gemtags.rb

Instance Method Summary collapse

Constructor Details

#initialize(watchers = [], options = {}) ⇒ SublimeGemtags

Returns a new instance of SublimeGemtags.



9
10
11
# File 'lib/guard/sublime-gemtags.rb', line 9

def initialize(watchers = [], options = {})
  super
end

Instance Method Details

#gemtags_fileObject



25
26
27
# File 'lib/guard/sublime-gemtags.rb', line 25

def gemtags_file
  ".gemtags"
end

#gen_gemtags(paths = []) ⇒ Object



29
30
31
32
33
34
35
36
37
38
# File 'lib/guard/sublime-gemtags.rb', line 29

def gen_gemtags(paths = [])
  if File.exists?(gemtags_file)
    mtime = paths.map {|path| File.mtime(path) }.max
    return if mtime && mtime <= File.mtime(gemtags_file)
  end
  
  command = "bundle exec gemtags"
  puts "exec #{command}"
  system command
end

#reloadObject



17
18
19
# File 'lib/guard/sublime-gemtags.rb', line 17

def reload
  self.gen_gemtags
end

#run_on_changes(paths) ⇒ Object



21
22
23
# File 'lib/guard/sublime-gemtags.rb', line 21

def run_on_changes(paths)
  self.gen_gemtags(paths)
end

#startObject



13
14
15
# File 'lib/guard/sublime-gemtags.rb', line 13

def start
  self.gen_gemtags
end