alba 1.3.0 → 1.6.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: b2c2e8c84ddccf4db9f9f18dd155361567f2a1733c55f817f5b4d97d573675d5
4
- data.tar.gz: 3f11dd120c8b57aef909d79f6570482b8af810cd19c57ddcaa0d7b2ee70c2d6b
3
+ metadata.gz: c7ab62feaab9747cd1441aea57b8d8f7f1d149261d86e4e64e9f859ae8f1091c
4
+ data.tar.gz: 4442a77416ee235ad6537580ec0600c4b1c9b0bea7b154b3a96010514316531d
5
5
  SHA512:
6
- metadata.gz: 8948a681fb88b3d84e3751e6df0f5ca28314d6c9b5e183666780be95b14fd3c7728e6ad1eb13309d4b7114115b56edbb28fe929c2376bbcc5b762846a7d00404
7
- data.tar.gz: 9a2430efc4cf3b7a24b27bb40228dad67e00bd0cb10c9e0fc3764eb49e9caafda5b6d9fa0cc0335c77edc42e0a60416b20343dee5cee23dcfbfe350bed90e9a6
6
+ metadata.gz: 373f00c4b2bf57f18d65d86a9c8209f9d0c94038f44a98df8e7c7768158d23e03f427729006eb113f0e88fde17a829364cf561026858c83bbb861a7d7eefba13
7
+ data.tar.gz: ad75036a0f554d13637d32413906f17166347459f2e3bcd3e1fe55f4ddc5d805da59ece5c1e46babadea434d667927aab4e3b7f6b0d37887ee6f58cae10396c9
@@ -0,0 +1,70 @@
1
+ # For most projects, this workflow file will not need changing; you simply need
2
+ # to commit it to your repository.
3
+ #
4
+ # You may wish to alter this file to override the set of languages analyzed,
5
+ # or to provide custom queries or build logic.
6
+ #
7
+ # ******** NOTE ********
8
+ # We have attempted to detect the languages in your repository. Please check
9
+ # the `language` matrix defined below to confirm you have the correct set of
10
+ # supported CodeQL languages.
11
+ #
12
+ name: "CodeQL"
13
+
14
+ on:
15
+ push:
16
+ branches: [ main ]
17
+ pull_request:
18
+ # The branches below must be a subset of the branches above
19
+ branches: [ main ]
20
+ schedule:
21
+ - cron: '21 4 * * 5'
22
+
23
+ jobs:
24
+ analyze:
25
+ name: Analyze
26
+ runs-on: ubuntu-latest
27
+ permissions:
28
+ actions: read
29
+ contents: read
30
+ security-events: write
31
+
32
+ strategy:
33
+ fail-fast: false
34
+ matrix:
35
+ language: [ 'ruby' ]
36
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37
+ # Learn more about CodeQL language support at https://git.io/codeql-language-support
38
+
39
+ steps:
40
+ - name: Checkout repository
41
+ uses: actions/checkout@v2
42
+
43
+ # Initializes the CodeQL tools for scanning.
44
+ - name: Initialize CodeQL
45
+ uses: github/codeql-action/init@v1
46
+ with:
47
+ languages: ${{ matrix.language }}
48
+ # If you wish to specify custom queries, you can do so here or in a config file.
49
+ # By default, queries listed here will override any specified in a config file.
50
+ # Prefix the list here with "+" to use these queries and those in the config file.
51
+ # queries: ./path/to/local/query, your-org/your-repo/queries@main
52
+
53
+ # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
54
+ # If this step fails, then you should remove it and run the build manually (see below)
55
+ - name: Autobuild
56
+ uses: github/codeql-action/autobuild@v1
57
+
58
+ # ℹ️ Command-line programs to run using the OS shell.
59
+ # 📚 https://git.io/JvXDl
60
+
61
+ # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
62
+ # and modify them (or add more) to build your code if your project
63
+ # uses a compiled language
64
+
65
+ #- run: |
66
+ # make bootstrap
67
+ # make release
68
+
69
+ - name: Perform CodeQL Analysis
70
+ uses: github/codeql-action/analyze@v1
@@ -8,9 +8,11 @@ jobs:
8
8
  fail-fast: false
9
9
  matrix:
10
10
  os: [ubuntu-latest, windows-latest, macos-latest]
11
- ruby: [2.5, 2.6, 2.7, 3.0, head, jruby, truffleruby]
11
+ ruby: [2.5, 2.6, 2.7, 3.0, 3.1, head, jruby, truffleruby]
12
12
  gemfile: [all, without_active_support, without_oj]
13
13
  exclude:
14
+ - os: windows-latest
15
+ ruby: 3.1
14
16
  - os: windows-latest
15
17
  ruby: jruby
16
18
  - os: windows-latest
@@ -0,0 +1,21 @@
1
+ name: Performance Check
2
+
3
+ on: [pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ strategy:
8
+ fail-fast: false
9
+ matrix:
10
+ ruby: [2.5, 2.6, 2.7, 3.0]
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ - name: Set up Ruby
15
+ uses: ruby/setup-ruby@v1
16
+ with:
17
+ ruby-version: ${{ matrix.ruby }}
18
+ bundler-cache: true
19
+ - name: Run benchmark
20
+ run: |
21
+ ruby script/perf_check.rb
data/.rubocop.yml CHANGED
@@ -13,12 +13,13 @@ AllCops:
13
13
  - 'Rakefile'
14
14
  - 'alba.gemspec'
15
15
  - 'benchmark/**/*.rb'
16
+ - 'script/**/*.rb'
16
17
  NewCops: enable
17
18
  EnabledByDefault: true
18
19
  TargetRubyVersion: 2.5
19
20
 
20
- # Oneline comment is not valid so until it gets valid, we disable it
21
- Bundler/GemComment:
21
+ # Items in Gemfile is dev dependencies and we don't have to specify versions.
22
+ Bundler/GemVersion:
22
23
  Enabled: false
23
24
 
24
25
  # We'd like to write something like:
@@ -44,18 +45,16 @@ Metrics:
44
45
  Exclude:
45
46
  - 'test/**/*.rb'
46
47
 
47
- Metrics/MethodLength:
48
- Max: 15
49
-
50
48
  # `Resource` module is a core module and its length tends to be long...
49
+ # `Alba` main module is also long because it has all parts of configuration
51
50
  Metrics/ModuleLength:
52
51
  Exclude:
53
52
  - 'lib/alba/resource.rb'
53
+ - 'lib/alba.rb'
54
54
 
55
55
  # Resource class includes DSLs, which tend to accept long list of parameters
56
56
  Metrics/ParameterLists:
57
57
  Exclude:
58
- - 'lib/alba/resource.rb'
59
58
  - 'test/**/*.rb'
60
59
 
61
60
  # We need to eval resource code to test errors on resource classes
@@ -81,7 +80,10 @@ Style/InlineComment:
81
80
  Enabled: false
82
81
 
83
82
  Style/MethodCallWithArgsParentheses:
84
- Enabled: false
83
+ IgnoredMethods: ['require', 'require_relative', 'include', 'extend', 'puts', 'p', 'warn', 'raise', 'send', 'public_send']
84
+ Exclude:
85
+ # There are so many `attributes` call without parenthese and that's absolutely fine
86
+ - 'test/**/*.rb'
85
87
 
86
88
  # There are so many cases we just want `if` expression!
87
89
  Style/MissingElse:
data/CHANGELOG.md CHANGED
@@ -6,6 +6,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.6.0] 2022-03-16
10
+
11
+ - [Feat] Support instance method as an attribute
12
+ - [Fix] Explicitly raise error when inference is disabled
13
+ - [Improve] `enable_inference!` now takes inflector as argument
14
+ - [Improve] `transform_keys` now accepts `:snake` and `:none`
15
+ - [Deprecate] `to_hash` is special method and should not be used
16
+ - [Deprecate] `ignoring` in favor of `attributes` overriding
17
+ - [Deprecate] `Alba.on_nil`, `Alba.on_error` and `Alba.enable_root_key_transformation!`
18
+
19
+ ## [1.5.0] 2021-11-28
20
+
21
+ - [Feat] Add nil handler
22
+ - [Feat] Implement layout feature
23
+ - [Improve] if option now works with Symbol
24
+ - [Improve] Add an alias for serialize
25
+ - [Improve] Deprecation warning now printed with caller
26
+
27
+ ## [1.4.0] 2021-06-30
28
+
29
+ - [Feat] Add a config method to set encoder directly
30
+ - [Feat] Implement `meta` method and option for metadata
31
+ - [Feat] Add `root_key` option to `Resource#serialize`
32
+ - [Feat] Enable setting key for collection with `root_key`
33
+ - [Feat] Add `Resource.root_key` and `Resource.root_key!`
34
+ - [Feat] `Alba.serialize` now infers resource class
35
+ - [Deprecated] `Resource.key` and `Resource.key!` are deprecated
36
+
9
37
  ## [1.3.0] 2021-05-31
10
38
 
11
39
  - [Perf] Improve performance for `many` [641d8f9]
data/Gemfile CHANGED
@@ -5,16 +5,17 @@ gemspec
5
5
 
6
6
  gem 'activesupport', require: false # For backend
7
7
  gem 'ffaker', require: false # For testing
8
+ gem 'inch', require: false # For inline documents
8
9
  gem 'minitest', '~> 5.14' # For test
9
10
  gem 'rake', '~> 13.0' # For test and automation
10
11
  gem 'rubocop', '>= 0.79.0', require: false # For lint
11
- gem 'rubocop-minitest', '~> 0.12.0', require: false # For lint
12
- gem 'rubocop-performance', '~> 1.11.0', require: false # For lint
12
+ gem 'rubocop-minitest', '~> 0.18.0', require: false # For lint
13
+ gem 'rubocop-performance', '~> 1.13.0', require: false # For lint
13
14
  gem 'rubocop-rake', '>= 0.5.1', require: false # For lint
14
15
  gem 'rubocop-sensible', '~> 0.3.0', require: false # For lint
15
16
  gem 'simplecov', '~> 0.21.0', require: false # For test coverage
16
17
  gem 'simplecov-cobertura', require: false # For test coverage
17
- gem 'yard', require: false
18
+ gem 'yard', require: false # For documentation
18
19
 
19
20
  platforms :ruby do
20
21
  gem 'oj', '~> 3.11', require: false # For backend