Class: BuildTool::Commands::Ctags

Inherits:
ModuleBasedCommand show all
Includes:
MJ::Tools::SubProcess
Defined in:
lib/build-tool/commands/ctags.rb

Overview

BuildCommand

Instance Attribute Summary

Attributes inherited from Base

#cmd, #options, #parent

Instance Method Summary collapse

Methods inherited from ModuleBasedCommand

#clean, #clone, #configure, #do_execute, #fetch, #initialize, #install, #is_module_ready?, #make, #rebase, #reconfigure, #summarize

Methods inherited from Standard

#complete_module, #complete_modules, #initialize, #log_directory, #while_logging_to

Methods inherited from Base

#<=>, #cleanup_after_vcs_access, #complete, #complete_arguments, #complete_readline_1_8, #complete_readline_1_9, #configuration, #do_complete_1_8, #do_complete_1_9, #do_execute, #each_option, #execute, #fullname, #initialize, #log?, #say, #setup_command, #show_help, #skip_command, #summarize, #teardown_command, #usage

Methods included from HelpText

#cmdalias, #description, included, #long_description, #name

Constructor Details

This class inherits a constructor from BuildTool::Commands::ModuleBasedCommand

Instance Method Details

#applicable?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/build-tool/commands/ctags.rb', line 23

def applicable?
    BuildTool::Application.instance.has_recipe?
end

#ctags(source, tagsfile) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/build-tool/commands/ctags.rb', line 41

def ctags( source, tagsfile )
    rc = self.class.execute "ctags -R -f #{tagsfile} #{source}"
    if rc != 0
        raise CtagsError, "ctags failed with error #{rc}!"
    end
    rc
end

#do_execute_module(mod) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/build-tool/commands/ctags.rb', line 27

def do_execute_module( mod )
    if mod.checkedout?
        FileUtils.mkdir_p mod.build_prefix_required.join("tags").to_s
        ctags(mod.source_directory,
              mod.build_prefix_required.join(
                  "tags",
                  mod.name.gsub( '/', '-' ) + ".tags" ))

    else
        logger.warn "Module is not checked out! Use -u to check it out."
        logger.warn "skipped!"
    end
end

#initialize_optionsObject



18
19
20
21
# File 'lib/build-tool/commands/ctags.rb', line 18

def initialize_options
    @options.banner = "Usage: #{Pathname.new($0).basename} #{self.fullname} MODULES..."
    super
end