countless 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: cb317432e20e425c9d4a173f46e886a839ce85aaf8b445b890e4a9b6a4dbfca4
4
+ data.tar.gz: 87c853ba24c79208a4e6fb84f2994af994618f5cdaf0c43a19942585e87885cd
5
+ SHA512:
6
+ metadata.gz: ebddecc5729fe2d1c9afdb04f135fbc30a907131999f7c2037288f3e86771fb360ef99920017cf01ad6891d286112f56335eaca0e3997c167a605e97f1e402c1
7
+ data.tar.gz: c1acaa20da4b0e735b3557a5b88166397e09ddaa1ad89cdf65b1088b6165fd5691d392c7574ffb466330aaeb8005230aed2a9e2ddc003e2b0a481acc2c482b5b
data/.editorconfig ADDED
@@ -0,0 +1,30 @@
1
+ # http://editorconfig.org
2
+ root = true
3
+
4
+ [*]
5
+ indent_style = space
6
+ indent_size = 2
7
+ end_of_line = lf
8
+ charset = utf-8
9
+ trim_trailing_whitespace = true
10
+ insert_final_newline = true
11
+
12
+ [*.md]
13
+ trim_trailing_whitespace = true
14
+
15
+ [*.json]
16
+ indent_style = space
17
+ indent_size = 2
18
+
19
+ [*.yml]
20
+ indent_style = space
21
+ indent_size = 2
22
+
23
+ [Makefile]
24
+ trim_trailing_whitespace = true
25
+ indent_style = tab
26
+ indent_size = 4
27
+
28
+ [*.sh]
29
+ indent_style = space
30
+ indent_size = 2
@@ -0,0 +1,39 @@
1
+ name: Build Documentation
2
+ on:
3
+ repository_dispatch:
4
+ types: [documentation]
5
+
6
+ concurrency:
7
+ group: 'docs'
8
+
9
+ jobs:
10
+ docs:
11
+ name: Build gem documentation
12
+ runs-on: ubuntu-20.04
13
+ timeout-minutes: 5
14
+ steps:
15
+ - uses: actions/checkout@v2
16
+
17
+ - name: Install the correct Ruby version
18
+ uses: ruby/setup-ruby@v1
19
+ with:
20
+ ruby-version: 2.5
21
+ bundler-cache: true
22
+ rubygems: latest
23
+
24
+ - name: Prepare the virtual environment
25
+ uses: hausgold/actions/ci@master
26
+ with:
27
+ clone_token: '${{ secrets.CLONE_TOKEN }}'
28
+ settings: '${{ github.repository }}'
29
+ target: ci/gem-test
30
+
31
+ - name: Build gem documentation
32
+ run: make docs
33
+
34
+ - name: Upload the code coverage report
35
+ run: coverage
36
+
37
+ - name: Add this job to the commit status
38
+ run: commit-status '${{ job.status }}'
39
+ if: always()
@@ -0,0 +1,69 @@
1
+ name: Test
2
+ on:
3
+ push:
4
+ branches:
5
+ - '**'
6
+ schedule:
7
+ - cron: '0 0 * * MON'
8
+
9
+ concurrency:
10
+ group: '${{ github.ref }}'
11
+ cancel-in-progress: true
12
+
13
+ jobs:
14
+ test:
15
+ name: 'Test the gem (Ruby ${{ matrix.ruby }}, Rails ${{ matrix.rails }})'
16
+ runs-on: ubuntu-20.04
17
+ timeout-minutes: 5
18
+ strategy:
19
+ fail-fast: false
20
+ matrix:
21
+ ruby: [2.5, 2.6, 2.7, '3.0', 3.1]
22
+ rails: [5.2, '6.0', 6.1, '7.0']
23
+ exclude:
24
+ # Rails 7.0 requires Ruby >=2.7
25
+ - ruby: 2.5
26
+ rails: '7.0'
27
+ - ruby: 2.6
28
+ rails: '7.0'
29
+ env:
30
+ BUNDLE_GEMFILE: 'gemfiles/rails_${{ matrix.rails }}.gemfile'
31
+ steps:
32
+ - uses: actions/checkout@v2
33
+
34
+ - name: Install the correct Ruby version
35
+ uses: ruby/setup-ruby@v1
36
+ with:
37
+ ruby-version: ${{ matrix.ruby }}
38
+ bundler-cache: true
39
+ rubygems: latest
40
+
41
+ - name: Prepare the virtual environment
42
+ uses: hausgold/actions/ci@master
43
+ with:
44
+ clone_token: '${{ secrets.CLONE_TOKEN }}'
45
+ settings: '${{ github.repository }}'
46
+ target: ci/gem-test
47
+
48
+ - name: Run the gem tests
49
+ run: make test
50
+
51
+ - name: Upload the code coverage report
52
+ run: coverage
53
+
54
+ trigger-docs:
55
+ name: Trigger the documentation upload
56
+ runs-on: ubuntu-20.04
57
+ timeout-minutes: 2
58
+ needs: test
59
+ if: github.ref == 'refs/heads/master'
60
+ steps:
61
+ - name: Prepare the virtual environment
62
+ uses: hausgold/actions/ci@master
63
+ with:
64
+ clone_token: '${{ secrets.CLONE_TOKEN }}'
65
+ settings: '${{ github.repository }}'
66
+ target: ci/noop
67
+
68
+ - name: Trigger the documentation upload
69
+ run: workflow documentation
data/.gitignore ADDED
@@ -0,0 +1,16 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/api/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /vendor/
11
+ /gemfiles/vendor/
12
+ *.gemfile.lock
13
+ /bin/cloc
14
+
15
+ # rspec failure tracking
16
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --format documentation
2
+ --color
data/.rubocop.yml ADDED
@@ -0,0 +1,58 @@
1
+ require:
2
+ - rubocop-rspec
3
+
4
+ Documentation:
5
+ Enabled: true
6
+
7
+ AllCops:
8
+ DisplayCopNames: true
9
+ TargetRubyVersion: 2.5
10
+ SuggestExtensions: false
11
+ Exclude:
12
+ - bin/**/*
13
+ - vendor/**/*
14
+ - build/**/*
15
+ - gemfiles/**/*
16
+ - spec/fixtures/files/**/*
17
+
18
+ Metrics/BlockLength:
19
+ Exclude:
20
+ - Rakefile
21
+ - '*.gemspec'
22
+ - spec/**/*.rb
23
+ - '**/*.rake'
24
+ - doc/**/*.rb
25
+
26
+ # We stay with the original Ruby Style Guide recommendation.
27
+ Layout/LineLength:
28
+ Max: 80
29
+
30
+ # Document all the things.
31
+ Style/DocumentationMethod:
32
+ Enabled: true
33
+ RequireForNonPublicMethods: true
34
+
35
+ # It's a deliberate idiom in RSpec.
36
+ # See: https://github.com/bbatsov/rubocop/issues/4222
37
+ Lint/AmbiguousBlockAssociation:
38
+ Exclude:
39
+ - "spec/**/*"
40
+
41
+ # Because +expect_any_instance_of().to have_received()+ is not
42
+ # supported with the +with(hash_including)+ matchers
43
+ RSpec/MessageSpies:
44
+ EnforcedStyle: receive
45
+
46
+ # Because nesting makes sense here to group the feature tests
47
+ # more effective. This increases maintainability.
48
+ RSpec/NestedGroups:
49
+ Max: 4
50
+
51
+ # Disable regular Rails spec paths.
52
+ RSpec/FilePath:
53
+ Enabled: false
54
+
55
+ # Because +enqueued_jobs+ is a method not a memoized variable,
56
+ # so when first evaluated it won't change.
57
+ RSpec/ExpectChange:
58
+ Enabled: false
data/.simplecov ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ SimpleCov.start 'test_frameworks' do
4
+ add_filter '/vendor/bundle/'
5
+ end
data/.yardopts ADDED
@@ -0,0 +1,6 @@
1
+ --output-dir=doc/api
2
+ --plugin activesupport-concern
3
+ --markup=rdoc
4
+ -
5
+ README.md
6
+ lib/**/*.rb
data/Appraisals ADDED
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ appraise 'rails-5.2' do
4
+ gem 'activejob', '5.2.0'
5
+ gem 'activerecord', '5.2.0'
6
+ gem 'activesupport', '5.2.0'
7
+ end
8
+
9
+ appraise 'rails-6.0' do
10
+ gem 'activejob', '6.0.0'
11
+ gem 'activerecord', '6.0.0'
12
+ gem 'activesupport', '6.0.0'
13
+ end
14
+
15
+ appraise 'rails-6.1' do
16
+ gem 'activejob', '6.1.0'
17
+ gem 'activerecord', '6.1.0'
18
+ gem 'activesupport', '6.1.0'
19
+ end
20
+
21
+ appraise 'rails-7.0' do
22
+ gem 'activejob', '7.0.0'
23
+ gem 'activerecord', '7.0.0'
24
+ gem 'activesupport', '7.0.0'
25
+ end
data/CHANGELOG.md ADDED
@@ -0,0 +1,3 @@
1
+ ### next
2
+
3
+ * Initial commit
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at hermann.mayer92@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
6
+
7
+ # Specify your gem's dependencies in countless.gemspec
8
+ gemspec
data/Guardfile ADDED
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ # A sample Guardfile
4
+ # More info at https://github.com/guard/guard#readme
5
+
6
+ ## Uncomment and set this to only include directories you want to watch
7
+ (directories %w[lib spec]).select do |d|
8
+ if Dir.exist?(d)
9
+ d
10
+ else
11
+ UI.warning("Directory #{d} does not exist")
12
+ end
13
+ end
14
+
15
+ ## Note: if you are using the `directories` clause above and you are not
16
+ ## watching the project directory ('.'), then you will want to move
17
+ ## the Guardfile to a watched dir and symlink it back, e.g.
18
+ #
19
+ # $ mkdir config
20
+ # $ mv Guardfile config/
21
+ # $ ln -s config/Guardfile .
22
+ #
23
+ # and, you'll have to watch "config/Guardfile" instead of "Guardfile"
24
+
25
+ # NOTE: The cmd option is now required due to the increasing number of ways
26
+ # rspec may be run, below are examples of the most common uses.
27
+ # * bundler: 'bundle exec rspec'
28
+ # * bundler binstubs: 'bin/rspec'
29
+ # * spring: 'bin/rspec' (This will use spring if running and you have
30
+ # installed the spring binstubs per the docs)
31
+ # * zeus: 'zeus rspec' (requires the server to be started separately)
32
+ # * 'just' rspec: 'rspec'
33
+
34
+ guard :rspec, cmd: 'bundle exec rspec' do
35
+ watch('spec/spec_helper.rb') { 'spec' }
36
+ watch(%r{^lib/countless.rb}) { 'spec' }
37
+ watch(%r{^spec/.+_spec\.rb$})
38
+ watch(%r{^lib/countless/([^\\]+)\.rb$}) do |m|
39
+ "spec/countless/#{m[1]}_spec.rb"
40
+ end
41
+ watch(%r{^lib/countless/([^\\]+)/(.*)\.rb$}) do |m|
42
+ "spec/#{m[1]}/#{m[2]}_spec.rb"
43
+ end
44
+ end
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 Hausgold
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
13
+ all 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
21
+ THE SOFTWARE.
data/Makefile ADDED
@@ -0,0 +1,151 @@
1
+ MAKEFLAGS += --warn-undefined-variables -j1
2
+ SHELL := bash
3
+ .SHELLFLAGS := -eu -o pipefail -c
4
+ .DEFAULT_GOAL := all
5
+ .DELETE_ON_ERROR:
6
+ .SUFFIXES:
7
+ .PHONY:
8
+
9
+ # Environment switches
10
+ MAKE_ENV ?= docker
11
+ COMPOSE_RUN_SHELL_FLAGS ?= --rm
12
+ BASH_RUN_SHELL_FLAGS ?=
13
+ CLOC_VERSION ?= v1.94
14
+ CLOC_BASE_URL ?= https://github.com/AlDanial/cloc
15
+ CLOC_URL ?= $(CLOC_BASE_URL)/releases/download/$(CLOC_VERSION)/cloc-1.94.pl
16
+
17
+ # Directories
18
+ VENDOR_DIR ?= vendor/bundle
19
+ GEMFILES_DIR ?= gemfiles
20
+ BIN_DIR ?= bin
21
+
22
+ # Host binaries
23
+ BASH ?= bash
24
+ COMPOSE ?= docker-compose
25
+ ID ?= id
26
+ MKDIR ?= mkdir
27
+ RM ?= rm
28
+ CURL ?= curl
29
+ CHMOD ?= chmod
30
+
31
+ # Container binaries
32
+ BUNDLE ?= bundle
33
+ APPRAISAL ?= appraisal
34
+ RAKE ?= rake
35
+ RUBOCOP ?= rubocop
36
+ GUARD ?= guard
37
+ YARD ?= yard
38
+
39
+ # Files
40
+ GEMFILES ?= $(subst _,-,$(patsubst $(GEMFILES_DIR)/%.gemfile,%,\
41
+ $(wildcard $(GEMFILES_DIR)/*.gemfile)))
42
+ TEST_GEMFILES := $(GEMFILES:%=test-%)
43
+
44
+ # Define a generic shell run wrapper
45
+ # $1 - The command to run
46
+ ifeq ($(MAKE_ENV),docker)
47
+ define run-shell
48
+ $(COMPOSE) run $(COMPOSE_RUN_SHELL_FLAGS) \
49
+ -e LANG=en_US.UTF-8 -e LANGUAGE=en_US.UTF-8 -e LC_ALL=en_US.UTF-8 \
50
+ -e HOME=/tmp -e BUNDLE_APP_CONFIG=/app/.bundle \
51
+ -u `$(ID) -u` test \
52
+ bash $(BASH_RUN_SHELL_FLAGS) -c 'sleep 0.1; echo; $(1)'
53
+ endef
54
+ else ifeq ($(MAKE_ENV),baremetal)
55
+ define run-shell
56
+ $(1)
57
+ endef
58
+ endif
59
+
60
+ all:
61
+ # Countless
62
+ #
63
+ # install Install the dependencies
64
+ # test Run the whole test suite
65
+ # clean Clean the dependencies
66
+ #
67
+ # docs Generate the Ruby documentation of the library
68
+ # stats Print the code statistics (library and test suite)
69
+ # notes Print all the notes from the code
70
+ # release Release a new Gem version (maintainers only)
71
+ #
72
+ # shell Run an interactive shell on the container
73
+ # shell-irb Run an interactive IRB shell on the container
74
+
75
+ .interactive:
76
+ @$(eval BASH_RUN_SHELL_FLAGS = --login)
77
+
78
+ install:
79
+ # Install the dependencies
80
+ @$(MKDIR) -p $(VENDOR_DIR)
81
+ @$(call run-shell,$(BUNDLE) check || $(BUNDLE) install --path $(VENDOR_DIR))
82
+ @$(call run-shell,$(BUNDLE) exec $(APPRAISAL) install)
83
+ @$(MAKE) --no-print-directory .fetch-cloc
84
+
85
+ .fetch-cloc:
86
+ # Fetch the CLOC ($(CLOC_VERSION)) binary
87
+ ifeq ("$(wildcard $(BIN_DIR)/cloc)","")
88
+ @$(CURL) -L '$(CLOC_URL)' -o '$(BIN_DIR)/cloc'
89
+ @$(CHMOD) +x '$(BIN_DIR)/cloc'
90
+ endif
91
+
92
+ test: \
93
+ test-specs \
94
+ test-style
95
+
96
+ test-specs: .fetch-cloc
97
+ # Run the whole test suite
98
+ @$(call run-shell,$(BUNDLE) exec $(RAKE) stats spec)
99
+
100
+ $(TEST_GEMFILES): GEMFILE=$(@:test-%=%)
101
+ $(TEST_GEMFILES):
102
+ # Run the whole test suite ($(GEMFILE))
103
+ @$(call run-shell,$(BUNDLE) exec $(APPRAISAL) $(GEMFILE) $(RAKE))
104
+
105
+ test-style: \
106
+ test-style-ruby
107
+
108
+ test-style-ruby:
109
+ # Run the static code analyzer (rubocop)
110
+ @$(call run-shell,$(BUNDLE) exec $(RUBOCOP) -a)
111
+
112
+ watch: install .interactive
113
+ # Watch for code changes and rerun the test suite
114
+ @$(call run-shell,$(BUNDLE) exec $(GUARD))
115
+
116
+ clean:
117
+ # Clean the dependencies
118
+ @$(RM) -rf $(VENDOR_DIR)
119
+
120
+ clean-containers:
121
+ # Clean running containers
122
+ ifeq ($(MAKE_ENV),docker)
123
+ @$(COMPOSE) down
124
+ endif
125
+
126
+ distclean: clean clean-containers
127
+
128
+ shell:
129
+ # Run an interactive shell on the container
130
+ @$(call run-shell,$(BASH) -i)
131
+
132
+ shell-irb:
133
+ # Run an interactive IRB shell on the container
134
+ @$(call run-shell,bin/console)
135
+
136
+ docs:
137
+ # Build the API documentation
138
+ @$(call run-shell,$(BUNDLE) exec $(YARD) -q && \
139
+ $(BUNDLE) exec $(YARD) stats --list-undoc --compact)
140
+
141
+ notes:
142
+ # Print the code statistics (library and test suite)
143
+ @$(call run-shell,$(BUNDLE) exec $(RAKE) notes)
144
+
145
+ stats:
146
+ # Print all the notes from the code
147
+ @$(call run-shell,$(BUNDLE) exec $(RAKE) stats)
148
+
149
+ release: .fetch-cloc
150
+ # Release a new gem version
151
+ @$(BUNDLE) exec $(RAKE) release