ok_gntpd 0.0.4 → 0.0.5
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.
- checksums.yaml +4 -4
 - data/README.md +28 -1
 - data/bin/ok_gntpd +4 -9
 - data/bin/okgntpd +12 -0
 - data/lib/ok_gntpd.rb +7 -9
 - data/lib/ok_gntpd/version.rb +1 -1
 - data/ok_gntpd.gemspec +2 -0
 - metadata +18 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 290ca902ce6945e4ee4fb2ee3f1cf3ce402c663e
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: a4d7dba48360e6f1c499ed421ed2e3817bc94dc4
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 6419b605a945b2bbf4e5b1cc8037a938fe7a421b280381e39e4bf4833fb5ef11a3b6ddc150ead82ad618ef3a36885651f18c2036ff2f5fe4d79a8442218a5d60
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 0f0500a10085694d251f210ae60ac14b30fc9391383f9717f877e4921d5a2b6a98488ecd9020a81764d43d10d9d1d7ad9b00e67a21ad07be16ee0e1a4667ddc9
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -1,6 +1,6 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # OkGntpd
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
     | 
    
         
            -
            An GNTPd which always return "OK". 
     | 
| 
      
 3 
     | 
    
         
            +
            An GNTPd which always return "OK".
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            ## Installation
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
         @@ -18,11 +18,31 @@ Or install it yourself as: 
     | 
|
| 
       18 
18 
     | 
    
         | 
| 
       19 
19 
     | 
    
         
             
            ## Usage
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
      
 21 
     | 
    
         
            +
            ### As non-daemon
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
       21 
23 
     | 
    
         
             
            Start GNTP server with:
         
     | 
| 
       22 
24 
     | 
    
         | 
| 
       23 
25 
     | 
    
         
             
                $ ok_gntpd
         
     | 
| 
       24 
26 
     | 
    
         | 
| 
       25 
27 
     | 
    
         
             
            Press Ctrl-C to stop it.
         
     | 
| 
      
 28 
     | 
    
         
            +
            You can specify port number with `-p` (default 23053).
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
            ### As daemon
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
            Start GNTP server with:
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                $ ok_gntpd -d
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
            You can specify pid file with `-P` (default /var/run/ok_gntpd.pid).
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
            Stop it with:
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                $ ok_gntpd -k -P /path/to/pid/file
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
            ### Help!
         
     | 
| 
      
 43 
     | 
    
         
            +
             
     | 
| 
      
 44 
     | 
    
         
            +
                $ ok_gntpd --help
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
       26 
46 
     | 
    
         | 
| 
       27 
47 
     | 
    
         
             
            ## Contributing
         
     | 
| 
       28 
48 
     | 
    
         | 
| 
         @@ -31,3 +51,10 @@ Press Ctrl-C to stop it. 
     | 
|
| 
       31 
51 
     | 
    
         
             
            3. Commit your changes (`git commit -am 'Add some feature'`)
         
     | 
| 
       32 
52 
     | 
    
         
             
            4. Push to the branch (`git push origin my-new-feature`)
         
     | 
| 
       33 
53 
     | 
    
         
             
            5. Create new Pull Request
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
      
 56 
     | 
    
         
            +
            ## Acknowledgement
         
     | 
| 
      
 57 
     | 
    
         
            +
             
     | 
| 
      
 58 
     | 
    
         
            +
            This code is originated from @snaka's post:
         
     | 
| 
      
 59 
     | 
    
         
            +
            http://d.hatena.ne.jp/snaka72/20090614/1244986772
         
     | 
| 
      
 60 
     | 
    
         
            +
             
     | 
    
        data/bin/ok_gntpd
    CHANGED
    
    | 
         @@ -2,16 +2,11 @@ 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            $:.unshift File.expand_path("../../lib", __FILE__)
         
     | 
| 
       4 
4 
     | 
    
         | 
| 
      
 5 
     | 
    
         
            +
            require "rubygems"
         
     | 
| 
       5 
6 
     | 
    
         
             
            require "optparse"
         
     | 
| 
      
 7 
     | 
    
         
            +
            require "dante"
         
     | 
| 
       6 
8 
     | 
    
         
             
            require "ok_gntpd"
         
     | 
| 
       7 
9 
     | 
    
         | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
             
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
            options = {}
         
     | 
| 
       12 
     | 
    
         
            -
            OptionParser.new do |op|
         
     | 
| 
       13 
     | 
    
         
            -
              op.on("-p", "--port PORT") { |v| options[:port] = v.to_i }
         
     | 
| 
       14 
     | 
    
         
            -
              op.parse!
         
     | 
| 
      
 10 
     | 
    
         
            +
            Dante.run("ok_gntpd", OkGntpd.default_options) do |options|
         
     | 
| 
      
 11 
     | 
    
         
            +
              OkGntpd.start(options)
         
     | 
| 
       15 
12 
     | 
    
         
             
            end
         
     | 
| 
       16 
     | 
    
         
            -
             
     | 
| 
       17 
     | 
    
         
            -
            OkGntpd.start(options)
         
     | 
    
        data/bin/okgntpd
    ADDED
    
    
    
        data/lib/ok_gntpd.rb
    CHANGED
    
    | 
         @@ -7,10 +7,16 @@ class OkGntpd 
     | 
|
| 
       7 
7 
     | 
    
         
             
                new(options).start
         
     | 
| 
       8 
8 
     | 
    
         
             
              end
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
      
 10 
     | 
    
         
            +
              def self.default_options
         
     | 
| 
      
 11 
     | 
    
         
            +
                {
         
     | 
| 
      
 12 
     | 
    
         
            +
                  :port   => 23053
         
     | 
| 
      
 13 
     | 
    
         
            +
                }
         
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
       10 
16 
     | 
    
         
             
              attr_reader :options, :status
         
     | 
| 
       11 
17 
     | 
    
         | 
| 
       12 
18 
     | 
    
         
             
              def initialize(options = nil)
         
     | 
| 
       13 
     | 
    
         
            -
                @options = default_options.merge(options || {})
         
     | 
| 
      
 19 
     | 
    
         
            +
                @options = self.class.default_options.merge(options || {})
         
     | 
| 
       14 
20 
     | 
    
         
             
                @status = :stop
         
     | 
| 
       15 
21 
     | 
    
         
             
              end
         
     | 
| 
       16 
22 
     | 
    
         | 
| 
         @@ -35,12 +41,4 @@ EOS 
     | 
|
| 
       35 
41 
     | 
    
         
             
                  puts "Closed."
         
     | 
| 
       36 
42 
     | 
    
         
             
                end
         
     | 
| 
       37 
43 
     | 
    
         
             
              end
         
     | 
| 
       38 
     | 
    
         
            -
             
     | 
| 
       39 
     | 
    
         
            -
             
     | 
| 
       40 
     | 
    
         
            -
              private
         
     | 
| 
       41 
     | 
    
         
            -
                def default_options
         
     | 
| 
       42 
     | 
    
         
            -
                  {
         
     | 
| 
       43 
     | 
    
         
            -
                    :port   => 23053
         
     | 
| 
       44 
     | 
    
         
            -
                  }
         
     | 
| 
       45 
     | 
    
         
            -
                end
         
     | 
| 
       46 
44 
     | 
    
         
             
            end
         
     | 
    
        data/lib/ok_gntpd/version.rb
    CHANGED
    
    
    
        data/ok_gntpd.gemspec
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,15 +1,29 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: ok_gntpd
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.5
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Masato Ikeda
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2013-02- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2013-02-24 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: dante
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - '>='
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - '>='
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '0'
         
     | 
| 
       13 
27 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
28 
     | 
    
         
             
              name: rake
         
     | 
| 
       15 
29 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -43,6 +57,7 @@ email: 
     | 
|
| 
       43 
57 
     | 
    
         
             
            - masato.ikeda@gmail.com
         
     | 
| 
       44 
58 
     | 
    
         
             
            executables:
         
     | 
| 
       45 
59 
     | 
    
         
             
            - ok_gntpd
         
     | 
| 
      
 60 
     | 
    
         
            +
            - okgntpd
         
     | 
| 
       46 
61 
     | 
    
         
             
            extensions: []
         
     | 
| 
       47 
62 
     | 
    
         
             
            extra_rdoc_files: []
         
     | 
| 
       48 
63 
     | 
    
         
             
            files:
         
     | 
| 
         @@ -53,6 +68,7 @@ files: 
     | 
|
| 
       53 
68 
     | 
    
         
             
            - README.md
         
     | 
| 
       54 
69 
     | 
    
         
             
            - Rakefile
         
     | 
| 
       55 
70 
     | 
    
         
             
            - bin/ok_gntpd
         
     | 
| 
      
 71 
     | 
    
         
            +
            - bin/okgntpd
         
     | 
| 
       56 
72 
     | 
    
         
             
            - lib/ok_gntpd.rb
         
     | 
| 
       57 
73 
     | 
    
         
             
            - lib/ok_gntpd/version.rb
         
     | 
| 
       58 
74 
     | 
    
         
             
            - ok_gntpd.gemspec
         
     |