service_disruption 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -12,7 +12,9 @@ A little library to easily tell you when the Tube has problems
12
12
 
13
13
  $: service_disruption start
14
14
 
15
- Extra arguments are: `-d` to deamonise and `-i` to change the polling time, defaults to once every 30 seconds
15
+ $: service_disruption stop
16
+
17
+ Extra arguments are: `-- -i` to change the polling time, defaults to once every 30 seconds
16
18
 
17
19
  Alternatively if you'd like to see some pretty colours on your command line you can run
18
20
 
@@ -1,15 +1,18 @@
1
1
  module ServiceDisruption
2
2
  class Command < Thor
3
3
 
4
- desc "start", "Run the monitor"
5
- method_option :daemonize, :aliases => "-d", :default => false, :type => :boolean, :banner => "Run as daemon"
4
+ desc "start", "Start a demonized monitor"
6
5
  method_option :interval, :aliases => "-i", :default => 30, :type => :numeric, :banner => "Interval to wait to poll in seconds"
7
6
  def start
8
- network = ServiceDisruption.network
9
- EventMachine::run do
10
- EventMachine::add_periodic_timer(options[:interval]) do
11
- network.update!
12
- end
7
+ Daemons.run_proc('service_disruption', :options => {:ARGV => ['start']}) do
8
+ run_as_event_machine(options)
9
+ end
10
+ end
11
+
12
+ desc "stop", "Stop a demonized monitor"
13
+ def stop
14
+ Daemons.run_proc('service_disruption', :options => {:ARGV => ['stop']}) do
15
+ run_as_event_machine
13
16
  end
14
17
  end
15
18
 
@@ -18,5 +21,16 @@ module ServiceDisruption
18
21
  puts ServiceDisruption.network
19
22
  end
20
23
 
24
+ private
25
+
26
+ def run_as_event_machine(options)
27
+ network = ServiceDisruption.network
28
+ EventMachine::run do
29
+ EventMachine::add_periodic_timer(options[:interval]) do
30
+ network.update!
31
+ end
32
+ end
33
+ end
34
+
21
35
  end
22
36
  end
@@ -7,6 +7,7 @@ require 'uri'
7
7
  require 'thor'
8
8
  require 'httparty'
9
9
  require 'eventmachine'
10
+ require 'daemons'
10
11
  require 'rainbow'
11
12
  require 'ruby_gntp'
12
13
  require 'active_support/core_ext'
@@ -24,7 +25,7 @@ require "service_disruption/notifier"
24
25
  require "service_disruption/core_ext/hash"
25
26
 
26
27
  module ServiceDisruption
27
- VERSION = '0.0.1'
28
+ VERSION = '0.1.0'
28
29
  TFL_ENDPOINT = 'http://cloud.tfl.gov.uk/TrackerNet/LineStatus'
29
30
  ROOT_PATH = File.dirname(File.dirname(__FILE__))
30
31
 
@@ -12,7 +12,8 @@ Gem::Specification.new do |s|
12
12
  A simple gem to track the current status of London Underground services
13
13
  }
14
14
  s.description = %q{
15
- BOOM!
15
+ A simple gem to track the current status of London Underground services, it polls the TFL endpoint and will alert
16
+ you if there is an issue, also provides a nice interface to TFL's tube data, still very beta, please give me a poke on github with suggestions and enhancements.
16
17
  }
17
18
 
18
19
  s.rubyforge_project = "service_disruption"
@@ -34,4 +35,5 @@ Gem::Specification.new do |s|
34
35
  s.add_runtime_dependency "rainbow", '~> 1.1.3'
35
36
  s.add_runtime_dependency "activesupport", '~> 3.2.0'
36
37
  s.add_runtime_dependency "ruby_gntp", '~> 0.3.4'
38
+ s.add_runtime_dependency "daemons", '~> 1.1.8'
37
39
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: service_disruption
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-04-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &70126178324100 !ruby/object:Gem::Requirement
16
+ requirement: &70289308727380 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.9.2
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70126178324100
24
+ version_requirements: *70289308727380
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &70126178339920 !ruby/object:Gem::Requirement
27
+ requirement: &70289308726280 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 2.9.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70126178339920
35
+ version_requirements: *70289308726280
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: fakeweb
38
- requirement: &70126178339400 !ruby/object:Gem::Requirement
38
+ requirement: &70289308758660 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 1.3.0
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70126178339400
46
+ version_requirements: *70289308758660
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: fuubar
49
- requirement: &70126178338900 !ruby/object:Gem::Requirement
49
+ requirement: &70289308795960 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 1.0.0
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70126178338900
57
+ version_requirements: *70289308795960
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: thor
60
- requirement: &70126178338400 !ruby/object:Gem::Requirement
60
+ requirement: &70289308800320 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 0.14.6
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70126178338400
68
+ version_requirements: *70289308800320
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: httparty
71
- requirement: &70126178337940 !ruby/object:Gem::Requirement
71
+ requirement: &70289308832460 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: 0.8.3
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70126178337940
79
+ version_requirements: *70289308832460
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: eventmachine
82
- requirement: &70126178337480 !ruby/object:Gem::Requirement
82
+ requirement: &70289308872560 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: 0.12.10
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *70126178337480
90
+ version_requirements: *70289308872560
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: rainbow
93
- requirement: &70126178337020 !ruby/object:Gem::Requirement
93
+ requirement: &70289308869600 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ~>
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: 1.1.3
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *70126178337020
101
+ version_requirements: *70289308869600
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: activesupport
104
- requirement: &70126178336560 !ruby/object:Gem::Requirement
104
+ requirement: &70289308868300 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ~>
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: 3.2.0
110
110
  type: :runtime
111
111
  prerelease: false
112
- version_requirements: *70126178336560
112
+ version_requirements: *70289308868300
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: ruby_gntp
115
- requirement: &70126178336080 !ruby/object:Gem::Requirement
115
+ requirement: &70289308867220 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ~>
@@ -120,8 +120,22 @@ dependencies:
120
120
  version: 0.3.4
121
121
  type: :runtime
122
122
  prerelease: false
123
- version_requirements: *70126178336080
124
- description: ! "\n BOOM!\n "
123
+ version_requirements: *70289308867220
124
+ - !ruby/object:Gem::Dependency
125
+ name: daemons
126
+ requirement: &70289308866020 !ruby/object:Gem::Requirement
127
+ none: false
128
+ requirements:
129
+ - - ~>
130
+ - !ruby/object:Gem::Version
131
+ version: 1.1.8
132
+ type: :runtime
133
+ prerelease: false
134
+ version_requirements: *70289308866020
135
+ description: ! "\n A simple gem to track the current status of London Underground
136
+ services, it polls the TFL endpoint and will alert\n you if there is an issue,
137
+ also provides a nice interface to TFL's tube data, still very beta, please give
138
+ me a poke on github with suggestions and enhancements.\n "
125
139
  email:
126
140
  - adam@benchmedia.co.uk
127
141
  executables:
@@ -169,7 +183,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
169
183
  version: '0'
170
184
  segments:
171
185
  - 0
172
- hash: -2835984172953313753
186
+ hash: 992296754875061883
173
187
  required_rubygems_version: !ruby/object:Gem::Requirement
174
188
  none: false
175
189
  requirements:
@@ -178,7 +192,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
178
192
  version: '0'
179
193
  segments:
180
194
  - 0
181
- hash: -2835984172953313753
195
+ hash: 992296754875061883
182
196
  requirements: []
183
197
  rubyforge_project: service_disruption
184
198
  rubygems_version: 1.8.17