chanko 2.0.7 → 2.0.8

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
  SHA1:
3
- metadata.gz: f325906ba94cd59313a68d2cba3be3bb6d3b05f9
4
- data.tar.gz: 5a7e857db28ef637d4fed3c77bd3c6976885fcc7
3
+ metadata.gz: 68c4176b063d78567c7cb08d88d0868e6f0cb892
4
+ data.tar.gz: 78ec98e8831cb4fd913e55a399538a4cc1ae7084
5
5
  SHA512:
6
- metadata.gz: f456c90d96c0ad8002028cf1c8d5402878133c330ec59917a75bdffb5ddece6937ce412337270cc8e455331e8160833b77a8ac467f21cb84d5194a0052b6edd6
7
- data.tar.gz: 5180320d9015bdcca75c76ba35c99ed2177e5f54da759e25680da76745fe17f160faa9304225a3f9891f9b5ab7998cc512a9c174a2df3226926cb392819bbbde
6
+ metadata.gz: 48b0858c605f85a665a1d614831d9fa3f60b5bac1fb74099065edcf061c61c2ab08b0faad3a833d8445941299a3869501a02f7c8f0b445473485f6abe817ca8f
7
+ data.tar.gz: b7139c166079d65b2bf88acaebced6170a32ebc77e303c9da082160bfb75c948a10865a0284ede9d1585cae947cd45955d69531033ea3afe7a238bfb08745698
@@ -6,3 +6,4 @@ rvm:
6
6
  branches:
7
7
  only:
8
8
  - master
9
+ sudo: false
@@ -1,3 +1,6 @@
1
+ ## 2.0.8
2
+ * Improve documentation about expanding class methods.
3
+
1
4
  ## 2.0.7
2
5
  * Fix run_default again. 2.0.6 still has run_default bug. Use unstack block instad of depth counting.
3
6
 
data/README.md CHANGED
@@ -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
  ```
@@ -1,3 +1,3 @@
1
1
  module Chanko
2
- VERSION = "2.0.7"
2
+ VERSION = "2.0.8"
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,14 @@
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.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-22 00:00:00.000000000 Z
11
+ date: 2015-09-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -301,7 +301,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
301
301
  version: '0'
302
302
  requirements: []
303
303
  rubyforge_project:
304
- rubygems_version: 2.0.14
304
+ rubygems_version: 2.4.5.1
305
305
  signing_key:
306
306
  specification_version: 4
307
307
  summary: Rails extension tool
@@ -371,3 +371,4 @@ test_files:
371
371
  - spec/fixtures/units/sensitive_inactive_unit/sensitive_inactive_unit.rb
372
372
  - spec/fixtures/units/sensitive_unit/sensitive_unit.rb
373
373
  - spec/spec_helper.rb
374
+ has_rdoc: