ok_gntpd 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 35988632f70d1087039651f1d336c2950479640d
4
- data.tar.gz: 2685c3139a0549ea63eff0ff1299b7bec0256b2f
3
+ metadata.gz: 290ca902ce6945e4ee4fb2ee3f1cf3ce402c663e
4
+ data.tar.gz: a4d7dba48360e6f1c499ed421ed2e3817bc94dc4
5
5
  SHA512:
6
- metadata.gz: 7d566f401492ab250e025d1308c5701f419937e894596b27f8911fe3e020c13b2f7e93fccd467fb505700398c0dd85a9ecbfac1bb7e6bcdf32d70ed69343c02e
7
- data.tar.gz: a02f67257a728c51438b6e7e62775b7438087c02f3edccc626da3a1fcf948f5e3266bf0a7b133f45b2f7f15ac8b73b5975f61e5c151d4884bf1677e62ae85765
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". Sorry, *this is not yet daemon*.
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
- # This code is originated from:
9
- # http://d.hatena.ne.jp/snaka72/20090614/1244986772
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
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ $:.unshift File.expand_path("../../lib", __FILE__)
4
+
5
+ require "rubygems"
6
+ require "optparse"
7
+ require "dante"
8
+ require "ok_gntpd"
9
+
10
+ Dante.run("ok_gntpd", OkGntpd.default_options) do |options|
11
+ OkGntpd.start(options)
12
+ end
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
@@ -1,3 +1,3 @@
1
1
  class OkGntpd
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
data/ok_gntpd.gemspec CHANGED
@@ -17,6 +17,8 @@ Gem::Specification.new do |gem|
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
19
 
20
+ gem.add_dependency "dante"
21
+
20
22
  gem.add_development_dependency "rake"
21
23
  gem.add_development_dependency "rspec"
22
24
  end
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
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-21 00:00:00.000000000 Z
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