Class: Guard::SublimeCtags

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

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of SublimeCtags.



8
9
10
# File 'lib/guard/sublime-ctags.rb', line 8

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

Instance Method Details

#ctags_fileObject



28
29
30
# File 'lib/guard/sublime-ctags.rb', line 28

def ctags_file
  ".tags"
end

#gen_ctags(files = []) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/guard/sublime-ctags.rb', line 32

def gen_ctags(files = [])
  if files.empty?
    command = "ctags -R -f #{ctags_file}"
    puts "exec #{command}"
    system command
  else
    command = "ctags -f #{ctags_file} --append=yes " + files.map{|f| "'#{f}'" }.join(" ")
    puts "exec #{command}"
    system command
  end
end

#reloadObject



16
17
18
# File 'lib/guard/sublime-ctags.rb', line 16

def reload
  self.gen_ctags
end

#run_on_changes(paths) ⇒ Object



20
21
22
# File 'lib/guard/sublime-ctags.rb', line 20

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

#run_on_removals(paths) ⇒ Object



24
25
26
# File 'lib/guard/sublime-ctags.rb', line 24

def run_on_removals(paths)
  self.gen_ctags
end

#startObject



12
13
14
# File 'lib/guard/sublime-ctags.rb', line 12

def start
  self.gen_ctags
end