chanko 2.0.7 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: f325906ba94cd59313a68d2cba3be3bb6d3b05f9
4
- data.tar.gz: 5a7e857db28ef637d4fed3c77bd3c6976885fcc7
2
+ SHA256:
3
+ metadata.gz: dd0d4fc859f9ec500c831edd710cfbcc587b6cc7577b0bebe427e92e954609d6
4
+ data.tar.gz: fd65d01e82c60cd769ecadff13957a59a1b994bfe08bbe959aa1985d5fefcb6d
5
5
  SHA512:
6
- metadata.gz: f456c90d96c0ad8002028cf1c8d5402878133c330ec59917a75bdffb5ddece6937ce412337270cc8e455331e8160833b77a8ac467f21cb84d5194a0052b6edd6
7
- data.tar.gz: 5180320d9015bdcca75c76ba35c99ed2177e5f54da759e25680da76745fe17f160faa9304225a3f9891f9b5ab7998cc512a9c174a2df3226926cb392819bbbde
6
+ metadata.gz: 603a7e536446a313a9200c07b4d55275524dc5737919e51e9fa1ea6f64897b7807fe5395f515d7087f7a26cd7003a6e1f4890b02b8df8ba70ade256dc13f5314
7
+ data.tar.gz: 1f7180cabfc7f7454828a567882ad80b983f8a8e7f1a7071772e4d33bacad7915f4e490b6ad47ec37581245af6de343430e17334f636eb352506fb72055bafa1
data/.travis.yml CHANGED
@@ -1,8 +1,8 @@
1
1
  rvm:
2
- - 1.9.3
3
- - 2.0.0
4
- - 2.1
5
- - 2.2
2
+ - 2.6
3
+ - 2.7
4
+ - 3.0
6
5
  branches:
7
6
  only:
8
7
  - master
8
+ sudo: false
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.8.7
16
- * Rails >= 3.0.10 (and Rails4!)
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
- and `User.find(params[:id]).unit.active?`, and so on.
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", ">= 3.0.10"
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"
@@ -8,7 +8,7 @@ module Chanko
8
8
  def inherited(base)
9
9
  if Config.auto_reload && base.name == "ApplicationController"
10
10
  base.class_eval do
11
- prepend_before_filter do
11
+ prepend_before_action do
12
12
  Chanko::Loader.cache.clear
13
13
  end
14
14
  end
data/lib/chanko/loader.rb CHANGED
@@ -48,8 +48,10 @@ module Chanko
48
48
  end
49
49
 
50
50
  def add_autoload_path
51
- ActiveSupport::Dependencies.autoload_paths << autoload_path
52
- ActiveSupport::Dependencies.autoload_paths.uniq!
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
@@ -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
@@ -33,7 +33,8 @@ module Chanko
33
33
  active_without_activations?(*args)
34
34
  end
35
35
  end
36
- alias_method_chain :active?, :activations
36
+ alias_method :active_without_activations?, :active?
37
+ alias_method :active?, :active_with_activations?
37
38
  end
38
39
  end
39
40
  end
@@ -1,3 +1,3 @@
1
1
  module Chanko
2
- VERSION = "2.0.7"
2
+ VERSION = "2.2.0"
3
3
  end
@@ -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
- # and `User.find(params[:id]).unit.active?`, and so on.
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
@@ -26,6 +26,12 @@ module EntryDeletion
26
26
  def soft_delete
27
27
  update_attributes(:deleted_at => Time.now)
28
28
  end
29
+
30
+ class_methods do
31
+ def gc_all_soft_deleted_users
32
+ where.not(deleted_at: nil).delete_all
33
+ end
34
+ end
29
35
  end
30
36
  end
31
37
 
@@ -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.serve_static_assets = false
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.serve_static_assets = true
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.7
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: 2015-05-22 00:00:00.000000000 Z
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: 3.0.10
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: 3.0.10
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: '0'
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
- rubyforge_project:
304
- rubygems_version: 2.0.14
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: