Permalink
Browse files

Fixing acts_as_archive binary (0.1.6)

  • Loading branch information...
winton committed Feb 4, 2010
1 parent d6ac11d commit 9dc96bb55a1b14f5c51ba213edb9480b23f0f7e0
Showing with 22 additions and 21 deletions.
  1. +7 −1 README.markdown
  2. +3 −4 Rakefile
  3. +1 −4 bin/acts_as_archive
  4. +11 −0 lib/acts_as_archive/base.rb
  5. +0 −12 rails/init.rb
View
@@ -17,6 +17,12 @@ Install
sudo gem install acts_as_archive --source http://gemcutter.org
</pre>
+**environment.rb**:
+
+<pre>
+config.gem 'acts_as_archive'
+</pre>
+
Update models
-------------
@@ -37,7 +43,7 @@ Terminal:
<pre>
cd your_rails_app
-acts_as_archive
+acts_as_archive Article
</pre>
This command creates your archive tables (<code>archived_articles</code> as per the example).
View
@@ -17,7 +17,7 @@ spec = Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.require_path = "lib"
s.summary = "Don't delete your records, move them to a different table"
- s.version = "0.1.4"
+ s.version = "0.1.6"
end
desc "Package gem"
@@ -28,8 +28,8 @@ end
desc "Install gem"
task :install do
Rake::Task['gem'].invoke
- `sudo gem uninstall #{GEM_NAME} -x`
- `sudo gem install pkg/#{GEM_NAME}*.gem`
+ `gem uninstall #{GEM_NAME} -x`
+ `gem install pkg/#{GEM_NAME}*.gem`
`rm -Rf pkg`
end
@@ -42,7 +42,6 @@ end
desc "Run specs"
Spec::Rake::SpecTask.new do |t|
- t.rcov = true
t.spec_opts = ["--format", "specdoc", "--colour"]
t.spec_files = FileList["spec/**/*_spec.rb"]
end
View
@@ -1,6 +1,3 @@
#!/usr/bin/env ruby
-$:.push File.expand_path("#{File.dirname(__FILE__)}/../lib")
-require 'acts_as_archive'
-
-puts `script/runner "ActsAsArchive.update"`
+puts `script/runner "ActsAsArchive.update #{ARGV.join ', '}"`
@@ -3,6 +3,17 @@
require File.dirname(__FILE__) + "/base/table"
module ActsAsArchive
+
+ def self.update(*models)
+ models.each do |klass|
+ if klass.respond_to?(:acts_as_archive?) && klass.acts_as_archive?
+ klass.create_archive_table
+ klass.migrate_from_acts_as_paranoid
+ klass.create_archive_indexes
+ end
+ end
+ end
+
module Base
def self.included(base)
base.extend ActMethods
View
@@ -2,15 +2,3 @@
ActiveRecord::Base.send(:include, ActsAsArchive::Base)
ActiveRecord::Migration.send(:include, ActsAsArchive::Migration)
-
-module ActsAsArchive
- def self.update
- Object.subclasses_of(ActiveRecord::Base).each do |klass|
- if klass.respond_to?(:acts_as_archive?) && klass.acts_as_archive?
- klass.create_archive_table
- klass.migrate_from_acts_as_paranoid
- klass.create_archive_indexes
- end
- end
- end
-end

0 comments on commit 9dc96bb

Please sign in to comment.