Skip to content

Commit

Permalink
move paranoia into a bundle gem format because we don't like using …
Browse files Browse the repository at this point in the history
…submodules
  • Loading branch information
radar committed Oct 7, 2010
0 parents commit b5f4394
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pkg/*
*.gem
.bundle
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source :gemcutter

# Specify your gem's dependencies in paranoia.gemspec
gemspec
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
require 'bundler'
Bundler::GemHelper.install_tasks
22 changes: 22 additions & 0 deletions lib/paranoia.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module Paranoia
def deleted?
!!self["deleted_at"]
end

def destroy
self["deleted_at"] = Time.now
self.save
_run_destroy_callbacks
end

alias_method :delete, :destroy

end

class ActiveRecord::Base
def self.acts_as_paranoid
self.send(:include, Paranoia)
default_scope :conditions => { :deleted_at => nil }
end
end

3 changes: 3 additions & 0 deletions lib/paranoia/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module Paranoia
VERSION = "0.0.1"
end
24 changes: 24 additions & 0 deletions paranoia.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- encoding: utf-8 -*-
require File.expand_path("../lib/paranoia/version", __FILE__)

Gem::Specification.new do |s|
s.name = "paranoia"
s.version = Paranoia::VERSION
s.platform = Gem::Platform::RUBY
s.authors = []
s.email = []
s.homepage = "http://rubygems.org/gems/paranoia"
s.summary = "TODO: Write a gem summary"
s.description = "TODO: Write a gem description"

s.required_rubygems_version = ">= 1.3.6"
s.rubyforge_project = "paranoia"

s.add_dependency "activerecord", "~> 3.0.0"

s.add_development_dependency "bundler", ">= 1.0.0"

s.files = `git ls-files`.split("\n")
s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
s.require_path = 'lib'
end

0 comments on commit b5f4394

Please sign in to comment.