chanko 2.0.7 → 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 +5 -5
- data/.travis.yml +4 -4
- data/CHANGELOG.md +16 -1
- data/README.md +9 -3
- data/chanko.gemspec +3 -2
- data/lib/chanko/controller.rb +1 -1
- data/lib/chanko/loader.rb +4 -2
- data/lib/chanko/railtie.rb +6 -0
- data/lib/chanko/test.rb +2 -1
- data/lib/chanko/version.rb +1 -1
- data/lib/generators/chanko/unit/templates/unit.rb.erb +7 -1
- data/spec/chanko/exception_handler_spec.rb +3 -3
- data/spec/dummy/app/units/entry_deletion/entry_deletion.rb +6 -0
- data/spec/dummy/config/environments/production.rb +1 -1
- data/spec/dummy/config/environments/test.rb +1 -1
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: dd0d4fc859f9ec500c831edd710cfbcc587b6cc7577b0bebe427e92e954609d6
|
4
|
+
data.tar.gz: fd65d01e82c60cd769ecadff13957a59a1b994bfe08bbe959aa1985d5fefcb6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 603a7e536446a313a9200c07b4d55275524dc5737919e51e9fa1ea6f64897b7807fe5395f515d7087f7a26cd7003a6e1f4890b02b8df8ba70ade256dc13f5314
|
7
|
+
data.tar.gz: 1f7180cabfc7f7454828a567882ad80b983f8a8e7f1a7071772e4d33bacad7915f4e490b6ad47ec37581245af6de343430e17334f636eb352506fb72055bafa1
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,21 @@
|
|
1
|
+
## 2.2.0
|
2
|
+
* Drop support for old Ruby versions.
|
3
|
+
* Support Rails 5.1.
|
4
|
+
|
5
|
+
## 2.1.1
|
6
|
+
* Delete circular symlink in gem package
|
7
|
+
* No changes in library code
|
8
|
+
|
9
|
+
## 2.1.0
|
10
|
+
* Support Rails 5.
|
11
|
+
* Drop support of ruby 1.9.x and 2.0.0.
|
12
|
+
* Drop support of Rails 3.x.
|
13
|
+
|
14
|
+
## 2.0.8
|
15
|
+
* Improve documentation about expanding class methods.
|
16
|
+
|
1
17
|
## 2.0.7
|
2
18
|
* Fix run_default again. 2.0.6 still has run_default bug. Use unstack block instad of depth counting.
|
3
|
-
|
4
19
|
|
5
20
|
## 2.0.6
|
6
21
|
* Fix stack control of run_default.
|
data/README.md
CHANGED
@@ -12,8 +12,8 @@ it will be automatically hidden and fallback to its normal behavior.
|
|
12
12
|
|
13
13
|
|
14
14
|
## Requirements
|
15
|
-
* Ruby >= 1.
|
16
|
-
* Rails >=
|
15
|
+
* Ruby >= 2.1.0
|
16
|
+
* Rails >= 4.0.0
|
17
17
|
|
18
18
|
|
19
19
|
## Usage
|
@@ -134,7 +134,7 @@ end
|
|
134
134
|
### models
|
135
135
|
In models block, you can expand model features by `expand` method.
|
136
136
|
The expanded methods are available via unit proxy like `User.unit.active`,
|
137
|
-
|
137
|
+
`User.find(params[:id]).unit.active?` or `User.unit.gc_all_soft_deleted_users`.
|
138
138
|
|
139
139
|
```ruby
|
140
140
|
models do
|
@@ -144,6 +144,12 @@ models do
|
|
144
144
|
def active?
|
145
145
|
deleted_at.nil?
|
146
146
|
end
|
147
|
+
|
148
|
+
class_methods do
|
149
|
+
def gc_all_soft_deleted_users
|
150
|
+
where.not(deleted_at: nil).delete_all
|
151
|
+
end
|
152
|
+
end
|
147
153
|
end
|
148
154
|
end
|
149
155
|
```
|
data/chanko.gemspec
CHANGED
@@ -5,7 +5,7 @@ require "chanko/version"
|
|
5
5
|
Gem::Specification.new do |gem|
|
6
6
|
gem.name = "chanko"
|
7
7
|
gem.version = Chanko::VERSION
|
8
|
-
gem.authors = ["Ryo Nakamura"]
|
8
|
+
gem.authors = ["MORITA shingo", "Ryo Nakamura"]
|
9
9
|
gem.email = ["tech@cookpad.com"]
|
10
10
|
gem.description = "Chanko is a Rails extension tool"
|
11
11
|
gem.summary = "Rails extension tool"
|
@@ -15,8 +15,9 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
16
16
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
17
17
|
gem.require_paths = ["lib"]
|
18
|
+
gem.required_ruby_version = '>= 2.6.0'
|
18
19
|
|
19
|
-
gem.add_dependency "rails", ">=
|
20
|
+
gem.add_dependency "rails", ">= 4.0.0"
|
20
21
|
gem.add_development_dependency "coffee-rails", ">= 3.0.10"
|
21
22
|
gem.add_development_dependency "coveralls"
|
22
23
|
gem.add_development_dependency "jquery-rails"
|
data/lib/chanko/controller.rb
CHANGED
data/lib/chanko/loader.rb
CHANGED
@@ -48,8 +48,10 @@ module Chanko
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def add_autoload_path
|
51
|
-
|
52
|
-
|
51
|
+
unless Rails.respond_to?(:autoloaders) && Rails.autoloaders.zeitwerk_enabled?
|
52
|
+
ActiveSupport::Dependencies.autoload_paths << autoload_path
|
53
|
+
ActiveSupport::Dependencies.autoload_paths.uniq!
|
54
|
+
end
|
53
55
|
end
|
54
56
|
|
55
57
|
def autoload_path
|
data/lib/chanko/railtie.rb
CHANGED
@@ -14,6 +14,12 @@ module Chanko
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
+
initializer("chanko.support_zeitwerk") do |app|
|
18
|
+
if Rails.respond_to?(:autoloaders) && Rails.autoloaders.zeitwerk_enabled?
|
19
|
+
Rails.autoloaders.main.collapse(Rails.root.join(Chanko::Config.units_directory_path, '*'))
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
17
23
|
initializer("chanko.prevent_units_directory_from_eager_loading", before: :set_autoload_paths) do |app|
|
18
24
|
if Chanko::Config.eager_load
|
19
25
|
Rails.configuration.eager_load_paths.delete(Rails.root.join(Chanko::Config.units_directory_path).to_s)
|
data/lib/chanko/test.rb
CHANGED
data/lib/chanko/version.rb
CHANGED
@@ -48,7 +48,7 @@ module <%= class_name %>
|
|
48
48
|
# ## models
|
49
49
|
# In models block, you can expand model features by `expand` method.
|
50
50
|
# The expanded methods are available via unit proxy like `User.unit.active`,
|
51
|
-
#
|
51
|
+
# `User.find(params[:id]).unit.active?` or `User.unit.gc_all_soft_deleted_users`.
|
52
52
|
#
|
53
53
|
# ```
|
54
54
|
# models do
|
@@ -58,6 +58,12 @@ module <%= class_name %>
|
|
58
58
|
# def active?
|
59
59
|
# deleted_at.nil?
|
60
60
|
# end
|
61
|
+
#
|
62
|
+
# class_methods do
|
63
|
+
# def gc_all_soft_deleted_users
|
64
|
+
# where.not(deleted_at: nil).delete_all
|
65
|
+
# end
|
66
|
+
# end
|
61
67
|
# end
|
62
68
|
# end
|
63
69
|
# ```
|
@@ -21,7 +21,7 @@ module Chanko
|
|
21
21
|
|
22
22
|
it "raises up error without any logging" do
|
23
23
|
expect(Logger).not_to receive(:debug)
|
24
|
-
expect { described_class.handle(error, insensitive_unit) }.to raise_error
|
24
|
+
expect { described_class.handle(error, insensitive_unit) }.to raise_error(error)
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -47,13 +47,13 @@ module Chanko
|
|
47
47
|
end
|
48
48
|
|
49
49
|
it "raises up error" do
|
50
|
-
expect { described_class.handle(error, insensitive_unit) }.to raise_error
|
50
|
+
expect { described_class.handle(error, insensitive_unit) }.to raise_error(error)
|
51
51
|
end
|
52
52
|
end
|
53
53
|
|
54
54
|
context "when unit.raise_error is configured" do
|
55
55
|
it "raises up error" do
|
56
|
-
expect { described_class.handle(error, sensitive_unit) }.to raise_error
|
56
|
+
expect { described_class.handle(error, sensitive_unit) }.to raise_error(error)
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
@@ -9,7 +9,7 @@ Dummy::Application.configure do
|
|
9
9
|
config.action_controller.perform_caching = true
|
10
10
|
|
11
11
|
# Disable Rails's static asset server (Apache or nginx will already do this)
|
12
|
-
config.
|
12
|
+
config.serve_static_files = false
|
13
13
|
|
14
14
|
# Compress JavaScripts and CSS
|
15
15
|
config.assets.compress = true
|
@@ -8,7 +8,7 @@ Dummy::Application.configure do
|
|
8
8
|
config.cache_classes = true
|
9
9
|
|
10
10
|
# Configure static asset server for tests with Cache-Control for performance
|
11
|
-
config.
|
11
|
+
config.serve_static_files = true
|
12
12
|
config.static_cache_control = "public, max-age=3600"
|
13
13
|
|
14
14
|
# Show full error reports and disable caching
|
metadata
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chanko
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
+
- MORITA shingo
|
7
8
|
- Ryo Nakamura
|
8
|
-
autorequire:
|
9
|
+
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date:
|
12
|
+
date: 2021-08-04 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: rails
|
@@ -16,14 +17,14 @@ dependencies:
|
|
16
17
|
requirements:
|
17
18
|
- - ">="
|
18
19
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
20
|
+
version: 4.0.0
|
20
21
|
type: :runtime
|
21
22
|
prerelease: false
|
22
23
|
version_requirements: !ruby/object:Gem::Requirement
|
23
24
|
requirements:
|
24
25
|
- - ">="
|
25
26
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
27
|
+
version: 4.0.0
|
27
28
|
- !ruby/object:Gem::Dependency
|
28
29
|
name: coffee-rails
|
29
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -285,7 +286,7 @@ files:
|
|
285
286
|
homepage: https://github.com/cookpad/chanko
|
286
287
|
licenses: []
|
287
288
|
metadata: {}
|
288
|
-
post_install_message:
|
289
|
+
post_install_message:
|
289
290
|
rdoc_options: []
|
290
291
|
require_paths:
|
291
292
|
- lib
|
@@ -293,16 +294,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
293
294
|
requirements:
|
294
295
|
- - ">="
|
295
296
|
- !ruby/object:Gem::Version
|
296
|
-
version:
|
297
|
+
version: 2.6.0
|
297
298
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
298
299
|
requirements:
|
299
300
|
- - ">="
|
300
301
|
- !ruby/object:Gem::Version
|
301
302
|
version: '0'
|
302
303
|
requirements: []
|
303
|
-
|
304
|
-
|
305
|
-
signing_key:
|
304
|
+
rubygems_version: 3.1.4
|
305
|
+
signing_key:
|
306
306
|
specification_version: 4
|
307
307
|
summary: Rails extension tool
|
308
308
|
test_files:
|