rider-kick 0.0.9 → 0.0.11

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: ec75fc6ba1f45d9d70021b69e3bdda3a01585978679adcd3ee32ab9d50b0a372
4
- data.tar.gz: 67886957fb7270e9529ac94ec311459aabaaf6a434a732751d5980a10bad65c9
3
+ metadata.gz: 1fd8e62c0ea5c410f89df58b905b2cbced9899e2eb6dfb8d44f3e02266d9cdc7
4
+ data.tar.gz: 070aa2514210ed7fa8e3d41a68fad1f4cbe10ee32531dbe90520f0b7d6e0142d
5
5
  SHA512:
6
- metadata.gz: 2fc7a917595c6fa982088940eb56c7843773474a8ce91d95c87485e78943b3e8615c7353125b2fb456f113e76292202839f0737910146482d5c1eec604d4508f
7
- data.tar.gz: 944b95a7baf3d9339520025ba8529b2de11f63be7b48f8429f2fb3e5435f14628054d64c07a2330f859adbd6216dbbdcc3e46e2ede1a67e80dcd344890785a38
6
+ metadata.gz: 47530287b5b9869c681a68e411719e37358e91c8774db8140bc086183ae2ba5271e10dd7cd2b50098a3025e13e7587b895353d1d948ae5a15a47a2e84a0d6cb2
7
+ data.tar.gz: d605efdff6aadd6d3fe15d26a77165cf521cc55e690db065803e8ac58afdd1ad74d17ebcd187fad13455548e418effc18d96e922864ec91725c577c8730a8ed6
data/README.md CHANGED
@@ -16,13 +16,16 @@ And then execute:
16
16
  $ rails new kotaro_minami -d=postgresql -T --skip-javascript --skip-asset-pipeline
17
17
  $ bundle install
18
18
  $ bundle add rider-kick
19
- $ bundle add sun-sword
20
19
  $ rails generate rider_kick:clean_arch --setup
21
20
  $ rails db:drop db:create db:migrate db:seed
22
- $ rails generate rider_kick:structure Models::User actor:owner
23
- $ rails generate rider_kick:scaffold users scope:dashboard
21
+ $ rails g model models/products name price:decimal is_published:boolean
22
+ $ rails generate rider_kick:structure Models::Product actor:owner
23
+ $ rails generate rider_kick:scaffold products scope:dashboard
24
+ ```
25
+ ### OPTIONAL
26
+ ```bash
27
+ $ bundle add sun-sword
24
28
  ```
25
-
26
29
  ## Usage
27
30
  ```bash
28
31
  Description:
@@ -116,7 +116,6 @@ module RiderKick
116
116
  inject_into_file 'Gemfile', after: "group :development, :test do\n" do
117
117
  <<-CONFIG
118
118
 
119
- gem "byebug"
120
119
  gem "rspec-rails"
121
120
  gem "factory_bot_rails"
122
121
  gem "shoulda-matchers"
@@ -118,9 +118,6 @@ module RiderKick
118
118
 
119
119
  def contract_fields
120
120
  skip_contract_fields = @skipped_fields.map(&:strip).uniq
121
- if @scope_owner_column.present?
122
- skip_contract_fields << @scope_owner_column.to_s
123
- end
124
121
  @model_class.columns.reject { |column| skip_contract_fields.include?(column.name.to_s) }.map(&:name).map(&:to_s)
125
122
  end
126
123
 
@@ -21,7 +21,6 @@ module RiderKick
21
21
  end
22
22
 
23
23
  def setup_variables
24
- @scope_owner_column = (SunSword.scope_owner_column.to_s rescue '')
25
24
  @variable_subject = arg_model_name.split('::').last.underscore.downcase
26
25
  @model_class = arg_model_name.camelize.constantize
27
26
  @subject_class = arg_model_name.split('::').last
@@ -65,7 +64,7 @@ module RiderKick
65
64
  end
66
65
 
67
66
  def contract_fields
68
- @model_class.columns.reject { |column| (['id', 'created_at', 'updated_at', 'type'] + [@scope_owner_column.to_s]).include?(column.name.to_s) }.map(&:name).map(&:to_s)
67
+ @model_class.columns.reject { |column| ['id', 'created_at', 'updated_at', 'type'].include?(column.name.to_s) }.map(&:name).map(&:to_s)
69
68
  end
70
69
 
71
70
  def get_column_type(field)
@@ -20,10 +20,8 @@ AllCops:
20
20
  - 'db/**/*'
21
21
  - 'config/**/*'
22
22
  - 'script/**/*'
23
- - 'bin/*'
24
23
  - 'public/views/*'
25
24
  - 'bin/**/*'
26
- - 'db/**/*'
27
25
  - 'tmp/**/*'
28
26
  - 'spec/spec_helper.rb'
29
27
  - 'spec/rails_helper.rb'
@@ -67,7 +65,7 @@ Gemspec/OrderedDependencies:
67
65
  Layout/AccessModifierIndentation:
68
66
  Enabled: true
69
67
  EnforcedStyle: indent
70
- IndentationWidth: ~
68
+ IndentationWidth: 2
71
69
 
72
70
  Layout/ArgumentAlignment:
73
71
  Enabled: true
@@ -526,9 +524,6 @@ Lint/ShadowedException:
526
524
  Lint/RedundantStringCoercion:
527
525
  Enabled: true
528
526
 
529
- Lint/Syntax:
530
- Enabled: true
531
-
532
527
  Lint/UnderscorePrefixedVariableName:
533
528
  Enabled: true
534
529
 
@@ -27,12 +27,12 @@ module RiderKick
27
27
  private :entity_class
28
28
  end
29
29
 
30
- def self.has_many(relation_name, use:)
31
- @has_many_builders << [relation_name, use]
30
+ def self.has_many(relation_name, attribute_as: nil, use:)
31
+ @has_many_builders << [attribute_as, relation_name, use]
32
32
  end
33
33
 
34
- def self.belongs_to(relation_name, use:)
35
- @belongs_to_builders << [relation_name, use]
34
+ def self.belongs_to(relation_name, attribute_as: nil, use:)
35
+ @belongs_to_builders << [attribute_as, relation_name, use]
36
36
  end
37
37
 
38
38
  # @param [ActiveRecord::Base] An ActiveRecord model to map to the entity
@@ -86,11 +86,11 @@ module RiderKick
86
86
 
87
87
  def attributes_for_belongs_to_relations
88
88
  self.class.belongs_to_builders.map do |belongs_to_builder_config|
89
- relation_name, builder_class = belongs_to_builder_config
90
- relation = @params.public_send(relation_name)
89
+ attribute, relation_name, builder_class = belongs_to_builder_config
90
+ relation = @params.public_send(relation_name)
91
91
 
92
92
  [
93
- relation_name,
93
+ attribute || relation_name,
94
94
  relation ? builder_class.new(relation).build : nil
95
95
  ]
96
96
  end.to_h
@@ -98,14 +98,14 @@ module RiderKick
98
98
 
99
99
  def attributes_for_has_many_relations
100
100
  self.class.has_many_builders.map do |has_many_builder_config|
101
- relation_name, builder_class = has_many_builder_config
102
- relations = @params.public_send(relation_name)
103
- built_relations = relations.map do |relation|
101
+ attribute, relation_name, builder_class = has_many_builder_config
102
+ relations = @params.public_send(relation_name)
103
+ built_relations = relations.map do |relation|
104
104
  builder_class.new(relation).build
105
105
  end
106
106
 
107
107
  [
108
- relation_name,
108
+ attribute || relation_name,
109
109
  built_relations
110
110
  ]
111
111
  end.to_h
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RiderKick
4
- VERSION = '0.0.9'
4
+ VERSION = '0.0.11'
5
5
  public_constant :VERSION
6
6
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rider-kick
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kotaro Minami
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2024-11-25 00:00:00.000000000 Z
10
+ date: 2025-05-22 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: dry-matcher
@@ -211,7 +210,6 @@ homepage: https://github.com/kotaroisme/rider-kick
211
210
  licenses:
212
211
  - MIT
213
212
  metadata: {}
214
- post_install_message:
215
213
  rdoc_options: []
216
214
  require_paths:
217
215
  - lib
@@ -226,8 +224,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
224
  - !ruby/object:Gem::Version
227
225
  version: '0'
228
226
  requirements: []
229
- rubygems_version: 3.5.23
230
- signing_key:
227
+ rubygems_version: 3.6.3
231
228
  specification_version: 4
232
229
  summary: Clean Architecture Framework.
233
230
  test_files: []