timeoutable 1.0.0 → 1.1.1
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 +4 -4
- data/.circleci/config.yml +16 -96
- data/.gitignore +3 -0
- data/README.md +22 -11
- data/lib/timeoutable/version.rb +2 -2
- metadata +3 -6
- data/bin/publish_gemfury +0 -27
- data/bin/publish_git +0 -38
- data/bin/version +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ad233d8b2d5a20876944168d646cb9a22155e957d80ec64bab75519a31a9045
|
4
|
+
data.tar.gz: 8aec57768ce5c97592abbbdd67b975d2c8c89e3c821a0fb2e4f82e3b199da763
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07ba46ce4de024ac211a1fa6a2ff8f31bfe2e168ae17d24d81c6101ddb0f5aa3730b8fb99874271d60c9eaac5624ee9518315547c427446b6ff8f2541480b691
|
7
|
+
data.tar.gz: b6bf15103dcad57222df5bafd840d6dbbe61c7b82d9eb9e80e2a94da3b96f86bb2302e2308952316a7a52fd2a93a4daff7fa81290e7888e4178a1c9c52ef93c4
|
data/.circleci/config.yml
CHANGED
@@ -1,108 +1,28 @@
|
|
1
|
-
version: 2.1
|
1
|
+
version: 2.1
|
2
2
|
|
3
|
-
# Declare the orbs that we'll use in our config.
|
4
|
-
# read more about orbs: https://circleci.com/docs/2.0/using-orbs/
|
5
3
|
orbs:
|
6
4
|
ruby: circleci/ruby@1.0
|
7
|
-
|
8
|
-
jobs:
|
9
|
-
build: # our first job, named "build"
|
10
|
-
docker:
|
11
|
-
- image: cimg/ruby:2.7-node # use a tailored CircleCI docker image.
|
12
|
-
steps:
|
13
|
-
- checkout # pull down our git code.
|
14
|
-
- ruby/install-deps # use the ruby orb to install dependencies
|
15
|
-
environment:
|
16
|
-
|
17
|
-
publish-gemfury:
|
18
|
-
docker:
|
19
|
-
- image: cimg/ruby:2.7-node # this is our primary docker image, where step commands run.
|
20
|
-
environment:
|
21
|
-
BUNDLE_JOBS: "3"
|
22
|
-
BUNDLE_RETRY: "3"
|
23
|
-
RAILS_ENV: test
|
24
|
-
steps:
|
25
|
-
- checkout
|
26
|
-
- ruby/install-deps
|
27
|
-
- run:
|
28
|
-
name: Publish Gemfury
|
29
|
-
command: |
|
30
|
-
bin/publish_gemfury
|
31
|
-
publish-github:
|
32
|
-
docker:
|
33
|
-
- image: cimg/ruby:2.7-node # this is our primary docker image, where step commands run.
|
34
|
-
environment:
|
35
|
-
BUNDLE_JOBS: "3"
|
36
|
-
BUNDLE_RETRY: "3"
|
37
|
-
RAILS_ENV: test
|
38
|
-
steps:
|
39
|
-
- checkout
|
40
|
-
- ruby/install-deps
|
41
|
-
- run:
|
42
|
-
name: 'Get Go'
|
43
|
-
command: |
|
44
|
-
sudo apt-get update -qq
|
45
|
-
sudo apt-get -y --no-install-recommends install golang-go
|
46
|
-
- run:
|
47
|
-
name: 'Set Git stats'
|
48
|
-
command: |
|
49
|
-
git config user.name $GITHUB_USER
|
50
|
-
git config user.email $GITHUB_EMAIL
|
51
|
-
- run:
|
52
|
-
name: 'Download GHR'
|
53
|
-
command: |
|
54
|
-
curl -sSL https://github.com/tcnksm/ghr/releases/download/v0.13.0/ghr_v0.13.0_linux_amd64.tar.gz | tar xz -f - -C . ghr_v0.13.0_linux_amd64/ghr
|
55
|
-
mv ghr_v0.13.0_linux_amd64/ghr .
|
56
|
-
rm -rf ghr_v0.13.0_linux_amd64
|
57
|
-
chmod 0755 ghr
|
58
|
-
- run:
|
59
|
-
name: Publish Git
|
60
|
-
command: |
|
61
|
-
export GHRLOCATION=ghr
|
62
|
-
bin/publish_git
|
63
|
-
test:
|
64
|
-
docker:
|
65
|
-
- image: cimg/ruby:2.7-node
|
66
|
-
- image: circleci/redis:latest
|
67
|
-
environment:
|
68
|
-
BUNDLE_JOBS: "3"
|
69
|
-
BUNDLE_RETRY: "3"
|
70
|
-
RAILS_ENV: test
|
71
|
-
# A series of steps to run, some are similar to those in "build".
|
72
|
-
steps:
|
73
|
-
- checkout
|
74
|
-
- ruby/install-deps
|
75
|
-
- run:
|
76
|
-
name: Setup Climate Control test-reporter
|
77
|
-
command: |
|
78
|
-
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
79
|
-
chmod +x ./cc-test-reporter
|
80
|
-
- run:
|
81
|
-
name: Run le tests
|
82
|
-
command: |
|
83
|
-
./cc-test-reporter before-build
|
84
|
-
SIMPLE_COV_RUN=true bundle exec rspec --format RspecJunitFormatter --out test-results/rspec/rspec.xml --format progress --color
|
85
|
-
./cc-test-reporter after-build format-coverage -t simplecov
|
5
|
+
cst: cst/framework@1
|
86
6
|
|
87
7
|
workflows:
|
88
8
|
version: 2
|
89
9
|
yeet-le-jobs:
|
90
10
|
jobs:
|
91
|
-
-
|
92
|
-
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
- publish-gemfury:
|
11
|
+
- cst/enforce-gem-version-bump
|
12
|
+
- cst/rspec-ruby:
|
13
|
+
rspec-system-args: "SIMPLE_COV_RUN=true"
|
14
|
+
cc-report-collect-ruby: "2.7.5"
|
15
|
+
matrix:
|
16
|
+
parameters:
|
17
|
+
ruby-version: ["2.7.5" , "3.0.0", "3.0.3"]
|
18
|
+
alias: required-matrix-tests
|
19
|
+
name: test-ruby<< matrix.ruby-version >>
|
20
|
+
- cst/publish-gem:
|
21
|
+
publish-git: true
|
22
|
+
publish-default-gem: true
|
104
23
|
requires:
|
105
|
-
-
|
24
|
+
- required-matrix-tests
|
25
|
+
- cst/enforce-gem-version-bump
|
106
26
|
filters:
|
107
27
|
branches:
|
108
28
|
only:
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,15 +1,11 @@
|
|
1
1
|
# Timeoutable
|
2
2
|
|
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/timeoutable`. 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
|
6
|
-
|
7
3
|
## Installation
|
8
4
|
|
9
5
|
Add this line to your application's Gemfile:
|
10
6
|
|
11
7
|
```ruby
|
12
|
-
gem 'timeoutable'
|
8
|
+
gem 'timeoutable', source: 'https://github.com/matt-taylor/timeoutable'
|
13
9
|
```
|
14
10
|
|
15
11
|
And then execute:
|
@@ -22,17 +18,32 @@ Or install it yourself as:
|
|
22
18
|
|
23
19
|
## Usage
|
24
20
|
|
25
|
-
|
21
|
+
Take a looke at the [TestableKlass](https://github.com/matt-taylor/timeoutable/blob/main/lib/timeoutable/testable_klass.rb) for complete example.
|
26
22
|
|
27
|
-
## Development
|
28
23
|
|
29
|
-
|
24
|
+
```ruby
|
25
|
+
params = {
|
26
|
+
warn: 10, # this can be a float
|
27
|
+
timeout: 15, # this can be a float
|
28
|
+
proc: ->(thread, seconds_elapsed) { thread[BIT_NAME] = 1 }, # proc to call after ${warn} seconds -- passes the original thread and the seconds that have elapsed
|
29
|
+
message: "Error message",
|
30
|
+
}
|
31
|
+
|
32
|
+
Timeoutable.timeout(**params) do
|
33
|
+
# code wrapped in a timeout
|
34
|
+
end
|
35
|
+
```
|
36
|
+
|
37
|
+
### How this works
|
38
|
+
After `warn` seconds have elapsed, `Timoutable` will call the `proc`. In the example, the `proc` will set a bit in the thread. However, you can choose any method of communication to gracefully shutdown.
|
39
|
+
|
40
|
+
## Development
|
30
41
|
|
31
|
-
|
42
|
+
After checking out the repo, run `make bash` to install dependencies and build a container. Then, run `bundle exec rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
32
43
|
|
33
44
|
## Contributing
|
34
45
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
46
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/matt-taylor/timeoutable. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/matt-taylor/timeoutable/blob/main/CODE_OF_CONDUCT.md).
|
36
47
|
|
37
48
|
## License
|
38
49
|
|
@@ -40,4 +51,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
40
51
|
|
41
52
|
## Code of Conduct
|
42
53
|
|
43
|
-
Everyone interacting in the Timeoutable project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
54
|
+
Everyone interacting in the Timeoutable project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/matt-taylor/timeoutable/blob/main/CODE_OF_CONDUCT.md).
|
data/lib/timeoutable/version.rb
CHANGED
@@ -2,8 +2,8 @@
|
|
2
2
|
|
3
3
|
module Timeoutable
|
4
4
|
MAJOR = 1 # With backwards incompatability. Requires annoucment and update documentation
|
5
|
-
MINOR =
|
6
|
-
PATCH =
|
5
|
+
MINOR = 1 # With feature launch. Documentation of upgrade is useful via a changelog
|
6
|
+
PATCH = 1 # With minor upgrades or patcing a small bug. No changelog necessary
|
7
7
|
VERSION = [MAJOR,MINOR,PATCH].join('.')
|
8
8
|
|
9
9
|
def self.get_version
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timeoutable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Taylor
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: timeout
|
@@ -45,10 +45,7 @@ files:
|
|
45
45
|
- README.md
|
46
46
|
- Rakefile
|
47
47
|
- bin/console
|
48
|
-
- bin/publish_gemfury
|
49
|
-
- bin/publish_git
|
50
48
|
- bin/setup
|
51
|
-
- bin/version
|
52
49
|
- docker-compose.yml
|
53
50
|
- lib/timeoutable.rb
|
54
51
|
- lib/timeoutable/testable_klass.rb
|
@@ -74,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
74
71
|
- !ruby/object:Gem::Version
|
75
72
|
version: '0'
|
76
73
|
requirements: []
|
77
|
-
rubygems_version: 3.2.
|
74
|
+
rubygems_version: 3.2.32
|
78
75
|
signing_key:
|
79
76
|
specification_version: 4
|
80
77
|
summary: Extension of Ruby's Timeout::timeout method
|
data/bin/publish_gemfury
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
#!/bin/bash -e
|
2
|
-
|
3
|
-
if [ -z "$GEMFURY_TOKEN" ]; then
|
4
|
-
echo 'Environment variable GEMFURY_TOKEN is not present'
|
5
|
-
exit 1
|
6
|
-
fi
|
7
|
-
|
8
|
-
VERSION=$(bin/version)
|
9
|
-
PACKAGE=timeoutable-${VERSION}.gem
|
10
|
-
|
11
|
-
# if [ $(git tag -l "$VERSION") ]; then
|
12
|
-
# echo "Pre existing version $VERSION, not tagging."
|
13
|
-
# echo "Pre existing version $VERSION, not pushing to gemfury."
|
14
|
-
# exit 0
|
15
|
-
# fi
|
16
|
-
|
17
|
-
# Build and publish to Gemfury
|
18
|
-
gem build timeoutable.gemspec
|
19
|
-
FILE=$(pwd)/${PACKAGE}
|
20
|
-
echo "Finished building $FILE"
|
21
|
-
|
22
|
-
# push to gemfury
|
23
|
-
curl --fail -F package=@${FILE} https://${GEMFURY_TOKEN}@push.fury.io/${GEMFURY_USER}/
|
24
|
-
echo "Finished Pushing to Gemfury"
|
25
|
-
|
26
|
-
# start fresh
|
27
|
-
rm timeoutable.gemspec
|
data/bin/publish_git
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
#!/bin/bash -e
|
2
|
-
|
3
|
-
if [ -z "$GITHUB_TOKEN" ]; then
|
4
|
-
echo 'Environment variable GITHUB_TOKEN is not present'
|
5
|
-
exit 1
|
6
|
-
fi
|
7
|
-
|
8
|
-
if [ -z "$GITHUB_USER" ]; then
|
9
|
-
echo 'Environment variable GITHUB_USER is not present'
|
10
|
-
exit 1
|
11
|
-
fi
|
12
|
-
|
13
|
-
|
14
|
-
VERSION=$(bin/version)
|
15
|
-
PACKAGE=timeoutable-${VERSION}.gem
|
16
|
-
|
17
|
-
# if [ $(git tag -l "$VERSION") ]; then
|
18
|
-
# echo "Pre existing version $VERSION, not tagging."
|
19
|
-
# exit 0
|
20
|
-
# fi
|
21
|
-
|
22
|
-
gem build timeoutable.gemspec
|
23
|
-
FILE=$(pwd)/${PACKAGE}
|
24
|
-
echo "Finished building $FILE"
|
25
|
-
|
26
|
-
# create tag in repo
|
27
|
-
git tag -a $VERSION -m "$VERSION"
|
28
|
-
git push https://${GITHUB_TOKEN}@github.com/${GITHUB_USER}/timeoutable.git $VERSION
|
29
|
-
echo "Finished Tagging to git"
|
30
|
-
|
31
|
-
|
32
|
-
# send artifacts to git
|
33
|
-
SHA=$(git rev-parse HEAD)
|
34
|
-
./$GHRLOCATION -soft -t ${GITHUB_TOKEN} -u ${GITHUB_USER} -r timeoutable -c ${SHA} ${VERSION} *.gem
|
35
|
-
echo "Finished Pushing artificat to Git"
|
36
|
-
|
37
|
-
# start fresh
|
38
|
-
rm timeoutable.gemspec
|