Class: Guard::CtagsBundler

Inherits:
Plugin
  • Object
show all
Defined in:
lib/guard/ctags-bundler.rb,
lib/guard/ctags-bundler/ctags_generator.rb

Defined Under Namespace

Classes: CtagsGenerator

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ CtagsBundler

Returns a new instance of CtagsBundler.



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

def initialize(options = {})
  super
  @ctags_generator = ::Guard::CtagsBundler::CtagsGenerator.new(options)
end

Class Method Details

.template(plugin_location) ⇒ Object



33
34
35
# File 'lib/guard/ctags-bundler.rb', line 33

def self.template(plugin_location)
  File.read(template_path(plugin_location))
end

.template_path(plugin_location) ⇒ Object



37
38
39
# File 'lib/guard/ctags-bundler.rb', line 37

def self.template_path(plugin_location)
  File.join(plugin_location, 'lib', 'guard', 'ctags-bundler', 'templates', 'Guardfile')
end

Instance Method Details

#run_on_changes(paths) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/guard/ctags-bundler.rb', line 19

def run_on_changes(paths)
  if paths.include?('Gemfile.lock')
    UI.info "regenerating bundler tags..."
    @ctags_generator.generate_bundler_tags
  end

  ruby_files = paths.reject {|f| f == 'Gemfile.lock'}

  if ruby_files.any?
    UI.info "regenerating project tags..."
    @ctags_generator.generate_project_tags
  end
end

#startObject



12
13
14
15
16
17
# File 'lib/guard/ctags-bundler.rb', line 12

def start
  UI.info 'Guard::CtagsBundler is running!'
  @ctags_generator.generate_bundler_tags
  @ctags_generator.generate_project_tags
  @ctags_generator.generate_stdlib_tags if options[:stdlib]
end