always 0.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 95841105f15ff9ce3bbaf1e683874442ac7b6001470cbb001800461bdbfcac08
4
+ data.tar.gz: 2bd3f82bd21442bbb0649e6178855cb3a92655e1de9092e8428efeada20eb824
5
+ SHA512:
6
+ metadata.gz: 72fcd1877695615e951d78a68caaece60904ac76c6668a80fb4d7f00a5f23514b575ef1499c9fef57e3162368df7b96a3df5280eb531469339a7f5fdaedbb6ce
7
+ data.tar.gz: d11c2fc0c61a531dfb20826b9daa760c4da5f214f030a2024086e9b23367acaf3e98c4d6ffebf009986b85cc78557e296ffd752d630b77679d4e29f1dfd233e8
data/.0pdd.yml ADDED
@@ -0,0 +1,22 @@
1
+ # Copyright (c) 2024 Yegor Bugayenko
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the 'Software'), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all
11
+ # copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ # SOFTWARE.
20
+ ---
21
+ errors:
22
+ - yegor256@gmail.com
data/.gitattributes ADDED
@@ -0,0 +1,7 @@
1
+ # Check out all text files in UNIX format, with LF as end of line
2
+ # Don't change this file. If you have any ideas about it, please
3
+ # submit a separate issue about it and we'll discuss.
4
+
5
+ * text=auto eol=lf
6
+ *.java ident
7
+ *.xml ident
@@ -0,0 +1,41 @@
1
+ # Copyright (c) 2024 Yegor Bugayenko
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the 'Software'), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all
11
+ # copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ # SOFTWARE.
20
+ ---
21
+ name: actionlint
22
+ 'on':
23
+ push:
24
+ branches:
25
+ - master
26
+ pull_request:
27
+ branches:
28
+ - master
29
+ jobs:
30
+ actionlint:
31
+ runs-on: ubuntu-22.04
32
+ steps:
33
+ - uses: actions/checkout@v4
34
+ - name: Download actionlint
35
+ id: get_actionlint
36
+ # yamllint disable-line rule:line-length
37
+ run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
38
+ shell: bash
39
+ - name: Check workflow files
40
+ run: ${{ steps.get_actionlint.outputs.executable }} -color
41
+ shell: bash
@@ -0,0 +1,39 @@
1
+ # Copyright (c) 2024 Yegor Bugayenko
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the 'Software'), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all
11
+ # copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ # SOFTWARE.
20
+ ---
21
+ name: codecov
22
+ 'on':
23
+ push:
24
+ branches:
25
+ - master
26
+ jobs:
27
+ codecov:
28
+ runs-on: ubuntu-22.04
29
+ steps:
30
+ - uses: actions/checkout@v4
31
+ - uses: ruby/setup-ruby@v1
32
+ with:
33
+ ruby-version: 3.2
34
+ bundler-cache: true
35
+ - run: bundle install
36
+ - run: bundle exec rake
37
+ - uses: codecov/codecov-action@v4.0.0-beta.3
38
+ with:
39
+ token: ${{ secrets.CODECOV_TOKEN }}
@@ -0,0 +1,57 @@
1
+ # Copyright (c) 2024 Yegor Bugayenko
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the 'Software'), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all
11
+ # copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ # SOFTWARE.
20
+ ---
21
+ name: license
22
+ 'on':
23
+ push:
24
+ branches:
25
+ - master
26
+ pull_request:
27
+ branches:
28
+ - master
29
+ jobs:
30
+ license:
31
+ runs-on: ubuntu-22.04
32
+ steps:
33
+ - uses: actions/checkout@v4
34
+ - shell: bash
35
+ run: |
36
+ header="Copyright (c) $(date +%Y) Yegor Bugayenko"
37
+ failed="false"
38
+ while IFS= read -r file; do
39
+ if ! grep -q "${header}" "${file}"; then
40
+ failed="true"
41
+ echo "⚠️ Copyright header is not found in: ${file}"
42
+ else
43
+ echo "File looks good: ${file}"
44
+ fi
45
+ done < <(find . -type f \( \
46
+ -name "Dockerfile" -o \
47
+ -name "LICENSE.txt" -o \
48
+ -name "Makefile" -o \
49
+ -name "Rakefile" -o \
50
+ -name "*.sh" -o \
51
+ -name "*.rb" -o \
52
+ -name "*.fe" -o \
53
+ -name "*.yml" \
54
+ \) -print)
55
+ if [ "${failed}" = "true" ]; then
56
+ exit 1
57
+ fi
@@ -0,0 +1,38 @@
1
+ # Copyright (c) 2024 Yegor Bugayenko
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the 'Software'), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all
11
+ # copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ # SOFTWARE.
20
+ ---
21
+ name: markdown-lint
22
+ 'on':
23
+ push:
24
+ branches:
25
+ - master
26
+ pull_request:
27
+ branches:
28
+ - master
29
+ paths-ignore: ['paper/**', 'sandbox/**']
30
+ concurrency:
31
+ group: markdown-lint-${{ github.ref }}
32
+ cancel-in-progress: true
33
+ jobs:
34
+ markdown-lint:
35
+ runs-on: ubuntu-22.04
36
+ steps:
37
+ - uses: actions/checkout@v4
38
+ - uses: articulate/actions-markdownlint@v1
@@ -0,0 +1,34 @@
1
+ # Copyright (c) 2024 Yegor Bugayenko
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the 'Software'), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all
11
+ # copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ # SOFTWARE.
20
+ ---
21
+ name: pdd
22
+ on:
23
+ push:
24
+ branches:
25
+ - master
26
+ pull_request:
27
+ branches:
28
+ - master
29
+ jobs:
30
+ pdd:
31
+ runs-on: ubuntu-22.04
32
+ steps:
33
+ - uses: actions/checkout@v4
34
+ - uses: volodya-lombrozo/pdd-action@master
@@ -0,0 +1,44 @@
1
+ # Copyright (c) 2024 Yegor Bugayenko
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the 'Software'), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all
11
+ # copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ # SOFTWARE.
20
+ ---
21
+ name: rake
22
+ on:
23
+ push:
24
+ branches:
25
+ - master
26
+ pull_request:
27
+ branches:
28
+ - master
29
+ jobs:
30
+ rake:
31
+ name: test
32
+ strategy:
33
+ matrix:
34
+ os: [ubuntu-20.04, macos-12, windows-2022]
35
+ ruby: [3.2]
36
+ runs-on: ${{ matrix.os }}
37
+ steps:
38
+ - uses: actions/checkout@v4
39
+ - uses: ruby/setup-ruby@v1
40
+ with:
41
+ ruby-version: ${{ matrix.ruby }}
42
+ bundler-cache: true
43
+ - run: bundle install
44
+ - run: bundle exec rake
@@ -0,0 +1,30 @@
1
+ # Copyright (c) 2024 Yegor Bugayenko
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the 'Software'), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all
11
+ # copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ # SOFTWARE.
20
+ ---
21
+ name: xcop
22
+ on:
23
+ push:
24
+ pull_request:
25
+ jobs:
26
+ xcop:
27
+ runs-on: ubuntu-22.04
28
+ steps:
29
+ - uses: actions/checkout@v4
30
+ - uses: g4s8/xcop-action@master
@@ -0,0 +1,34 @@
1
+ # Copyright (c) 2024 Yegor Bugayenko
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the 'Software'), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all
11
+ # copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ # SOFTWARE.
20
+ ---
21
+ name: yamllint
22
+ 'on':
23
+ push:
24
+ branches:
25
+ - master
26
+ pull_request:
27
+ branches:
28
+ - master
29
+ jobs:
30
+ yamllint:
31
+ runs-on: ubuntu-22.04
32
+ steps:
33
+ - uses: actions/checkout@v4
34
+ - uses: ibiqlik/action-yamllint@v3
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ coverage/
2
+ .idea/
3
+ *.gem
4
+ .bundle/
5
+ .DS_Store
6
+ rdoc/
7
+ doc/
8
+ .yardoc/
9
+ temp/
data/.pdd ADDED
@@ -0,0 +1,7 @@
1
+ --source=.
2
+ --verbose
3
+ --exclude target/**/*
4
+ --exclude coverage/**/*
5
+ --rule min-words:20
6
+ --rule min-estimate:15
7
+ --rule max-estimate:90
data/.rubocop.yml ADDED
@@ -0,0 +1,29 @@
1
+ # Copyright (c) 2024 Yegor Bugayenko
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the 'Software'), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all
11
+ # copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ # SOFTWARE.
20
+ ---
21
+ AllCops:
22
+ Exclude:
23
+ - 'bin/**/*'
24
+ - 'assets/**/*'
25
+ - 'vendor/**/*'
26
+ DisplayCopNames: true
27
+ TargetRubyVersion: 3.2
28
+ SuggestExtensions: false
29
+ NewCops: enable
data/.rultor.yml ADDED
@@ -0,0 +1,44 @@
1
+ # Copyright (c) 2024 Yegor Bugayenko
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the 'Software'), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in all
11
+ # copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ # SOFTWARE.
20
+ ---
21
+ docker:
22
+ image: yegor256/rultor-image:1.23.1
23
+ assets:
24
+ rubygems.yml: yegor256/home#assets/rubygems.yml
25
+ install: |
26
+ pdd -f /dev/null
27
+ bundle install --no-color
28
+ release:
29
+ pre: false
30
+ script: |-
31
+ [[ "${tag}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || exit -1
32
+ bundle exec rake
33
+ rm -rf *.gem
34
+ sed -i "s/0\.0\.0/${tag}/g" always.gemspec
35
+ git add always.gemspec
36
+ sed -i "s/0\.0\.0/${tag}/g" lib/always.rb
37
+ git add lib/always.rb
38
+ git commit -m "version set to ${tag}"
39
+ gem build always.gemspec
40
+ chmod 0600 ../rubygems.yml
41
+ gem push *.gem --config-file ../rubygems.yml
42
+ merge:
43
+ script: |-
44
+ bundle exec rake
data/.simplecov ADDED
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ #
4
+ # Copyright (c) 2024 Yegor Bugayenko
5
+ #
6
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ # of this software and associated documentation files (the 'Software'), to deal
8
+ # in the Software without restriction, including without limitation the rights
9
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ # copies of the Software, and to permit persons to whom the Software is
11
+ # furnished to do so, subject to the following conditions:
12
+ #
13
+ # The above copyright notice and this permission notice shall be included in all
14
+ # copies or substantial portions of the Software.
15
+ #
16
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ # SOFTWARE.
23
+
24
+ if Gem.win_platform?
25
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
26
+ SimpleCov::Formatter::HTMLFormatter
27
+ ]
28
+ SimpleCov.start do
29
+ add_filter '/test/'
30
+ add_filter '/features/'
31
+ end
32
+ else
33
+ SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(
34
+ [SimpleCov::Formatter::HTMLFormatter]
35
+ )
36
+ SimpleCov.start do
37
+ add_filter '/test/'
38
+ add_filter '/features/'
39
+ minimum_coverage 20
40
+ end
41
+ end
data/Gemfile ADDED
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2024 Yegor Bugayenko
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the 'Software'), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
23
+ source 'https://rubygems.org'
24
+ gemspec
25
+
26
+ gem 'cucumber', '9.2.0', require: false
27
+ gem 'minitest', '5.23.1', require: false
28
+ gem 'net-ping', '2.0.8', require: false
29
+ gem 'rake', '13.2.1', require: false
30
+ gem 'rspec-rails', '6.1.2', require: false
31
+ gem 'rubocop', '1.64.0', require: false
32
+ gem 'rubocop-performance', '1.21.0', require: false
33
+ gem 'rubocop-rspec', '2.29.2', require: false
34
+ gem 'simplecov', '0.22.0', require: false
35
+ gem 'simplecov-cobertura', '2.1.0', require: false
36
+ gem 'webmock', '3.23.1', require: false
37
+ gem 'yard', '0.9.36', require: false
data/Gemfile.lock ADDED
@@ -0,0 +1,244 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ always (0.0.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ actionpack (7.1.3.3)
10
+ actionview (= 7.1.3.3)
11
+ activesupport (= 7.1.3.3)
12
+ nokogiri (>= 1.8.5)
13
+ racc
14
+ rack (>= 2.2.4)
15
+ rack-session (>= 1.0.1)
16
+ rack-test (>= 0.6.3)
17
+ rails-dom-testing (~> 2.2)
18
+ rails-html-sanitizer (~> 1.6)
19
+ actionview (7.1.3.3)
20
+ activesupport (= 7.1.3.3)
21
+ builder (~> 3.1)
22
+ erubi (~> 1.11)
23
+ rails-dom-testing (~> 2.2)
24
+ rails-html-sanitizer (~> 1.6)
25
+ activesupport (7.1.3.3)
26
+ base64
27
+ bigdecimal
28
+ concurrent-ruby (~> 1.0, >= 1.0.2)
29
+ connection_pool (>= 2.2.5)
30
+ drb
31
+ i18n (>= 1.6, < 2)
32
+ minitest (>= 5.1)
33
+ mutex_m
34
+ tzinfo (~> 2.0)
35
+ addressable (2.8.6)
36
+ public_suffix (>= 2.0.2, < 6.0)
37
+ ast (2.4.2)
38
+ base64 (0.2.0)
39
+ bigdecimal (3.1.8)
40
+ builder (3.2.4)
41
+ concurrent-ruby (1.2.3)
42
+ connection_pool (2.4.1)
43
+ crack (1.0.0)
44
+ bigdecimal
45
+ rexml
46
+ crass (1.0.6)
47
+ cucumber (9.2.0)
48
+ builder (~> 3.2)
49
+ cucumber-ci-environment (> 9, < 11)
50
+ cucumber-core (> 13, < 14)
51
+ cucumber-cucumber-expressions (~> 17.0)
52
+ cucumber-gherkin (> 24, < 28)
53
+ cucumber-html-formatter (> 20.3, < 22)
54
+ cucumber-messages (> 19, < 25)
55
+ diff-lcs (~> 1.5)
56
+ mini_mime (~> 1.1)
57
+ multi_test (~> 1.1)
58
+ sys-uname (~> 1.2)
59
+ cucumber-ci-environment (10.0.1)
60
+ cucumber-core (13.0.2)
61
+ cucumber-gherkin (>= 27, < 28)
62
+ cucumber-messages (>= 20, < 23)
63
+ cucumber-tag-expressions (> 5, < 7)
64
+ cucumber-cucumber-expressions (17.1.0)
65
+ bigdecimal
66
+ cucumber-gherkin (27.0.0)
67
+ cucumber-messages (>= 19.1.4, < 23)
68
+ cucumber-html-formatter (21.3.1)
69
+ cucumber-messages (> 19, < 25)
70
+ cucumber-messages (22.0.0)
71
+ cucumber-tag-expressions (6.1.0)
72
+ diff-lcs (1.5.1)
73
+ docile (1.4.0)
74
+ drb (2.2.1)
75
+ erubi (1.12.0)
76
+ ffi (1.16.3)
77
+ ffi (1.16.3-x64-mingw-ucrt)
78
+ hashdiff (1.1.0)
79
+ i18n (1.14.5)
80
+ concurrent-ruby (~> 1.0)
81
+ io-console (0.7.2)
82
+ irb (1.13.1)
83
+ rdoc (>= 4.0.0)
84
+ reline (>= 0.4.2)
85
+ json (2.7.2)
86
+ language_server-protocol (3.17.0.3)
87
+ loofah (2.22.0)
88
+ crass (~> 1.0.2)
89
+ nokogiri (>= 1.12.0)
90
+ mini_mime (1.1.5)
91
+ minitest (5.23.1)
92
+ multi_test (1.1.0)
93
+ mutex_m (0.2.0)
94
+ net-ping (2.0.8)
95
+ nokogiri (1.16.5-aarch64-linux)
96
+ racc (~> 1.4)
97
+ nokogiri (1.16.5-arm-linux)
98
+ racc (~> 1.4)
99
+ nokogiri (1.16.5-arm64-darwin)
100
+ racc (~> 1.4)
101
+ nokogiri (1.16.5-x64-mingw-ucrt)
102
+ racc (~> 1.4)
103
+ nokogiri (1.16.5-x86-linux)
104
+ racc (~> 1.4)
105
+ nokogiri (1.16.5-x86_64-darwin)
106
+ racc (~> 1.4)
107
+ nokogiri (1.16.5-x86_64-linux)
108
+ racc (~> 1.4)
109
+ parallel (1.24.0)
110
+ parser (3.3.2.0)
111
+ ast (~> 2.4.1)
112
+ racc
113
+ psych (5.1.2)
114
+ stringio
115
+ public_suffix (5.0.5)
116
+ racc (1.8.0)
117
+ rack (3.0.11)
118
+ rack-session (2.0.0)
119
+ rack (>= 3.0.0)
120
+ rack-test (2.1.0)
121
+ rack (>= 1.3)
122
+ rackup (2.1.0)
123
+ rack (>= 3)
124
+ webrick (~> 1.8)
125
+ rails-dom-testing (2.2.0)
126
+ activesupport (>= 5.0.0)
127
+ minitest
128
+ nokogiri (>= 1.6)
129
+ rails-html-sanitizer (1.6.0)
130
+ loofah (~> 2.21)
131
+ nokogiri (~> 1.14)
132
+ railties (7.1.3.3)
133
+ actionpack (= 7.1.3.3)
134
+ activesupport (= 7.1.3.3)
135
+ irb
136
+ rackup (>= 1.0.0)
137
+ rake (>= 12.2)
138
+ thor (~> 1.0, >= 1.2.2)
139
+ zeitwerk (~> 2.6)
140
+ rainbow (3.1.1)
141
+ rake (13.2.1)
142
+ rdoc (6.7.0)
143
+ psych (>= 4.0.0)
144
+ regexp_parser (2.9.2)
145
+ reline (0.5.8)
146
+ io-console (~> 0.5)
147
+ rexml (3.2.8)
148
+ strscan (>= 3.0.9)
149
+ rspec-core (3.13.0)
150
+ rspec-support (~> 3.13.0)
151
+ rspec-expectations (3.13.0)
152
+ diff-lcs (>= 1.2.0, < 2.0)
153
+ rspec-support (~> 3.13.0)
154
+ rspec-mocks (3.13.1)
155
+ diff-lcs (>= 1.2.0, < 2.0)
156
+ rspec-support (~> 3.13.0)
157
+ rspec-rails (6.1.2)
158
+ actionpack (>= 6.1)
159
+ activesupport (>= 6.1)
160
+ railties (>= 6.1)
161
+ rspec-core (~> 3.13)
162
+ rspec-expectations (~> 3.13)
163
+ rspec-mocks (~> 3.13)
164
+ rspec-support (~> 3.13)
165
+ rspec-support (3.13.1)
166
+ rubocop (1.64.0)
167
+ json (~> 2.3)
168
+ language_server-protocol (>= 3.17.0)
169
+ parallel (~> 1.10)
170
+ parser (>= 3.3.0.2)
171
+ rainbow (>= 2.2.2, < 4.0)
172
+ regexp_parser (>= 1.8, < 3.0)
173
+ rexml (>= 3.2.5, < 4.0)
174
+ rubocop-ast (>= 1.31.1, < 2.0)
175
+ ruby-progressbar (~> 1.7)
176
+ unicode-display_width (>= 2.4.0, < 3.0)
177
+ rubocop-ast (1.31.3)
178
+ parser (>= 3.3.1.0)
179
+ rubocop-capybara (2.20.0)
180
+ rubocop (~> 1.41)
181
+ rubocop-factory_bot (2.25.1)
182
+ rubocop (~> 1.41)
183
+ rubocop-performance (1.21.0)
184
+ rubocop (>= 1.48.1, < 2.0)
185
+ rubocop-ast (>= 1.31.1, < 2.0)
186
+ rubocop-rspec (2.29.2)
187
+ rubocop (~> 1.40)
188
+ rubocop-capybara (~> 2.17)
189
+ rubocop-factory_bot (~> 2.22)
190
+ rubocop-rspec_rails (~> 2.28)
191
+ rubocop-rspec_rails (2.28.3)
192
+ rubocop (~> 1.40)
193
+ ruby-progressbar (1.13.0)
194
+ simplecov (0.22.0)
195
+ docile (~> 1.1)
196
+ simplecov-html (~> 0.11)
197
+ simplecov_json_formatter (~> 0.1)
198
+ simplecov-cobertura (2.1.0)
199
+ rexml
200
+ simplecov (~> 0.19)
201
+ simplecov-html (0.12.3)
202
+ simplecov_json_formatter (0.1.4)
203
+ stringio (3.1.0)
204
+ strscan (3.1.0)
205
+ sys-uname (1.2.3)
206
+ ffi (~> 1.1)
207
+ thor (1.3.1)
208
+ tzinfo (2.0.6)
209
+ concurrent-ruby (~> 1.0)
210
+ unicode-display_width (2.5.0)
211
+ webmock (3.23.1)
212
+ addressable (>= 2.8.0)
213
+ crack (>= 0.3.2)
214
+ hashdiff (>= 0.4.0, < 2.0.0)
215
+ webrick (1.8.1)
216
+ yard (0.9.36)
217
+ zeitwerk (2.6.15)
218
+
219
+ PLATFORMS
220
+ aarch64-linux
221
+ arm-linux
222
+ arm64-darwin
223
+ x64-mingw-ucrt
224
+ x86-linux
225
+ x86_64-darwin
226
+ x86_64-linux
227
+
228
+ DEPENDENCIES
229
+ always!
230
+ cucumber (= 9.2.0)
231
+ minitest (= 5.23.1)
232
+ net-ping (= 2.0.8)
233
+ rake (= 13.2.1)
234
+ rspec-rails (= 6.1.2)
235
+ rubocop (= 1.64.0)
236
+ rubocop-performance (= 1.21.0)
237
+ rubocop-rspec (= 2.29.2)
238
+ simplecov (= 0.22.0)
239
+ simplecov-cobertura (= 2.1.0)
240
+ webmock (= 3.23.1)
241
+ yard (= 0.9.36)
242
+
243
+ BUNDLED WITH
244
+ 2.5.6
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ (The MIT License)
2
+
3
+ Copyright (c) 2024 Yegor Bugayenko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the 'Software'), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # Runs a Background Loop Forever
2
+
3
+ [![DevOps By Rultor.com](http://www.rultor.com/b/yegor256/always)](http://www.rultor.com/p/yegor256/always)
4
+ [![We recommend RubyMine](https://www.elegantobjects.org/rubymine.svg)](https://www.jetbrains.com/ruby/)
5
+
6
+ [![rake](https://github.com/yegor256/always/actions/workflows/rake.yml/badge.svg)](https://github.com/yegor256/always/actions/workflows/rake.yml)
7
+ [![PDD status](http://www.0pdd.com/svg?name=yegor256/always)](http://www.0pdd.com/p?name=yegor256/always)
8
+ [![Gem Version](https://badge.fury.io/rb/always.svg)](http://badge.fury.io/rb/always)
9
+ [![Test Coverage](https://img.shields.io/codecov/c/github/yegor256/always.svg)](https://codecov.io/github/yegor256/always?branch=master)
10
+ [![Yard Docs](http://img.shields.io/badge/yard-docs-blue.svg)](http://rubydoc.info/github/yegor256/always/master/frames)
11
+ [![Hits-of-Code](https://hitsofcode.com/github/yegor256/always)](https://hitsofcode.com/view/github/yegor256/always)
12
+ [![License](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/yegor256/always/blob/master/LICENSE.txt)
13
+
14
+ This simple Ruby gem helps you run a loop forever, in a background thread.
15
+
16
+ ```ruby
17
+ require 'always'
18
+ # Prepare, with five threads and 30-seconds delay between loop cycles:
19
+ a = Always.new(5, 30)
20
+ # Start them all together spinning forever:
21
+ a.start do
22
+ puts "I'm alive"
23
+ end
24
+ # Stop them all together:
25
+ a.stop
26
+ ```
27
+
28
+ ## How to contribute
29
+
30
+ Read
31
+ [these guidelines](https://www.yegor256.com/2014/04/15/github-guidelines.html).
32
+ Make sure you build is green before you contribute
33
+ your pull request. You will need to have
34
+ [Ruby](https://www.ruby-lang.org/en/) 3.0+ and
35
+ [Bundler](https://bundler.io/) installed. Then:
36
+
37
+ ```bash
38
+ bundle update
39
+ bundle exec rake
40
+ ```
41
+
42
+ If it's clean and you don't see any error messages, submit your pull request.
data/Rakefile ADDED
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2024 Yegor Bugayenko
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the 'Software'), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
23
+ require 'rubygems'
24
+ require 'rake'
25
+ require 'rdoc'
26
+ require 'rake/clean'
27
+
28
+ def name
29
+ @name ||= File.basename(Dir['*.gemspec'].first, '.*')
30
+ end
31
+
32
+ def version
33
+ Gem::Specification.load(Dir['*.gemspec'].first).version
34
+ end
35
+
36
+ task default: %i[clean test rubocop yard copyright]
37
+
38
+ require 'rake/testtask'
39
+ desc 'Run all unit tests'
40
+ Rake::TestTask.new(:test) do |test|
41
+ Rake::Cleaner.cleanup_files(['coverage'])
42
+ test.libs << 'lib' << 'test'
43
+ test.pattern = 'test/**/test_*.rb'
44
+ test.warning = true
45
+ test.verbose = false
46
+ end
47
+
48
+ require 'yard'
49
+ desc 'Build Yard documentation'
50
+ YARD::Rake::YardocTask.new do |t|
51
+ t.files = ['lib/**/*.rb']
52
+ end
53
+
54
+ require 'rubocop/rake_task'
55
+ desc 'Run RuboCop on all directories'
56
+ RuboCop::RakeTask.new(:rubocop) do |task|
57
+ task.fail_on_error = true
58
+ task.requires << 'rubocop-rspec'
59
+ end
60
+
61
+ task :copyright do
62
+ sh "grep -q -r '#{Date.today.strftime('%Y')}' \
63
+ --include '*.rb' \
64
+ --include '*.yml' \
65
+ --include '*.txt' \
66
+ --include 'Rakefile' \
67
+ ."
68
+ end
data/always.gemspec ADDED
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2024 Yegor Bugayenko
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the 'Software'), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
23
+ require 'English'
24
+
25
+ Gem::Specification.new do |s|
26
+ s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
27
+ s.required_ruby_version = '>=3.2'
28
+ s.name = 'always'
29
+ s.version = '0.0.1'
30
+ s.license = 'MIT'
31
+ s.summary = 'A simple Ruby framework that spins a loop forever, in a background thread'
32
+ s.description =
33
+ 'You may need this framework if you have a routine task ' \
34
+ 'that must be performed every once in a while, but may raise exceptions ' \
35
+ 'which you don\'t want to cause a termination of the entire routine cycle.'
36
+ s.authors = ['Yegor Bugayenko']
37
+ s.email = 'yegor256@gmail.com'
38
+ s.homepage = 'http://github.com/yegor256/always'
39
+ s.files = `git ls-files`.split($RS)
40
+ s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
41
+ s.rdoc_options = ['--charset=UTF-8']
42
+ s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
43
+ s.metadata['rubygems_mfa_required'] = 'true'
44
+ end
data/lib/always.rb ADDED
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2024 Yegor Bugayenko
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the 'Software'), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
23
+ # Always.
24
+ # Author:: Yegor Bugayenko (yegor256@gmail.com)
25
+ # Copyright:: Copyright (c) 2024 Yegor Bugayenko
26
+ # License:: MIT
27
+ class Always
28
+ # The version of the framework.
29
+ VERSION = '0.0.1'
30
+
31
+ # Constructor.
32
+ def initialize(total, pause = 0)
33
+ @total = total
34
+ @pause = pause
35
+ @on_error = nil
36
+ @threads = []
37
+ end
38
+
39
+ # What to do when an exception occurs?
40
+ def on_error(&block)
41
+ @on_error = block
42
+ end
43
+
44
+ def start
45
+ (0..@total - 1).each do |i|
46
+ @threads[i] = Thread.new do
47
+ body(i)
48
+ end
49
+ end
50
+ end
51
+
52
+ def stop
53
+ @threads.each(&:terminate)
54
+ end
55
+
56
+ private
57
+
58
+ # rubocop:disable Lint/RescueException
59
+ def body(idx)
60
+ loop do
61
+ begin
62
+ yield
63
+ rescue Exception => e
64
+ @on_error&.call(e, idx)
65
+ end
66
+ sleep(@pause)
67
+ rescue Exception
68
+ # If we reach this point, we must not even try to
69
+ # do anything. Here we must quietly ignore everything
70
+ # and let the daemon go to the next cycle.
71
+ end
72
+ end
73
+ # rubocop:enable Lint/RescueException
74
+ end
data/renovate.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://docs.renovatebot.com/renovate-schema.json",
3
+ "extends": [
4
+ "config:base"
5
+ ]
6
+ }
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2024 Yegor Bugayenko
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the 'Software'), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
23
+ $stdout.sync = true
24
+
25
+ require 'simplecov'
26
+ SimpleCov.start
27
+
28
+ require 'simplecov-cobertura'
29
+ SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
30
+
31
+ require 'minitest/autorun'
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Copyright (c) 2024 Yegor Bugayenko
4
+ #
5
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ # of this software and associated documentation files (the 'Software'), to deal
7
+ # in the Software without restriction, including without limitation the rights
8
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ # copies of the Software, and to permit persons to whom the Software is
10
+ # furnished to do so, subject to the following conditions:
11
+ #
12
+ # The above copyright notice and this permission notice shall be included in all
13
+ # copies or substantial portions of the Software.
14
+ #
15
+ # THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ # SOFTWARE.
22
+
23
+ require 'minitest/autorun'
24
+ require_relative '../lib/always'
25
+
26
+ # Test.
27
+ # Author:: Yegor Bugayenko (yegor256@gmail.com)
28
+ # Copyright:: Copyright (c) 2024 Yegor Bugayenko
29
+ # License:: MIT
30
+ class TestAlways < Minitest::Test
31
+ def test_simple
32
+ a = Always.new(3)
33
+ a.start do
34
+ raise 'intentionally'
35
+ end
36
+ a.stop
37
+ end
38
+ end
metadata ADDED
@@ -0,0 +1,73 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: always
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Yegor Bugayenko
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-05-31 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: You may need this framework if you have a routine task that must be performed
14
+ every once in a while, but may raise exceptions which you don't want to cause a
15
+ termination of the entire routine cycle.
16
+ email: yegor256@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files:
20
+ - README.md
21
+ - LICENSE.txt
22
+ files:
23
+ - ".0pdd.yml"
24
+ - ".gitattributes"
25
+ - ".github/workflows/actionlint.yml"
26
+ - ".github/workflows/codecov.yml"
27
+ - ".github/workflows/license.yml"
28
+ - ".github/workflows/markdown-lint.yml"
29
+ - ".github/workflows/pdd.yml"
30
+ - ".github/workflows/rake.yml"
31
+ - ".github/workflows/xcop.yml"
32
+ - ".github/workflows/yamllint.yml"
33
+ - ".gitignore"
34
+ - ".pdd"
35
+ - ".rubocop.yml"
36
+ - ".rultor.yml"
37
+ - ".simplecov"
38
+ - Gemfile
39
+ - Gemfile.lock
40
+ - LICENSE.txt
41
+ - README.md
42
+ - Rakefile
43
+ - always.gemspec
44
+ - lib/always.rb
45
+ - renovate.json
46
+ - test/test__helper.rb
47
+ - test/test_always.rb
48
+ homepage: http://github.com/yegor256/always
49
+ licenses:
50
+ - MIT
51
+ metadata:
52
+ rubygems_mfa_required: 'true'
53
+ post_install_message:
54
+ rdoc_options:
55
+ - "--charset=UTF-8"
56
+ require_paths:
57
+ - lib
58
+ required_ruby_version: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '3.2'
63
+ required_rubygems_version: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - ">="
66
+ - !ruby/object:Gem::Version
67
+ version: '0'
68
+ requirements: []
69
+ rubygems_version: 3.4.10
70
+ signing_key:
71
+ specification_version: 4
72
+ summary: A simple Ruby framework that spins a loop forever, in a background thread
73
+ test_files: []