JackDanger-permanent_records 1.0.1 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -1,12 +1,24 @@
1
- # -*- ruby -*-
2
-
3
1
  require 'rubygems'
4
- require 'hoe'
5
- require File.dirname(__FILE__) + '/lib/permanent_records'
2
+ require 'rake'
3
+
4
+ begin
5
+ require 'jeweler'
6
+ Jeweler::Tasks.new do |gem|
7
+ gem.name = "permanent_records"
8
+ gem.summary = %Q{Soft-delete your ActiveRecord records}
9
+ gem.description = %Q{Rather than actually deleting data this just sets Record#deleted_at. Provides helpful scopes.}
10
+ gem.email = "gems@6brand.com"
11
+ gem.homepage = "http://github.com/JackDanger/permanent_records"
12
+ gem.authors = ["Jack Danger Canty"]
13
+ end
14
+ rescue LoadError
15
+ puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
16
+ end
6
17
 
7
- Hoe.new('permanent_records', PermanentRecords::VERSION) do |p|
8
- p.summary = "Soft-delete your ActiveRecord data."
9
- p.developer('Jack Danger Canty', 'gems@6brand.com')
18
+ require 'rake/testtask'
19
+ task :test do
20
+ exec "ruby test/permanent_records_test.rb"
10
21
  end
11
22
 
12
- # vim: syntax=Ruby
23
+ task :default => :test
24
+
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.4
@@ -1,8 +1,7 @@
1
1
  module PermanentRecords
2
- VERSION = '1.0.1'
3
2
  def self.included(base)
4
3
  if base.respond_to?(:named_scope)
5
- base.named_scope :deleted, :conditions => {:deleted_at => true}
4
+ base.named_scope :deleted, :conditions => :deleted_at
6
5
  base.named_scope :not_deleted, :conditions => { :deleted_at => nil }
7
6
  else
8
7
  base.extend LegacyScopes
@@ -0,0 +1,63 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run `rake gemspec`
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{permanent_records}
8
+ s.version = "1.0.3"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Jack Danger Canty"]
12
+ s.date = %q{2009-09-27}
13
+ s.description = %q{Rather than actually deleting data this just sets Record#deleted_at. Provides helpful scopes.}
14
+ s.email = %q{gems@6brand.com}
15
+ s.extra_rdoc_files = [
16
+ "README"
17
+ ]
18
+ s.files = [
19
+ "MIT-LICENSE",
20
+ "Manifest.txt",
21
+ "README",
22
+ "Rakefile",
23
+ "VERSION",
24
+ "init.rb",
25
+ "install.rb",
26
+ "lib/permanent_records.rb",
27
+ "permanent_records.gemspec",
28
+ "tasks/permanent_records_tasks.rake",
29
+ "test/database.yml",
30
+ "test/hole.rb",
31
+ "test/kitty.rb",
32
+ "test/mole.rb",
33
+ "test/muskrat.rb",
34
+ "test/permanent_records_test.rb",
35
+ "test/schema.rb",
36
+ "test/test_helper.rb",
37
+ "uninstall.rb"
38
+ ]
39
+ s.homepage = %q{http://github.com/JackDanger/permanent_records}
40
+ s.rdoc_options = ["--charset=UTF-8"]
41
+ s.require_paths = ["lib"]
42
+ s.rubygems_version = %q{1.3.5}
43
+ s.summary = %q{Soft-delete your ActiveRecord records}
44
+ s.test_files = [
45
+ "test/hole.rb",
46
+ "test/kitty.rb",
47
+ "test/mole.rb",
48
+ "test/muskrat.rb",
49
+ "test/permanent_records_test.rb",
50
+ "test/schema.rb",
51
+ "test/test_helper.rb"
52
+ ]
53
+
54
+ if s.respond_to? :specification_version then
55
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
56
+ s.specification_version = 3
57
+
58
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
59
+ else
60
+ end
61
+ else
62
+ end
63
+ end
data/test/database.yml CHANGED
@@ -1,9 +1,9 @@
1
1
  sqlite:
2
2
  :adapter: sqlite
3
- :dbfile: plugin.sqlite.db
3
+ :database: plugin.sqlite.db
4
4
  sqlite3:
5
5
  :adapter: sqlite3
6
- :dbfile: ":memory:"
6
+ :database: ":memory:"
7
7
  postgresql:
8
8
  :adapter: postgresql
9
9
  :username: postgres
@@ -15,4 +15,4 @@ mysql:
15
15
  :host: localhost
16
16
  :username: rails
17
17
  :password:
18
- :database: plugin_test
18
+ :database: plugin_test
@@ -1,11 +1,10 @@
1
- require 'test/unit'
2
1
  require File.expand_path(File.dirname(__FILE__) + "/test_helper")
3
2
 
4
3
  %w(hole mole muskrat kitty).each do |a|
5
4
  require File.expand_path(File.dirname(__FILE__) + "/" + a)
6
5
  end
7
6
 
8
- class PermanentRecordsTest < Test::Unit::TestCase
7
+ class PermanentRecordsTest < ActiveSupport::TestCase
9
8
 
10
9
  def setup
11
10
  super
@@ -79,6 +78,16 @@ class PermanentRecordsTest < Test::Unit::TestCase
79
78
  assert !@deleted.destroy.revive.revive.destroy.destroy.revive.deleted?
80
79
  end
81
80
 
81
+ def test_with_counting_on_deleted_limits_scope_to_count_deleted_records
82
+ assert_equal Muskrat.deleted.length,
83
+ Muskrat.deleted.count
84
+ end
85
+
86
+ def test_with_counting_on_not_deleted_limits_scope_to_count_not_deleted_records
87
+ assert_equal Muskrat.not_deleted.length,
88
+ Muskrat.not_deleted.count
89
+ end
90
+
82
91
  def test_with_deleted_limits_scope_to_deleted_records
83
92
  assert Muskrat.deleted.all?(&:deleted?)
84
93
  end
data/test/test_helper.rb CHANGED
@@ -5,10 +5,12 @@ $:.unshift(File.dirname(__FILE__) + '/../lib')
5
5
  RAILS_ROOT = File.dirname(__FILE__)
6
6
 
7
7
  require 'rubygems'
8
+ gem 'test-unit'
8
9
  require 'test/unit'
9
10
  require 'active_record'
10
11
  require 'active_record/fixtures'
11
12
  require "#{File.dirname(__FILE__)}/../init"
13
+
12
14
  require File.expand_path(File.dirname(__FILE__) + "/muskrat")
13
15
 
14
16
  config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
@@ -17,10 +19,8 @@ ActiveRecord::Base.establish_connection(config[ENV['DB'] || 'sqlite3'])
17
19
 
18
20
  load(File.dirname(__FILE__) + "/schema.rb") if File.exist?(File.dirname(__FILE__) + "/schema.rb")
19
21
 
20
- Test::Unit::TestCase.fixture_path = File.dirname(__FILE__) + "/fixtures/"
21
- $LOAD_PATH.unshift(Test::Unit::TestCase.fixture_path)
22
-
23
- class Test::Unit::TestCase #:nodoc:
22
+ class ActiveSupport::TestCase #:nodoc:
23
+ include ActiveRecord::TestFixtures
24
24
  # def create_fixtures(*table_names)
25
25
  # if block_given?
26
26
  # Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, table_names) { yield }
@@ -28,7 +28,10 @@ class Test::Unit::TestCase #:nodoc:
28
28
  # Fixtures.create_fixtures(Test::Unit::TestCase.fixture_path, table_names)
29
29
  # end
30
30
  # end
31
-
31
+
32
+ self.fixture_path = File.dirname(__FILE__) + "/fixtures/"
33
+ $LOAD_PATH.unshift(fixture_path)
34
+
32
35
  # Turn off transactional fixtures if you're working with MyISAM tables in MySQL
33
36
  self.use_transactional_fixtures = true
34
37
 
@@ -36,4 +39,4 @@ class Test::Unit::TestCase #:nodoc:
36
39
  self.use_instantiated_fixtures = false
37
40
 
38
41
  # Add more helper methods to be used by all tests here...
39
- end
42
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: JackDanger-permanent_records
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jack Danger Canty
@@ -9,38 +9,29 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-19 00:00:00 -07:00
12
+ date: 2009-09-27 00:00:00 -07:00
13
13
  default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: hoe
17
- type: :development
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 1.11.0
24
- version:
25
- description:
26
- email:
27
- - gems@6brand.com
14
+ dependencies: []
15
+
16
+ description: Rather than actually deleting data this just sets Record#deleted_at. Provides helpful scopes.
17
+ email: gems@6brand.com
28
18
  executables: []
29
19
 
30
20
  extensions: []
31
21
 
32
22
  extra_rdoc_files:
33
- - Manifest.txt
23
+ - README
34
24
  files:
35
25
  - MIT-LICENSE
36
26
  - Manifest.txt
37
27
  - README
38
28
  - Rakefile
29
+ - VERSION
39
30
  - init.rb
40
31
  - install.rb
41
32
  - lib/permanent_records.rb
33
+ - permanent_records.gemspec
42
34
  - tasks/permanent_records_tasks.rake
43
- - test/cached_values_test.rb
44
35
  - test/database.yml
45
36
  - test/hole.rb
46
37
  - test/kitty.rb
@@ -50,12 +41,12 @@ files:
50
41
  - test/schema.rb
51
42
  - test/test_helper.rb
52
43
  - uninstall.rb
53
- has_rdoc: true
54
- homepage:
44
+ has_rdoc: false
45
+ homepage: http://github.com/JackDanger/permanent_records
46
+ licenses:
55
47
  post_install_message:
56
48
  rdoc_options:
57
- - --main
58
- - README.txt
49
+ - --charset=UTF-8
59
50
  require_paths:
60
51
  - lib
61
52
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -72,10 +63,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
72
63
  version:
73
64
  requirements: []
74
65
 
75
- rubyforge_project: permanent_records
76
- rubygems_version: 1.2.0
66
+ rubyforge_project:
67
+ rubygems_version: 1.3.5
77
68
  signing_key:
78
- specification_version: 2
79
- summary: Soft-delete your ActiveRecord data.
69
+ specification_version: 3
70
+ summary: Soft-delete your ActiveRecord records
80
71
  test_files:
72
+ - test/hole.rb
73
+ - test/kitty.rb
74
+ - test/mole.rb
75
+ - test/muskrat.rb
76
+ - test/permanent_records_test.rb
77
+ - test/schema.rb
81
78
  - test/test_helper.rb