vrowser 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/bin/vrowser +12 -1
- data/lib/vrowser.rb +27 -17
- data/public_html/css/main.css +1 -38
- data/public_html/index.html +6 -0
- metadata +3 -3
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            0.1. | 
| 1 | 
            +
            0.1.3
         | 
    
        data/bin/vrowser
    CHANGED
    
    | @@ -59,12 +59,16 @@ hoge | |
| 59 59 | 
             
                    Trollop::die "unknown subcommand: #{cmd.inspect}"
         | 
| 60 60 | 
             
                  end
         | 
| 61 61 | 
             
                end
         | 
| 62 | 
            +
                return execute_sub_commands(cmd, cmd_opts)
         | 
| 63 | 
            +
              end
         | 
| 62 64 |  | 
| 63 | 
            -
             | 
| 65 | 
            +
              def execute_sub_commands(cmd, cmd_opts)
         | 
| 66 | 
            +
                if self.class.sub_commands.include? cmd
         | 
| 64 67 | 
             
                  self.send("command_" +  cmd, cmd_opts)
         | 
| 65 68 | 
             
                  return 0
         | 
| 66 69 | 
             
                else
         | 
| 67 70 | 
             
                  cmd_opts.help.display
         | 
| 71 | 
            +
                  return 1
         | 
| 68 72 | 
             
                end
         | 
| 69 73 | 
             
              end
         | 
| 70 74 |  | 
| @@ -86,6 +90,13 @@ hoge | |
| 86 90 | 
             
                end
         | 
| 87 91 | 
             
              end
         | 
| 88 92 |  | 
| 93 | 
            +
              def command_fetch(options)
         | 
| 94 | 
            +
                Vrowser.load_file(options[:config_file]) do |vrowser|
         | 
| 95 | 
            +
                  vrowser.fetch
         | 
| 96 | 
            +
                  vrowser.clear
         | 
| 97 | 
            +
                end
         | 
| 98 | 
            +
              end
         | 
| 99 | 
            +
             | 
| 89 100 | 
             
              def command_update(options)
         | 
| 90 101 | 
             
                Vrowser.load_file(options[:config_file]) do |vrowser|
         | 
| 91 102 | 
             
                  vrowser.update
         | 
    
        data/lib/vrowser.rb
    CHANGED
    
    | @@ -6,11 +6,21 @@ require 'retry-handler' | |
| 6 6 | 
             
            require 'active_support/core_ext'
         | 
| 7 7 | 
             
            require 'yaml'
         | 
| 8 8 | 
             
            require 'json'
         | 
| 9 | 
            +
            require 'time'
         | 
| 9 10 |  | 
| 10 11 | 
             
            module VrowserModel
         | 
| 11 12 | 
             
              def self.connect(options={})
         | 
| 12 | 
            -
                 | 
| 13 | 
            -
             | 
| 13 | 
            +
                logger = options.delete(:logger)
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                Sequel::Model.plugin :schema
         | 
| 16 | 
            +
                Sequel::Model.plugin :timestamps, :update_on_create => true
         | 
| 17 | 
            +
                Sequel::Model.plugin :force_encoding, 'utf-8'
         | 
| 18 | 
            +
                if logger
         | 
| 19 | 
            +
                  Sequel.connect(options, :loggers => [logger])
         | 
| 20 | 
            +
                else
         | 
| 21 | 
            +
                  Sequel.connect(options)
         | 
| 22 | 
            +
                end
         | 
| 23 | 
            +
             | 
| 14 24 | 
             
                self.define_models
         | 
| 15 25 | 
             
                Servers.plugin :timestamps, :create=>:created_at, :update=>:updated_at
         | 
| 16 26 | 
             
              end
         | 
| @@ -21,16 +31,16 @@ module VrowserModel | |
| 21 31 | 
             
                    unless table_exists?
         | 
| 22 32 | 
             
                      set_schema do
         | 
| 23 33 | 
             
                        primary_key :id
         | 
| 24 | 
            -
                         | 
| 25 | 
            -
                         | 
| 26 | 
            -
                         | 
| 27 | 
            -
                         | 
| 28 | 
            -
                         | 
| 29 | 
            -
                         | 
| 30 | 
            -
                         | 
| 31 | 
            -
                         | 
| 32 | 
            -
                        timestamp :created_at
         | 
| 33 | 
            -
                        timestamp :updated_at
         | 
| 34 | 
            +
                        String :name
         | 
| 35 | 
            +
                        String :host, :unique => true
         | 
| 36 | 
            +
                        String :status
         | 
| 37 | 
            +
                        Integer :ping
         | 
| 38 | 
            +
                        String :num_players
         | 
| 39 | 
            +
                        String :type
         | 
| 40 | 
            +
                        String :map
         | 
| 41 | 
            +
                        String :players
         | 
| 42 | 
            +
                        timestamp :created_at, :default => nil, :null => true
         | 
| 43 | 
            +
                        timestamp :updated_at, :default => nil, :null => true
         | 
| 34 44 | 
             
                      end
         | 
| 35 45 | 
             
                      create_table
         | 
| 36 46 | 
             
                    end
         | 
| @@ -99,8 +109,8 @@ class Vrowser | |
| 99 109 | 
             
                    self.update(server.host, protocol)
         | 
| 100 110 | 
             
                    updated += 1
         | 
| 101 111 | 
             
                  }
         | 
| 102 | 
            -
                rescue
         | 
| 103 | 
            -
             | 
| 112 | 
            +
                #rescue => ex
         | 
| 113 | 
            +
                #  @@logger.error "#{ex.inspect}"
         | 
| 104 114 | 
             
                ensure
         | 
| 105 115 | 
             
                  @@logger.info "updated #{updated} servers"
         | 
| 106 116 | 
             
                end
         | 
| @@ -114,8 +124,8 @@ class Vrowser | |
| 114 124 | 
             
                    self.update_info(server.host, protocol)
         | 
| 115 125 | 
             
                    updated += 1
         | 
| 116 126 | 
             
                  }
         | 
| 117 | 
            -
                rescue
         | 
| 118 | 
            -
                  @@logger.error  | 
| 127 | 
            +
                rescue => ex
         | 
| 128 | 
            +
                  @@logger.error "#{ex.inspect}"
         | 
| 119 129 | 
             
                ensure
         | 
| 120 130 | 
             
                  @@logger.info "updated #{updated} servers"
         | 
| 121 131 | 
             
                end
         | 
| @@ -210,7 +220,7 @@ class Vrowser | |
| 210 220 | 
             
                  return QStat.query_serverlist(host, gametype, gamename, maxping)
         | 
| 211 221 | 
             
                }.retry(:accept_exception => StandardError, :logger => @@logger)
         | 
| 212 222 | 
             
              rescue => ex
         | 
| 213 | 
            -
                @@logger.error " | 
| 223 | 
            +
                @@logger.error "#{ex.inspect}"
         | 
| 214 224 | 
             
                return []
         | 
| 215 225 | 
             
              end
         | 
| 216 226 |  | 
    
        data/public_html/css/main.css
    CHANGED
    
    | @@ -1,10 +1,7 @@ | |
| 1 1 | 
             
            body{
         | 
| 2 2 | 
             
              font-size: 16px;
         | 
| 3 3 | 
             
              color: black;
         | 
| 4 | 
            -
              /*font-family:"Lucida Grande", Tahoma, Arial, Verdana, sans-serif;*/
         | 
| 5 4 | 
             
              font-family: 'メイリオ',Meiryo,Tahoma,Arial,Verdana,sans-serif;
         | 
| 6 | 
            -
              /*background-color: #090909;*/
         | 
| 7 | 
            -
              /*background-color: white;*/
         | 
| 8 5 | 
             
            }
         | 
| 9 6 |  | 
| 10 7 | 
             
            pre{
         | 
| @@ -25,7 +22,6 @@ header{ | |
| 25 22 | 
             
              top: 0;
         | 
| 26 23 | 
             
              left: 0;
         | 
| 27 24 | 
             
              width: 100%;
         | 
| 28 | 
            -
              /*height: 100%;*/
         | 
| 29 25 | 
             
            }
         | 
| 30 26 |  | 
| 31 27 | 
             
            del{
         | 
| @@ -49,6 +45,7 @@ h1{ | |
| 49 45 | 
             
              border-width: 0 0 1px 0;
         | 
| 50 46 | 
             
              text-shadow: 1px 1px 5px rgba(0, 0, 0, 0.5);
         | 
| 51 47 | 
             
              padding: 0;margin: 0;
         | 
| 48 | 
            +
              padding-left: 10px;
         | 
| 52 49 | 
             
            }
         | 
| 53 50 |  | 
| 54 51 | 
             
            h1 > a{
         | 
| @@ -64,14 +61,6 @@ h2{ | |
| 64 61 | 
             
              text-shadow: 1px 1px 5px rgba(0, 0, 0, 0.5);
         | 
| 65 62 | 
             
            }
         | 
| 66 63 |  | 
| 67 | 
            -
            section{
         | 
| 68 | 
            -
              margin-left: 50px;
         | 
| 69 | 
            -
            }
         | 
| 70 | 
            -
             | 
| 71 | 
            -
            section p{
         | 
| 72 | 
            -
              margin-left: 20px;
         | 
| 73 | 
            -
            }
         | 
| 74 | 
            -
             | 
| 75 64 | 
             
            body{
         | 
| 76 65 | 
             
              background-color: white;
         | 
| 77 66 | 
             
              color: black;
         | 
| @@ -79,10 +68,6 @@ body{ | |
| 79 68 | 
             
              padding: 0px;
         | 
| 80 69 | 
             
            }
         | 
| 81 70 |  | 
| 82 | 
            -
            section{
         | 
| 83 | 
            -
              margin-left: 24px;
         | 
| 84 | 
            -
            }
         | 
| 85 | 
            -
             | 
| 86 71 | 
             
            #toolbar{
         | 
| 87 72 | 
             
              padding-top: 5px;
         | 
| 88 73 | 
             
              background-color: #333;
         | 
| @@ -106,10 +91,6 @@ section{ | |
| 106 91 | 
             
            #main_icon{
         | 
| 107 92 | 
             
              position: absolute;
         | 
| 108 93 | 
             
            }
         | 
| 109 | 
            -
            section{
         | 
| 110 | 
            -
              margin-left: 50px;
         | 
| 111 | 
            -
              margin-right: 80px;
         | 
| 112 | 
            -
            }
         | 
| 113 94 | 
             
            section > h1{
         | 
| 114 95 | 
             
              margin-top: 10px;
         | 
| 115 96 | 
             
            }
         | 
| @@ -128,25 +109,7 @@ footer{ | |
| 128 109 | 
             
              -moz-box-shadow: 0px 10px 10px 10px gray;
         | 
| 129 110 | 
             
            }
         | 
| 130 111 |  | 
| 131 | 
            -
            /*
         | 
| 132 | 
            -
            section > ul > ul > li{
         | 
| 133 | 
            -
              border: solid 1px pink;*
         | 
| 134 | 
            -
              padding: 10px;
         | 
| 135 | 
            -
              width: 300px;
         | 
| 136 | 
            -
              height: 250px;
         | 
| 137 | 
            -
              float: left;
         | 
| 138 | 
            -
              list-style: none;
         | 
| 139 | 
            -
              overflow: hidden;
         | 
| 140 | 
            -
            }
         | 
| 141 | 
            -
             | 
| 142 | 
            -
            section{
         | 
| 143 | 
            -
              clear: both;
         | 
| 144 | 
            -
            }
         | 
| 145 | 
            -
              */
         | 
| 146 | 
            -
             | 
| 147 112 | 
             
            td,th{
         | 
| 148 | 
            -
              /*border: solid 1px black;*/
         | 
| 149 | 
            -
              /*border-width: 1px 1px 0 0;*/
         | 
| 150 113 | 
             
              padding: 5px;
         | 
| 151 114 | 
             
              margin: 0;
         | 
| 152 115 | 
             
            }
         | 
    
        data/public_html/index.html
    CHANGED
    
    | @@ -11,11 +11,17 @@ | |
| 11 11 | 
             
                <link rel="StyleSheet" href="./css/demo_page.css" />
         | 
| 12 12 | 
             
                <link rel="StyleSheet" href="./css/demo_table.css" />
         | 
| 13 13 | 
             
                <link rel="StyleSheet" href="./css/demo_table_jui.css" />
         | 
| 14 | 
            +
                <title>Vrowser</title>
         | 
| 14 15 | 
             
               </head>
         | 
| 15 16 |  | 
| 16 17 | 
             
               <body>
         | 
| 17 18 | 
             
                 <section>
         | 
| 18 19 | 
             
                 <h1 id="subject">Vrowser <a href="https://github.com/kimoto/vrowser/">(source)</a></h1>
         | 
| 20 | 
            +
                 <ul>
         | 
| 21 | 
            +
                   <li>サーバーの行でダブルクリックでログインできます</li>
         | 
| 22 | 
            +
                   <li>プレイヤー名で検索できます</li>
         | 
| 23 | 
            +
                 </ul>
         | 
| 24 | 
            +
             | 
| 19 25 | 
             
                 <table id="servers" class="display">
         | 
| 20 26 | 
             
                   <thead>
         | 
| 21 27 | 
             
                     <tr>
         | 
    
        metadata
    CHANGED
    
    | @@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version | |
| 5 5 | 
             
              segments: 
         | 
| 6 6 | 
             
              - 0
         | 
| 7 7 | 
             
              - 1
         | 
| 8 | 
            -
              -  | 
| 9 | 
            -
              version: 0.1. | 
| 8 | 
            +
              - 3
         | 
| 9 | 
            +
              version: 0.1.3
         | 
| 10 10 | 
             
            platform: ruby
         | 
| 11 11 | 
             
            authors: 
         | 
| 12 12 | 
             
            - kimoto
         | 
| @@ -83,7 +83,7 @@ dependencies: | |
| 83 83 | 
             
              type: :runtime
         | 
| 84 84 | 
             
              version_requirements: *id005
         | 
| 85 85 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 86 | 
            -
              name:  | 
| 86 | 
            +
              name: mysql
         | 
| 87 87 | 
             
              prerelease: false
         | 
| 88 88 | 
             
              requirement: &id006 !ruby/object:Gem::Requirement 
         | 
| 89 89 | 
             
                none: false
         |