service 1.0.1 → 2.0.0
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 +7 -0
- data/LICENSE +1 -1
- data/README.md +55 -72
- data/Rakefile +5 -47
- data/VERSION +1 -1
- data/bin/rake +17 -0
- data/examples/ping_pong.rb +51 -0
- data/examples/queue.rb +49 -0
- data/lib/service.rb +66 -80
- data/service.gemspec +15 -40
- metadata +18 -87
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 014411ad19101419e3294a47ab2ffaa3413ab578
|
4
|
+
data.tar.gz: 065676ea6aa57f1ea4a4597a2accd4aab16e9a1d
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8b0f6ae156be43fd61794402b4b816e181aa16a7f1a84f55f37b562d7f187f9560d832287ae802c3a7b021bfe05f9342d123e6513fbf0506c96214efc4b8ea1b
|
7
|
+
data.tar.gz: 05cd10eb30527a7b4131d2c5126c3e63d4844e1815d8db2f50b003d224c70f5379a0c443089823610ae40c00e5e99dd3538c67571011e95374463f3a2f981870
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
# Service
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
Service encapsulates an object which executes a bit of code in a loop that can be started or
|
6
|
-
stopped and query whether it is running or not.
|
3
|
+
Service encapsulates an object which executes a bit of code in a loop that can be started or stopped and query whether
|
4
|
+
it is running or not.
|
7
5
|
|
8
6
|
## Install
|
9
7
|
|
@@ -13,52 +11,65 @@ stopped and query whether it is running or not.
|
|
13
11
|
|
14
12
|
## Usage
|
15
13
|
|
14
|
+
> See the `examples/` directory for more usage examples.
|
15
|
+
|
16
|
+
### Requiring
|
17
|
+
|
18
|
+
Class/Module | File
|
19
|
+
-----------------|--------------------------
|
20
|
+
`Service` | `service`
|
21
|
+
`Service::Base` | `service/base`
|
22
|
+
|
16
23
|
### Defining
|
17
24
|
|
18
|
-
You can define an Object as a Service by subclassing `Service` or by including
|
19
|
-
`Service::Base`.
|
25
|
+
You can define an Object as a Service by subclassing `Service` or by including `Service::Base`:
|
20
26
|
|
21
27
|
```ruby
|
22
28
|
class ServiceA < Service
|
23
29
|
end
|
24
30
|
|
25
31
|
class ServiceB
|
32
|
+
|
26
33
|
include Service::Base
|
27
|
-
end
|
28
34
|
|
29
|
-
class ServiceC
|
30
|
-
extend Service::Base
|
31
35
|
end
|
32
36
|
```
|
33
37
|
|
34
|
-
A `Service` object stores it's state in the `@_service_state` instance variable as to be as
|
35
|
-
|
38
|
+
> A `Service` object stores it's state in the `@_service_state` instance variable as to be as unobtrusive as possible
|
39
|
+
> when integrating with your custom objects.
|
36
40
|
|
37
|
-
The next thing to do is define
|
41
|
+
The next thing to do is to define an `#execute` instance method on your object:
|
38
42
|
|
39
43
|
```ruby
|
40
44
|
class MyService < Service
|
45
|
+
|
41
46
|
def execute
|
42
47
|
# ...
|
43
48
|
end
|
49
|
+
|
44
50
|
end
|
45
51
|
```
|
46
52
|
|
47
53
|
### Running
|
48
54
|
|
49
|
-
Service
|
50
|
-
|
51
|
-
|
55
|
+
Service simply allows you to run your code that is within the `#execute` instance method in four different ways:
|
56
|
+
|
57
|
+
* Once (`#execute`)
|
58
|
+
* Once, within a new Thread (`#execute!`)
|
59
|
+
* Looping (`#start`/`#run`)
|
60
|
+
* Looping, within a new Thread (`#start!`/`#run!`)
|
52
61
|
|
53
62
|
***
|
54
63
|
|
55
|
-
Use the
|
64
|
+
Use the `#start`/`#run` instance method to call the `#execute` instance method in a loop.
|
56
65
|
|
57
66
|
```ruby
|
58
67
|
class MyService < Service
|
68
|
+
|
59
69
|
def execute
|
60
70
|
puts "Hello"
|
61
71
|
end
|
72
|
+
|
62
73
|
end
|
63
74
|
|
64
75
|
MyService.new.run
|
@@ -67,13 +78,15 @@ MyService.new.run
|
|
67
78
|
# => ...
|
68
79
|
```
|
69
80
|
|
70
|
-
Use
|
81
|
+
Use `#start!`/`#run!` to call the `#execute` instance method in a new Thread.
|
71
82
|
|
72
83
|
```ruby
|
73
84
|
class MyService < Service
|
85
|
+
|
74
86
|
def execute
|
75
87
|
puts "Hello"
|
76
88
|
end
|
89
|
+
|
77
90
|
end
|
78
91
|
|
79
92
|
thread = MyService.new.run!
|
@@ -85,88 +98,58 @@ thread.join
|
|
85
98
|
|
86
99
|
### Stopping
|
87
100
|
|
88
|
-
Use the
|
89
|
-
This will also kill the Thread it is running in, if running
|
101
|
+
Use the `#stop` instance method break the run loop.
|
102
|
+
This will also kill the Thread it is running in, if running within a Thread.
|
90
103
|
|
91
104
|
```ruby
|
92
|
-
class
|
105
|
+
class CountingService < Service
|
106
|
+
|
107
|
+
def initialize
|
108
|
+
@count = 0
|
109
|
+
end
|
110
|
+
|
93
111
|
def execute
|
94
|
-
|
95
|
-
|
112
|
+
puts @count
|
113
|
+
sleep 1
|
114
|
+
|
115
|
+
@count += 1
|
96
116
|
end
|
117
|
+
|
97
118
|
end
|
98
119
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
120
|
+
service = CountingService.new
|
121
|
+
|
122
|
+
service.run! # Run the #execute method in a loop within a new Thread
|
123
|
+
sleep 5
|
124
|
+
service.stop
|
103
125
|
```
|
104
126
|
|
105
127
|
### Querying State
|
106
128
|
|
107
|
-
Use the `started?`/`running?` or `stopped?` instance methods to determine the current state of
|
129
|
+
Use the `started?`/`running?` or `stopped?` instance methods to determine the current state of
|
108
130
|
the Service instance.
|
109
131
|
|
110
132
|
```ruby
|
111
133
|
class MyService < Service
|
134
|
+
|
112
135
|
def execute
|
113
136
|
sleep 10
|
114
137
|
end
|
138
|
+
|
115
139
|
end
|
116
140
|
|
117
141
|
service = MyService.new
|
142
|
+
|
118
143
|
p service.running? # => false
|
144
|
+
|
119
145
|
service.run!
|
120
146
|
sleep 1
|
121
|
-
p service.running? # => true
|
122
|
-
```
|
123
|
-
|
124
|
-
## Example
|
125
|
-
|
126
|
-
```ruby
|
127
|
-
require 'service'
|
128
|
-
|
129
|
-
class PingService < Service
|
130
|
-
def execute
|
131
|
-
sleep rand(5)
|
132
|
-
print 'ping'
|
133
|
-
stop
|
134
|
-
end
|
135
|
-
end
|
136
147
|
|
137
|
-
|
138
|
-
include Service::Base
|
139
|
-
|
140
|
-
def execute
|
141
|
-
sleep rand(5)
|
142
|
-
print 'pong'
|
143
|
-
stop
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
class ExcitementService
|
148
|
-
extend Service::Base
|
149
|
-
|
150
|
-
def execute
|
151
|
-
sleep rand(5)
|
152
|
-
print '!'
|
153
|
-
stop
|
154
|
-
end
|
155
|
-
end
|
156
|
-
|
157
|
-
threads = []
|
158
|
-
threads << PingService.new.run!
|
159
|
-
threads << PongService.new.run!
|
160
|
-
threads << ExcitementService.new.run!
|
161
|
-
|
162
|
-
threads.each(&:join)
|
148
|
+
p service.running? # => true
|
163
149
|
```
|
164
150
|
|
165
151
|
## Copyright
|
166
152
|
|
167
|
-
Copyright © 2012 Ryan Scott Lewis <
|
153
|
+
Copyright © 2012 Ryan Scott Lewis <ryanscottlewis@gmail.com>.
|
168
154
|
|
169
155
|
The MIT License (MIT) - See LICENSE for further details.
|
170
|
-
|
171
|
-
[message_queue]: http://en.wikipedia.org/wiki/Message_queue
|
172
|
-
[queue]: http://rubydoc.info/stdlib/thread/Queue
|
data/Rakefile
CHANGED
@@ -1,51 +1,9 @@
|
|
1
|
-
|
1
|
+
spec = eval(File.read('service.gemspec'))
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
yield
|
8
|
-
rescue LoadError
|
9
|
-
puts '', "Could not load '#{path}'.", 'Try to `rake gem:spec` and `bundle install` and try again.', ''
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
13
|
-
spec = Gem::Specification.new do |s|
|
14
|
-
|
15
|
-
# Variables
|
16
|
-
s.name = 'service'
|
17
|
-
s.author = 'Ryan Scott Lewis'
|
18
|
-
s.email = 'ryan@rynet.us'
|
19
|
-
s.summary = 'A basic implementation of a Service, which has a run loop can be start and stopped or run an a new Thread.'
|
20
|
-
s.description = 'Service encapsulates an object which executes a bit of code in a loop that can be started or stopped and query whether it is running or not.'
|
21
|
-
|
22
|
-
# Dependencies
|
23
|
-
s.add_dependency 'version', '~> 1.0'
|
24
|
-
s.add_development_dependency 'rake', '~> 10.0'
|
25
|
-
s.add_development_dependency 'guard-yard', '~> 2.0'
|
26
|
-
s.add_development_dependency 'rb-fsevent', '~> 0.9'
|
27
|
-
s.add_development_dependency 'redcarpet', '~> 2.2.2'
|
28
|
-
s.add_development_dependency 'github-markup', '~> 0.7'
|
29
|
-
|
30
|
-
# Pragmatically set variables
|
31
|
-
s.homepage = "http://github.com/RyanScottLewis/#{s.name}"
|
32
|
-
s.version = Pathname.glob('VERSION*').first.read
|
33
|
-
s.require_paths = ['lib']
|
34
|
-
s.files = `git ls-files`.lines.to_a.collect { |s| s.strip }
|
35
|
-
s.executables = `git ls-files -- bin/*`.lines.to_a.collect { |s| File.basename(s.strip) }
|
36
|
-
|
37
|
-
end
|
38
|
-
|
39
|
-
desc 'Generate the gemspec defined in this Rakefile'
|
40
|
-
task :gemspec do
|
41
|
-
Pathname.new("#{spec.name}.gemspec").open('w') { |f| f.write(spec.to_ruby) }
|
42
|
-
end
|
43
|
-
|
44
|
-
require_task 'rake/version_task' do
|
45
|
-
Rake::VersionTask.new do |t|
|
46
|
-
t.with_git_tag = true
|
47
|
-
t.with_gemspec = spec
|
48
|
-
end
|
3
|
+
require 'rake/version_task'
|
4
|
+
Rake::VersionTask.new do |t|
|
5
|
+
t.with_git_tag = true
|
6
|
+
t.with_gemspec = spec
|
49
7
|
end
|
50
8
|
|
51
9
|
require 'rubygems/package_task'
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.0.0
|
data/bin/rake
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
#
|
4
|
+
# This file was generated by Bundler.
|
5
|
+
#
|
6
|
+
# The application 'rake' is installed as part of a gem, and
|
7
|
+
# this file is here to facilitate running it.
|
8
|
+
#
|
9
|
+
|
10
|
+
require "pathname"
|
11
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
|
12
|
+
Pathname.new(__FILE__).realpath)
|
13
|
+
|
14
|
+
require "rubygems"
|
15
|
+
require "bundler/setup"
|
16
|
+
|
17
|
+
load Gem.bin_path("rake", "rake")
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'service'
|
2
|
+
|
3
|
+
# Generates the string "ping pong" asynchronously.
|
4
|
+
# Calls to `sleep 5` simulate computationally intensive work.
|
5
|
+
#
|
6
|
+
# Example of using the `#execute!` to execute a service in a new Thread.
|
7
|
+
# Should take ~5s (instead of ~10s)
|
8
|
+
|
9
|
+
class BaseService < Service
|
10
|
+
|
11
|
+
def initialize(buffer)
|
12
|
+
@buffer = buffer
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
class PingService < BaseService
|
18
|
+
|
19
|
+
def execute
|
20
|
+
sleep 5
|
21
|
+
|
22
|
+
@buffer[0] = 'ping'
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
class PongService < BaseService
|
28
|
+
|
29
|
+
def execute
|
30
|
+
sleep 5
|
31
|
+
|
32
|
+
@buffer[1] = 'pong'
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
|
38
|
+
buffer = []
|
39
|
+
threads = []
|
40
|
+
|
41
|
+
started_at = Time.now
|
42
|
+
|
43
|
+
threads << PingService.new(buffer).execute!
|
44
|
+
threads << PongService.new(buffer).execute!
|
45
|
+
|
46
|
+
threads.each(&:join)
|
47
|
+
|
48
|
+
result = buffer.join
|
49
|
+
|
50
|
+
puts "Done: '#{result}'"
|
51
|
+
puts "Took #{Time.now - started_at}s"
|
data/examples/queue.rb
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'service'
|
2
|
+
# require 'thread' # For the Queue class
|
3
|
+
|
4
|
+
# Running two services which transfer data to each other in a thread-safe manner.
|
5
|
+
#
|
6
|
+
# Example of using the `#run!` to execute a service's run loop in a new Thread.
|
7
|
+
|
8
|
+
class BaseService < Service
|
9
|
+
|
10
|
+
def initialize(queue)
|
11
|
+
@queue = queue
|
12
|
+
end
|
13
|
+
|
14
|
+
end
|
15
|
+
|
16
|
+
# A service which counts infinitely, adding each number to the queue.
|
17
|
+
class CountService < BaseService
|
18
|
+
|
19
|
+
def initialize(queue)
|
20
|
+
super
|
21
|
+
|
22
|
+
@count = 0
|
23
|
+
end
|
24
|
+
|
25
|
+
def execute
|
26
|
+
sleep rand(2) # Simulate computationally intensive work
|
27
|
+
@queue << @count # Add the current count to the queue
|
28
|
+
@count += 1 # Increment the count
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
# A service which pops all values off each value and prints it each cycle
|
34
|
+
class ReportService < BaseService
|
35
|
+
|
36
|
+
def execute
|
37
|
+
sleep 1 # Wait for a bit, to allow the queue to populate
|
38
|
+
puts(@queue.pop) until @queue.empty? # Until the queue is empty, pop a value off the queue and print it
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
threads = []
|
44
|
+
queue = Queue.new
|
45
|
+
|
46
|
+
threads << CountService.new(queue).run!
|
47
|
+
threads << ReportService.new(queue).run!
|
48
|
+
|
49
|
+
threads.each(&:join)
|
data/lib/service.rb
CHANGED
@@ -1,88 +1,74 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
# Service encapsulates an object which executes a bit of code in a loop
|
4
|
-
# that can be started or stopped and query whether it is running or not.
|
5
|
-
#
|
6
|
-
# Objects can subclass Service.
|
1
|
+
# Service encapsulates an object which executes a bit of code in a loop that can be started or stopped and query whether
|
2
|
+
# it is running or not.
|
7
3
|
class Service
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
#
|
4
|
+
|
5
|
+
VERSION = "2.0.0".freeze
|
6
|
+
|
7
|
+
# The instance methods to be mixed into a Service.
|
12
8
|
module Base
|
13
|
-
|
14
|
-
#
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
# @returns [true, false]
|
20
|
-
def stopped?
|
21
|
-
@_service_state == :stopped
|
22
|
-
end
|
23
|
-
|
24
|
-
# Query if the service is currently started.
|
25
|
-
#
|
26
|
-
# @returns [true, false]
|
27
|
-
def started?
|
28
|
-
@_service_state == :started
|
29
|
-
end
|
30
|
-
alias_method :running?, :started?
|
31
|
-
|
32
|
-
# The code that will be executed within the run loop.
|
33
|
-
# @abstract Subclass and override {#run} to implement a custom Service.
|
34
|
-
def execute
|
35
|
-
raise NotImplementedError
|
36
|
-
end
|
37
|
-
|
38
|
-
# Call the {#execute} method within a new Thread.
|
39
|
-
#
|
40
|
-
# @return [Thread]
|
41
|
-
def execute!
|
42
|
-
Thread.new { execute }
|
43
|
-
end
|
44
|
-
|
45
|
-
# Stop the run loop.
|
46
|
-
def stop
|
47
|
-
@_service_state = :stopped
|
48
|
-
end
|
49
|
-
|
50
|
-
# Start the run loop.
|
51
|
-
def start
|
52
|
-
@_service_state = :started
|
53
|
-
loop do
|
54
|
-
break if stopped?
|
55
|
-
execute
|
56
|
-
end
|
57
|
-
end
|
58
|
-
alias_method :run, :start
|
59
|
-
|
60
|
-
# Start the run loop in a new Thread.
|
61
|
-
#
|
62
|
-
# @return [Thread]
|
63
|
-
def start!
|
64
|
-
Thread.new { start }
|
65
|
-
end
|
66
|
-
alias_method :run!, :start!
|
67
|
-
|
9
|
+
|
10
|
+
# Query if the service is currently stopped.
|
11
|
+
#
|
12
|
+
# @return [Boolean]
|
13
|
+
def stopped?
|
14
|
+
@_service_state == :stopped
|
68
15
|
end
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
16
|
+
|
17
|
+
# Query if the service is currently started.
|
18
|
+
#
|
19
|
+
# @return [Boolean]
|
20
|
+
def started?
|
21
|
+
@_service_state == :started
|
22
|
+
end
|
23
|
+
alias_method :running?, :started?
|
24
|
+
|
25
|
+
# The code that will be executed within the run loop.
|
26
|
+
#
|
27
|
+
# @abstract Override {#execute} to implement a custom Service.
|
28
|
+
def execute
|
29
|
+
raise NotImplementedError
|
30
|
+
end
|
31
|
+
|
32
|
+
# Call the {#execute} method within a new Thread.
|
33
|
+
#
|
34
|
+
# @return [Thread]
|
35
|
+
def execute!
|
36
|
+
Thread.new { execute }
|
37
|
+
end
|
38
|
+
|
39
|
+
# Stop the run loop.
|
40
|
+
#
|
41
|
+
# @return [Symbol] The current state (`:stopped`).
|
42
|
+
def stop
|
43
|
+
@_service_state = :stopped
|
44
|
+
end
|
45
|
+
|
46
|
+
# Start the run loop.
|
47
|
+
#
|
48
|
+
# @return [Symbol] The current state (`:started`).
|
49
|
+
def start
|
50
|
+
@_service_state = :started
|
51
|
+
|
52
|
+
loop do
|
53
|
+
break if stopped?
|
54
|
+
|
55
|
+
execute
|
80
56
|
end
|
81
|
-
|
82
57
|
end
|
83
|
-
|
58
|
+
|
59
|
+
alias_method :run, :start
|
60
|
+
|
61
|
+
# Start the run loop in a new Thread.
|
62
|
+
#
|
63
|
+
# @return [Thread]
|
64
|
+
def start!
|
65
|
+
Thread.new { start }
|
66
|
+
end
|
67
|
+
|
68
|
+
alias_method :run!, :start!
|
69
|
+
|
84
70
|
end
|
85
|
-
|
71
|
+
|
86
72
|
include Base
|
87
|
-
|
73
|
+
|
88
74
|
end
|
data/service.gemspec
CHANGED
@@ -1,44 +1,19 @@
|
|
1
|
-
# -*- encoding: utf-8 -*-
|
2
|
-
|
3
1
|
Gem::Specification.new do |s|
|
4
|
-
|
5
|
-
s.
|
6
|
-
|
7
|
-
s.
|
8
|
-
s.
|
9
|
-
s.
|
10
|
-
s.description = "Service encapsulates an object which executes a bit of code in a loop that can be started or stopped and query whether it is running or not."
|
11
|
-
s.email = "ryan@rynet.us"
|
12
|
-
s.files = ["Gemfile", "LICENSE", "README.md", "Rakefile", "VERSION", "lib/service.rb", "service.gemspec"]
|
13
|
-
s.homepage = "http://github.com/RyanScottLewis/service"
|
14
|
-
s.require_paths = ["lib"]
|
15
|
-
s.rubygems_version = "1.8.24"
|
16
|
-
s.summary = "A basic implementation of a Service, which has a run loop can be start and stopped or run an a new Thread."
|
2
|
+
# Variables
|
3
|
+
s.name = 'service'
|
4
|
+
s.author = 'Ryan Scott Lewis'
|
5
|
+
s.email = 'ryanscottlewis@gmail.com'
|
6
|
+
s.summary = 'A basic implementation of a Service, which has a run loop can be start and stopped or run an a new Thread.'
|
7
|
+
s.description = 'Service encapsulates an object which executes a bit of code in a loop that can be started or stopped and query whether it is running or not.'
|
17
8
|
|
18
|
-
|
19
|
-
|
9
|
+
# Dependencies
|
10
|
+
s.add_development_dependency 'version', '~> 1.0'
|
11
|
+
s.add_development_dependency 'rake', '~> 10.0'
|
20
12
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
s.add_development_dependency(%q<github-markup>, ["~> 0.7"])
|
28
|
-
else
|
29
|
-
s.add_dependency(%q<version>, ["~> 1.0"])
|
30
|
-
s.add_dependency(%q<rake>, ["~> 10.0"])
|
31
|
-
s.add_dependency(%q<guard-yard>, ["~> 2.0"])
|
32
|
-
s.add_dependency(%q<rb-fsevent>, ["~> 0.9"])
|
33
|
-
s.add_dependency(%q<redcarpet>, ["~> 2.2.2"])
|
34
|
-
s.add_dependency(%q<github-markup>, ["~> 0.7"])
|
35
|
-
end
|
36
|
-
else
|
37
|
-
s.add_dependency(%q<version>, ["~> 1.0"])
|
38
|
-
s.add_dependency(%q<rake>, ["~> 10.0"])
|
39
|
-
s.add_dependency(%q<guard-yard>, ["~> 2.0"])
|
40
|
-
s.add_dependency(%q<rb-fsevent>, ["~> 0.9"])
|
41
|
-
s.add_dependency(%q<redcarpet>, ["~> 2.2.2"])
|
42
|
-
s.add_dependency(%q<github-markup>, ["~> 0.7"])
|
43
|
-
end
|
13
|
+
# Pragmatically set variables
|
14
|
+
s.homepage = "http://github.com/RyanScottLewis/#{s.name}"
|
15
|
+
s.version = File.read('VERSION')
|
16
|
+
s.require_paths = ['lib']
|
17
|
+
s.files = `git ls-files`.lines.to_a.collect { |s| s.strip }
|
18
|
+
s.executables = `git ls-files -- bin/*`.lines.to_a.collect { |s| File.basename(s.strip) }
|
44
19
|
end
|
metadata
CHANGED
@@ -1,116 +1,48 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
5
|
-
prerelease:
|
4
|
+
version: 2.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Ryan Scott Lewis
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2018-01-16 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: version
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- - ~>
|
17
|
+
- - "~>"
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '1.0'
|
22
|
-
type: :
|
20
|
+
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- - ~>
|
24
|
+
- - "~>"
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '1.0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- - ~>
|
31
|
+
- - "~>"
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '10.0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- - ~>
|
38
|
+
- - "~>"
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '10.0'
|
46
|
-
- !ruby/object:Gem::Dependency
|
47
|
-
name: guard-yard
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - ~>
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: '2.0'
|
54
|
-
type: :development
|
55
|
-
prerelease: false
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
|
-
requirements:
|
59
|
-
- - ~>
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '2.0'
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: rb-fsevent
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
|
-
requirements:
|
67
|
-
- - ~>
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '0.9'
|
70
|
-
type: :development
|
71
|
-
prerelease: false
|
72
|
-
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
|
-
requirements:
|
75
|
-
- - ~>
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: '0.9'
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
name: redcarpet
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
|
-
requirements:
|
83
|
-
- - ~>
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: 2.2.2
|
86
|
-
type: :development
|
87
|
-
prerelease: false
|
88
|
-
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ~>
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: 2.2.2
|
94
|
-
- !ruby/object:Gem::Dependency
|
95
|
-
name: github-markup
|
96
|
-
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
|
-
requirements:
|
99
|
-
- - ~>
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
version: '0.7'
|
102
|
-
type: :development
|
103
|
-
prerelease: false
|
104
|
-
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
|
-
requirements:
|
107
|
-
- - ~>
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '0.7'
|
110
41
|
description: Service encapsulates an object which executes a bit of code in a loop
|
111
42
|
that can be started or stopped and query whether it is running or not.
|
112
|
-
email:
|
113
|
-
executables:
|
43
|
+
email: ryanscottlewis@gmail.com
|
44
|
+
executables:
|
45
|
+
- rake
|
114
46
|
extensions: []
|
115
47
|
extra_rdoc_files: []
|
116
48
|
files:
|
@@ -119,34 +51,33 @@ files:
|
|
119
51
|
- README.md
|
120
52
|
- Rakefile
|
121
53
|
- VERSION
|
54
|
+
- bin/rake
|
55
|
+
- examples/ping_pong.rb
|
56
|
+
- examples/queue.rb
|
122
57
|
- lib/service.rb
|
123
58
|
- service.gemspec
|
124
59
|
homepage: http://github.com/RyanScottLewis/service
|
125
60
|
licenses: []
|
61
|
+
metadata: {}
|
126
62
|
post_install_message:
|
127
63
|
rdoc_options: []
|
128
64
|
require_paths:
|
129
65
|
- lib
|
130
66
|
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
-
none: false
|
132
67
|
requirements:
|
133
|
-
- -
|
68
|
+
- - ">="
|
134
69
|
- !ruby/object:Gem::Version
|
135
70
|
version: '0'
|
136
|
-
segments:
|
137
|
-
- 0
|
138
|
-
hash: 900928583881142489
|
139
71
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
|
-
none: false
|
141
72
|
requirements:
|
142
|
-
- -
|
73
|
+
- - ">="
|
143
74
|
- !ruby/object:Gem::Version
|
144
75
|
version: '0'
|
145
76
|
requirements: []
|
146
77
|
rubyforge_project:
|
147
|
-
rubygems_version:
|
78
|
+
rubygems_version: 2.6.11
|
148
79
|
signing_key:
|
149
|
-
specification_version:
|
80
|
+
specification_version: 4
|
150
81
|
summary: A basic implementation of a Service, which has a run loop can be start and
|
151
82
|
stopped or run an a new Thread.
|
152
83
|
test_files: []
|