Sha256: 4cb8ddd66cc3da83404396e0308f35ec4513fde9fdf18d5a2aecec3249c71cdd

Contents?: true

Size: 1.23 KB

Versions: 27

Compression:

Stored size: 1.23 KB

Contents

#!/usr/bin/env ruby
require 'rubygems'
require 'spiderfw'
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

27 entries across 27 versions & 1 rubygems

Version Path
spiderfw-0.6.20 apps/servant/bin/spider-servant.rb
spiderfw-0.6.19 apps/servant/bin/spider-servant.rb
spiderfw-0.6.18 apps/servant/bin/spider-servant.rb
spiderfw-0.6.17 apps/servant/bin/spider-servant.rb
spiderfw-0.6.16 apps/servant/bin/spider-servant.rb
spiderfw-0.6.15 apps/servant/bin/spider-servant.rb
spiderfw-0.6.14 apps/servant/bin/spider-servant.rb
spiderfw-0.6.13 apps/servant/bin/spider-servant.rb
spiderfw-0.6.12 apps/servant/bin/spider-servant.rb
spiderfw-0.6.11 apps/servant/bin/spider-servant.rb
spiderfw-0.6.10 apps/servant/bin/spider-servant.rb
spiderfw-0.6.9 apps/servant/bin/spider-servant.rb
spiderfw-0.6.8 apps/servant/bin/spider-servant.rb
spiderfw-0.6.7 apps/servant/bin/spider-servant.rb
spiderfw-0.6.6 apps/servant/bin/spider-servant.rb
spiderfw-0.6.5 apps/servant/bin/spider-servant.rb
spiderfw-0.6.4 apps/servant/bin/spider-servant.rb
spiderfw-0.6.3 apps/servant/bin/spider-servant.rb
spiderfw-0.6.2 apps/servant/bin/spider-servant.rb
spiderfw-0.6.1 apps/servant/bin/spider-servant.rb