Permalink
Browse files

Modernized the gem, and a few other tweaks.

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...
1 parent 1f45d2d commit f4fc7ba9f6e7841b0e3841c0eb5e6092741883cb @andremedeiros andremedeiros committed Mar 7, 2014
Showing with 44 additions and 64 deletions.
  1. +6 −11 Gemfile
  2. +3 −24 Rakefile
  3. +21 −15 acts_as_paranoid.gemspec
  4. +0 −4 lib/acts_as_paranoid.rb
  5. +3 −0 lib/acts_as_paranoid/version.rb
  6. +11 −10 test/test_helper.rb
View
17 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
View
@@ -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"
@@ -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
@@ -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}"
View
@@ -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
View
@@ -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?
@@ -0,0 +1,3 @@
+module ActsAsParanoid
+ VERSION = "0.5.0"
+end
View
@@ -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

0 comments on commit f4fc7ba

Please sign in to comment.