keyless 1.0.2 → 1.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2fd16c98d515436659a9719caeb4552f1426992f77b4a1b2bf2465ad90cbf115
4
- data.tar.gz: ce0f9e63a8f37f73282be5692a22de88ce6cf8bcddfeb2fafc71015b54281989
3
+ metadata.gz: bf3b27e57dd5695ad190bc2940a7cdb7b08ea79b66d35bdf4c2d67acefa6cc42
4
+ data.tar.gz: aed02f107d55f5a77e50c724fa517a50864ec42f16d4c505ab84ed31d4443cf6
5
5
  SHA512:
6
- metadata.gz: 92c80c2e5b22db4bd178441cc406d7379f64f870be51909d11139a56a64b0c5497415af384088601fd8cefb19b0cacbc97a50881959a56a775de0375bc8ebc9b
7
- data.tar.gz: 2c212d36f0fd05ba0a5cf7a315f873b752f7549c532f3e39c3f5e4489db28e6eeb9213a0f76c728e41a55ae08db66ccb9bc8ebbe94fb5a084cd4a05d31729336
6
+ metadata.gz: 2669da4e5baf3e6bf8fc6f3b37e28b9e09278ba245f8057fd80e332b4bee8b4c34195bba07b22b549fca6213722fc1ac9ad1f58186cd30b835524009e79daf42
7
+ data.tar.gz: 6f5ff05b341d0991786a76aff5d6f3a042800fe6a9f5fdc8a3a92e037c9b76eaa6b7d6f6d690442e4f0d85dc831c40b5ccb4ff736fa5953170d0c21ff2f8604d
@@ -9,16 +9,17 @@ concurrency:
9
9
  jobs:
10
10
  docs:
11
11
  name: Build gem documentation
12
- runs-on: ubuntu-20.04
12
+ runs-on: ubuntu-22.04
13
13
  timeout-minutes: 5
14
14
  steps:
15
- - uses: actions/checkout@v2
15
+ - uses: actions/checkout@v3
16
16
 
17
17
  - name: Install the correct Ruby version
18
18
  uses: ruby/setup-ruby@v1
19
19
  with:
20
20
  ruby-version: 2.5
21
21
  bundler-cache: true
22
+ rubygems: '3.3.26'
22
23
 
23
24
  - name: Prepare the virtual environment
24
25
  uses: hausgold/actions/ci@master
@@ -0,0 +1,47 @@
1
+ name: Release
2
+ run-name: Release ${{ github.event.inputs.VERSION }}
3
+
4
+ on:
5
+ workflow_dispatch:
6
+ inputs:
7
+ VERSION:
8
+ description: The new version to release. (eg. `1.0.0`) Check the
9
+ changelog for the latest version.
10
+
11
+ concurrency:
12
+ group: '${{ github.event.inputs.VERSION }}'
13
+ cancel-in-progress: true
14
+
15
+ jobs:
16
+ docs:
17
+ name: Release the gem
18
+ runs-on: ubuntu-22.04
19
+ timeout-minutes: 5
20
+ steps:
21
+ - uses: actions/checkout@v3
22
+
23
+ - name: Install Ruby 2.5
24
+ uses: ruby/setup-ruby@v1
25
+ with:
26
+ ruby-version: 2.5
27
+ bundler-cache: true
28
+ rubygems: '3.3.26'
29
+
30
+ - name: Prepare the virtual environment
31
+ uses: hausgold/actions/ci@master
32
+ with:
33
+ clone_token: '${{ secrets.CLONE_TOKEN }}'
34
+ settings: '${{ github.repository }}'
35
+ target: ci/gem-test
36
+
37
+ - name: Switch to SSH remotes for the Git repository
38
+ run: git-ssh-remotes
39
+
40
+ - name: Enforce version '${{ github.event.inputs.VERSION }}'
41
+ run: set-gem-version '${{ github.event.inputs.VERSION }}'
42
+
43
+ - name: Prepare the Git release commit
44
+ run: git-release-commit '${{ github.event.inputs.VERSION }}'
45
+
46
+ - name: Push the release Git commit/tag and package to the registry
47
+ run: make release
@@ -12,21 +12,25 @@ concurrency:
12
12
 
13
13
  jobs:
14
14
  test:
15
- name: 'Test the gem (Ruby ${{ matrix.ruby }})'
16
- runs-on: ubuntu-20.04
15
+ name: 'Test the gem (Ruby ${{ matrix.ruby }}, Rails ${{ matrix.rails }})'
16
+ runs-on: ubuntu-22.04
17
17
  timeout-minutes: 5
18
18
  strategy:
19
19
  fail-fast: false
20
20
  matrix:
21
- ruby: [2.4, 2.5, 2.6]
21
+ ruby: ['2.5', '2.7']
22
+ rails: ['5.2']
23
+ env:
24
+ BUNDLE_GEMFILE: 'gemfiles/rails_${{ matrix.rails }}.gemfile'
22
25
  steps:
23
- - uses: actions/checkout@v2
26
+ - uses: actions/checkout@v3
24
27
 
25
28
  - name: Install the correct Ruby version
26
29
  uses: ruby/setup-ruby@v1
27
30
  with:
28
31
  ruby-version: ${{ matrix.ruby }}
29
32
  bundler-cache: true
33
+ rubygems: '3.3.26'
30
34
 
31
35
  - name: Prepare the virtual environment
32
36
  uses: hausgold/actions/ci@master
@@ -43,7 +47,7 @@ jobs:
43
47
 
44
48
  trigger-docs:
45
49
  name: Trigger the documentation upload
46
- runs-on: ubuntu-20.04
50
+ runs-on: ubuntu-22.04
47
51
  timeout-minutes: 2
48
52
  needs: test
49
53
  if: github.ref == 'refs/heads/master'
data/.rspec CHANGED
@@ -1,3 +1,3 @@
1
+ --backtrace
2
+ --force-color
1
3
  --format documentation
2
- --color
3
- --require spec_helper
data/.rubocop.yml CHANGED
@@ -1,14 +1,19 @@
1
- require: rubocop-rspec
1
+ require:
2
+ - rubocop-rspec
3
+ - rubocop-rails
2
4
 
3
5
  Rails:
4
6
  Enabled: true
5
7
 
6
- Documentation:
8
+ Style/Documentation:
7
9
  Enabled: true
8
10
 
9
11
  AllCops:
12
+ NewCops: enable
13
+ SuggestExtensions: false
10
14
  DisplayCopNames: true
11
15
  TargetRubyVersion: 2.5
16
+ TargetRailsVersion: 5.2
12
17
  Exclude:
13
18
  - bin/**/*
14
19
  - vendor/**/*
@@ -23,6 +28,14 @@ Metrics/BlockLength:
23
28
  - '**/*.rake'
24
29
  - doc/**/*.rb
25
30
 
31
+ # MFA is not yet enabled for our gems yet.
32
+ Gemspec/RequireMFA:
33
+ Enabled: false
34
+
35
+ # We stay with the original Ruby Style Guide recommendation.
36
+ Layout/LineLength:
37
+ Max: 80
38
+
26
39
  # Document all the things.
27
40
  Style/DocumentationMethod:
28
41
  Enabled: true
@@ -51,3 +64,8 @@ RSpec/FilePath:
51
64
  # Because we just implemented the ActiveRecord API.
52
65
  Rails/SkipsModelValidations:
53
66
  Enabled: false
67
+
68
+ # We use memoized helpers all over the place to construct inputs and output
69
+ # which can be customized at nested contexts easily.
70
+ RSpec/MultipleMemoizedHelpers:
71
+ Enabled: false
data/.simplecov CHANGED
@@ -1,3 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'simplecov-html'
4
+ require 'simplecov_json_formatter'
5
+
6
+ SimpleCov.formatters = SimpleCov::Formatter::MultiFormatter.new(
7
+ [
8
+ SimpleCov::Formatter::HTMLFormatter,
9
+ SimpleCov::Formatter::JSONFormatter
10
+ ]
11
+ )
12
+
1
13
  SimpleCov.start 'test_frameworks' do
2
14
  add_filter '/vendor/bundle/'
3
15
  end
data/Appraisals ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ appraise 'rails-5.2' do
4
+ gem 'activesupport', '~> 5.2.0'
5
+ end
data/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ### next
2
+
3
+ * TODO: Replace this bullet point with an actual description of a change.
4
+
5
+ ### 1.2.0
6
+
7
+ * Added support for Gem release automation
8
+
9
+ ### 1.1.0
10
+
11
+ * Bundler >= 2.3 is from now on required as minimal version (#1)
12
+ * Dropped support for Ruby < 2.5 (#1)
13
+ * Dropped support for Rails < 5.2 (#1)
14
+ * Updated all development/runtime gems to their latest
15
+ Ruby 2.5 compatible version (#1)
16
+
1
17
  ### 1.0.2
2
18
 
3
19
  * Migrated to Github Actions
@@ -10,5 +26,6 @@
10
26
 
11
27
  ### 1.0.0
12
28
 
13
- * Initial release, extracted from former [grape-jwt-authentication](https://github.com/hausgold/grape-jwt-authentication)
14
- code at v1.3.0.
29
+ * Initial release, extracted from former
30
+ [grape-jwt-authentication](https://github.com/hausgold/grape-jwt-authentication)
31
+ code at v1.3.0.
@@ -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 development@hausgold.de. 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/Dockerfile CHANGED
@@ -2,7 +2,7 @@ FROM hausgold/ruby:2.5
2
2
  MAINTAINER Hermann Mayer <hermann.mayer@hausgold.de>
3
3
 
4
4
  # Update system gem
5
- RUN gem update --system
5
+ RUN gem update --system '3.3.26'
6
6
 
7
7
  # Install system packages and the latest bundler
8
8
  RUN apt-get update -yqqq && \
@@ -11,8 +11,7 @@ RUN apt-get update -yqqq && \
11
11
  ca-certificates \
12
12
  bash-completion inotify-tools && \
13
13
  echo 'en_US.UTF-8 UTF-8' >> /etc/locale.gen && /usr/sbin/locale-gen && \
14
- gem install bundler -v '~> 2.0' --no-document --no-prerelease && \
15
- gem install bundler -v '~> 1.0' --no-document --no-prerelease
14
+ gem install bundler -v '~> 2.3.0' --no-document --no-prerelease
16
15
 
17
16
  # Add new web user
18
17
  RUN mkdir /app && \
data/Envfile CHANGED
@@ -1,6 +1,3 @@
1
1
  LANG=en_US.UTF-8
2
2
  LANGUAGE=en_US.UTF-8
3
3
  LC_ALL=en_US.UTF-8
4
-
5
- # Just fix this, so Appraisals with Rails 4 are working fine
6
- BUNDLER_VERSION=1.17.3
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/keyless.rb}) { 'spec' }
37
+ watch(%r{^spec/.+_spec\.rb$})
38
+ watch(%r{^lib/keyless/([^\\]+)\.rb$}) do |m|
39
+ "spec/keyless/#{m[1]}_spec.rb"
40
+ end
41
+ watch(%r{^lib/keyless/([^\\]+)/(.*)\.rb$}) do |m|
42
+ "spec/keyless/#{m[1]}/#{m[2]}_spec.rb"
43
+ end
44
+ end
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2017 HAUSGOLD | talocasa GmbH
3
+ Copyright (c) 2023 HAUSGOLD | talocasa GmbH
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/Makefile CHANGED
@@ -9,6 +9,7 @@ SHELL := bash
9
9
  # Environment switches
10
10
  MAKE_ENV ?= docker
11
11
  COMPOSE_RUN_SHELL_FLAGS ?= --rm
12
+ BASH_RUN_SHELL_FLAGS ?=
12
13
 
13
14
  # Directories
14
15
  VENDOR_DIR ?= vendor/bundle
@@ -25,12 +26,20 @@ RM ?= rm
25
26
  XARGS ?= xargs
26
27
 
27
28
  # Container binaries
29
+ APPRAISAL ?= appraisal
28
30
  BUNDLE ?= bundle
29
31
  GEM ?= gem
32
+ GUARD ?= guard
30
33
  RAKE ?= rake
34
+ RSPEC ?= rspec
31
35
  RUBOCOP ?= rubocop
32
36
  YARD ?= yard
33
37
 
38
+ # Files
39
+ GEMFILES ?= $(subst _,-,$(patsubst $(GEMFILES_DIR)/%.gemfile,%,\
40
+ $(wildcard $(GEMFILES_DIR)/*.gemfile)))
41
+ TEST_GEMFILES := $(GEMFILES:%=test-%)
42
+
34
43
  # Define a generic shell run wrapper
35
44
  # $1 - The command to run
36
45
  ifeq ($(MAKE_ENV),docker)
@@ -38,7 +47,8 @@ define run-shell
38
47
  $(COMPOSE) run $(COMPOSE_RUN_SHELL_FLAGS) \
39
48
  -e LANG=en_US.UTF-8 -e LANGUAGE=en_US.UTF-8 -e LC_ALL=en_US.UTF-8 \
40
49
  -e HOME=/home/web -e BUNDLE_APP_CONFIG=/app/.bundle \
41
- -u `$(ID) -u` test bash -c 'sleep 0.1; echo; $(1)'
50
+ -u `$(ID) -u` test \
51
+ bash $(BASH_RUN_SHELL_FLAGS) -c 'sleep 0.1; echo; $(1)'
42
52
  endef
43
53
  else ifeq ($(MAKE_ENV),baremetal)
44
54
  define run-shell
@@ -55,6 +65,7 @@ all:
55
65
  #
56
66
  # test Run the whole test suite
57
67
  # test-style Test the code styles
68
+ # watch Watch for code changes and rerun the test suite
58
69
  #
59
70
  # docs Generate the Ruby documentation of the library
60
71
  # stats Print the code statistics (library and test suite)
@@ -64,12 +75,24 @@ all:
64
75
  # shell Run an interactive shell on the container
65
76
  # shell-irb Run an interactive IRB shell on the container
66
77
 
78
+ .interactive:
79
+ @$(eval BASH_RUN_SHELL_FLAGS = --login)
80
+
67
81
  install:
68
82
  # Install the dependencies
69
83
  @$(MKDIR) -p $(VENDOR_DIR)
70
84
  @$(call run-shell,$(BUNDLE) check || $(BUNDLE) install --path $(VENDOR_DIR))
71
- @$(call run-shell,GEM_HOME=vendor/bundle/ruby/$${RUBY_MAJOR}.0 \
72
- $(GEM) install bundler -v "~> 1.0")
85
+ @$(call run-shell,$(BUNDLE) exec $(APPRAISAL) install)
86
+
87
+ update:
88
+ # Install the dependencies
89
+ @$(MKDIR) -p $(VENDOR_DIR)
90
+ @$(call run-shell,$(BUNDLE) update)
91
+ @$(call run-shell,$(BUNDLE) exec $(APPRAISAL) update)
92
+
93
+ watch: install .interactive
94
+ # Watch for code changes and rerun the test suite
95
+ @$(call run-shell,$(BUNDLE) exec $(GUARD))
73
96
 
74
97
  test: \
75
98
  test-specs \
@@ -79,6 +102,11 @@ test-specs:
79
102
  # Run the whole test suite
80
103
  @$(call run-shell,$(BUNDLE) exec $(RAKE) stats spec)
81
104
 
105
+ $(TEST_GEMFILES): GEMFILE=$(@:test-%=%)
106
+ $(TEST_GEMFILES):
107
+ # Run the whole test suite ($(GEMFILE))
108
+ @$(call run-shell,$(BUNDLE) exec $(APPRAISAL) $(GEMFILE) $(RSPEC))
109
+
82
110
  test-style: \
83
111
  test-style-ruby
84
112
 
@@ -90,8 +118,8 @@ clean:
90
118
  # Clean the dependencies
91
119
  @$(RM) -rf $(VENDOR_DIR)
92
120
  @$(RM) -rf $(VENDOR_DIR)/Gemfile.lock
93
- @$(RM) -rf pkg
94
- @$(RM) -rf coverage
121
+ @$(RM) -rf .bundle .yardoc coverage pkg Gemfile.lock doc/api \
122
+ .rspec_status
95
123
 
96
124
  clean-containers:
97
125
  # Clean running containers
@@ -102,7 +130,7 @@ endif
102
130
  clean-images:
103
131
  # Clean build images
104
132
  ifeq ($(MAKE_ENV),docker)
105
- @-$(DOCKER) images | $(GREP) rimless \
133
+ @-$(DOCKER) images | $(GREP) $(shell basename "`pwd`") \
106
134
  | $(AWK) '{ print $$3 }' \
107
135
  | $(XARGS) -rn1 $(DOCKER) rmi -f
108
136
  endif
data/README.md CHANGED
@@ -25,7 +25,9 @@ flexible on the JWT verification level.
25
25
  - [Custom JWT verification key](#custom-jwt-verification-key)
26
26
  - [Full RSA256 example](#full-rsa256-example)
27
27
  - [Development](#development)
28
+ - [Code of Conduct](#code-of-conduct)
28
29
  - [Contributing](#contributing)
30
+ - [Releasing](#releasing)
29
31
 
30
32
  ## Installation
31
33
 
@@ -265,17 +267,28 @@ end
265
267
 
266
268
  ## Development
267
269
 
268
- After checking out the repo, run `bin/setup` to install dependencies. Then, run
269
- `bundle exec rake spec` to run the tests. You can also run `bin/console` for an
270
+ After checking out the repo, run `make install` to install dependencies. Then,
271
+ run `make test` to run the tests. You can also run `make shell-irb` for an
270
272
  interactive prompt that will allow you to experiment.
271
273
 
272
- To install this gem onto your local machine, run `bundle exec rake install`. To
273
- release a new version, update the version number in `version.rb`, and then run
274
- `bundle exec rake release`, which will create a git tag for the version, push
275
- git commits and tags, and push the `.gem` file to
276
- [rubygems.org](https://rubygems.org).
274
+ ## Code of Conduct
275
+
276
+ Everyone interacting in the project codebase, issue tracker, chat
277
+ rooms and mailing lists is expected to follow the [code of
278
+ conduct](./CODE_OF_CONDUCT.md).
277
279
 
278
280
  ## Contributing
279
281
 
280
282
  Bug reports and pull requests are welcome on GitHub at
281
- https://github.com/hausgold/keyless.
283
+ https://github.com/hausgold/keyless. Make sure that every pull request adds
284
+ a bullet point to the [changelog](./CHANGELOG.md) file with a reference to the
285
+ actual pull request.
286
+
287
+ ## Releasing
288
+
289
+ The release process of this Gem is fully automated. You just need to open the
290
+ Github Actions [Release
291
+ Workflow](https://github.com/hausgold/keyless/actions/workflows/release.yml)
292
+ and trigger a new run via the **Run workflow** button. Insert the new version
293
+ number (check the [changelog](./CHANGELOG.md) first for the latest release) and
294
+ you're done.
data/Rakefile CHANGED
@@ -2,71 +2,18 @@
2
2
 
3
3
  require 'bundler/gem_tasks'
4
4
  require 'rspec/core/rake_task'
5
- require 'rails/code_statistics'
6
- require 'pp'
5
+ require 'countless/rake_tasks'
7
6
 
8
7
  RSpec::Core::RakeTask.new(:spec)
9
8
 
10
9
  task default: :spec
11
10
 
12
- # Load some railties tasks
13
- load 'rails/tasks/statistics.rake'
14
- load 'rails/tasks/annotations.rake'
15
-
16
- # Clear the default statistics directory constant
17
- #
18
- # rubocop:disable Style/MutableConstant because we define it
19
- Object.send(:remove_const, :STATS_DIRECTORIES)
20
- ::STATS_DIRECTORIES = []
21
- # rubocop:enable Style/MutableConstant
22
-
23
- # Monkey patch the Rails +CodeStatistics+ class to support configurable
24
- # patterns per path. This is reuqired to support top-level only file matches.
25
- class CodeStatistics
26
- DEFAULT_PATTERN = /^(?!\.).*?\.(rb|js|coffee|rake)$/.freeze
27
-
28
- # Pass the possible +pattern+ argument down to the
29
- # +calculate_directory_statistics+ method call.
30
- def calculate_statistics
31
- Hash[@pairs.map do |pair|
32
- [pair.first, calculate_directory_statistics(*pair[1..-1])]
33
- end]
34
- end
35
-
36
- # Match the pattern against the individual file name and the relative file
37
- # path. This allows top-level only matches.
38
- def calculate_directory_statistics(directory, pattern = DEFAULT_PATTERN)
39
- stats = CodeStatisticsCalculator.new
40
-
41
- Dir.foreach(directory) do |file_name|
42
- path = "#{directory}/#{file_name}"
43
-
44
- if File.directory?(path) && (/^\./ !~ file_name)
45
- stats.add(calculate_directory_statistics(path, pattern))
46
- elsif file_name =~ pattern || path =~ pattern
47
- stats.add_by_file_path(path)
48
- end
49
- end
50
-
51
- stats
52
- end
53
- end
54
-
55
11
  # Configure all code statistics directories
56
- vendors = [
57
- [:unshift, 'Top-levels', 'lib', %r{lib(/keyless)?/[^/]+\.rb$}],
58
- [:unshift, 'Top-levels specs', 'spec', %r{spec/.*_spec\.rb$}]
59
- ].reverse
60
-
61
- vendors.each do |method, type, dir, pattern|
62
- ::STATS_DIRECTORIES.send(method, [type, dir, pattern].compact)
63
- ::CodeStatistics::TEST_TYPES << type if type.include? 'specs'
64
- end
65
-
66
- # Setup annotations
67
- ENV['SOURCE_ANNOTATION_DIRECTORIES'] = 'spec,doc'
68
-
69
- desc 'Enumerate all annotations'
70
- task :notes do
71
- SourceAnnotationExtractor.enumerate '@?OPTIMIZE|@?FIXME|@?TODO', tag: true
12
+ Countless.configure do |config|
13
+ config.stats_base_directories = [
14
+ { name: 'Top-levels',
15
+ pattern: 'lib/**/*.rb' },
16
+ { name: 'Top-levels specs', test: true,
17
+ pattern: 'spec/**/*_spec.rb' }
18
+ ]
72
19
  end
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activesupport", "~> 5.2.0"
6
+
7
+ gemspec path: "../"
data/keyless.gemspec CHANGED
@@ -5,39 +5,55 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require 'keyless/version'
6
6
 
7
7
  Gem::Specification.new do |spec|
8
- spec.name = 'keyless'
9
- spec.version = Keyless::VERSION
10
- spec.authors = ['Hermann Mayer', 'Christopher Mühl', 'Marcus Geißler']
11
- spec.email = ['hermann.mayer92@gmail.com',
12
- 'christopher@padarom.xyz',
13
- 'mg@hausgold.de']
8
+ spec.name = 'keyless'
9
+ spec.version = Keyless::VERSION
10
+ spec.authors = ['Hermann Mayer', 'Christopher Mühl', 'Marcus Geißler']
11
+ spec.email = ['hermann.mayer92@gmail.com',
12
+ 'christopher@padarom.xyz',
13
+ 'marcus3006@gmail.com']
14
14
 
15
- spec.summary = 'A reusable JWT authentication helper'
16
- spec.description = 'A reusable JWT authentication helper'
17
- spec.homepage = 'https://github.com/hausgold/keyless'
15
+ spec.license = 'MIT'
16
+ spec.summary = 'A reusable JWT authentication helper'
17
+ spec.description = 'A reusable JWT authentication helper'
18
+
19
+ base_uri = "https://github.com/hausgold/#{spec.name}"
20
+ spec.metadata = {
21
+ 'homepage_uri' => base_uri,
22
+ 'source_code_uri' => base_uri,
23
+ 'changelog_uri' => "#{base_uri}/blob/master/CHANGELOG.md",
24
+ 'bug_tracker_uri' => "#{base_uri}/issues",
25
+ 'documentation_uri' => "https://www.rubydoc.info/gems/#{spec.name}"
26
+ }
18
27
 
19
28
  spec.files = `git ls-files -z`.split("\x0").reject do |f|
20
29
  f.match(%r{^(test|spec|features)/})
21
30
  end
22
- spec.bindir = 'exe'
23
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+
32
+ spec.bindir = 'exe'
33
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
34
  spec.require_paths = ['lib']
25
35
 
26
- spec.add_runtime_dependency 'activesupport', '>= 3.2.0'
27
- spec.add_runtime_dependency 'httparty'
28
- spec.add_runtime_dependency 'jwt', '~> 2.1'
29
- spec.add_runtime_dependency 'recursive-open-struct', '~> 1.0'
30
-
31
- spec.add_development_dependency 'bundler', '>= 1.16', '< 3'
32
- spec.add_development_dependency 'railties', '>= 4.2.0', '< 6.1'
33
- spec.add_development_dependency 'rake', '~> 10.0'
34
- spec.add_development_dependency 'rspec', '~> 3.0'
35
- spec.add_development_dependency 'rubocop', '~> 0.63.1'
36
- spec.add_development_dependency 'rubocop-rspec', '~> 1.31'
37
- spec.add_development_dependency 'simplecov', '< 0.18'
38
- spec.add_development_dependency 'timecop', '~> 0.9.1'
39
- spec.add_development_dependency 'vcr', '~> 3.0'
40
- spec.add_development_dependency 'webmock', '~> 3.1'
41
- spec.add_development_dependency 'yard', '~> 0.9.18'
42
- spec.add_development_dependency 'yard-activesupport-concern', '~> 0.0.1'
36
+ spec.required_ruby_version = '>= 2.5'
37
+
38
+ spec.add_runtime_dependency 'activesupport', '>= 5.2'
39
+ spec.add_runtime_dependency 'httparty', '>= 0.21'
40
+ spec.add_runtime_dependency 'jwt', '~> 2.6'
41
+ spec.add_runtime_dependency 'recursive-open-struct', '~> 1.1'
42
+
43
+ spec.add_development_dependency 'appraisal', '~> 2.4'
44
+ spec.add_development_dependency 'bundler', '~> 2.3'
45
+ spec.add_development_dependency 'countless', '~> 1.1'
46
+ spec.add_development_dependency 'guard-rspec', '~> 4.7'
47
+ spec.add_development_dependency 'railties', '>= 5.2'
48
+ spec.add_development_dependency 'rake', '~> 13.0'
49
+ spec.add_development_dependency 'rspec', '~> 3.12'
50
+ spec.add_development_dependency 'rubocop', '~> 1.28'
51
+ spec.add_development_dependency 'rubocop-rails', '~> 2.14'
52
+ spec.add_development_dependency 'rubocop-rspec', '~> 2.10'
53
+ spec.add_development_dependency 'simplecov', '>= 0.22'
54
+ spec.add_development_dependency 'timecop', '>= 0.9.6'
55
+ spec.add_development_dependency 'vcr', '~> 6.0'
56
+ spec.add_development_dependency 'webmock', '~> 3.18'
57
+ spec.add_development_dependency 'yard', '>= 0.9.28'
58
+ spec.add_development_dependency 'yard-activesupport-concern', '>= 0.0.1'
43
59
  end
@@ -1,5 +1,23 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # The gem version details.
3
4
  module Keyless
4
- VERSION = '1.0.2'
5
+ # The version of the +keyless+ gem
6
+ VERSION = '1.2.0'
7
+
8
+ class << self
9
+ # Returns the version of gem as a string.
10
+ #
11
+ # @return [String] the gem version as string
12
+ def version
13
+ VERSION
14
+ end
15
+
16
+ # Returns the version of the gem as a +Gem::Version+.
17
+ #
18
+ # @return [Gem::Version] the gem version as object
19
+ def gem_version
20
+ Gem::Version.new VERSION
21
+ end
22
+ end
5
23
  end
data/lib/keyless.rb CHANGED
@@ -7,9 +7,7 @@ require 'active_support/cache'
7
7
  require 'active_support/core_ext/hash'
8
8
  require 'active_support/time'
9
9
  require 'active_support/time_with_zone'
10
-
11
10
  require 'jwt'
12
-
13
11
  require 'keyless/version'
14
12
  require 'keyless/configuration'
15
13
  require 'keyless/jwt'
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keyless
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hermann Mayer
8
8
  - Christopher Mühl
9
9
  - Marcus Geißler
10
- autorequire:
10
+ autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2021-10-15 00:00:00.000000000 Z
13
+ date: 2023-02-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -18,257 +18,305 @@ dependencies:
18
18
  requirements:
19
19
  - - ">="
20
20
  - !ruby/object:Gem::Version
21
- version: 3.2.0
21
+ version: '5.2'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - ">="
27
27
  - !ruby/object:Gem::Version
28
- version: 3.2.0
28
+ version: '5.2'
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: httparty
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - ">="
34
34
  - !ruby/object:Gem::Version
35
- version: '0'
35
+ version: '0.21'
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: '0'
42
+ version: '0.21'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: jwt
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '2.1'
49
+ version: '2.6'
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - "~>"
55
55
  - !ruby/object:Gem::Version
56
- version: '2.1'
56
+ version: '2.6'
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: recursive-open-struct
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - "~>"
62
62
  - !ruby/object:Gem::Version
63
- version: '1.0'
63
+ version: '1.1'
64
64
  type: :runtime
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
68
  - - "~>"
69
69
  - !ruby/object:Gem::Version
70
- version: '1.0'
70
+ version: '1.1'
71
+ - !ruby/object:Gem::Dependency
72
+ name: appraisal
73
+ requirement: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - "~>"
76
+ - !ruby/object:Gem::Version
77
+ version: '2.4'
78
+ type: :development
79
+ prerelease: false
80
+ version_requirements: !ruby/object:Gem::Requirement
81
+ requirements:
82
+ - - "~>"
83
+ - !ruby/object:Gem::Version
84
+ version: '2.4'
71
85
  - !ruby/object:Gem::Dependency
72
86
  name: bundler
73
87
  requirement: !ruby/object:Gem::Requirement
74
88
  requirements:
75
- - - ">="
89
+ - - "~>"
90
+ - !ruby/object:Gem::Version
91
+ version: '2.3'
92
+ type: :development
93
+ prerelease: false
94
+ version_requirements: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - "~>"
76
97
  - !ruby/object:Gem::Version
77
- version: '1.16'
78
- - - "<"
98
+ version: '2.3'
99
+ - !ruby/object:Gem::Dependency
100
+ name: countless
101
+ requirement: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - "~>"
79
104
  - !ruby/object:Gem::Version
80
- version: '3'
105
+ version: '1.1'
81
106
  type: :development
82
107
  prerelease: false
83
108
  version_requirements: !ruby/object:Gem::Requirement
84
109
  requirements:
85
- - - ">="
110
+ - - "~>"
86
111
  - !ruby/object:Gem::Version
87
- version: '1.16'
88
- - - "<"
112
+ version: '1.1'
113
+ - !ruby/object:Gem::Dependency
114
+ name: guard-rspec
115
+ requirement: !ruby/object:Gem::Requirement
116
+ requirements:
117
+ - - "~>"
89
118
  - !ruby/object:Gem::Version
90
- version: '3'
119
+ version: '4.7'
120
+ type: :development
121
+ prerelease: false
122
+ version_requirements: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - "~>"
125
+ - !ruby/object:Gem::Version
126
+ version: '4.7'
91
127
  - !ruby/object:Gem::Dependency
92
128
  name: railties
93
129
  requirement: !ruby/object:Gem::Requirement
94
130
  requirements:
95
131
  - - ">="
96
132
  - !ruby/object:Gem::Version
97
- version: 4.2.0
98
- - - "<"
99
- - !ruby/object:Gem::Version
100
- version: '6.1'
133
+ version: '5.2'
101
134
  type: :development
102
135
  prerelease: false
103
136
  version_requirements: !ruby/object:Gem::Requirement
104
137
  requirements:
105
138
  - - ">="
106
139
  - !ruby/object:Gem::Version
107
- version: 4.2.0
108
- - - "<"
109
- - !ruby/object:Gem::Version
110
- version: '6.1'
140
+ version: '5.2'
111
141
  - !ruby/object:Gem::Dependency
112
142
  name: rake
113
143
  requirement: !ruby/object:Gem::Requirement
114
144
  requirements:
115
145
  - - "~>"
116
146
  - !ruby/object:Gem::Version
117
- version: '10.0'
147
+ version: '13.0'
118
148
  type: :development
119
149
  prerelease: false
120
150
  version_requirements: !ruby/object:Gem::Requirement
121
151
  requirements:
122
152
  - - "~>"
123
153
  - !ruby/object:Gem::Version
124
- version: '10.0'
154
+ version: '13.0'
125
155
  - !ruby/object:Gem::Dependency
126
156
  name: rspec
127
157
  requirement: !ruby/object:Gem::Requirement
128
158
  requirements:
129
159
  - - "~>"
130
160
  - !ruby/object:Gem::Version
131
- version: '3.0'
161
+ version: '3.12'
132
162
  type: :development
133
163
  prerelease: false
134
164
  version_requirements: !ruby/object:Gem::Requirement
135
165
  requirements:
136
166
  - - "~>"
137
167
  - !ruby/object:Gem::Version
138
- version: '3.0'
168
+ version: '3.12'
139
169
  - !ruby/object:Gem::Dependency
140
170
  name: rubocop
141
171
  requirement: !ruby/object:Gem::Requirement
142
172
  requirements:
143
173
  - - "~>"
144
174
  - !ruby/object:Gem::Version
145
- version: 0.63.1
175
+ version: '1.28'
176
+ type: :development
177
+ prerelease: false
178
+ version_requirements: !ruby/object:Gem::Requirement
179
+ requirements:
180
+ - - "~>"
181
+ - !ruby/object:Gem::Version
182
+ version: '1.28'
183
+ - !ruby/object:Gem::Dependency
184
+ name: rubocop-rails
185
+ requirement: !ruby/object:Gem::Requirement
186
+ requirements:
187
+ - - "~>"
188
+ - !ruby/object:Gem::Version
189
+ version: '2.14'
146
190
  type: :development
147
191
  prerelease: false
148
192
  version_requirements: !ruby/object:Gem::Requirement
149
193
  requirements:
150
194
  - - "~>"
151
195
  - !ruby/object:Gem::Version
152
- version: 0.63.1
196
+ version: '2.14'
153
197
  - !ruby/object:Gem::Dependency
154
198
  name: rubocop-rspec
155
199
  requirement: !ruby/object:Gem::Requirement
156
200
  requirements:
157
201
  - - "~>"
158
202
  - !ruby/object:Gem::Version
159
- version: '1.31'
203
+ version: '2.10'
160
204
  type: :development
161
205
  prerelease: false
162
206
  version_requirements: !ruby/object:Gem::Requirement
163
207
  requirements:
164
208
  - - "~>"
165
209
  - !ruby/object:Gem::Version
166
- version: '1.31'
210
+ version: '2.10'
167
211
  - !ruby/object:Gem::Dependency
168
212
  name: simplecov
169
213
  requirement: !ruby/object:Gem::Requirement
170
214
  requirements:
171
- - - "<"
215
+ - - ">="
172
216
  - !ruby/object:Gem::Version
173
- version: '0.18'
217
+ version: '0.22'
174
218
  type: :development
175
219
  prerelease: false
176
220
  version_requirements: !ruby/object:Gem::Requirement
177
221
  requirements:
178
- - - "<"
222
+ - - ">="
179
223
  - !ruby/object:Gem::Version
180
- version: '0.18'
224
+ version: '0.22'
181
225
  - !ruby/object:Gem::Dependency
182
226
  name: timecop
183
227
  requirement: !ruby/object:Gem::Requirement
184
228
  requirements:
185
- - - "~>"
229
+ - - ">="
186
230
  - !ruby/object:Gem::Version
187
- version: 0.9.1
231
+ version: 0.9.6
188
232
  type: :development
189
233
  prerelease: false
190
234
  version_requirements: !ruby/object:Gem::Requirement
191
235
  requirements:
192
- - - "~>"
236
+ - - ">="
193
237
  - !ruby/object:Gem::Version
194
- version: 0.9.1
238
+ version: 0.9.6
195
239
  - !ruby/object:Gem::Dependency
196
240
  name: vcr
197
241
  requirement: !ruby/object:Gem::Requirement
198
242
  requirements:
199
243
  - - "~>"
200
244
  - !ruby/object:Gem::Version
201
- version: '3.0'
245
+ version: '6.0'
202
246
  type: :development
203
247
  prerelease: false
204
248
  version_requirements: !ruby/object:Gem::Requirement
205
249
  requirements:
206
250
  - - "~>"
207
251
  - !ruby/object:Gem::Version
208
- version: '3.0'
252
+ version: '6.0'
209
253
  - !ruby/object:Gem::Dependency
210
254
  name: webmock
211
255
  requirement: !ruby/object:Gem::Requirement
212
256
  requirements:
213
257
  - - "~>"
214
258
  - !ruby/object:Gem::Version
215
- version: '3.1'
259
+ version: '3.18'
216
260
  type: :development
217
261
  prerelease: false
218
262
  version_requirements: !ruby/object:Gem::Requirement
219
263
  requirements:
220
264
  - - "~>"
221
265
  - !ruby/object:Gem::Version
222
- version: '3.1'
266
+ version: '3.18'
223
267
  - !ruby/object:Gem::Dependency
224
268
  name: yard
225
269
  requirement: !ruby/object:Gem::Requirement
226
270
  requirements:
227
- - - "~>"
271
+ - - ">="
228
272
  - !ruby/object:Gem::Version
229
- version: 0.9.18
273
+ version: 0.9.28
230
274
  type: :development
231
275
  prerelease: false
232
276
  version_requirements: !ruby/object:Gem::Requirement
233
277
  requirements:
234
- - - "~>"
278
+ - - ">="
235
279
  - !ruby/object:Gem::Version
236
- version: 0.9.18
280
+ version: 0.9.28
237
281
  - !ruby/object:Gem::Dependency
238
282
  name: yard-activesupport-concern
239
283
  requirement: !ruby/object:Gem::Requirement
240
284
  requirements:
241
- - - "~>"
285
+ - - ">="
242
286
  - !ruby/object:Gem::Version
243
287
  version: 0.0.1
244
288
  type: :development
245
289
  prerelease: false
246
290
  version_requirements: !ruby/object:Gem::Requirement
247
291
  requirements:
248
- - - "~>"
292
+ - - ">="
249
293
  - !ruby/object:Gem::Version
250
294
  version: 0.0.1
251
295
  description: A reusable JWT authentication helper
252
296
  email:
253
297
  - hermann.mayer92@gmail.com
254
298
  - christopher@padarom.xyz
255
- - mg@hausgold.de
299
+ - marcus3006@gmail.com
256
300
  executables: []
257
301
  extensions: []
258
302
  extra_rdoc_files: []
259
303
  files:
260
304
  - ".editorconfig"
261
305
  - ".github/workflows/documentation.yml"
306
+ - ".github/workflows/release.yml"
262
307
  - ".github/workflows/test.yml"
263
308
  - ".gitignore"
264
309
  - ".rspec"
265
310
  - ".rubocop.yml"
266
311
  - ".simplecov"
267
312
  - ".yardopts"
313
+ - Appraisals
268
314
  - CHANGELOG.md
315
+ - CODE_OF_CONDUCT.md
269
316
  - Dockerfile
270
317
  - Envfile
271
318
  - Gemfile
319
+ - Guardfile
272
320
  - LICENSE
273
321
  - Makefile
274
322
  - README.md
@@ -280,16 +328,23 @@ files:
280
328
  - config/docker/.inputrc
281
329
  - doc/assets/project.svg
282
330
  - docker-compose.yml
331
+ - gemfiles/rails_5.2.gemfile
283
332
  - keyless.gemspec
284
333
  - lib/keyless.rb
285
334
  - lib/keyless/configuration.rb
286
335
  - lib/keyless/jwt.rb
287
336
  - lib/keyless/rsa_public_key.rb
288
337
  - lib/keyless/version.rb
289
- homepage: https://github.com/hausgold/keyless
290
- licenses: []
291
- metadata: {}
292
- post_install_message:
338
+ homepage:
339
+ licenses:
340
+ - MIT
341
+ metadata:
342
+ homepage_uri: https://github.com/hausgold/keyless
343
+ source_code_uri: https://github.com/hausgold/keyless
344
+ changelog_uri: https://github.com/hausgold/keyless/blob/master/CHANGELOG.md
345
+ bug_tracker_uri: https://github.com/hausgold/keyless/issues
346
+ documentation_uri: https://www.rubydoc.info/gems/keyless
347
+ post_install_message:
293
348
  rdoc_options: []
294
349
  require_paths:
295
350
  - lib
@@ -297,15 +352,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
297
352
  requirements:
298
353
  - - ">="
299
354
  - !ruby/object:Gem::Version
300
- version: '0'
355
+ version: '2.5'
301
356
  required_rubygems_version: !ruby/object:Gem::Requirement
302
357
  requirements:
303
358
  - - ">="
304
359
  - !ruby/object:Gem::Version
305
360
  version: '0'
306
361
  requirements: []
307
- rubygems_version: 3.2.16
308
- signing_key:
362
+ rubygems_version: 3.3.26
363
+ signing_key:
309
364
  specification_version: 4
310
365
  summary: A reusable JWT authentication helper
311
366
  test_files: []