attached 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -251,6 +251,12 @@ module Attached
251
251
  end
252
252
 
253
253
 
254
+ # Todo.
255
+
256
+ def reprocess!
257
+ end
258
+
259
+
254
260
  private
255
261
 
256
262
  # Helper function for calling processors.
@@ -3,10 +3,16 @@ require 'rails'
3
3
 
4
4
  module Attached
5
5
  class Railtie < Rails::Railtie
6
+
7
+ rake_tasks do
8
+ load 'tasks/attached.rake'
9
+ end
10
+
6
11
  initializer 'attached.initialize' do
7
12
  ActiveSupport.on_load(:active_record) do
8
13
  ActiveRecord::Base.send :include, Attached
9
14
  end
10
15
  end
16
+
11
17
  end
12
18
  end
@@ -1,6 +1,10 @@
1
1
  require 'attached/storage/base'
2
2
 
3
- require 'aws/s3'
3
+ begin
4
+ require 'aws/s3'
5
+ rescue LoadError
6
+ raise "Installation of 'aws/s3' is required before using 'aws' for storage"
7
+ end
4
8
 
5
9
 
6
10
  module Attached
@@ -0,0 +1,17 @@
1
+ namespace :attached do
2
+
3
+ desc "Process a given 'model' and 'attachment'."
4
+ task :process, :model, :attachment, :needs => :environment do |t, args|
5
+
6
+ model = args[:model] or raise "Must specify model."
7
+ attachment = args[:attachment] or raise "Must specify attachment."
8
+
9
+ klass = model.camelize.constantize or raise "Invalid model '#{model}'"
10
+
11
+ klass.all.each do |instance|
12
+ instance.send(attachment).reprocess!
13
+ end
14
+
15
+ end
16
+
17
+ end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 5
9
- version: 0.1.5
8
+ - 6
9
+ version: 0.1.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Kevin Sylvestre
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-12-17 00:00:00 -05:00
17
+ date: 2010-12-20 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -61,6 +61,7 @@ files:
61
61
  - lib/attached/storage/base.rb
62
62
  - lib/attached/storage.rb
63
63
  - lib/attached.rb
64
+ - lib/tasks/attached.rake
64
65
  - README.rdoc
65
66
  - LICENSE
66
67
  - Gemfile