acts_as_archive 0.1.4 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -17,7 +17,7 @@ spec = Gem::Specification.new do |s|
17
17
  s.platform = Gem::Platform::RUBY
18
18
  s.require_path = "lib"
19
19
  s.summary = "Don't delete your records, move them to a different table"
20
- s.version = "0.1.4"
20
+ s.version = "0.1.5"
21
21
  end
22
22
 
23
23
  desc "Package gem"
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{acts_as_archive}
5
- s.version = "0.1.4"
5
+ s.version = "0.1.5"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Winton Welsh"]
9
- s.date = %q{2009-10-14}
9
+ s.date = %q{2009-11-24}
10
10
  s.default_executable = %q{acts_as_archive}
11
11
  s.email = %q{mail@wintoni.us}
12
12
  s.executables = ["acts_as_archive"]
@@ -19,9 +19,9 @@ module ActsAsArchive
19
19
  if table_exists? && !archive_table_exists?
20
20
  connection.execute(%{
21
21
  CREATE TABLE archived_#{table_name}
22
- ENGINE=InnoDB
22
+ #{"ENGINE=InnoDB" unless sqlite?}
23
23
  AS SELECT * from #{table_name}
24
- WHERE false;
24
+ WHERE 1 = 0;
25
25
  })
26
26
  columns = connection.columns("archived_#{table_name}").collect(&:name)
27
27
  unless columns.include?('deleted_at')
@@ -56,6 +56,12 @@ module ActsAsArchive
56
56
  end
57
57
  end
58
58
  end
59
+
60
+ private
61
+
62
+ def sqlite?
63
+ ActiveRecord::Base.connection.class.to_s.downcase.include?('sqlite')
64
+ end
59
65
  end
60
66
 
61
67
  module InstanceMethods
@@ -32,17 +32,23 @@ describe ActsAsArchive::Base::Table do
32
32
  describe 'create_archive_indexes' do
33
33
 
34
34
  before(:all) do
35
- Article.create_archive_indexes
35
+ unless Article.send(:sqlite?)
36
+ Article.create_archive_indexes
37
+ end
36
38
  end
37
39
 
38
40
  it "should create archive indexes" do
39
- indexes.should == [ "id", "deleted_at" ]
41
+ unless Article.send(:sqlite?)
42
+ indexes.should == [ "id", "deleted_at" ]
43
+ end
40
44
  end
41
45
 
42
46
  it "should destroy archive indexes" do
43
- Article.class_eval { acts_as_archive }
44
- Article.create_archive_indexes
45
- indexes.should == []
47
+ unless Article.send(:sqlite?)
48
+ Article.class_eval { acts_as_archive }
49
+ Article.create_archive_indexes
50
+ indexes.should == []
51
+ end
46
52
  end
47
53
  end
48
54
 
@@ -1,7 +1,10 @@
1
1
  test:
2
- adapter: mysql
3
- database: acts_as_archive
4
- username: root
5
- password:
6
- host: localhost
7
- socket: /tmp/mysql.sock
2
+ adapter: sqlite3
3
+ database: ":memory:"
4
+ # test:
5
+ # adapter: mysql
6
+ # database: acts_as_archive
7
+ # username: root
8
+ # password:
9
+ # host: localhost
10
+ # socket: /tmp/mysql.sock
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_archive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Winton Welsh
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-06 00:00:00 -08:00
12
+ date: 2009-11-24 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies: []
15
15