tlopo-executor 0.1.0 → 0.1.2
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 +5 -5
- data/.travis.yml +1 -2
- data/Jenkinsfile +29 -0
- data/README.md +49 -18
- data/lib/tlopo/executor/version.rb +1 -1
- data/lib/tlopo/executor.rb +8 -0
- data/tlopo-executor.gemspec +5 -3
- metadata +40 -16
- data/bin/console +0 -14
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b1411b6a13911a2a8df003ef71181ea9d92fa58b2e4b6980001baa3afd7bcd99
|
4
|
+
data.tar.gz: 33649c55d00ea775919a656f0ff3b5a03791d7dd37efb40b54658af1554e5565
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e475a6e0b7155c43e818b418cbdea2b6e46d17dbba24887f7a4e4b243fcc5b11ace7d2e0cf590459bd7990c9b84e5f850ca9b9afa0ca252f4d5527e0ea160eb
|
7
|
+
data.tar.gz: 277af903b752e4fda58987645dc9ddb331242575fbdb8a490b8be5107539764a05557e00e4298d009818d5508a7d3d37f57dc34da3a2d6ee0d2601a2a84bf006
|
data/.travis.yml
CHANGED
data/Jenkinsfile
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
pipeline {
|
2
|
+
agent {
|
3
|
+
kubernetes {
|
4
|
+
yaml """
|
5
|
+
apiVersion: v1
|
6
|
+
kind: Pod
|
7
|
+
metadata:
|
8
|
+
labels:
|
9
|
+
some-label: some-label-value
|
10
|
+
spec:
|
11
|
+
containers:
|
12
|
+
- name: rubyci
|
13
|
+
image: ruby:2.5
|
14
|
+
command:
|
15
|
+
- cat
|
16
|
+
tty: true
|
17
|
+
"""
|
18
|
+
}
|
19
|
+
}
|
20
|
+
stages {
|
21
|
+
stage('Run tests') {
|
22
|
+
steps {
|
23
|
+
container('rubyci') {
|
24
|
+
sh 'bundle install && rake test'
|
25
|
+
}
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
}
|
data/README.md
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
-
#
|
1
|
+
# tlopo-executor
|
2
|
+
[](http://badge.fury.io/rb/tlopo-executor)
|
3
|
+
[](https://travis-ci.org/tlopo-ruby/tlopo-executor)
|
4
|
+
[](https://codeclimate.com/github/tlopo-ruby/tlopo-executor)
|
5
|
+
[](https://gemnasium.com/tlopo-ruby/tlopo-executor)
|
6
|
+
[](https://coveralls.io/github/tlopo-ruby/tlopo-executor?branch=master)
|
2
7
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
8
|
+
A simple Executor service aka Threadpool executor
|
6
9
|
|
7
10
|
## Installation
|
8
11
|
|
@@ -14,30 +17,58 @@ gem 'tlopo-executor'
|
|
14
17
|
|
15
18
|
And then execute:
|
16
19
|
|
17
|
-
|
20
|
+
```Bash
|
21
|
+
bundle
|
22
|
+
```
|
18
23
|
|
19
24
|
Or install it yourself as:
|
20
25
|
|
21
|
-
|
26
|
+
```Bash
|
27
|
+
gem install tlopo-executor
|
28
|
+
```
|
22
29
|
|
23
30
|
## Usage
|
24
31
|
|
25
|
-
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
32
|
+
Simple usage
|
30
33
|
|
31
|
-
|
34
|
+
```ruby
|
35
|
+
require 'tlopo/executor'
|
36
|
+
require 'socket'
|
37
|
+
require 'timeout'
|
38
|
+
|
39
|
+
exec = Tlopo::Executor.new
|
40
|
+
|
41
|
+
['80','443','22'].each do |port|
|
42
|
+
exec.schedule(
|
43
|
+
proc do
|
44
|
+
begin
|
45
|
+
Timeout.timeout(1){TCPSocket.new('www.google.co.uk', port ).close}
|
46
|
+
rescue
|
47
|
+
raise "Port #{port} is not open"
|
48
|
+
end
|
49
|
+
end
|
50
|
+
)
|
51
|
+
end
|
52
|
+
errors = exec.run.errors
|
53
|
+
p errors unless exec.success?
|
54
|
+
```
|
32
55
|
|
33
56
|
## Contributing
|
34
57
|
|
35
|
-
|
36
|
-
|
37
|
-
|
58
|
+
1. Fork it ( https://github.com/[my-github-username]/kubeclient/fork )
|
59
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
60
|
+
3. Test your changes with `rake test rubocop`, add new tests if needed.
|
61
|
+
4. If you added a new functionality, add it to README
|
62
|
+
5. Commit your changes (`git commit -am 'Add some feature'`)
|
63
|
+
6. Push to the branch (`git push origin my-new-feature`)
|
64
|
+
7. Create a new Pull Request
|
38
65
|
|
39
|
-
|
66
|
+
## Tests
|
40
67
|
|
41
|
-
|
68
|
+
This library is tested with Minitest.
|
69
|
+
Please run all tests before submitting a Pull Request, and add new tests for new functionality.
|
42
70
|
|
43
|
-
|
71
|
+
Running tests:
|
72
|
+
```ruby
|
73
|
+
rake test
|
74
|
+
```
|
data/lib/tlopo/executor.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require 'tlopo/executor/version'
|
2
|
+
require 'logger'
|
2
3
|
|
3
4
|
module Tlopo
|
5
|
+
LOGGER ||= Logger.new $stderr
|
4
6
|
# Simple Executor service aka threadpool executor
|
5
7
|
class Executor
|
6
8
|
def initialize(size = 10)
|
@@ -25,6 +27,12 @@ module Tlopo
|
|
25
27
|
self
|
26
28
|
end
|
27
29
|
|
30
|
+
def run_or_die
|
31
|
+
run
|
32
|
+
errors.each {|e| LOGGER.error e }
|
33
|
+
raise 'Found error(s)' unless errors.empty?
|
34
|
+
end
|
35
|
+
|
28
36
|
def success?
|
29
37
|
@error.empty?
|
30
38
|
end
|
data/tlopo-executor.gemspec
CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
|
|
17
17
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
18
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
19
|
if spec.respond_to?(:metadata)
|
20
|
-
#spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
20
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
21
|
else
|
22
22
|
raise 'RubyGems 2.0 or newer is required to protect against ' \
|
23
23
|
'public gem pushes.'
|
@@ -30,7 +30,9 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
31
31
|
spec.require_paths = ['lib']
|
32
32
|
|
33
|
-
spec.add_development_dependency('bundler', '~>
|
33
|
+
spec.add_development_dependency('bundler', '~> 2.4')
|
34
34
|
spec.add_development_dependency('minitest', '~> 5.0')
|
35
|
-
spec.add_development_dependency('
|
35
|
+
spec.add_development_dependency('simplecov', '~> 0.22')
|
36
|
+
spec.add_development_dependency('rake', '~> 13.0')
|
37
|
+
spec.add_development_dependency('rubocop', '~> 1.6')
|
36
38
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tlopo-executor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tiago Lopo
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.4'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.4'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: minitest
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -38,26 +38,52 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '5.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: simplecov
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.22'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0.22'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rake
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
61
|
+
version: '13.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '13.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.6'
|
48
76
|
type: :development
|
49
77
|
prerelease: false
|
50
78
|
version_requirements: !ruby/object:Gem::Requirement
|
51
79
|
requirements:
|
52
80
|
- - "~>"
|
53
81
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
82
|
+
version: '1.6'
|
55
83
|
description: A simple executor service aka threadpool executor
|
56
84
|
email:
|
57
85
|
- tiagolopo@yahoo.com.br
|
58
|
-
executables:
|
59
|
-
- console
|
60
|
-
- setup
|
86
|
+
executables: []
|
61
87
|
extensions: []
|
62
88
|
extra_rdoc_files: []
|
63
89
|
files:
|
@@ -66,11 +92,10 @@ files:
|
|
66
92
|
- ".travis.yml"
|
67
93
|
- CODE_OF_CONDUCT.md
|
68
94
|
- Gemfile
|
95
|
+
- Jenkinsfile
|
69
96
|
- LICENSE.txt
|
70
97
|
- README.md
|
71
98
|
- Rakefile
|
72
|
-
- bin/console
|
73
|
-
- bin/setup
|
74
99
|
- exe/tlopo-executor
|
75
100
|
- lib/tlopo/executor.rb
|
76
101
|
- lib/tlopo/executor/version.rb
|
@@ -79,7 +104,7 @@ homepage: https://github.com/tlopo-ruby/tlopo-executor
|
|
79
104
|
licenses:
|
80
105
|
- MIT
|
81
106
|
metadata: {}
|
82
|
-
post_install_message:
|
107
|
+
post_install_message:
|
83
108
|
rdoc_options: []
|
84
109
|
require_paths:
|
85
110
|
- lib
|
@@ -94,9 +119,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
119
|
- !ruby/object:Gem::Version
|
95
120
|
version: '0'
|
96
121
|
requirements: []
|
97
|
-
|
98
|
-
|
99
|
-
signing_key:
|
122
|
+
rubygems_version: 3.4.10
|
123
|
+
signing_key:
|
100
124
|
specification_version: 4
|
101
125
|
summary: A simple executor service aka threadpool executor
|
102
126
|
test_files: []
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'bundler/setup'
|
4
|
-
require 'tlopo/executor'
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require 'irb'
|
14
|
-
IRB.start(__FILE__)
|