rom-factory 0.10.1 → 0.11.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.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.action_hero.yml +21 -0
  3. data/.devtools/templates/changelog.erb +43 -0
  4. data/.devtools/templates/release.erb +36 -0
  5. data/.github/FUNDING.yml +1 -0
  6. data/.github/ISSUE_TEMPLATE/bug-report.md +26 -0
  7. data/.github/ISSUE_TEMPLATE/config.yml +5 -0
  8. data/.github/SUPPORT.md +3 -0
  9. data/.github/workflows/ci.yml +87 -0
  10. data/.github/workflows/docsite.yml +38 -9
  11. data/.github/workflows/rubocop.yml +46 -0
  12. data/.github/workflows/sync_configs.yml +41 -18
  13. data/.rspec +1 -1
  14. data/.rubocop.yml +198 -40
  15. data/CHANGELOG.md +88 -33
  16. data/CODEOWNERS +1 -0
  17. data/CODE_OF_CONDUCT.md +1 -1
  18. data/CONTRIBUTING.md +4 -4
  19. data/Gemfile +22 -22
  20. data/Gemfile.devtools +20 -0
  21. data/LICENSE +1 -1
  22. data/README.md +13 -48
  23. data/Rakefile +1 -1
  24. data/benchmarks/basic.rb +10 -10
  25. data/changelog.yml +99 -0
  26. data/docsite/source/index.html.md +162 -1
  27. data/lib/rom/factory/attribute_registry.rb +2 -2
  28. data/lib/rom/factory/attributes/association.rb +52 -12
  29. data/lib/rom/factory/attributes/callable.rb +1 -1
  30. data/lib/rom/factory/attributes/value.rb +1 -1
  31. data/lib/rom/factory/attributes.rb +4 -6
  32. data/lib/rom/factory/builder/persistable.rb +3 -5
  33. data/lib/rom/factory/builder.rb +8 -18
  34. data/lib/rom/factory/constants.rb +1 -1
  35. data/lib/rom/factory/dsl.rb +36 -23
  36. data/lib/rom/factory/factories.rb +13 -15
  37. data/lib/rom/factory/registry.rb +2 -2
  38. data/lib/rom/factory/sequences.rb +1 -1
  39. data/lib/rom/factory/tuple_evaluator.rb +18 -22
  40. data/lib/rom/factory/version.rb +1 -1
  41. data/lib/rom/factory.rb +8 -5
  42. data/lib/rom-factory.rb +1 -1
  43. data/project.yml +3 -0
  44. data/rom-factory.gemspec +8 -11
  45. metadata +43 -43
  46. data/.codeclimate.yml +0 -12
  47. data/.github/ISSUE_TEMPLATE/----please-don-t-ask-for-support-via-issues.md +0 -10
  48. data/.github/ISSUE_TEMPLATE/----please-don-t-report-feature-requests-via-issues.md +0 -10
  49. data/.github/ISSUE_TEMPLATE/---a-detailed-bug-report.md +0 -30
  50. data/.github/ISSUE_TEMPLATE/---bug-report.md +0 -30
  51. data/.github/ISSUE_TEMPLATE/---feature-request.md +0 -18
  52. data/.github/workflows/custom_ci.yml +0 -118
  53. data/Appraisals +0 -9
  54. data/LICENSE.txt +0 -21
  55. data/gemfiles/faker_1.gemfile +0 -34
  56. data/gemfiles/faker_1.gemfile.lock +0 -178
  57. data/gemfiles/faker_2.gemfile +0 -34
  58. data/gemfiles/faker_2.gemfile.lock +0 -178
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 504ab61b3360ec9a28fd62e995f5968cee1f26ac566ab8f4fa5058626f192b62
4
- data.tar.gz: 0f657fa936e822c49e6fca236b0adbac14d661ae4340dbb22c2387a65326fc6b
3
+ metadata.gz: ef868642e36f9a4e7b18c91925f378a2c0da27bd4c7ac6d048650c0c739ce3d9
4
+ data.tar.gz: 8815cd6d8318b35298ff341e5308e7b76692be6d6af58b076a9c5ddd23688bd2
5
5
  SHA512:
6
- metadata.gz: a3bccee8f544c0022d71a6b1652a86d228ff93e97708568192c6027d33bbd1c723bc0f0a303a57c3d673ae614da240c1523436247a35fc5599fecb365e02545f
7
- data.tar.gz: dced3ab7a97199b676e64d5b71aec8ffafc00ff578e3800f78200024c62b82a07f41a125c2bf37b2a4534fde5e8155e9ab84fc31e0279e50d2b3d6113a766983
6
+ metadata.gz: fb80a101f1b6c380ee4660d49756c02a0af58ed60d8c53d7a97ba5f94b5a04b37255a11018c7f47fe0665b71ba4a47ee70c65b1c6418c0d642b7e662bc5beffa
7
+ data.tar.gz: 9f74c1af825e6927a2f1926963c39ac41b7b74471e2795cd6e8b28d1aca839c8fe1a1c688d4116e371a759ababa0b5df3147fcf8ae6b15fc0aaa5418fc4af9db
data/.action_hero.yml ADDED
@@ -0,0 +1,21 @@
1
+ # This is a config synced from rom-rb/template-gem repo
2
+
3
+ sources:
4
+ - repo: rom-rb/template-gem
5
+ sync:
6
+ - "!.github/workflows/ci.yml.erb"
7
+ - ".action_hero.yml.erb"
8
+ - ".devtools/templates/*.sync:${{dir}}/${{name}}"
9
+ - ".github/**/*.*"
10
+ - "spec/support/*"
11
+ - "CODE_OF_CONDUCT.md"
12
+ - "CONTRIBUTING.md"
13
+ - "CODEOWNERS"
14
+ - "LICENSE.erb"
15
+ - "README.erb"
16
+ - "Gemfile.devtools"
17
+ - ".rspec"
18
+ - ".rubocop.yml"
19
+ - repo: action-hero/workflows
20
+ sync:
21
+ - ".github/workflows/*.yml"
@@ -0,0 +1,43 @@
1
+
2
+ <!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
3
+
4
+ <% releases.each_with_index do |r, idx| %>
5
+ ## <%= r.version %> <%= r.date %>
6
+
7
+ <% if r.summary %>
8
+ <%= r.summary %>
9
+
10
+ <% end %>
11
+
12
+ <% if r.added? %>
13
+ ### Added
14
+
15
+ <% r.added.each do |log| %>
16
+ - <%= log %>
17
+ <% end %>
18
+
19
+ <% end %>
20
+ <% if r.fixed? %>
21
+ ### Fixed
22
+
23
+ <% r.fixed.each do |log| %>
24
+ - <%= log %>
25
+ <% end %>
26
+
27
+ <% end %>
28
+ <% if r.changed? %>
29
+ ### Changed
30
+
31
+ <% r.changed.each do |log| %>
32
+ - <%= log %>
33
+ <% end %>
34
+ <% end %>
35
+ <% curr_ver = r.date ? "v#{r.version}" : 'master' %>
36
+ <% prev_rel = releases[idx + 1] %>
37
+ <% if prev_rel %>
38
+ <% ver_range = "v#{prev_rel.version}...#{curr_ver}" %>
39
+
40
+ [Compare <%=ver_range%>](https://github.com/rom-rb/<%= project.name %>/compare/<%=ver_range%>)
41
+ <% end %>
42
+
43
+ <% end %>
@@ -0,0 +1,36 @@
1
+
2
+ <!--- DO NOT EDIT THIS FILE - IT'S AUTOMATICALLY GENERATED VIA DEVTOOLS --->
3
+
4
+ <% if latest_release.summary %>
5
+ <%= latest_release.summary %>
6
+
7
+ <% end %>
8
+
9
+ <% if latest_release.added? %>
10
+ ### Added
11
+
12
+ <% latest_release.added.each do |log| %>
13
+ - <%= log %>
14
+ <% end %>
15
+
16
+ <% end %>
17
+ <% if latest_release.fixed? %>
18
+ ### Fixed
19
+
20
+ <% latest_release.fixed.each do |log| %>
21
+ - <%= log %>
22
+ <% end %>
23
+
24
+ <% end %>
25
+ <% if latest_release.changed? %>
26
+ ### Changed
27
+
28
+ <% latest_release.changed.each do |log| %>
29
+ - <%= log %>
30
+ <% end %>
31
+ <% end %>
32
+ <% if previous_release %>
33
+ <% ver_range = "v#{previous_release.version}...v#{latest_release.version}" %>
34
+
35
+ [Compare <%=ver_range%>](https://github.com/rom-rb/<%= project.name %>/compare/<%=ver_range%>)
36
+ <% end %>
@@ -0,0 +1 @@
1
+ github: hanami
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: "\U0001F41B Bug report"
3
+ about: See CONTRIBUTING.md for more information
4
+ title: ''
5
+ labels: bug, help wanted
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ ## Describe the bug
11
+
12
+ A clear and concise description of what the bug is.
13
+
14
+ ## To Reproduce
15
+
16
+ Provide detailed steps to reproduce, **an executable script would be best**.
17
+
18
+ ## Expected behavior
19
+
20
+ A clear and concise description of what you expected to happen.
21
+
22
+ ## My environment
23
+
24
+ - Affects my production application: **YES/NO**
25
+ - Ruby version: ...
26
+ - OS: ...
@@ -0,0 +1,5 @@
1
+ blank_issues_enabled: false
2
+ contact_links:
3
+ - name: Community Support
4
+ url: https://discourse.rom-rb.org
5
+ about: Please ask and answer questions here.
@@ -0,0 +1,3 @@
1
+ ## Support
2
+
3
+ If you need help with any of the rom-rb libraries, feel free to ask questions on our [discussion forum](https://discourse.rom-rb.org/). This is the best place to seek help. Make sure to search for a potential solution in past threads before posting your question. Thanks! :heart:
@@ -0,0 +1,87 @@
1
+ ---
2
+ name: ci
3
+ on:
4
+ push:
5
+ paths:
6
+ - ".github/workflows/ci.yml"
7
+ - lib/**
8
+ - "*.gemspec"
9
+ - spec/**
10
+ - Rakefile
11
+ - Gemfile
12
+ - Gemfile.devtools
13
+ - ".rubocop.yml"
14
+ - project.yml
15
+ pull_request:
16
+ branches:
17
+ - master
18
+ create:
19
+ jobs:
20
+ tests:
21
+ runs-on: ubuntu-latest
22
+ strategy:
23
+ fail-fast: false
24
+ matrix:
25
+ ruby:
26
+ - '3.1'
27
+ - '3.0'
28
+ - '2.7'
29
+ env:
30
+ COVERAGE: "${{matrix.coverage}}"
31
+ COVERAGE_TOKEN: "${{secrets.CODACY_PROJECT_TOKEN}}"
32
+ APT_DEPS: libpq-dev libmysqlclient-dev libsqlite3-dev
33
+ steps:
34
+ - name: Checkout
35
+ uses: actions/checkout@v1
36
+ - name: Install package dependencies
37
+ run: "[ -e $APT_DEPS ] || sudo apt-get install -y --no-install-recommends $APT_DEPS"
38
+ - name: Set up Ruby
39
+ uses: ruby/setup-ruby@v1
40
+ with:
41
+ ruby-version: "${{matrix.ruby}}"
42
+ - name: Install latest bundler
43
+ run: |
44
+ gem install bundler --no-document
45
+ bundle config set without 'tools benchmarks docs'
46
+ - name: Bundle install
47
+ run: bundle install --jobs 4 --retry 3
48
+ - name: Run all tests
49
+ run: bundle exec rake
50
+ - name: Run codacy-coverage-reporter
51
+ uses: codacy/codacy-coverage-reporter-action@master
52
+ if: env.COVERAGE == 'true' && env.COVERAGE_TOKEN != ''
53
+ with:
54
+ project-token: "${{secrets.CODACY_PROJECT_TOKEN}}"
55
+ coverage-reports: coverage/coverage.xml
56
+ services:
57
+ db:
58
+ image: postgres:10.8
59
+ env:
60
+ POSTGRES_USER: runner
61
+ POSTGRES_PASSWORD: ''
62
+ POSTGRES_DB: rom_factory
63
+ ports:
64
+ - 5432:5432
65
+ options: "--health-cmd pg_isready --health-interval 10s --health-timeout 5s
66
+ --health-retries 5"
67
+ release:
68
+ runs-on: ubuntu-latest
69
+ if: contains(github.ref, 'tags') && github.event_name == 'create'
70
+ needs: tests
71
+ env:
72
+ GITHUB_LOGIN: rom-bot
73
+ GITHUB_TOKEN: "${{secrets.GH_PAT}}"
74
+ steps:
75
+ - uses: actions/checkout@v1
76
+ - name: Install package dependencies
77
+ run: "[ -e $APT_DEPS ] || sudo apt-get install -y --no-install-recommends $APT_DEPS"
78
+ - name: Set up Ruby
79
+ uses: ruby/setup-ruby@v1
80
+ with:
81
+ ruby-version: 2.6
82
+ - name: Install dependencies
83
+ run: gem install ossy --no-document
84
+ - name: Trigger release workflow
85
+ run: |
86
+ tag=$(echo $GITHUB_REF | cut -d / -f 3)
87
+ ossy gh w rom-rb/devtools release --payload "{\"tag\":\"$tag\",\"sha\":\"${{github.sha}}\",\"tag_creator\":\"$GITHUB_ACTOR\",\"repo\":\"$GITHUB_REPOSITORY\",\"repo_name\":\"${{github.event.repository.name}}\"}"
@@ -1,4 +1,4 @@
1
- # this file is managed by rom-rb/devtools project
1
+ # This file is synced from rom-rb/template-gem repo
2
2
 
3
3
  name: docsite
4
4
 
@@ -8,7 +8,7 @@ on:
8
8
  - docsite/**
9
9
  - .github/workflows/docsite.yml
10
10
  branches:
11
- - master
11
+ - main
12
12
  - release-**
13
13
  tags:
14
14
 
@@ -16,19 +16,48 @@ jobs:
16
16
  update-docs:
17
17
  runs-on: ubuntu-latest
18
18
  steps:
19
- - uses: actions/checkout@v1
19
+ - uses: actions/checkout@v2
20
+ with:
21
+ fetch-depth: 0
22
+ - run: |
23
+ git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
20
24
  - name: Set up Ruby
21
25
  uses: actions/setup-ruby@v1
22
26
  with:
23
27
  ruby-version: "2.6.x"
28
+ - name: Set up git user
29
+ run: |
30
+ git config --local user.email "rom-bot@rom-rb.org"
31
+ git config --local user.name "rom-bot"
24
32
  - name: Install dependencies
33
+ run: gem install ossy --no-document
34
+ - name: Update release branches
25
35
  run: |
26
- gem install bundler
27
- bundle install --jobs 4 --retry 3 --without benchmarks sql
28
- - name: Symlink ossy
29
- run: mkdir -p bin && ln -sf "$(bundle show ossy)/bin/ossy" bin/ossy
36
+ branches=`git log --format=%B -n 1 $GITHUB_SHA | grep "docsite:release-" || echo "nothing"`
37
+
38
+ if [[ ! $branches -eq "nothing" ]]; then
39
+ for b in $branches
40
+ do
41
+ name=`echo $b | ruby -e 'puts gets[/:(.+)/, 1].gsub(/\s+/, "")'`
42
+
43
+ echo "merging $GITHUB_SHA to $name"
44
+
45
+ git checkout -b $name --track origin/$name
46
+
47
+ echo `git log -n 1`
48
+
49
+ git cherry-pick $GITHUB_SHA -m 1
50
+ done
51
+
52
+ git push --all "https://rom-bot:${{secrets.GH_PAT}}@github.com/$GITHUB_REPOSITORY.git"
53
+
54
+ git checkout main
55
+ else
56
+ echo "no need to update branches"
57
+ fi
30
58
  - name: Trigger rom-rb.org deploy
31
59
  env:
32
60
  GITHUB_LOGIN: rom-bot
33
- GITHUB_TOKEN: ${{ secrets.GH_PAT }}
34
- run: bin/ossy github workflow rom-rb/rom-rb.org ci
61
+ GITHUB_TOKEN: ${{secrets.GH_PAT}}
62
+ run: ossy github workflow rom-rb/rom-rb.org ci
63
+
@@ -0,0 +1,46 @@
1
+ name: "RuboCop"
2
+ on:
3
+ push:
4
+ branches:
5
+ - "main"
6
+ - "master"
7
+ paths:
8
+ - "**/*.rb"
9
+ - "**/*.rake"
10
+ - "Rakefile"
11
+ - "Gemfile*"
12
+ - ".rubocop.yml"
13
+ pull_request:
14
+ branches:
15
+ - "main"
16
+ - "master"
17
+ types:
18
+ - "opened"
19
+ - "synchronize"
20
+ workflow_dispatch:
21
+ jobs:
22
+ run:
23
+ runs-on: ubuntu-latest
24
+ name: ${{ matrix.type }}
25
+ strategy:
26
+ fail-fast: false
27
+ matrix:
28
+ type: ["Style", "Layout", "Naming", "Lint", "Metrics", "Security"]
29
+ steps:
30
+ - name: Clone
31
+ uses: actions/checkout@v2
32
+ - name: Get git diff
33
+ id: get_diff
34
+ uses: technote-space/get-diff-action@v4
35
+ with:
36
+ PATTERNS: |
37
+ **/*.rb
38
+ **/*.rake
39
+ Gemfile
40
+ Rakefile
41
+ - name: Check ${{ matrix.type }}
42
+ uses: action-hero/actions/rubocop@main
43
+ if: ${{ env.GIT_DIFF != '' }}
44
+ with:
45
+ diff: ${{ env.GIT_DIFF }}
46
+ type: ${{ matrix.type }}
@@ -1,30 +1,53 @@
1
- # this file is managed by rom-rb/devtools project
1
+ # This file is synced from rom-rb/template-gem repo
2
2
 
3
- name: sync_configs
3
+ name: Changelog
4
4
 
5
5
  on:
6
- repository_dispatch:
6
+ push:
7
+ paths:
8
+ - "changelog.yml"
9
+ branches:
10
+ - "main"
11
+ pull_request:
12
+ branches:
13
+ - "main"
14
+ types: [closed]
7
15
 
8
16
  jobs:
9
- sync-configs:
17
+ sync:
10
18
  runs-on: ubuntu-latest
11
- if: github.event.action == 'sync_configs'
19
+ if: github.event.pull_request.merged == true
20
+ name: Update
21
+ env:
22
+ GITHUB_LOGIN: rom-bot
23
+ GITHUB_TOKEN: ${{ secrets.GH_PAT }}
12
24
  steps:
13
- - uses: actions/checkout@v1
14
- - name: Update configuration files from devtools
15
- env:
16
- GITHUB_LOGIN: ${{ github.actor }}
17
- GITHUB_TOKEN: ${{ secrets.GH_PAT }}
25
+ - name: Checkout ${{github.repository}}
26
+ uses: actions/checkout@v1
27
+ - name: Checkout devtools
28
+ uses: actions/checkout@v2
29
+ with:
30
+ repository: rom-rb/devtools
31
+ path: tmp/devtools
32
+ - name: Setup git user
18
33
  run: |
19
- git clone https://github.com/rom-rb/devtools.git tmp/devtools
20
-
21
- rsync -av tmp/devtools/shared/ .
22
-
23
34
  git config --local user.email "rom-bot@rom-rb.org"
24
35
  git config --local user.name "rom-bot"
36
+ - name: Set up Ruby
37
+ uses: actions/setup-ruby@v1
38
+ with:
39
+ ruby-version: "2.6"
40
+ - name: Install dependencies
41
+ run: gem install ossy --no-document
42
+ - name: Update changelog.yml from commit
43
+ run: tmp/devtools/bin/update-changelog-from-commit $GITHUB_SHA
44
+ - name: Compile CHANGELOG.md
45
+ run: tmp/devtools/bin/compile-changelog
46
+ - name: Commit
47
+ run: |
25
48
  git add -A
26
- git commit -m "[devtools] config sync" || echo "nothing changed"
49
+ git commit -m "Update CHANGELOG.md" || echo "nothing to commit"
27
50
  - name: Push changes
28
- uses: ad-m/github-push-action@master
29
- with:
30
- github_token: ${{ secrets.GH_PAT }}
51
+ run: |
52
+ git pull --rebase origin main
53
+ git push https://rom-bot:${{secrets.GH_PAT}}@github.com/${{github.repository}}.git HEAD:main
data/.rspec CHANGED
@@ -1,4 +1,4 @@
1
1
  --color
2
2
  --require spec_helper
3
3
  --order random
4
-
4
+ --warnings