Sha256: 14bc55a7ba209c3a9cdf62c76e5fa8a16c6a90c4e951a25ed12023c6de34e0d7

Contents?: true

Size: 1.54 KB

Versions: 12

Compression:

Stored size: 1.54 KB

Contents

# -*- coding: UTF-8 -*-

require 'mj/tools/subprocess'
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."
        long_description [ "Invoke ctags for the specified MODULES." ]

        def initialize_options
            options.banner = "Usage: #{self.fullname}  [OPTIONS]... MODULES..."
            options.separator( "" )
            options.separator( "Options" )
            super
        end

        def applicable?
            BuildTool::Application.instance.has_recipe?
        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
                warn( "Module is not checked out! Use -u to check it out." )
                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

12 entries across 12 versions & 1 rubygems

Version Path
build-tool-0.6.9 lib/build-tool/commands/ctags.rb
build-tool-0.6.8 lib/build-tool/commands/ctags.rb
build-tool-0.6.7 lib/build-tool/commands/ctags.rb
build-tool-0.6.6 lib/build-tool/commands/ctags.rb
build-tool-0.6.5 lib/build-tool/commands/ctags.rb
build-tool-0.6.4 lib/build-tool/commands/ctags.rb
build-tool-0.6.3 lib/build-tool/commands/ctags.rb
build-tool-0.6.2 lib/build-tool/commands/ctags.rb
build-tool-0.6.1 lib/build-tool/commands/ctags.rb
build-tool-0.6.0 lib/build-tool/commands/ctags.rb
build-tool-0.6.0.rc2 lib/build-tool/commands/ctags.rb
build-tool-0.6.0.rc1 lib/build-tool/commands/ctags.rb