azeroth 2.1.1 → 2.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 +4 -4
- data/.circleci/config.yml +6 -9
- data/.github/active_ext-usage.md +137 -0
- data/.github/azeroth-usage.md +277 -0
- data/.github/copilot-instructions.md +70 -0
- data/.github/core_ext-usage.md +324 -0
- data/.github/jace-usage.md +241 -0
- data/.rubocop.yml +14 -1
- data/.rubocop_todo.yml +1 -15
- data/Dockerfile +2 -2
- data/Gemfile +20 -16
- data/README.md +5 -6
- data/Rakefile +3 -0
- data/azeroth.gemspec +3 -3
- data/lib/azeroth/decorator/key_value_extractor.rb +1 -1
- data/lib/azeroth/version.rb +1 -1
- data/spec/controllers/documents_controller_spec.rb +5 -5
- data/spec/controllers/documents_with_error_controller_spec.rb +3 -3
- data/spec/controllers/index_documents_controller_spec.rb +1 -1
- data/spec/controllers/paginated_documents_controller_spec.rb +1 -1
- data/spec/controllers/rendering_controller_spec.rb +1 -1
- data/spec/dummy/app/controllers/games_controller.rb +1 -0
- data/spec/dummy/app/controllers/publishers_controller.rb +1 -0
- data/spec/dummy/app/models/document.rb +1 -1
- data/spec/dummy/app/models/dummy_model.rb +1 -1
- data/spec/dummy/app/models/factory.rb +3 -3
- data/spec/dummy/app/models/game/decorator.rb +1 -1
- data/spec/dummy/app/models/game.rb +1 -1
- data/spec/dummy/app/models/movie.rb +1 -1
- data/spec/dummy/app/models/pokemon/decorator.rb +1 -3
- data/spec/dummy/app/models/pokemon.rb +8 -2
- data/spec/dummy/app/models/pokemon_master.rb +5 -3
- data/spec/dummy/app/models/product.rb +1 -1
- data/spec/dummy/app/models/publisher.rb +2 -2
- data/spec/dummy/app/models/user.rb +1 -1
- data/spec/dummy/app/models/website/decorator.rb +1 -1
- data/spec/dummy/app/models/website/with_location.rb +1 -1
- data/spec/dummy/app/models/website.rb +1 -1
- data/spec/dummy/bin/setup +0 -4
- data/spec/dummy/bin/update +0 -4
- data/spec/dummy/config/environments/development.rb +1 -1
- data/spec/lib/azeroth/model_spec.rb +1 -0
- data/spec/lib/azeroth/request_handler/index_spec.rb +5 -5
- data/spec/lib/azeroth/routes_builder_spec.rb +1 -1
- data/spec/spec_helper.rb +7 -0
- data/spec/support/app/controllers/controller.rb +1 -1
- data/spec/support/app/controllers/request_handler_controller.rb +1 -1
- metadata +13 -8
data/README.md
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
Azeroth
|
|
2
2
|
========
|
|
3
3
|
[](https://circleci.com/gh/darthjee/azeroth)
|
|
4
|
-
[](https://codeclimate.com/github/darthjee/azeroth)
|
|
4
|
+
[](https://app.codacy.com/gh/darthjee/azeroth/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade)
|
|
5
|
+
[](https://app.codacy.com/gh/darthjee/azeroth/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_coverage)
|
|
7
6
|
[](https://badge.fury.io/rb/azeroth)
|
|
8
7
|
[](http://inch-ci.org/github/darthjee/azeroth)
|
|
9
8
|
|
|
@@ -11,7 +10,7 @@ Azeroth
|
|
|
11
10
|
|
|
12
11
|
Yard Documentation
|
|
13
12
|
-------------------
|
|
14
|
-
[https://www.rubydoc.info/gems/azeroth/2.
|
|
13
|
+
[https://www.rubydoc.info/gems/azeroth/2.2.0](https://www.rubydoc.info/gems/azeroth/2.2.0)
|
|
15
14
|
|
|
16
15
|
Azeroth has been designed making the coding of controllers easier
|
|
17
16
|
as routes in controllers are usually copy, paste and replace of same
|
|
@@ -25,9 +24,9 @@ does not perform database operations
|
|
|
25
24
|
Future versions will enable `html` rendering to also perform
|
|
26
25
|
database operations.
|
|
27
26
|
|
|
28
|
-
Current Release
|
|
27
|
+
**Current Release**: [2.2.0](https://github.com/darthjee/azeroth/tree/2.2.0)
|
|
29
28
|
|
|
30
|
-
|
|
29
|
+
**Next release**: [2.3.0](https://github.com/darthjee/azeroth/compare/2.2.0...main)
|
|
31
30
|
|
|
32
31
|
Installation
|
|
33
32
|
---------------
|
data/Rakefile
CHANGED
data/azeroth.gemspec
CHANGED
|
@@ -19,7 +19,7 @@ Gem::Specification.new do |gem|
|
|
|
19
19
|
gem.require_paths = ['lib']
|
|
20
20
|
|
|
21
21
|
gem.add_dependency 'activesupport', '~> 7.2.x'
|
|
22
|
-
gem.add_dependency 'darthjee-active_ext', '>= 1.
|
|
23
|
-
gem.add_dependency 'jace', '>= 0.1.
|
|
24
|
-
gem.add_dependency 'sinclair', '>= 3.
|
|
22
|
+
gem.add_dependency 'darthjee-active_ext', '>= 1.4.0'
|
|
23
|
+
gem.add_dependency 'jace', '>= 0.1.2'
|
|
24
|
+
gem.add_dependency 'sinclair', '>= 3.1.0'
|
|
25
25
|
end
|
data/lib/azeroth/version.rb
CHANGED
|
@@ -4,7 +4,7 @@ require 'spec_helper'
|
|
|
4
4
|
|
|
5
5
|
describe DocumentsController do
|
|
6
6
|
let(:parsed_response) do
|
|
7
|
-
|
|
7
|
+
response.parsed_body
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
describe 'GET index' do
|
|
@@ -74,7 +74,7 @@ describe DocumentsController do
|
|
|
74
74
|
end
|
|
75
75
|
|
|
76
76
|
it { expect(response).not_to be_successful }
|
|
77
|
-
it { expect(response
|
|
77
|
+
it { expect(response).to have_http_status(:not_found) }
|
|
78
78
|
|
|
79
79
|
it 'returns empty body' do
|
|
80
80
|
expect(response.body).to eq('')
|
|
@@ -199,7 +199,7 @@ describe DocumentsController do
|
|
|
199
199
|
end
|
|
200
200
|
|
|
201
201
|
it { expect(response).not_to be_successful }
|
|
202
|
-
it { expect(response
|
|
202
|
+
it { expect(response).to have_http_status(:not_found) }
|
|
203
203
|
|
|
204
204
|
it 'returns empty body' do
|
|
205
205
|
expect(response.body).to eq('')
|
|
@@ -285,7 +285,7 @@ describe DocumentsController do
|
|
|
285
285
|
end
|
|
286
286
|
|
|
287
287
|
it { expect(response).not_to be_successful }
|
|
288
|
-
it { expect(response
|
|
288
|
+
it { expect(response).to have_http_status(:not_found) }
|
|
289
289
|
|
|
290
290
|
it 'returns empty body' do
|
|
291
291
|
expect(response.body).to eq('')
|
|
@@ -342,7 +342,7 @@ describe DocumentsController do
|
|
|
342
342
|
end
|
|
343
343
|
|
|
344
344
|
it { expect(response).not_to be_successful }
|
|
345
|
-
it { expect(response
|
|
345
|
+
it { expect(response).to have_http_status(:not_found) }
|
|
346
346
|
|
|
347
347
|
it 'returns empty body' do
|
|
348
348
|
expect(response.body).to eq('')
|
|
@@ -4,7 +4,7 @@ require 'spec_helper'
|
|
|
4
4
|
|
|
5
5
|
describe DocumentsWithErrorController do
|
|
6
6
|
let(:parsed_response) do
|
|
7
|
-
|
|
7
|
+
response.parsed_body
|
|
8
8
|
end
|
|
9
9
|
|
|
10
10
|
describe 'GET index' do
|
|
@@ -129,7 +129,7 @@ describe DocumentsWithErrorController do
|
|
|
129
129
|
it 'returns updated document json' do
|
|
130
130
|
patch :update, params: parameters
|
|
131
131
|
|
|
132
|
-
expect(
|
|
132
|
+
expect(response.parsed_body)
|
|
133
133
|
.to eq(JSON.parse(expected_body))
|
|
134
134
|
end
|
|
135
135
|
|
|
@@ -147,7 +147,7 @@ describe DocumentsWithErrorController do
|
|
|
147
147
|
end
|
|
148
148
|
|
|
149
149
|
it { expect(response).not_to be_successful }
|
|
150
|
-
it { expect(response
|
|
150
|
+
it { expect(response).to have_http_status(:not_found) }
|
|
151
151
|
|
|
152
152
|
it 'returns empty body' do
|
|
153
153
|
expect(response.body).to eq('')
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
class Factory <
|
|
4
|
-
has_many :products
|
|
5
|
-
has_one :main_product, class_name: 'Product'
|
|
3
|
+
class Factory < ApplicationRecord
|
|
4
|
+
has_many :products, dependent: :destroy
|
|
5
|
+
has_one :main_product, class_name: 'Product', dependent: :destroy
|
|
6
6
|
end
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
class Pokemon <
|
|
3
|
+
class Pokemon < ApplicationRecord
|
|
4
4
|
belongs_to :pokemon_master
|
|
5
5
|
has_one :previous_form,
|
|
6
6
|
class_name: 'Pokemon',
|
|
7
|
-
foreign_key: :previous_form_id
|
|
7
|
+
foreign_key: :previous_form_id,
|
|
8
|
+
inverse_of: :next_form,
|
|
9
|
+
dependent: :destroy
|
|
10
|
+
has_one :next_form,
|
|
11
|
+
class_name: 'Pokemon',
|
|
12
|
+
dependent: :destroy,
|
|
13
|
+
inverse_of: :previous_form
|
|
8
14
|
end
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
class PokemonMaster <
|
|
3
|
+
class PokemonMaster < ApplicationRecord
|
|
4
4
|
has_one :favorite_pokemon, -> { where(favorite: true) },
|
|
5
|
-
class_name: 'Pokemon'
|
|
6
|
-
|
|
5
|
+
class_name: 'Pokemon',
|
|
6
|
+
inverse_of: :pokemon_master,
|
|
7
|
+
dependent: :destroy
|
|
8
|
+
has_many :pokemons, dependent: :destroy, inverse_of: :pokemon_master
|
|
7
9
|
end
|
data/spec/dummy/bin/setup
CHANGED
|
@@ -17,7 +17,6 @@ chdir APP_ROOT do
|
|
|
17
17
|
# This script is a starting point to setup your application.
|
|
18
18
|
# Add necessary setup steps to this file.
|
|
19
19
|
|
|
20
|
-
puts '== Installing dependencies =='
|
|
21
20
|
system! 'gem install bundler --conservative'
|
|
22
21
|
system('bundle check') || system!('bundle install')
|
|
23
22
|
|
|
@@ -29,12 +28,9 @@ chdir APP_ROOT do
|
|
|
29
28
|
# cp 'config/database.yml.sample', 'config/database.yml'
|
|
30
29
|
# end
|
|
31
30
|
|
|
32
|
-
puts "\n== Preparing database =="
|
|
33
31
|
system! 'bin/rails db:setup'
|
|
34
32
|
|
|
35
|
-
puts "\n== Removing old logs and tempfiles =="
|
|
36
33
|
system! 'bin/rails log:clear tmp:clear'
|
|
37
34
|
|
|
38
|
-
puts "\n== Restarting application server =="
|
|
39
35
|
system! 'bin/rails restart'
|
|
40
36
|
end
|
data/spec/dummy/bin/update
CHANGED
|
@@ -17,19 +17,15 @@ chdir APP_ROOT do
|
|
|
17
17
|
# This script is a way to update your development environment automatically.
|
|
18
18
|
# Add necessary update steps to this file.
|
|
19
19
|
|
|
20
|
-
puts '== Installing dependencies =='
|
|
21
20
|
system! 'gem install bundler --conservative'
|
|
22
21
|
system('bundle check') || system!('bundle install')
|
|
23
22
|
|
|
24
23
|
# Install JavaScript dependencies if using Yarn
|
|
25
24
|
# system('bin/yarn')
|
|
26
25
|
|
|
27
|
-
puts "\n== Updating database =="
|
|
28
26
|
system! 'bin/rails db:migrate'
|
|
29
27
|
|
|
30
|
-
puts "\n== Removing old logs and tempfiles =="
|
|
31
28
|
system! 'bin/rails log:clear tmp:clear'
|
|
32
29
|
|
|
33
|
-
puts "\n== Restarting application server =="
|
|
34
30
|
system! 'bin/rails restart'
|
|
35
31
|
end
|
|
@@ -18,7 +18,7 @@ Rails.application.configure do
|
|
|
18
18
|
|
|
19
19
|
# Enable/disable caching. By default caching is disabled.
|
|
20
20
|
# Run rails dev:cache to toggle caching.
|
|
21
|
-
if Rails.root.join('tmp
|
|
21
|
+
if Rails.root.join('tmp/caching-dev.txt').exist?
|
|
22
22
|
config.action_controller.perform_caching = true
|
|
23
23
|
|
|
24
24
|
config.cache_store = :memory_store
|
|
@@ -12,7 +12,7 @@ describe Azeroth::RequestHandler::Index do
|
|
|
12
12
|
context 'when pagination is active' do
|
|
13
13
|
it_behaves_like 'a request handler' do
|
|
14
14
|
let(:documents_count) { Random.rand(21..30) }
|
|
15
|
-
let(:expected_resource) { Document.
|
|
15
|
+
let(:expected_resource) { Document.limit(20) }
|
|
16
16
|
let(:options_hash) { { paginated: true } }
|
|
17
17
|
|
|
18
18
|
it 'adds total pages header' do
|
|
@@ -34,7 +34,7 @@ describe Azeroth::RequestHandler::Index do
|
|
|
34
34
|
context 'when page is given' do
|
|
35
35
|
it_behaves_like 'a request handler' do
|
|
36
36
|
let(:documents_count) { Random.rand(41..50) }
|
|
37
|
-
let(:expected_resource) { Document.
|
|
37
|
+
let(:expected_resource) { Document.offset(20).limit(20) }
|
|
38
38
|
let(:options_hash) { { paginated: true } }
|
|
39
39
|
let(:extra_params) { { page: '2' } }
|
|
40
40
|
|
|
@@ -58,7 +58,7 @@ describe Azeroth::RequestHandler::Index do
|
|
|
58
58
|
context 'when third page is given' do
|
|
59
59
|
it_behaves_like 'a request handler' do
|
|
60
60
|
let(:documents_count) { Random.rand(41..50) }
|
|
61
|
-
let(:expected_resource) { Document.
|
|
61
|
+
let(:expected_resource) { Document.offset(40) }
|
|
62
62
|
let(:options_hash) { { paginated: true } }
|
|
63
63
|
let(:extra_params) { { page: '3' } }
|
|
64
64
|
|
|
@@ -82,7 +82,7 @@ describe Azeroth::RequestHandler::Index do
|
|
|
82
82
|
context 'when per_page is not default' do
|
|
83
83
|
it_behaves_like 'a request handler' do
|
|
84
84
|
let(:documents_count) { Random.rand(21..30) }
|
|
85
|
-
let(:expected_resource) { Document.
|
|
85
|
+
let(:expected_resource) { Document.limit(10) }
|
|
86
86
|
let(:options_hash) { { paginated: true, per_page: 10 } }
|
|
87
87
|
|
|
88
88
|
it 'adds total pages header' do
|
|
@@ -105,7 +105,7 @@ describe Azeroth::RequestHandler::Index do
|
|
|
105
105
|
context 'when per page is given in params' do
|
|
106
106
|
it_behaves_like 'a request handler' do
|
|
107
107
|
let(:documents_count) { Random.rand(41..50) }
|
|
108
|
-
let(:expected_resource) { Document.
|
|
108
|
+
let(:expected_resource) { Document.offset(10).limit(10) }
|
|
109
109
|
let(:options_hash) { { paginated: true, per_page: 15 } }
|
|
110
110
|
let(:extra_params) { { page: '2', per_page: '10' } }
|
|
111
111
|
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'simplecov'
|
|
4
|
+
|
|
5
|
+
if ENV['CI']
|
|
6
|
+
require 'simplecov-lcov'
|
|
7
|
+
SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true
|
|
8
|
+
SimpleCov.formatter = SimpleCov::Formatter::LcovFormatter
|
|
9
|
+
end
|
|
10
|
+
|
|
4
11
|
SimpleCov.start do
|
|
5
12
|
add_filter '/spec/'
|
|
6
13
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: azeroth
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Darthjee
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-03-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -30,42 +30,42 @@ dependencies:
|
|
|
30
30
|
requirements:
|
|
31
31
|
- - ">="
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: 1.
|
|
33
|
+
version: 1.4.0
|
|
34
34
|
type: :runtime
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - ">="
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: 1.
|
|
40
|
+
version: 1.4.0
|
|
41
41
|
- !ruby/object:Gem::Dependency
|
|
42
42
|
name: jace
|
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
|
44
44
|
requirements:
|
|
45
45
|
- - ">="
|
|
46
46
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: 0.1.
|
|
47
|
+
version: 0.1.2
|
|
48
48
|
type: :runtime
|
|
49
49
|
prerelease: false
|
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
51
|
requirements:
|
|
52
52
|
- - ">="
|
|
53
53
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: 0.1.
|
|
54
|
+
version: 0.1.2
|
|
55
55
|
- !ruby/object:Gem::Dependency
|
|
56
56
|
name: sinclair
|
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
|
58
58
|
requirements:
|
|
59
59
|
- - ">="
|
|
60
60
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: 3.
|
|
61
|
+
version: 3.1.0
|
|
62
62
|
type: :runtime
|
|
63
63
|
prerelease: false
|
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
|
66
66
|
- - ">="
|
|
67
67
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: 3.
|
|
68
|
+
version: 3.1.0
|
|
69
69
|
description: Rails controller builder
|
|
70
70
|
email:
|
|
71
71
|
- darthjee@gmail.com
|
|
@@ -75,6 +75,11 @@ extensions: []
|
|
|
75
75
|
extra_rdoc_files: []
|
|
76
76
|
files:
|
|
77
77
|
- ".circleci/config.yml"
|
|
78
|
+
- ".github/active_ext-usage.md"
|
|
79
|
+
- ".github/azeroth-usage.md"
|
|
80
|
+
- ".github/copilot-instructions.md"
|
|
81
|
+
- ".github/core_ext-usage.md"
|
|
82
|
+
- ".github/jace-usage.md"
|
|
78
83
|
- ".gitignore"
|
|
79
84
|
- ".rubocop.yml"
|
|
80
85
|
- ".rubocop_todo.yml"
|