soft_deletion 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -8,3 +8,4 @@ gem 'rake'
8
8
  gem 'sqlite3'
9
9
  gem 'rspec'
10
10
  gem 'database_cleaner'
11
+ gem 'bump'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- soft_deletion (0.2.0)
4
+ soft_deletion (0.2.1)
5
5
 
6
6
  GEM
7
7
  remote: http://rubygems.org/
@@ -22,6 +22,7 @@ GEM
22
22
  rake
23
23
  arel (3.0.2)
24
24
  builder (3.0.0)
25
+ bump (0.3.8)
25
26
  database_cleaner (0.8.0)
26
27
  diff-lcs (1.1.3)
27
28
  i18n (0.6.0)
@@ -45,6 +46,7 @@ DEPENDENCIES
45
46
  activerecord
46
47
  activesupport
47
48
  appraisal
49
+ bump
48
50
  database_cleaner
49
51
  rake
50
52
  rspec
data/Rakefile CHANGED
@@ -1,26 +1,11 @@
1
+ require 'bundler/setup'
1
2
  require 'appraisal'
2
3
  require 'bundler/gem_tasks'
3
4
  require 'rspec/core/rake_task'
5
+ require 'bump/tasks'
4
6
 
5
7
  task :default do
6
8
  sh "bundle exec rake appraisal:install && bundle exec rake appraisal spec"
7
9
  end
8
10
 
9
11
  RSpec::Core::RakeTask.new(:spec)
10
-
11
- # extracted from https://github.com/grosser/project_template
12
- rule /^version:bump:.*/ do |t|
13
- sh "git status | grep 'nothing to commit'" # ensure we are not dirty
14
- index = ['major', 'minor','patch'].index(t.name.split(':').last)
15
- file = 'lib/soft_deletion/version.rb'
16
-
17
- version_file = File.read(file)
18
- old_version, *version_parts = version_file.match(/(\d+)\.(\d+)\.(\d+)/).to_a
19
- version_parts[index] = version_parts[index].to_i + 1
20
- version_parts[2] = 0 if index < 2 # remove patch for minor
21
- version_parts[1] = 0 if index < 1 # remove minor for major
22
- new_version = version_parts * '.'
23
- File.open(file,'w'){|f| f.write(version_file.sub(old_version, new_version)) }
24
-
25
- sh "bundle && git add #{file} Gemfile.lock && git commit -m 'bump version to #{new_version}'"
26
- end
data/Readme.md CHANGED
@@ -50,6 +50,7 @@ Authors
50
50
  ### [Contributors](https://github.com/grosser/soft_deletion/contributors)
51
51
  - [Michel Pigassou](https://github.com/Dagnan)
52
52
  - [Steven Davidovitz](https://github.com/steved555)
53
+ - [PikachuEXE](https://github.com/PikachuEXE)
53
54
 
54
55
  [Zendesk](http://zendesk.com)<br/>
55
56
  michael@grosser.it<br/>
@@ -10,12 +10,12 @@ module SoftDeletion
10
10
  if ActiveRecord::VERSION::MAJOR > 2
11
11
  base.define_callbacks :soft_delete
12
12
  class << base
13
- def before_soft_delete(*callbacks)
14
- set_callback :soft_delete, :before, *callbacks
13
+ def before_soft_delete(*callbacks, &block)
14
+ set_callback :soft_delete, :before, *callbacks, &block
15
15
  end
16
16
 
17
- def after_soft_delete(*callbacks)
18
- set_callback :soft_delete, :after, *callbacks
17
+ def after_soft_delete(*callbacks, &block)
18
+ set_callback :soft_delete, :after, *callbacks, &block
19
19
  end
20
20
  end
21
21
  else
@@ -1,3 +1,3 @@
1
1
  module SoftDeletion
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
@@ -76,6 +76,15 @@ describe SoftDeletion do
76
76
  Category.soft_delete_all!(category)
77
77
  end
78
78
 
79
+ it "is called with a block" do
80
+ Category.after_soft_delete{|c| c.foo }
81
+ category = Category.create!
82
+
83
+ category.should_receive(:foo)
84
+
85
+ category.soft_delete!
86
+ end
87
+
79
88
  it "should be call multiple after soft-deletion" do
80
89
  Category.after_soft_delete :foo, :bar
81
90
  category = Category.create!
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soft_deletion
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
5
4
  prerelease:
5
+ version: 0.2.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Zendesk
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-15 00:00:00.000000000 Z
12
+ date: 2012-12-30 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email: michael@grosser.it
@@ -43,23 +43,23 @@ rdoc_options: []
43
43
  require_paths:
44
44
  - lib
45
45
  required_ruby_version: !ruby/object:Gem::Requirement
46
- none: false
47
46
  requirements:
48
47
  - - ! '>='
49
48
  - !ruby/object:Gem::Version
50
49
  version: '0'
51
50
  segments:
52
51
  - 0
53
- hash: -3275884841840712801
54
- required_rubygems_version: !ruby/object:Gem::Requirement
52
+ hash: 3946818531354053907
55
53
  none: false
54
+ required_rubygems_version: !ruby/object:Gem::Requirement
56
55
  requirements:
57
56
  - - ! '>='
58
57
  - !ruby/object:Gem::Version
59
58
  version: '0'
60
59
  segments:
61
60
  - 0
62
- hash: -3275884841840712801
61
+ hash: 3946818531354053907
62
+ none: false
63
63
  requirements: []
64
64
  rubyforge_project:
65
65
  rubygems_version: 1.8.24