Sha256: ce632ba6d8e7835f62ffd3c409b1a2b47eec2d2d0ba5eb87ba42e454d27f1af5

Contents?: true

Size: 1.22 KB

Versions: 6

Compression:

Stored size: 1.22 KB

Contents

require 'build-tool/application'
require 'build-tool/commands'

module BuildTool; module Commands;

    class CtagsError < BuildTool::Error; end
    #
    # BuildCommand
    #
    class Ctags < ModuleBasedCommand

        include MJ::Tools::SubProcess

        name        "ctags"
        description "run ctags on the module."

        def applicable?
            BuildTool::Application.instance.name != "build-tool"
        end

        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

        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
    end # class Build

end; end # module BuildTool::Commands


Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
build-tool-0.2 lib/build-tool/commands/ctags.rb
build-tool-0.1.4 lib/build-tool/commands/ctags.rb
build-tool-0.1.3 lib/build-tool/commands/ctags.rb
build-tool-0.1.2 lib/build-tool/commands/ctags.rb
build-tool-0.1.0 lib/build-tool/commands/ctags.rb
build-tool-0.1.1 lib/build-tool/commands/ctags.rb