tlopo-executor 0.1.0 → 0.1.2

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
- SHA1:
3
- metadata.gz: f0fd73ecc5966518ca878a8cc0f592718ecf924c
4
- data.tar.gz: 3257c2173a968f29c9f0d75ea415a120f5598686
2
+ SHA256:
3
+ metadata.gz: b1411b6a13911a2a8df003ef71181ea9d92fa58b2e4b6980001baa3afd7bcd99
4
+ data.tar.gz: 33649c55d00ea775919a656f0ff3b5a03791d7dd37efb40b54658af1554e5565
5
5
  SHA512:
6
- metadata.gz: 7014eec89db667bb0302c677bea2743c26208f2c4fe4ba9a9e3d48ee1aa5e454ac1a46d8de16935068f4d43c2020eea7218a48b9e00952a38452d00e70696e80
7
- data.tar.gz: 9121477c86792c451156df5044a38b37a9e53f09ac8fb5f856a4cbf13fd5508146ca5bef4706518c8b774ef1d3ee604af9275c631b4c5686444224217ef2facf
6
+ metadata.gz: 2e475a6e0b7155c43e818b418cbdea2b6e46d17dbba24887f7a4e4b243fcc5b11ace7d2e0cf590459bd7990c9b84e5f850ca9b9afa0ca252f4d5527e0ea160eb
7
+ data.tar.gz: 277af903b752e4fda58987645dc9ddb331242575fbdb8a490b8be5107539764a05557e00e4298d009818d5508a7d3d37f57dc34da3a2d6ee0d2601a2a84bf006
data/.travis.yml CHANGED
@@ -8,5 +8,4 @@ sudo: false
8
8
  cache: bundler
9
9
  script: bundle exec rake $TASK
10
10
  env:
11
- - TASK=test
12
- - TASK=rubocop
11
+ - TASK=test_with_coveralls
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
- # Tlopo::Executor
1
+ # tlopo-executor
2
+ [![Gem Version](https://badge.fury.io/rb/tlopo-executor.svg)](http://badge.fury.io/rb/tlopo-executor)
3
+ [![Build Status](https://travis-ci.org/tlopo-ruby/tlopo-executor.svg?branch=master)](https://travis-ci.org/tlopo-ruby/tlopo-executor)
4
+ [![Code Climate](https://codeclimate.com/github/tlopo-ruby/tlopo-executor/badges/gpa.svg)](https://codeclimate.com/github/tlopo-ruby/tlopo-executor)
5
+ [![Dependency Status](https://gemnasium.com/tlopo-ruby/tlopo-executor.svg)](https://gemnasium.com/tlopo-ruby/tlopo-executor)
6
+ [![Coverage Status](https://coveralls.io/repos/github/tlopo-ruby/tlopo-executor/badge.svg?branch=master)](https://coveralls.io/github/tlopo-ruby/tlopo-executor?branch=master)
2
7
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/tlopo/executor`. To experiment with that code, run `bin/console` for an interactive prompt.
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
- $ bundle
20
+ ```Bash
21
+ bundle
22
+ ```
18
23
 
19
24
  Or install it yourself as:
20
25
 
21
- $ gem install tlopo-executor
26
+ ```Bash
27
+ gem install tlopo-executor
28
+ ```
22
29
 
23
30
  ## Usage
24
31
 
25
- TODO: Write usage instructions here
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
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
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
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/tlopo-executor. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
-
37
- ## License
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
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
66
+ ## Tests
40
67
 
41
- ## Code of Conduct
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
- Everyone interacting in the Tlopo::Executor project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/tlopo-executor/blob/master/CODE_OF_CONDUCT.md).
71
+ Running tests:
72
+ ```ruby
73
+ rake test
74
+ ```
@@ -1,5 +1,5 @@
1
1
  module Tlopo
2
2
  class Executor
3
- VERSION = '0.1.0'.freeze
3
+ VERSION = '0.1.2'.freeze
4
4
  end
5
5
  end
@@ -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
@@ -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', '~> 1.15')
33
+ spec.add_development_dependency('bundler', '~> 2.4')
34
34
  spec.add_development_dependency('minitest', '~> 5.0')
35
- spec.add_development_dependency('rake', '~> 10.0')
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.0
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: 2018-01-13 00:00:00.000000000 Z
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: '1.15'
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: '1.15'
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: '10.0'
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: '10.0'
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
- rubyforge_project:
98
- rubygems_version: 2.6.13
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__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here