Sha256: c027499711c92122d2e02a6a39a2da17299fbd59cfcda19bcdc76540b5816ae4

Contents?: true

Size: 1.23 KB

Versions: 15

Compression:

Stored size: 1.23 KB

Contents

#!/usr/bin/env ruby
require 'rubygems'
require 'spiderfw/init'
require 'cmdparse'
require $SPIDER_PATH+'/apps/servant/lib/servant.rb'
require 'ruby-debug'


class Cmd

    def initialize
        @cmd = CmdParse::CommandParser.new( true, true )
        @cmd.program_name = "spider-servant"
        @cmd.options = CmdParse::OptionParserWrapper.new do |opt|
            opt.separator _("Global options:")
            opt.on("--verbose", _("Be verbose when outputting info"), "-v" ) {|t| $verbose = true }
            opt.on("--config-file [FILE]", _("Configuration file"), "-c"){ |c| @config_file = c }
        end

        ping_server = CmdParse::Command.new('ping_server', false)
        ping_server.set_execution_block do |args|
            servant = Spider::Servant::Servant.new(@config_file)
            servant.ping_server
        end


        @cmd.add_command(CmdParse::HelpCommand.new, true)
        @cmd.add_command(ping_server)

    end

    def parse
        cmd_name = nil
        0.upto(ARGV.length) do |i|
            if (ARGV[i] && ARGV[i] != 'help' && ARGV[i][0].chr != '-')
                cmd_name = ARGV[i]
                break
            end
        end
        cmd_name ||= 'help'
        @cmd.parse
    end

end

cmd = Cmd.new
cmd.parse
exit

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
spiderfw-0.6.34 apps/servant/bin/spider-servant.rb
spiderfw-0.6.33 apps/servant/bin/spider-servant.rb
spiderfw-0.6.32 apps/servant/bin/spider-servant.rb
spiderfw-0.6.31 apps/servant/bin/spider-servant.rb
spiderfw-0.6.30 apps/servant/bin/spider-servant.rb
spiderfw-0.6.29 apps/servant/bin/spider-servant.rb
spiderfw-0.6.28 apps/servant/bin/spider-servant.rb
spiderfw-0.6.27 apps/servant/bin/spider-servant.rb
spiderfw-0.6.26 apps/servant/bin/spider-servant.rb
spiderfw-0.6.26.pre1 apps/servant/bin/spider-servant.rb
spiderfw-0.6.25 apps/servant/bin/spider-servant.rb
spiderfw-0.6.24 apps/servant/bin/spider-servant.rb
spiderfw-0.6.23 apps/servant/bin/spider-servant.rb
spiderfw-0.6.22 apps/servant/bin/spider-servant.rb
spiderfw-0.6.21 apps/servant/bin/spider-servant.rb