Skip to content

Commit

Permalink
Modernized the gem, and a few other tweaks.
Browse files Browse the repository at this point in the history
Now it looks like what a gem generated with `bundle gem` would look
like.

Also:
- Change requirements back to ActiveRecord 3.1, seen as the gem is not
  ready for prime time with Rails 4;
- Silence tests;
- Indicate which license this gem has.
  • Loading branch information
Andre Medeiros committed Mar 7, 2014
1 parent 1f45d2d commit f4fc7ba
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 64 deletions.
17 changes: 6 additions & 11 deletions Gemfile
@@ -1,15 +1,10 @@
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"
end
group :development do
gem "activerecord", ">= 3.0", "<= 4.0", :require => "active_record"
gem "activesupport", ">= 3.0", "<= 4.0", :require => "active_support"

platforms :jruby do
gem "activerecord-jdbcsqlite3-adapter"
gem "sqlite3", :platforms => [:ruby]
gem "activerecord-jdbcsqlite3-adapter", :platforms => [:jruby]
end
27 changes: 3 additions & 24 deletions Rakefile
@@ -1,9 +1,5 @@
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 "rdoc/task"

Expand All @@ -14,13 +10,8 @@ task :default => :test

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 @@ -33,18 +24,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
36 changes: 21 additions & 15 deletions acts_as_paranoid.gemspec
@@ -1,20 +1,26 @@
Gem::Specification.new do |s|
s.name = "acts_as_paranoid"
s.version = "0.5.0"
s.platform = Gem::Platform::RUBY
s.authors = ["Goncalo Silva", "Charles G.", "Rick Olson"]
s.email = ["goncalossilva@gmail.com"]
s.homepage = "https://github.com/goncalossilva/rails3_acts_as_paranoid"
s.summary = "Active Record plugin which allows you to hide and restore records without actually deleting them."
s.description = "Active Record 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 = ["Goncalo Silva", "Charles G.", "Rick Olson"]
spec.email = ["goncalossilva@gmail.com"]
spec.summary = "Active Record plugin which allows you to hide and restore records without actually deleting them."
spec.description = "Active Record plugin which allows you to hide and restore records without actually deleting them. Check its GitHub page for more in-depth information."
spec.homepage = "https://github.com/goncalossilva/rails3_acts_as_paranoid"
spec.license = "MIT"

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

s.add_development_dependency "minitest"
s.add_development_dependency 'rake', ['>= 0']
spec.required_rubygems_version = ">= 1.3.6"

s.files = Dir["{lib}/**/*.rb", "LICENSE", "*.markdown"]
spec.add_dependency "activerecord", ">= 3.1", "< 4.0"

spec.add_development_dependency "bundler", "~> 1.5"
spec.add_development_dependency "rake"
end
4 changes: 0 additions & 4 deletions lib/acts_as_paranoid.rb
@@ -1,12 +1,8 @@
require 'active_record/base'
require 'active_record/relation'
require 'active_record/callbacks'
require 'acts_as_paranoid/core'
require 'acts_as_paranoid/associations'
require 'acts_as_paranoid/validations'
require 'acts_as_paranoid/relation'


module ActsAsParanoid

def paranoid?
Expand Down
3 changes: 3 additions & 0 deletions lib/acts_as_paranoid/version.rb
@@ -0,0 +1,3 @@
module ActsAsParanoid
VERSION = "0.5.0"
end
21 changes: 11 additions & 10 deletions test/test_helper.rb
@@ -1,16 +1,17 @@
require 'rubygems'
require 'test/unit'
require 'active_support'
require 'active_record'
require 'active_model'

$:.unshift "#{File.dirname(__FILE__)}/../"
$:.unshift "#{File.dirname(__FILE__)}/../lib/"
$:.unshift "#{File.dirname(__FILE__)}/../lib/validations"
require 'bundler'
begin
Bundler.require(:default, :development)
rescue Bundler::BundlerError => e
$stderr.puts e.message
$stderr.puts "Run `bundle install` to install missing gems"
exit e.status_code
end

require 'init'
require 'acts_as_paranoid'
require 'minitest/autorun'

ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
ActiveRecord::Schema.verbose = false

def setup_db
ActiveRecord::Schema.define(:version => 1) do
Expand Down

0 comments on commit f4fc7ba

Please sign in to comment.