Class: RTagsTask

Inherits:
Rake::TaskLib
  • Object
show all
Defined in:
lib/rtagstask.rb,
lib/rtagstask/version.rb

Constant Summary collapse

VERSION =
'0.0.4'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = :tags) {|_self| ... } ⇒ RTagsTask

Returns a new instance of RTagsTask.

Yields:

  • (_self)

Yield Parameters:

  • _self (RTagsTask)

    the object that the method was called on



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/rtagstask.rb', line 8

def initialize(name = :tags)
  @name, @rtags_dir = name, %w[lib test]
  @vi, @quiet = true, true

  yield self if block_given?

  @tagfile ||= vi ? 'tags' : 'TAGS'

  desc "Build the tags file used by #{vi ? 'vi' : 'emacs'}"
  task @name do
    cmd  = "rtags"
    cmd << ' --quiet' if quiet
    cmd << ' --vi' if vi
    cmd << " -f #{tagfile}"
    cmd << " -R #{rtags_dir.join(' ')}"

    sh cmd

    puts
  end

  task :default => @name

  desc 'Remove rtags products'
  task "clobber_#{@name}" do
    rm_f @tagfile
  end

  task :clobber => :"clobber_#{@name}"
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



6
7
8
# File 'lib/rtagstask.rb', line 6

def name
  @name
end

#quietObject

Returns the value of attribute quiet.



6
7
8
# File 'lib/rtagstask.rb', line 6

def quiet
  @quiet
end

#rtags_dirObject

Returns the value of attribute rtags_dir.



6
7
8
# File 'lib/rtagstask.rb', line 6

def rtags_dir
  @rtags_dir
end

#tagfileObject

Returns the value of attribute tagfile.



6
7
8
# File 'lib/rtagstask.rb', line 6

def tagfile
  @tagfile
end

#viObject

Returns the value of attribute vi.



6
7
8
# File 'lib/rtagstask.rb', line 6

def vi
  @vi
end