rom-rails 1.1.0 → 2.3.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 (54) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/----please-don-t-ask-for-support-via-issues.md +10 -0
  3. data/.github/ISSUE_TEMPLATE/---bug-report.md +30 -0
  4. data/.github/ISSUE_TEMPLATE/---feature-request.md +18 -0
  5. data/.github/workflows/ci.yml +67 -0
  6. data/.github/workflows/docsite.yml +34 -0
  7. data/.github/workflows/sync_configs.yml +30 -0
  8. data/.rubocop.yml +46 -9
  9. data/CHANGELOG.md +68 -0
  10. data/CONTRIBUTING.md +29 -0
  11. data/Gemfile +21 -12
  12. data/README.md +3 -5
  13. data/Rakefile +1 -1
  14. data/docsite/source/index.html.md +165 -0
  15. data/lib/generators/rom.rb +8 -0
  16. data/lib/generators/rom/commands/templates/create.rb.erb +0 -2
  17. data/lib/generators/rom/commands/templates/delete.rb.erb +0 -1
  18. data/lib/generators/rom/commands/templates/update.rb.erb +0 -2
  19. data/lib/generators/rom/commands_generator.rb +1 -1
  20. data/lib/generators/rom/install/templates/application_model.rb +2 -2
  21. data/lib/generators/rom/install/templates/initializer.rb.erb +1 -1
  22. data/lib/generators/rom/install/templates/types.rb +3 -3
  23. data/lib/generators/rom/install_generator.rb +1 -4
  24. data/lib/generators/rom/relation_generator.rb +1 -1
  25. data/lib/generators/rom/repository/templates/repository.rb.erb +8 -0
  26. data/lib/generators/rom/repository_generator.rb +1 -2
  27. data/lib/rom/rails/active_record/configuration.rb +41 -55
  28. data/lib/rom/rails/active_record/uri_builder.rb +70 -0
  29. data/lib/rom/rails/configuration.rb +1 -1
  30. data/lib/rom/rails/railtie.rb +30 -12
  31. data/lib/rom/rails/tasks/db.rake +6 -0
  32. data/lib/rom/rails/version.rb +1 -1
  33. data/rom-rails.gemspec +8 -9
  34. data/spec/dummy/app/commands/create_user.rb +0 -1
  35. data/spec/dummy/app/forms/user_form.rb +1 -2
  36. data/spec/dummy/app/relations/dummy_relation.rb +1 -1
  37. data/spec/dummy/app/relations/tasks.rb +1 -0
  38. data/spec/dummy/app/relations/users.rb +1 -0
  39. data/spec/dummy/bin/bundle +1 -1
  40. data/spec/dummy/bin/rails +1 -1
  41. data/spec/dummy/config/initializers/rom.rb +4 -3
  42. data/spec/dummy/lib/additional_app/{app → persistence}/commands/create_additional_task.rb +0 -0
  43. data/spec/dummy/lib/rom/test_adapter.rb +1 -0
  44. data/spec/integration/controller_extensions_spec.rb +23 -0
  45. data/spec/integration/initializer_spec.rb +1 -1
  46. data/spec/integration/user_commands_spec.rb +1 -1
  47. data/spec/lib/active_record/configuration_spec.rb +87 -1
  48. data/spec/lib/generators/commands_generator_spec.rb +2 -3
  49. data/spec/lib/generators/install_generator_spec.rb +7 -10
  50. data/spec/lib/generators/mapper_generator_spec.rb +1 -1
  51. data/spec/lib/generators/relation_generator_spec.rb +5 -2
  52. data/spec/lib/generators/repository_generator_spec.rb +17 -1
  53. metadata +45 -34
  54. data/.travis.yml +0 -20
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d4eaf43b4a1e3674b9796df9c03afefe43e571d2fa9f27f12474b99e472ff636
4
- data.tar.gz: f320d87054de5000318c5f5426778d1cba4057ec8331cf0a6861a2713fe84628
3
+ metadata.gz: 5fce2e9329194bb83964a04c19899efea1d3f61e2c38a62f5587440a431deb7f
4
+ data.tar.gz: cf7aac16519079bec773b5fa2799199212989c8c8b36c4afd7e2d44eee1032ee
5
5
  SHA512:
6
- metadata.gz: 84e3f5fbf22a37294507e14d8de2bc2673091f4a8fe2e5b1a0b9eeba84ead0f967bbb7e08d9a805cd97d30a2c8ff5caba70a601ca88fcdabdd1614a67c424110
7
- data.tar.gz: f77380599becffba851cba0a2c4572a03edc968f21dcc83012df701342d4cd64f7825b275b5768fcbd55094c01e163847b67aafa555562431bcc2b1158378134
6
+ metadata.gz: 846026a514b5aa386cbba31d68e1b643894fb729ef6ee08b3e72dd9b289609b98ca31fe87f431abbfd3cb950c6e42639e89445d96202705c91ed06be14962f4f
7
+ data.tar.gz: 0b3d2dbeaa5c848b52f8d143b79a191fb2ec0a1a08783c7100720abbb74a36ae840c55a41f8ddddc0cf323045f81d10fc5baa638a7bd07325c31edc9cf3a2690
@@ -0,0 +1,10 @@
1
+ ---
2
+ name: "⚠️ Please don't ask for support via issues"
3
+ about: See CONTRIBUTING.md for more information
4
+ title: ''
5
+ labels: ''
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+
@@ -0,0 +1,30 @@
1
+ ---
2
+ name: "\U0001F41B Bug report"
3
+ about: See CONTRIBUTING.md for more information
4
+ title: ''
5
+ labels: bug
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ **Before you submit this: WE ONLY ACCEPT BUG REPORTS AND FEATURE REQUESTS**
11
+
12
+ For more information see [our contribution guidelines](https://github.com/rom-rb/rom/blob/master/CONTRIBUTING.md)
13
+
14
+ **Describe the bug**
15
+
16
+ A clear and concise description of what the bug is.
17
+
18
+ **To Reproduce**
19
+
20
+ Provide detailed steps to reproduce, an executable script would be best.
21
+
22
+ **Expected behavior**
23
+
24
+ A clear and concise description of what you expected to happen.
25
+
26
+ **Your environment**
27
+
28
+ - Affects my production application: **YES/NO**
29
+ - Ruby version: ...
30
+ - OS: ...
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: "\U0001F6E0 Feature request"
3
+ about: See CONTRIBUTING.md for more information
4
+ title: ''
5
+ labels: feature
6
+ assignees: ''
7
+
8
+ ---
9
+
10
+ Summary of what the feature is supposed to do.
11
+
12
+ ## Examples
13
+
14
+ Code examples showing how the feature could be used.
15
+
16
+ ## Resources
17
+
18
+ Additional information, like a link to the discussion forum thread where the feature was discussed etc.
@@ -0,0 +1,67 @@
1
+ ---
2
+ name: ci
3
+ on:
4
+ push:
5
+ branches:
6
+ - master
7
+ paths:
8
+ - ".github/workflows/ci.yml"
9
+ - lib/**
10
+ - "*.gemspec"
11
+ - spec/**
12
+ - db/migrate/**
13
+ - Rakefile
14
+ - Gemfile
15
+ - ".rubocop.yml"
16
+ pull_request:
17
+ branches:
18
+ - master
19
+ create:
20
+ jobs:
21
+ tests:
22
+ runs-on: ubuntu-latest
23
+ strategy:
24
+ fail-fast: false
25
+ matrix:
26
+ ruby:
27
+ - '2.7'
28
+ - '2.6'
29
+ - '2.5'
30
+ - '2.4'
31
+ - jruby
32
+ rails:
33
+ - "6.1.0"
34
+ - "6.0.0"
35
+ - "5.2.0"
36
+ - "5.1.0"
37
+ - "5.0.0"
38
+ - "4.2.0"
39
+ exclude:
40
+ - ruby: "2.4"
41
+ rails: "6.0.0"
42
+ - ruby: "2.4"
43
+ rails: "6.1.0"
44
+ - ruby: "2.7"
45
+ rails: "4.2.0"
46
+ env:
47
+ APT_DEPS: libsqlite3-dev
48
+ RAILS_VERSION: "${{matrix.rails}}"
49
+ RAILS_ENV: test
50
+
51
+ steps:
52
+ - name: Checkout
53
+ uses: actions/checkout@v1
54
+ - name: Install package dependencies
55
+ run: "[ -e $APT_DEPS ] || sudo apt-get install -y --no-install-recommends $APT_DEPS"
56
+ - name: Set up Ruby
57
+ uses: ruby/setup-ruby@v1
58
+ with:
59
+ ruby-version: "${{matrix.ruby}}"
60
+ - name: Install latest bundler
61
+ run: |
62
+ gem install bundler --no-document
63
+ bundle config set without 'tools benchmarks docs'
64
+ - name: Bundle install
65
+ run: bundle install --jobs 4 --retry 3
66
+ - name: Run all tests
67
+ run: bundle exec rake app:db:reset app:spec
@@ -0,0 +1,34 @@
1
+ # this file is managed by rom-rb/devtools project
2
+
3
+ name: docsite
4
+
5
+ on:
6
+ push:
7
+ paths:
8
+ - docsite/**
9
+ - .github/workflows/docsite.yml
10
+ branches:
11
+ - master
12
+ - release-**
13
+ tags:
14
+
15
+ jobs:
16
+ update-docs:
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - uses: actions/checkout@v1
20
+ - name: Set up Ruby
21
+ uses: actions/setup-ruby@v1
22
+ with:
23
+ ruby-version: "2.6.x"
24
+ - name: Install dependencies
25
+ 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
30
+ - name: Trigger rom-rb.org deploy
31
+ env:
32
+ GITHUB_LOGIN: rom-bot
33
+ GITHUB_TOKEN: ${{ secrets.GH_PAT }}
34
+ run: bin/ossy github workflow rom-rb/rom-rb.org ci
@@ -0,0 +1,30 @@
1
+ # this file is managed by rom-rb/devtools project
2
+
3
+ name: sync_configs
4
+
5
+ on:
6
+ repository_dispatch:
7
+
8
+ jobs:
9
+ sync-configs:
10
+ runs-on: ubuntu-latest
11
+ if: github.event.action == 'sync_configs'
12
+ 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 }}
18
+ run: |
19
+ git clone https://github.com/rom-rb/devtools.git tmp/devtools
20
+
21
+ rsync -av tmp/devtools/shared/ .
22
+
23
+ git config --local user.email "rom-bot@rom-rb.org"
24
+ git config --local user.name "rom-bot"
25
+ git add -A
26
+ git commit -m "[devtools] config sync" || echo "nothing changed"
27
+ - name: Push changes
28
+ uses: ad-m/github-push-action@master
29
+ with:
30
+ github_token: ${{ secrets.GH_PAT }}
data/.rubocop.yml CHANGED
@@ -22,6 +22,7 @@ Metrics/PerceivedComplexity:
22
22
 
23
23
  # Don’t check temp and Rails-generated files
24
24
  AllCops:
25
+ TargetRubyVersion: 2.3.1
25
26
  Exclude:
26
27
  - spec/dummy/Rakefile
27
28
  - spec/dummy/config/**/*
@@ -30,10 +31,14 @@ AllCops:
30
31
  - tmp/**/*
31
32
  - vendor/**/*
32
33
 
34
+ Layout/AlignArguments:
35
+ EnforcedStyle: with_fixed_indentation
36
+
33
37
  # The enforced style doesn’t match Vim’s defaults
34
- Style/AlignParameters:
38
+ Layout/AlignParameters:
35
39
  Enabled: false
36
40
 
41
+
37
42
  # UTF-8 is perfectly fine in comments
38
43
  Style/AsciiComments:
39
44
  Enabled: false
@@ -60,8 +65,8 @@ Style/ClassAndModuleChildren:
60
65
  Style/Documentation:
61
66
  Enabled: false
62
67
 
63
- # This is a shim file for those who require 'rom-mongo'
64
- Style/FileName:
68
+ # This is a shim file for those who require 'rom-rails'
69
+ Naming/FileName:
65
70
  Exclude:
66
71
  - lib/rom-rails.rb
67
72
 
@@ -78,7 +83,7 @@ Style/MultilineBlockChain:
78
83
  Enabled: false
79
84
 
80
85
  # Multiline operation chains are indented
81
- Style/MultilineOperationIndentation:
86
+ Layout/MultilineOperationIndentation:
82
87
  EnforcedStyle: indented
83
88
 
84
89
  # Model::Validator uses Model::ValidationError for this
@@ -91,7 +96,7 @@ Style/SignalException:
91
96
  EnforcedStyle: only_raise
92
97
 
93
98
  # Need to be skipped for >-> usage
94
- Style/SpaceAroundOperators:
99
+ Layout/SpaceAroundOperators:
95
100
  Enabled: false
96
101
 
97
102
  # Accept both single and double quotes
@@ -102,10 +107,6 @@ Style/StringLiterals:
102
107
  Style/TrivialAccessors:
103
108
  Enabled: false
104
109
 
105
- Style/AccessorMethodName:
106
- Exclude:
107
- - lib/rom/rails/model/params.rb
108
-
109
110
  # Allow logical `or`/`and` in conditionals
110
111
  Style/AndOr:
111
112
  EnforcedStyle: conditionals
@@ -114,3 +115,39 @@ Style/AndOr:
114
115
  Performance/RedundantBlockCall:
115
116
  Enabled: false
116
117
 
118
+ Style/FrozenStringLiteralComment:
119
+ Enabled: false
120
+
121
+ Style/PercentLiteralDelimiters:
122
+ Enabled: false
123
+
124
+ Lint/AmbiguousBlockAssociation:
125
+ Enabled: false
126
+
127
+ Metrics/BlockLength:
128
+ Enabled: false
129
+
130
+ Layout/SpaceInsideHashLiteralBraces:
131
+ Enabled: false
132
+
133
+ Style/BlockDelimiters:
134
+ Enabled: false
135
+
136
+
137
+ Layout/SpaceInsideArrayLiteralBrackets:
138
+ Enabled: false
139
+
140
+ Style/IfUnlessModifier:
141
+ Enabled: false
142
+
143
+ Layout/AccessModifierIndentation:
144
+ Enabled: false
145
+
146
+ Style/SymbolArray:
147
+ Enabled: false
148
+
149
+ Style/SafeNavigation:
150
+ Enabled: false
151
+
152
+ Lint/HandleExceptions:
153
+ Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,3 +1,71 @@
1
+ ## v2.3.0 2021-03-20
2
+
3
+ ### Changed
4
+
5
+ * Updated dependencies to allow Rails 6.1 (alex-lairan)
6
+
7
+ ## v2.2.0 2019-09-12
8
+
9
+ ### Changed
10
+
11
+ * Read new-style Rails6 configuration, inferring all defined databases (cflipse)
12
+
13
+ ### Fixed
14
+
15
+ * Updated generator to produce files that are actually compatible with ROM 5.0 (cflipse)
16
+
17
+ [Compare v2.1.0...v2.2.0](https://github.com/rom-rb/rom-rails/compare/v2.1.0...v2.2.0)
18
+
19
+ ## v2.1.0 2019-09-09
20
+
21
+ ### Changed
22
+
23
+ * Allow rails6 (cflipse)
24
+
25
+ [Compare v2.0.0...v2.1.0](https://github.com/rom-rb/rom-rails/compare/v2.0.0...v2.1.0)
26
+
27
+ ## v2.0.0 2019-04-27
28
+
29
+ ### Changed
30
+
31
+ * Updated to depend on rom-* 5.0
32
+ * Repository generator creates a `by_id` method (cflipse)
33
+
34
+ [Compare v1.3.0...v2.0.0](https://github.com/rom-rb/rom-rails/compare/v1.3.0...v2.0.0)
35
+
36
+ ## v1.3.0 2018-11-26
37
+
38
+ ### Changed
39
+
40
+ * Rake task automatically attempts to include `rom-sql`'s tasks (cflipse)
41
+ * Escape special characters in username & password from parsed database.yml (Cervajz)
42
+
43
+ ### Fixed
44
+
45
+ * do not double log when ActiveRecord is present (Cervajz)
46
+ * running the install generator no longer results in a broken app if `DATABASE_URL` is not set (cflipse)
47
+
48
+ [Compare v1.2.0...v1.3.0](https://github.com/rom-rb/rom-rails/compare/v1.2.0...v1.3.0)
49
+
50
+ ## v1.2.0 2018-10-20
51
+
52
+ ### Changed
53
+
54
+ * ROM output is broadcast to STDOUT during rails console (radar)
55
+ * Generators default to same adapter as the default gateway (cflipse)
56
+ * Default auto-registration path set to app (cflipse)
57
+ * Include controller extensions in API controllers (cflipse)
58
+
59
+ [Compare v1.1.1...v1.2.0](https://github.com/rom-rb/rom-rails/compare/v1.1.1...v1.2.0)
60
+
61
+ ## v1.1.1 2018-04-17
62
+
63
+ ### Fixedd
64
+
65
+ * Fix Rails.logger lookup bug (cflipse)
66
+
67
+ [Compare v1.1.0...v1.1.1](https://github.com/rom-rb/rom-rails/compare/v1.1.0...v1.1.1)
68
+
1
69
  ## v1.1.0 2018-03-18
2
70
 
3
71
  ### Added
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,29 @@
1
+ # Issue Guidelines
2
+
3
+ ## Reporting bugs
4
+
5
+ If you found a bug, report an issue and describe what's the expected behavior versus what actually happens. If the bug causes a crash, attach a full backtrace. If possible, a reproduction script showing the problem is highly appreciated.
6
+
7
+ ## Reporting feature requests
8
+
9
+ Report a feature request **only after discussing it first on [discourse.rom-rb.org](https://discourse.rom-rb.org)** where it was accepted. Please provide a concise description of the feature, don't link to a discussion thread, and instead summarize what was discussed.
10
+
11
+ ## Reporting questions, support requests, ideas, concerns etc.
12
+
13
+ **PLEASE DON'T** - use [discourse.rom-rb.org](http://discourse.rom-rb.org) instead.
14
+
15
+ # Pull Request Guidelines
16
+
17
+ A Pull Request will only be accepted if it addresses a specific issue that was reported previously, or fixes typos, mistakes in documentation etc.
18
+
19
+ Other requirements:
20
+
21
+ 1) Do not open a pull request if you can't provide tests along with it. If you have problems writing tests, ask for help in the related issue.
22
+ 2) Follow the style conventions of the surrounding code. In most cases, this is standard ruby style.
23
+ 3) Add API documentation if it's a new feature
24
+ 4) Update API documentation if it changes an existing feature
25
+ 5) Bonus points for sending a PR to [github.com/rom-rb/rom-rb.org](https://github.com/rom-rb/rom-rb.org) which updates user documentation and guides
26
+
27
+ # Asking for help
28
+
29
+ If these guidelines aren't helpful, and you're stuck, please post a message on [discourse.rom-rb.org](https://discourse.rom-rb.org).
data/Gemfile CHANGED
@@ -2,32 +2,41 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- RAILS_VERSION = ENV.fetch("RAILS_VERSION", '5.1.0').freeze
5
+ RAILS_VERSION = ENV.fetch("RAILS_VERSION", '6.1.1').freeze
6
6
 
7
7
  %w(railties actionview actionpack activerecord).each do |name|
8
8
  gem name, "~> #{RAILS_VERSION}"
9
9
  end
10
10
 
11
- gem 'sqlite3', platforms: [:mri, :rbx]
12
11
  gem 'byebug', platforms: :mri
12
+ gem 'sqlite3', platforms: [:mri, :rbx]
13
+
13
14
 
14
- gem 'rom', git: 'https://github.com/rom-rb/rom', branch: 'master' do
15
- gem 'rom-core'
16
- gem 'rom-mapper'
17
- gem 'rom-repository', group: :tools
18
- end
19
15
 
20
- gem 'rom-sql', github: 'rom-rb/rom-sql', branch: 'master'
16
+ if ENV["USE_ROM_MASTER"].eql?("true")
17
+ gem 'rom', git: 'https://github.com/rom-rb/rom', branch: 'master' do
18
+ gem 'rom-core'
19
+ gem 'rom-mapper'
20
+ gem 'rom-repository', group: :tools
21
+ end
22
+
23
+ gem 'rom-sql', github: 'rom-rb/rom-sql', branch: 'master'
24
+ else
25
+ gem "rom"
26
+ gem "rom-sql"
27
+
28
+ gem "sequel", "5.31.0"
29
+ end
21
30
 
22
31
  platforms :jruby do
23
32
  gem 'jdbc-sqlite3'
24
33
  end
25
34
 
26
35
  group :test do
27
- gem 'rack-test'
28
- gem 'rspec-rails', '~> 3.1'
29
- gem 'codeclimate-test-reporter', require: nil
30
- gem 'database_cleaner'
31
36
  gem 'capybara'
37
+ gem 'codeclimate-test-reporter', require: nil
38
+ gem 'database_cleaner', "~> 1.8.1"
32
39
  gem 'generator_spec'
40
+ gem 'rack-test'
41
+ gem 'rspec-rails', '~> 3.1'
33
42
  end