attached 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/attached/attachment.rb +6 -0
- data/lib/attached/railtie.rb +6 -0
- data/lib/attached/storage/aws.rb +5 -1
- data/lib/tasks/attached.rake +17 -0
- metadata +4 -3
data/lib/attached/attachment.rb
CHANGED
data/lib/attached/railtie.rb
CHANGED
|
@@ -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
|
data/lib/attached/storage/aws.rb
CHANGED
|
@@ -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
|
-
-
|
|
9
|
-
version: 0.1.
|
|
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
|
+
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
|