base_editing_bootstrap 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +19 -0
- data/README.md +9 -3
- data/base_editing_bootstrap.gemspec +10 -9
- data/lib/base_editing_bootstrap/VERSION +1 -1
- data/lib/base_editing_bootstrap.rb +2 -0
- data/lib/generators/base_editing_bootstrap/install/USAGE +2 -0
- data/lib/generators/base_editing_bootstrap/install/install_generator.rb +31 -0
- data/lib/generators/base_editing_bootstrap/install/templates/initializer.rb +22 -0
- data/spec/support/external_shared/pundit.rb +27 -0
- metadata +53 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c34b968628eb0454335d3d95796e381ec478cb236a44941cbf267220377df6b
|
4
|
+
data.tar.gz: ac7a7f7106bf53615569782e55a19aafccd3c2d63aee77c0e71b27b6e7599de6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3dccc18a70b861a9d3ead369dbbd57d4c5504bd7316e16c07521ef75e4bdb0142d8978ff47787f0d80143af1511c44efc199bb04c85a7a3852a35d8ae7fea7ee
|
7
|
+
data.tar.gz: d0cefc4ba1f38b7ec45e3a93609b0cd498dfb6dcee6be9d7054a3b18e7cadaddb97855355595fb2b783baeb2d98f6d1410b6453832de3e32344cc170014c8c7f
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,25 @@
|
|
2
2
|
All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines.
|
3
3
|
|
4
4
|
- - -
|
5
|
+
## 0.4.0 - 2024-04-29
|
6
|
+
#### Bug Fixes
|
7
|
+
- Add Translations for pagination - (14bbb6f) - Marino Bonetti
|
8
|
+
- Remove rubygems warnings - (5b0dc6e) - Marino Bonetti
|
9
|
+
#### Documentation
|
10
|
+
- Documentation - (a2f93cd) - Marino Bonetti
|
11
|
+
#### Features
|
12
|
+
- Prepare new installer - (9189b26) - Marino Bonetti
|
13
|
+
#### Miscellaneous Chores
|
14
|
+
- Start initializer as template - (7cc6756) - Marino Bonetti
|
15
|
+
- Fix versions in gemfile - (5280d4e) - Marino Bonetti
|
16
|
+
#### Tests
|
17
|
+
- Create spec for generators - (c7b3210) - Marino Bonetti
|
18
|
+
- Spec per generator - (bf79a97) - Marino Bonetti
|
19
|
+
- Add test to policy - (41d6bac) - Marino Bonetti
|
20
|
+
- Match gem version - (462e72f) - Marino Bonetti
|
21
|
+
|
22
|
+
- - -
|
23
|
+
|
5
24
|
## 0.3.0 - 2024-04-27
|
6
25
|
#### Bug Fixes
|
7
26
|
- Remove files from gem - (660cb3d) - Marino Bonetti
|
data/README.md
CHANGED
@@ -20,8 +20,13 @@ Or install it yourself as:
|
|
20
20
|
$ gem install base_editing_bootstrap
|
21
21
|
```
|
22
22
|
|
23
|
-
|
24
|
-
|
23
|
+
Then run installer:
|
24
|
+
```bash
|
25
|
+
$ bundle exec rails g base_editing_bootstrap:install
|
26
|
+
```
|
27
|
+
|
28
|
+
### Generators
|
29
|
+
Then Install dependency (if you run base_editing_bootstrap:install you are good to go):
|
25
30
|
```bash
|
26
31
|
|
27
32
|
bundle exec rails g pundit:install
|
@@ -36,7 +41,8 @@ La versione più semplice è attraverso: https://github.com/rails/cssbundling-ra
|
|
36
41
|
Una volta installato basta lanciare bin/rails css:install:bootstrap come da
|
37
42
|
documentazione e avrete la vostra versione di boostrap installata.
|
38
43
|
|
39
|
-
Installare `gem "factory_bot_rails"
|
44
|
+
Installare `gem "factory_bot_rails"`,
|
45
|
+
Optional configurarlo correttamente in application.rb
|
40
46
|
```ruby
|
41
47
|
config.generators do |g|
|
42
48
|
g.test_framework :rspec
|
@@ -37,18 +37,19 @@ Gem::Specification.new do |spec|
|
|
37
37
|
spec.add_dependency 'ransack', ['~> 4.0', '>= 4.0.0']
|
38
38
|
# Pagination
|
39
39
|
spec.add_dependency 'kaminari', ['~> 1.2', '>= 1.2.2']
|
40
|
+
spec.add_dependency 'kaminari-i18n', '~> 0.5'
|
40
41
|
|
41
42
|
spec.add_development_dependency "rspec-rails", '~> 6.0'
|
42
43
|
spec.add_development_dependency "factory_bot_rails", '~> 6.4'
|
43
|
-
spec.add_development_dependency 'faker'
|
44
|
-
spec.add_development_dependency "puma"
|
45
|
-
spec.add_development_dependency "sqlite3"
|
46
|
-
spec.add_development_dependency "sprockets-rails"
|
47
|
-
spec.add_development_dependency 'rails-i18n', '~> 7.0
|
48
|
-
spec.add_development_dependency "i18n-debug"
|
49
|
-
spec.add_development_dependency "cssbundling-rails"
|
44
|
+
spec.add_development_dependency 'faker', '~> 3.3'
|
45
|
+
spec.add_development_dependency "puma", '~> 6.4'
|
46
|
+
spec.add_development_dependency "sqlite3", '~> 1.7'
|
47
|
+
spec.add_development_dependency "sprockets-rails", '~> 3.4'
|
48
|
+
spec.add_development_dependency 'rails-i18n', '~> 7.0' # For 7.0.0
|
49
|
+
spec.add_development_dependency "i18n-debug", '~> 1.2'
|
50
|
+
spec.add_development_dependency "cssbundling-rails", '~> 1.4'
|
50
51
|
spec.add_development_dependency "rspec-parameterized", ">= 1.0.0" # https://github.com/tomykaira/rspec-parameterized
|
51
|
-
spec.add_development_dependency 'rspec-html-matchers' # https://github.com/kucaahbe/rspec-html-matchers
|
52
|
-
spec.add_development_dependency 'rails-controller-testing'
|
52
|
+
spec.add_development_dependency 'rspec-html-matchers', '~> 0.10' # https://github.com/kucaahbe/rspec-html-matchers
|
53
|
+
spec.add_development_dependency 'rails-controller-testing', '~>1.0'
|
53
54
|
|
54
55
|
end
|
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require "ransack"
|
2
2
|
require "kaminari"
|
3
|
+
require "kaminari-i18n"
|
3
4
|
require "pundit"
|
4
5
|
|
5
6
|
if ENV['RAILS_ENV'] == 'test' and defined? RSpec
|
@@ -11,6 +12,7 @@ end
|
|
11
12
|
|
12
13
|
require "zeitwerk"
|
13
14
|
loader = Zeitwerk::Loader.for_gem
|
15
|
+
loader.ignore("#{__dir__}/generators")
|
14
16
|
loader.setup
|
15
17
|
|
16
18
|
module BaseEditingBootstrap
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module BaseEditingBootstrap
|
4
|
+
module Generators
|
5
|
+
class InstallGenerator < ::Rails::Generators::Base
|
6
|
+
source_root File.expand_path("templates", __dir__)
|
7
|
+
|
8
|
+
def create_initializer
|
9
|
+
initializer_file_name = "initializer.rb"
|
10
|
+
destination = File.join('config', 'initializers', "base_editing_bootstrap.rb")
|
11
|
+
template initializer_file_name, destination
|
12
|
+
end
|
13
|
+
|
14
|
+
def install_and_configure_pundit
|
15
|
+
generate "pundit:install"
|
16
|
+
inject_into_class "app/controllers/application_controller.rb", "ApplicationController", " include Pundit::Authorization\n"
|
17
|
+
end
|
18
|
+
|
19
|
+
def prepare_test_environment
|
20
|
+
gem "factory_bot_rails", group: :test, version: '~> 6.4', comment: "Necessary for spec"
|
21
|
+
inject_into_class "config/application.rb", "Application", <<~RUBY
|
22
|
+
config.generators do |g|
|
23
|
+
g.test_framework :rspec
|
24
|
+
g.fixture_replacement :factory_bot
|
25
|
+
g.factory_bot dir: 'spec/factories'
|
26
|
+
end
|
27
|
+
RUBY
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
BaseEditingBootstrap.configure do |config|
|
4
|
+
##
|
5
|
+
# Controller da cui derivare poi il BaseEditingController da cui derivano
|
6
|
+
# tutti i controller sottostanti
|
7
|
+
# @default "ApplicationController"
|
8
|
+
# config_accessor :inherited_controller, default: "ApplicationController"
|
9
|
+
|
10
|
+
##
|
11
|
+
# Configurazione per alterare lo standard di azione post aggiornamento record
|
12
|
+
# il default è andare nella pagina di editing del record
|
13
|
+
# possibili valori :edit , :index
|
14
|
+
# config_accessor :after_success_update_redirect, default: :edit
|
15
|
+
|
16
|
+
##
|
17
|
+
# Configurazione per alterare lo standard di azione post creazione record
|
18
|
+
# il default è andare nella pagina di editing del record
|
19
|
+
# possibili valori :edit , :index
|
20
|
+
# config_accessor :after_success_create_redirect, default: :edit
|
21
|
+
|
22
|
+
end
|
@@ -12,3 +12,30 @@ RSpec::Matchers.define :permit_editable_attributes do |*expected_attributes|
|
|
12
12
|
actual_attributes.empty?
|
13
13
|
end
|
14
14
|
end
|
15
|
+
|
16
|
+
shared_examples "a standard policy" do |factory|
|
17
|
+
let(:user) { create(:user) }
|
18
|
+
let(:instance) { described_class.new(user, build(factory)) }
|
19
|
+
|
20
|
+
describe "standard_methotds" do
|
21
|
+
where(:method, :response) do
|
22
|
+
[
|
23
|
+
[:show?, false],
|
24
|
+
[:destroy?, true],
|
25
|
+
[:update?, true],
|
26
|
+
[:create?, true],
|
27
|
+
[:index?, true],
|
28
|
+
]
|
29
|
+
end
|
30
|
+
|
31
|
+
with_them do
|
32
|
+
it "should " do
|
33
|
+
expect(instance).to respond_to(method)
|
34
|
+
end
|
35
|
+
it "return value" do
|
36
|
+
expect(instance.send(method)).to be == response
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: base_editing_bootstrap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marino Bonetti
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-04-
|
11
|
+
date: 2024-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -90,6 +90,20 @@ dependencies:
|
|
90
90
|
- - ">="
|
91
91
|
- !ruby/object:Gem::Version
|
92
92
|
version: 1.2.2
|
93
|
+
- !ruby/object:Gem::Dependency
|
94
|
+
name: kaminari-i18n
|
95
|
+
requirement: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - "~>"
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0.5'
|
100
|
+
type: :runtime
|
101
|
+
prerelease: false
|
102
|
+
version_requirements: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - "~>"
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0.5'
|
93
107
|
- !ruby/object:Gem::Dependency
|
94
108
|
name: rspec-rails
|
95
109
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,100 +136,100 @@ dependencies:
|
|
122
136
|
name: faker
|
123
137
|
requirement: !ruby/object:Gem::Requirement
|
124
138
|
requirements:
|
125
|
-
- - "
|
139
|
+
- - "~>"
|
126
140
|
- !ruby/object:Gem::Version
|
127
|
-
version: '
|
141
|
+
version: '3.3'
|
128
142
|
type: :development
|
129
143
|
prerelease: false
|
130
144
|
version_requirements: !ruby/object:Gem::Requirement
|
131
145
|
requirements:
|
132
|
-
- - "
|
146
|
+
- - "~>"
|
133
147
|
- !ruby/object:Gem::Version
|
134
|
-
version: '
|
148
|
+
version: '3.3'
|
135
149
|
- !ruby/object:Gem::Dependency
|
136
150
|
name: puma
|
137
151
|
requirement: !ruby/object:Gem::Requirement
|
138
152
|
requirements:
|
139
|
-
- - "
|
153
|
+
- - "~>"
|
140
154
|
- !ruby/object:Gem::Version
|
141
|
-
version: '
|
155
|
+
version: '6.4'
|
142
156
|
type: :development
|
143
157
|
prerelease: false
|
144
158
|
version_requirements: !ruby/object:Gem::Requirement
|
145
159
|
requirements:
|
146
|
-
- - "
|
160
|
+
- - "~>"
|
147
161
|
- !ruby/object:Gem::Version
|
148
|
-
version: '
|
162
|
+
version: '6.4'
|
149
163
|
- !ruby/object:Gem::Dependency
|
150
164
|
name: sqlite3
|
151
165
|
requirement: !ruby/object:Gem::Requirement
|
152
166
|
requirements:
|
153
|
-
- - "
|
167
|
+
- - "~>"
|
154
168
|
- !ruby/object:Gem::Version
|
155
|
-
version: '
|
169
|
+
version: '1.7'
|
156
170
|
type: :development
|
157
171
|
prerelease: false
|
158
172
|
version_requirements: !ruby/object:Gem::Requirement
|
159
173
|
requirements:
|
160
|
-
- - "
|
174
|
+
- - "~>"
|
161
175
|
- !ruby/object:Gem::Version
|
162
|
-
version: '
|
176
|
+
version: '1.7'
|
163
177
|
- !ruby/object:Gem::Dependency
|
164
178
|
name: sprockets-rails
|
165
179
|
requirement: !ruby/object:Gem::Requirement
|
166
180
|
requirements:
|
167
|
-
- - "
|
181
|
+
- - "~>"
|
168
182
|
- !ruby/object:Gem::Version
|
169
|
-
version: '
|
183
|
+
version: '3.4'
|
170
184
|
type: :development
|
171
185
|
prerelease: false
|
172
186
|
version_requirements: !ruby/object:Gem::Requirement
|
173
187
|
requirements:
|
174
|
-
- - "
|
188
|
+
- - "~>"
|
175
189
|
- !ruby/object:Gem::Version
|
176
|
-
version: '
|
190
|
+
version: '3.4'
|
177
191
|
- !ruby/object:Gem::Dependency
|
178
192
|
name: rails-i18n
|
179
193
|
requirement: !ruby/object:Gem::Requirement
|
180
194
|
requirements:
|
181
195
|
- - "~>"
|
182
196
|
- !ruby/object:Gem::Version
|
183
|
-
version: 7.0
|
197
|
+
version: '7.0'
|
184
198
|
type: :development
|
185
199
|
prerelease: false
|
186
200
|
version_requirements: !ruby/object:Gem::Requirement
|
187
201
|
requirements:
|
188
202
|
- - "~>"
|
189
203
|
- !ruby/object:Gem::Version
|
190
|
-
version: 7.0
|
204
|
+
version: '7.0'
|
191
205
|
- !ruby/object:Gem::Dependency
|
192
206
|
name: i18n-debug
|
193
207
|
requirement: !ruby/object:Gem::Requirement
|
194
208
|
requirements:
|
195
|
-
- - "
|
209
|
+
- - "~>"
|
196
210
|
- !ruby/object:Gem::Version
|
197
|
-
version: '
|
211
|
+
version: '1.2'
|
198
212
|
type: :development
|
199
213
|
prerelease: false
|
200
214
|
version_requirements: !ruby/object:Gem::Requirement
|
201
215
|
requirements:
|
202
|
-
- - "
|
216
|
+
- - "~>"
|
203
217
|
- !ruby/object:Gem::Version
|
204
|
-
version: '
|
218
|
+
version: '1.2'
|
205
219
|
- !ruby/object:Gem::Dependency
|
206
220
|
name: cssbundling-rails
|
207
221
|
requirement: !ruby/object:Gem::Requirement
|
208
222
|
requirements:
|
209
|
-
- - "
|
223
|
+
- - "~>"
|
210
224
|
- !ruby/object:Gem::Version
|
211
|
-
version: '
|
225
|
+
version: '1.4'
|
212
226
|
type: :development
|
213
227
|
prerelease: false
|
214
228
|
version_requirements: !ruby/object:Gem::Requirement
|
215
229
|
requirements:
|
216
|
-
- - "
|
230
|
+
- - "~>"
|
217
231
|
- !ruby/object:Gem::Version
|
218
|
-
version: '
|
232
|
+
version: '1.4'
|
219
233
|
- !ruby/object:Gem::Dependency
|
220
234
|
name: rspec-parameterized
|
221
235
|
requirement: !ruby/object:Gem::Requirement
|
@@ -234,30 +248,30 @@ dependencies:
|
|
234
248
|
name: rspec-html-matchers
|
235
249
|
requirement: !ruby/object:Gem::Requirement
|
236
250
|
requirements:
|
237
|
-
- - "
|
251
|
+
- - "~>"
|
238
252
|
- !ruby/object:Gem::Version
|
239
|
-
version: '0'
|
253
|
+
version: '0.10'
|
240
254
|
type: :development
|
241
255
|
prerelease: false
|
242
256
|
version_requirements: !ruby/object:Gem::Requirement
|
243
257
|
requirements:
|
244
|
-
- - "
|
258
|
+
- - "~>"
|
245
259
|
- !ruby/object:Gem::Version
|
246
|
-
version: '0'
|
260
|
+
version: '0.10'
|
247
261
|
- !ruby/object:Gem::Dependency
|
248
262
|
name: rails-controller-testing
|
249
263
|
requirement: !ruby/object:Gem::Requirement
|
250
264
|
requirements:
|
251
|
-
- - "
|
265
|
+
- - "~>"
|
252
266
|
- !ruby/object:Gem::Version
|
253
|
-
version: '0'
|
267
|
+
version: '1.0'
|
254
268
|
type: :development
|
255
269
|
prerelease: false
|
256
270
|
version_requirements: !ruby/object:Gem::Requirement
|
257
271
|
requirements:
|
258
|
-
- - "
|
272
|
+
- - "~>"
|
259
273
|
- !ruby/object:Gem::Version
|
260
|
-
version: '0'
|
274
|
+
version: '1.0'
|
261
275
|
description: Raccolta di utility per semplificare costruzione cms in rails
|
262
276
|
email:
|
263
277
|
- marinobonetti@gmail.com
|
@@ -340,6 +354,9 @@ files:
|
|
340
354
|
- lib/base_editing_bootstrap/searches/base.rb
|
341
355
|
- lib/base_editing_bootstrap/searches/field.rb
|
342
356
|
- lib/base_editing_bootstrap/version.rb
|
357
|
+
- lib/generators/base_editing_bootstrap/install/USAGE
|
358
|
+
- lib/generators/base_editing_bootstrap/install/install_generator.rb
|
359
|
+
- lib/generators/base_editing_bootstrap/install/templates/initializer.rb
|
343
360
|
- lib/tasks/base_editing_bootstrap_tasks.rake
|
344
361
|
- spec/support/external_shared/base_editing_controller_helpers.rb
|
345
362
|
- spec/support/external_shared/base_model.rb
|