polling 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: ad86e5d3482a48a478ee18550da47f30a6e55f92
4
+ data.tar.gz: 690d6c6395be49bf1a582369fc7275fe9c08d7b9
5
+ SHA512:
6
+ metadata.gz: b1b0984f266e31cac791e25807d629b4ab4c1e0e96076142245aef0ba4d83a3cbcb27a4738a1c9878a6fce215d2ee35082b883a44f758e62c9ccdede4bc01439
7
+ data.tar.gz: bb4f40ee5d92695a408b8867f75c8b7feec3e7d02d50072b5131b7b10a69999b4d72a7d0e399e328632b9a21d5b916a8b362ca07f87fbd62e4f43497aab362bb
data/Gemfile CHANGED
@@ -1,4 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
- gem 'mocha'
4
+
5
+ group :test do
6
+ gem 'mocha'
7
+ end
data/README.md CHANGED
@@ -24,22 +24,22 @@ New Interface
24
24
 
25
25
  result
26
26
 
27
- start: 2012-11-16 19:47:36 +0900
28
- sleep 23.980872869491577seconds (until 2012-11-16 19:48:00 +0900)
27
+ #[debug]=> start: 2012-11-16 19:47:36 +0900
28
+ #[debug]=> sleep 23.980872869491577seconds (until 2012-11-16 19:48:00 +0900)
29
29
  test
30
- sleep 7.999034881591797seconds (until 2012-11-16 19:48:10 +0900)
30
+ #[debug]=> sleep 7.999034881591797seconds (until 2012-11-16 19:48:10 +0900)
31
31
  test
32
- sleep 7.999000072479248seconds (until 2012-11-16 19:48:20 +0900)
32
+ #[debug]=> sleep 7.999000072479248seconds (until 2012-11-16 19:48:20 +0900)
33
33
  test
34
- sleep 7.998318195343018seconds (until 2012-11-16 19:48:30 +0900)
34
+ #[debug]=> sleep 7.998318195343018seconds (until 2012-11-16 19:48:30 +0900)
35
35
  test
36
- sleep 7.998938083648682seconds (until 2012-11-16 19:48:40 +0900)
36
+ #[debug]=> sleep 7.998938083648682seconds (until 2012-11-16 19:48:40 +0900)
37
37
  test
38
- sleep 7.999677896499634seconds (until 2012-11-16 19:48:50 +0900)
38
+ #[debug]=> sleep 7.999677896499634seconds (until 2012-11-16 19:48:50 +0900)
39
39
  test
40
- sleep 7.998055934906006seconds (until 2012-11-16 19:49:00 +0900)
40
+ #[debug]=> sleep 7.998055934906006seconds (until 2012-11-16 19:49:00 +0900)
41
41
  test
42
- sleep 7.998072147369385seconds (until 2012-11-16 19:49:10 +0900)
42
+ #[debug]=> sleep 7.998072147369385seconds (until 2012-11-16 19:49:10 +0900)
43
43
 
44
44
  set offset
45
45
 
@@ -52,20 +52,20 @@ set offset
52
52
 
53
53
  result
54
54
 
55
- start: 2013-03-24 23:38:25 +0900
56
- sleep 4.086651802062988seconds (until 2013-03-24 23:38:30 +0900)
55
+ #[debug]=> start: 2013-03-24 23:38:25 +0900
56
+ #[debug]=> sleep 4.086651802062988seconds (until 2013-03-24 23:38:30 +0900)
57
57
  2013-03-24 23:38:30 +0900
58
58
  exec sleep 2
59
- sleep 2.9990789890289307seconds (until 2013-03-24 23:38:35 +0900)
59
+ #[debug]=> sleep 2.9990789890289307seconds (until 2013-03-24 23:38:35 +0900)
60
60
  2013-03-24 23:38:35 +0900
61
61
  exec sleep 2
62
- sleep 2.9979379177093506seconds (until 2013-03-24 23:38:40 +0900)
62
+ #[debug]=> sleep 2.9979379177093506seconds (until 2013-03-24 23:38:40 +0900)
63
63
  2013-03-24 23:38:40 +0900
64
64
  exec sleep 2
65
- sleep 2.9986801147460938seconds (until 2013-03-24 23:38:45 +0900)
65
+ #[debug]=> sleep 2.9986801147460938seconds (until 2013-03-24 23:38:45 +0900)
66
66
  2013-03-24 23:38:45 +0900
67
67
  exec sleep 2
68
- sleep 2.998732089996338seconds (until 2013-03-24 23:38:50 +0900)
68
+ #[debug]=> sleep 2.998732089996338seconds (until 2013-03-24 23:38:50 +0900)
69
69
 
70
70
  Async run
71
71
 
@@ -77,16 +77,16 @@ Async run
77
77
 
78
78
  async run result
79
79
 
80
- start: 2013-03-31 07:17:58 +0900
80
+ #[debug]=> start: 2013-03-31 07:17:58 +0900
81
81
  exec sleep 2
82
82
  2013-03-31 07:18:00 +0900
83
- sleep 2.998924seconds (until 2013-03-31 07:18:03 +0900)
83
+ #[debug]=> sleep 2.998924seconds (until 2013-03-31 07:18:03 +0900)
84
84
  exec sleep 2
85
85
  2013-03-31 07:18:05 +0900
86
- sleep 2.999263seconds (until 2013-03-31 07:18:08 +0900)
86
+ #[debug]=> sleep 2.999263seconds (until 2013-03-31 07:18:08 +0900)
87
87
  exec sleep 2
88
88
  2013-03-31 07:18:10 +0900
89
- sleep 2.998978seconds (until 2013-03-31 07:18:13 +0900)
89
+ #[debug]=> sleep 2.998978seconds (until 2013-03-31 07:18:13 +0900)
90
90
 
91
91
  debug
92
92
 
@@ -118,7 +118,13 @@ It starts at per minute 0 second.
118
118
  puts "test"
119
119
  sleep 2
120
120
  end
121
-
121
+
122
+ setting parameters
123
+
124
+ - offset: Integer
125
+ - debug: Boolean
126
+ - print_start_time: Boolean
127
+
122
128
  ## Copyright
123
129
 
124
- Copyright (c) 2012, hiro-su All rights reserved.
130
+ Copyright (c) 2012-2014, hiro-su All rights reserved.
data/Rakefile CHANGED
@@ -2,3 +2,5 @@ require "bundler/gem_tasks"
2
2
  require "rake/testtask"
3
3
 
4
4
  Rake::TestTask.new
5
+
6
+ task default: :test
data/lib/polling/sleep.rb CHANGED
@@ -2,6 +2,8 @@ module Polling
2
2
  module Sleep
3
3
  def self.exec stime
4
4
  stime > 0 ? (sleep stime) : false
5
+ rescue Interrupt
6
+ exit 0
5
7
  end
6
8
  end
7
9
  end
@@ -1,3 +1,3 @@
1
1
  module Polling
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
data/lib/polling.rb CHANGED
@@ -30,7 +30,7 @@ module Polling
30
30
  end
31
31
 
32
32
  interval = Validate.value interval
33
- e.__send__(:start_print, e.stime)
33
+ e.__send__(:start_print, e.stime) if @print_start_time || @debug
34
34
 
35
35
  case interval
36
36
  when Array
@@ -65,7 +65,7 @@ module Polling
65
65
  raise "Can't input Array class : #{interval}"
66
66
  end
67
67
 
68
- e.__send__(:start_print, 0)
68
+ e.__send__(:start_print, 0) if @print_start_time || @debug
69
69
  loop { exec.call interval }
70
70
  rescue => ex
71
71
  $stderr.puts ex.to_s
data/polling.gemspec CHANGED
@@ -16,4 +16,7 @@ Gem::Specification.new do |gem|
16
16
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
+
20
+ gem.add_development_dependency "bundler", "~> 1.3"
21
+ gem.add_development_dependency "rake"
19
22
  end
metadata CHANGED
@@ -1,16 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: polling
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
5
- prerelease:
4
+ version: 0.1.4
6
5
  platform: ruby
7
6
  authors:
8
7
  - hiro-su
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-03-31 00:00:00.000000000 Z
13
- dependencies: []
11
+ date: 2014-11-11 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
14
41
  description: polling
15
42
  email:
16
43
  - h.sugipon@gmail.com
@@ -18,7 +45,7 @@ executables: []
18
45
  extensions: []
19
46
  extra_rdoc_files: []
20
47
  files:
21
- - .gitignore
48
+ - ".gitignore"
22
49
  - Gemfile
23
50
  - LICENSE.txt
24
51
  - README.md
@@ -40,27 +67,26 @@ files:
40
67
  - test/test_validate.rb
41
68
  homepage: https://github.com/hiro-su/polling
42
69
  licenses: []
70
+ metadata: {}
43
71
  post_install_message:
44
72
  rdoc_options: []
45
73
  require_paths:
46
74
  - lib
47
75
  required_ruby_version: !ruby/object:Gem::Requirement
48
- none: false
49
76
  requirements:
50
- - - ! '>='
77
+ - - ">="
51
78
  - !ruby/object:Gem::Version
52
79
  version: '0'
53
80
  required_rubygems_version: !ruby/object:Gem::Requirement
54
- none: false
55
81
  requirements:
56
- - - ! '>='
82
+ - - ">="
57
83
  - !ruby/object:Gem::Version
58
84
  version: '0'
59
85
  requirements: []
60
86
  rubyforge_project:
61
- rubygems_version: 1.8.24
87
+ rubygems_version: 2.2.2
62
88
  signing_key:
63
- specification_version: 3
89
+ specification_version: 4
64
90
  summary: polling
65
91
  test_files:
66
92
  - test/async_run.rb