Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build #2

Open
wants to merge 95 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
95 commits
Select commit Hold shift + click to select a range
0c692d2
Remove Gemfile.lock from repository
Feb 24, 2014
9e6ee17
Resolve warning about rake/rdoctask
Feb 24, 2014
0d5956f
Move test dependencies into gemspec as development dependencies
Feb 24, 2014
d6d4699
Support activerecord >= 4.0.0
Feb 24, 2014
631ffaf
bump gem to 0.5.0
Feb 24, 2014
587074b
Update gemspec summary and description to remove dependency mention.
Feb 24, 2014
9de04ab
Add gemfile support for testing against various versions of
Feb 24, 2014
c24aefd
Fix trailing spaces on files.
Mar 7, 2014
1f45d2d
Merge pull request #3 from andremedeiros/whitespace-fix
Mar 7, 2014
f4fc7ba
Modernized the gem, and a few other tweaks.
Mar 7, 2014
5a47cdf
Support AR from 3.0 onwards.
Mar 7, 2014
bd2d0d7
Merge pull request #1 from andremedeiros/modernize-gem
Mar 7, 2014
86ecbcd
Added gemfiles to test AR 3.1 and 3.2
Mar 7, 2014
d5a831f
Make Travis test only the versions that we actually support
Mar 7, 2014
95ecde7
Lock sqlite3 version so tests run with rbx
Mar 7, 2014
e2ad638
Silence more deprecations
Mar 7, 2014
c36e3ed
Documentation improvements
Mar 7, 2014
1bb293a
Move the AR dependency back to 3.1
Mar 7, 2014
7c543aa
Merge pull request #4 from andremedeiros/master
Mar 12, 2014
48ff312
Add Zachary to the authors and change the gem homepage.
Apr 5, 2014
67c6923
Merge pull request #5 from andremedeiros/master
May 12, 2014
5a23726
Test Ruby 2.1.x [ci skip]
May 12, 2014
879c66e
Delete duplicate description content
May 12, 2014
e7da594
Use original 0.4.x ActiveRecord dependency, we shouldn't change this
May 12, 2014
b8ebaef
Preparing 0.4.x patch level release first
May 12, 2014
2e9fd78
For this release we don't need AR 4+ gemfiles
May 12, 2014
e9cf44b
Use pessimistic dependency requirement
May 12, 2014
7fb0b5c
Use gemspec for remaining dependencies
May 12, 2014
fa21bfa
Fix typo in gemspec authors
May 12, 2014
0a66132
Add André Medeiros for his help!
May 12, 2014
5a1bafd
Enable 1.8.7 for Rails 3.x
May 12, 2014
ee96785
Allow testing of AR 3.0.0 since this patch level supports all Rails 3…
May 12, 2014
6714ab9
Revert "Allow testing of AR 3.0.0 since this patch level supports all…
May 12, 2014
f13cc2f
Correction, this patch level release will only support Rails 3.2.x
May 12, 2014
546267e
Markdown syntax
May 12, 2014
b1b61c1
Rails 3.2 still supported Ruby 1.8, so we should do our best.
May 12, 2014
7b9b0d7
Make sure we use latest sqlite3 1.3.x when testing
May 12, 2014
61b26a5
Move gemspec after platform dependencies
May 12, 2014
a944af8
Move Credits below Acknowledgements [ci skip]
May 12, 2014
2fcc4c6
Update Copyright notice [ci skip]
May 12, 2014
990a9c7
Add rdoc as development dependency to let Ruby 1.8 tests run
May 12, 2014
17cf61a
Add minitest as development dependency to let tests run on Ruby 1.8
May 12, 2014
37725d8
Remove ./gemfiles since we only test one version of Rails
May 12, 2014
5e6bc34
Mark as pre-release
May 12, 2014
fbcbdd4
Master is now 0.5.x
May 12, 2014
b583c3c
Update README.markdown
Aug 28, 2013
17617a4
Merge andremedeiros/acts_as_paranoid@f77770e manually
May 12, 2014
d2748d6
Remove init.rb
Aug 11, 2014
c1e4004
Specify branch support for master, add Gonçalo to credits.
Aug 11, 2014
f53f13b
See `LICENSE`.
Aug 11, 2014
7cb5ccd
Update homepage
Aug 11, 2014
ed2a82e
Fixed minor spelling mistake
binarycleric Aug 21, 2014
52c5166
Merge pull request #15 from binarycleric/spelling_fixup
Aug 22, 2014
75a4662
rm 1.8 support, test against ruby-head
Aug 25, 2014
2b5fa82
Target AR 4.x
Aug 25, 2014
6f7fa03
This branch targets 4.x
Aug 25, 2014
18d9ec4
Thank you @technoweenie!! <3 <3
Aug 25, 2014
f672e87
Update repository homepage to org
Aug 25, 2014
6bb32b2
build travis
Aug 25, 2014
7057280
Initial test matrix setup for AR 4+ on travis
Aug 25, 2014
82845ba
Fix typo in version iteration of Rakefile
Aug 25, 2014
5bf262e
belongs_to_with_deleted should pass scope to belongs_to_without_deleted
yuki24 Mar 19, 2013
e796b9f
don't save when destroying a non persisted object
pelargir May 11, 2013
ec9c311
Rails 4.0.0 compatibility
byroot Feb 26, 2013
d5c17ad
Merged in @byroot's Rails 4.0.0 support, thank you! <3 <3 <3
Aug 26, 2014
c6d7c28
Add travis script for test
Aug 26, 2014
115f762
bump to beta1
Aug 26, 2014
d7929c0
result is a hash
Aug 29, 2014
9fdd810
Don't eager load logger, we no longer support 1.8.7 anyways
Aug 29, 2014
6142210
Use unscoped instead of with_default_scope
Aug 29, 2014
eef6a4f
serialized_attributes has been deprecated in rails/rails#15704
Aug 29, 2014
ddcd191
Use timestamps with null: false
Aug 29, 2014
e014094
Use minitest version compatible with other dependencies
mvz Nov 18, 2014
fd4e16e
Use #column_types instead of #type_for_attribute
mvz Nov 18, 2014
e8f7fbb
Do not mangle belongs_to result
mvz Nov 18, 2014
a8953b5
Set with_deleted option
mvz Nov 18, 2014
3bf46c2
Fix with_deleted
mvz Nov 18, 2014
3c12279
Soft destroy dependents
mvz Nov 19, 2014
421dd3d
Fix dependent recoverable associations scope
mvz Nov 19, 2014
37a9e33
Fix test to show dependent removal behavior
mvz Nov 19, 2014
6d9981e
Use destroy_fully! where needed
mvz Nov 19, 2014
97d3b00
Allow broad range of minitest versions
mvz Nov 19, 2014
9c70f8c
Munge result of belongs_to differently for AR 4.0
mvz Nov 19, 2014
01bdce8
Fix #without_paranoid_default_scope on AR 4.0
mvz Nov 19, 2014
ae6598c
Make #validate_each work with AR 4.2
mvz Nov 19, 2014
784a874
Fix tests to allow reflections hash keys to be strings
mvz Nov 19, 2014
be7e251
Fix AR 4.2 deprecation warnings in tests
mvz Nov 19, 2014
fa16de9
Update_all for delete_all recovery
Aug 6, 2014
a48781f
removed extraneous "then" from case statement
pavlos Apr 14, 2015
273e741
reimlemented Chris Chiu's changes "Added support for only propagating…
pavlos Apr 14, 2015
07bb0cd
reimplemented Chris Chiu's change "Halt execution of recovery if call…
pavlos Apr 14, 2015
7891ea6
fixed string based terminator deprecation warning
pavlos Apr 14, 2015
316e98a
reimplemented Chris Chiu's change "Fixing cascading recover to recove…
pavlos Apr 14, 2015
c2d914e
fix delete order
pavlos Jun 11, 2015
5932cfe
destroy_dependent_associations! calls destroy_fully!
pavlos Jun 11, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
pkg
.bundle
.DS_Store
Gemfile.lock
gemfiles/*.lock
21 changes: 18 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,21 @@
language: ruby
script: "bundle exec rake test"
rvm:
- 1.9.2
- 1.9.3
- jruby-19mode
- rbx-19mode
- 2.0.0
- 2.1
- ruby-head
- jruby
- rbx
gemfile:
- gemfiles/active_record_40.gemfile
- gemfiles/active_record_41.gemfile
- gemfiles/active_record_42.gemfile
- gemfiles/active_record_edge.gemfile
matrix:
allow_failures:
- rvm: ruby-head
- rvm: rbx
- rvm: jruby
- gemfile: gemfiles/active_record_edge.gemfile
fast_finish: true
21 changes: 5 additions & 16 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
source "http://rubygems.org"

gem "activerecord", "~>3.2"
source "https://rubygems.org"

# Development dependencies
gem "rake"
gem "activesupport", "~>3.2"

platforms :ruby do
gem "sqlite3"
group :development do
gem "sqlite3", :platforms => [:ruby]
gem "activerecord-jdbcsqlite3-adapter", :platforms => [:jruby]
end

platforms :jruby do
gem "activerecord-jdbcsqlite3-adapter"
end

group :test do
gem "minitest"
gem "autotest-growl"
end
gemspec
41 changes: 0 additions & 41 deletions Gemfile.lock

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2010 Gonçalo Silva
Copyright (c) 2014 Zachary Scott, Gonçalo Silva, Rick Olson

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
Expand Down
50 changes: 17 additions & 33 deletions README.markdown → README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# ActsAsParanoid

A simple plugin which hides records instead of deleting them, being able to recover them.
[![Build Status](https://travis-ci.org/ActsAsParanoid/acts_as_paranoid.png?branch=master)](https://travis-ci.org/ActsAsParanoid/acts_as_paranoid)

**This branch targets Rails 3.2.** If you're working with another version, switch to the corresponding branch.
A Rails plugin to add soft delete.

## Credits
This gem can be used to hide records instead of deleting them, making them recoverable later.

This plugin was inspired by [acts_as_paranoid](http://github.com/technoweenie/acts_as_paranoid) and [acts_as_active](http://github.com/fernandoluizao/acts_as_active).
## Support

While porting it to Rails 3, I decided to apply the ideas behind those plugins to an unified solution while removing a **lot** of the complexity found in them. I eventually ended up writing a new plugin from scratch.
**This branch targets Rails 4.x.**

If you're working with another version, switch to the corresponding branch, or require an older version of the acts_as_paranoid gem.

## Usage

Expand Down Expand Up @@ -187,13 +189,15 @@ Associations are also supported. From the simplest behaviors you'd expect to mor

```ruby
class Parent < ActiveRecord::Base
has_many :children, :class_name => "ParanoiacChild"
has_many :children, :class_name => "ParanoiacChild"
end

class ParanoiacChild < ActiveRecord::Base
belongs_to :parent
belongs_to :parent_including_deleted, :class_name => "Parent", :with_deleted => true
# You cannot name association *_with_deleted
acts_as_paranoid
belongs_to :parent

# You may need to provide a foreign_key like this
belongs_to :parent_including_deleted, :class_name => "Parent", foreign_key => 'parent_id', :with_deleted => true
end

parent = Parent.first
Expand All @@ -214,37 +218,17 @@ Watch out for these caveats:
- You cannot name association `*_with_deleted`
- `unscoped` will return all records, deleted or not

# Support

This gem supports the most recent versions of Rails and Ruby.

## Rails

For Rails 3.2 check the README at the [rails3.2](https://github.com/goncalossilva/rails3_acts_as_paranoid/tree/rails3.2) branch and add this to your Gemfile:

gem "acts_as_paranoid", "~>0.4.0"

For Rails 3.1 check the README at the [rails3.1](https://github.com/goncalossilva/rails3_acts_as_paranoid/tree/rails3.1) branch and add this to your Gemfile:

gem "rails3_acts_as_paranoid", "~>0.1.4"

For Rails 3.0 check the README at the [rails3.0](https://github.com/goncalossilva/rails3_acts_as_paranoid/tree/rails3.0) branch and add this to your Gemfile:

gem "rails3_acts_as_paranoid", "~>0.0.9"


## Ruby

This gem is tested on Ruby 1.9, JRuby and Rubinius (both in 1.9 mode). It *might* work fine in 1.8, but it's not officially supported.

# Acknowledgements

* To [Rick Olson](https://github.com/technoweenie) for creating acts_as_paranoid
* To [cheerfulstoic](https://github.com/cheerfulstoic) for adding recursive recovery
* To [Jonathan Vaught](https://github.com/gravelpup) for adding paranoid validations
* To [Geoffrey Hichborn](https://github.com/phene) for improving the overral code quality and adding support for after_commit
* To [flah00](https://github.com/flah00) for adding support for STI-based associations (with :dependent)
* To [vikramdhillon](https://github.com/vikramdhillon) for the idea and initial implementation of support for string column type
* To [Craig Walker](https://github.com/softcraft-development) for Rails 3.1 support and fixing various pending issues
* To [Charles G.](https://github.com/chuckg) for Rails 3.2 support and for making a desperately needed global code refactoring
* To [Gonçalo Silva](https://github.com/goncalossilva) for supporting this gem prior to v0.4.3
* To [Jean Boussier](https://github.com/byroot) for initial Rails 4.0.0 support

Copyright © 2010 Gonçalo Silva, released under the MIT license
See `LICENSE`.
51 changes: 23 additions & 28 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,34 @@
begin
require "bundler"
Bundler.setup
rescue LoadError
$stderr.puts "You need to have Bundler installed to be able build this gem."
end
require "bundler/gem_tasks"

require "rake/testtask"
require "rake/rdoctask"
require "rdoc/task"

gemspec = eval(File.read(Dir["*.gemspec"].first))


desc 'Default: run unit tests.'
task :default => :test
task :default => "test:all"

namespace :test do
%w(active_record_edge active_record_40 active_record_41 active_record_42).each do |version|
desc "Test acts_as_paranoid against #{version}"
task version do
sh "BUNDLE_GEMFILE='gemfiles/#{version}.gemfile' bundle --quiet"
sh "BUNDLE_GEMFILE='gemfiles/#{version}.gemfile' bundle exec rake -t test"
end
end

desc "Run all tests for acts_as_paranoid"
task :all do
%w(active_record_edge active_record_40 active_record_41 active_record_42).each do |version|
sh "BUNDLE_GEMFILE='gemfiles/#{version}.gemfile' bundle --quiet"
sh "BUNDLE_GEMFILE='gemfiles/#{version}.gemfile' bundle exec rake -t test"
end
end
end

desc 'Test the acts_as_paranoid plugin.'
Rake::TestTask.new(:test) do |t|
t.libs << 'lib'
t.libs << 'test'

test_files = FileList['test/**/test_*.rb']
test_files.exclude('test/test_helper.rb')
t.test_files = test_files

t.pattern = 'test/test_*.rb'
t.verbose = true
end

Expand All @@ -34,18 +41,6 @@ Rake::RDocTask.new(:rdoc) do |rdoc|
rdoc.rdoc_files.include('lib/**/*.rb')
end

desc "Validate the gemspec"
task :gemspec do
gemspec.validate
end

desc "Build gem locally"
task :build => :gemspec do
system "gem build #{gemspec.name}.gemspec"
FileUtils.mkdir_p "pkg"
FileUtils.mv "#{gemspec.name}-#{gemspec.version}.gem", "pkg"
end

desc "Install gem locally"
task :install => :build do
system "gem install pkg/#{gemspec.name}-#{gemspec.version}"
Expand Down
38 changes: 25 additions & 13 deletions acts_as_paranoid.gemspec
Original file line number Diff line number Diff line change
@@ -1,17 +1,29 @@
Gem::Specification.new do |s|
s.name = "acts_as_paranoid"
s.version = "0.0.0"
s.platform = Gem::Platform::RUBY
s.authors = ["Goncalo Silva", "Charles G.", "Rick Olson"]
s.email = ["[email protected]"]
s.homepage = "https://github.com/goncalossilva/rails3_acts_as_paranoid"
s.summary = "Active Record (~>3.2) plugin which allows you to hide and restore records without actually deleting them."
s.description = "Active Record (~>3.2) plugin which allows you to hide and restore records without actually deleting them. Check its GitHub page for more in-depth information."
s.rubyforge_project = s.name
# coding: utf-8
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'acts_as_paranoid/version'

s.required_rubygems_version = ">= 1.3.6"
Gem::Specification.new do |spec|
spec.name = "acts_as_paranoid"
spec.version = ActsAsParanoid::VERSION
spec.authors = ["Zachary Scott", "Goncalo Silva", "Rick Olson"]
spec.email = ["[email protected]"]
spec.summary = "Active Record plugin which allows you to hide and restore records without actually deleting them."
spec.description = "Check the home page for more in-depth information."
spec.homepage = "https://github.com/ActsAsParanoid/acts_as_paranoid"
spec.license = "MIT"

s.add_dependency "activerecord", "~> 3.2"
spec.files = Dir["{lib}/**/*.rb", "LICENSE", "*.md"]
spec.test_files = Dir["test/*.rb"]
spec.require_paths = ["lib"]

s.files = Dir["{lib}/**/*.rb", "LICENSE", "*.markdown"]
spec.required_rubygems_version = ">= 1.3.6"

spec.add_dependency "activerecord", "~> 4.0"
spec.add_dependency "activesupport", "~> 4.0"

spec.add_development_dependency "bundler", "~> 1.5"
spec.add_development_dependency "rake"
spec.add_development_dependency "rdoc"
spec.add_development_dependency "minitest", ">= 4.0", "<= 6.0"
end
25 changes: 25 additions & 0 deletions gemfiles/active_record_40.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
source 'https://rubygems.org'

gem 'activerecord', '~> 4.0.0', :require => 'active_record'
gem 'activesupport', '~> 4.0.0', :require => 'active_support'

platforms :ruby do
if RUBY_VERSION > "2.1.0"
gem 'sqlite3'
else
gem 'sqlite3', '1.3.8'
end
end

platforms :jruby do
gem 'activerecord-jdbcsqlite3-adapter', '>= 1.3.0'
end

platforms :rbx do
gem 'rubysl', '~> 2.0'
gem 'racc'
gem 'rubysl-test-unit'
gem 'rubinius-developer_tools'
end

gemspec :path => '../'
25 changes: 25 additions & 0 deletions gemfiles/active_record_41.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
source 'https://rubygems.org'

gem 'activerecord', '~> 4.1.0', :require => 'active_record'
gem 'activesupport', '~> 4.1.0', :require => 'active_support'

platforms :ruby do
if RUBY_VERSION > "2.1.0"
gem 'sqlite3'
else
gem 'sqlite3', '1.3.8'
end
end

platforms :jruby do
gem 'activerecord-jdbcsqlite3-adapter', '>= 1.3.0'
end

platforms :rbx do
gem 'rubysl', '~> 2.0'
gem 'racc'
gem 'minitest'
gem 'rubinius-developer_tools'
end

gemspec :path => '../'
25 changes: 25 additions & 0 deletions gemfiles/active_record_42.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
source 'https://rubygems.org'

gem 'activerecord', '~> 4.2.0.beta1', :require => 'active_record'
gem 'activesupport', '~> 4.2.0.beta1', :require => 'active_support'

platforms :ruby do
if RUBY_VERSION > "2.1.0"
gem 'sqlite3'
else
gem 'sqlite3', '1.3.8'
end
end

platforms :jruby do
gem 'activerecord-jdbcsqlite3-adapter', '>= 1.3.0'
end

platforms :rbx do
gem 'rubysl', '~> 2.0'
gem 'racc'
gem 'minitest'
gem 'rubinius-developer_tools'
end

gemspec :path => '../'
Loading