radiant-clipped-extension 1.0.12 → 1.0.13

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -28,7 +28,7 @@ At the moment I think uploads probably don't work in IE7. See github for more is
28
28
 
29
29
  ## Requirements
30
30
 
31
- The `paperclip`, `uuidtools` and `acts_as_list` gems are required. For S3 storage you need the `aws-s3` gem.
31
+ The `paperclip`, `uuidtools` and `acts_as_list` gems are required. For cloud storage you need the `fog` gem.
32
32
 
33
33
  Paperclip's post-processors require ImageMagick. PDF-thumbnailing also requires ghostscript, which is usually
34
34
  installed with ImageMagick anyway, and if you want to generate thumbnails from video clips then you also need FFmpeg.
data/app/models/asset.rb CHANGED
@@ -39,15 +39,17 @@ class Asset < ActiveRecord::Base
39
39
  asset.paperclip_processors
40
40
  },
41
41
  :whiny => false,
42
- :storage => Radiant.config["paperclip.storage"] == "s3" ? :s3 : :filesystem,
43
- :s3_credentials => {
44
- :access_key_id => Radiant.config["paperclip.s3.key"],
45
- :secret_access_key => Radiant.config["paperclip.s3.secret"]
46
- },
47
- :s3_host_alias => Radiant.config["paperclip.s3.host_alias"] || Radiant.config["paperclip.s3.bucket"],
48
- :bucket => Radiant.config["paperclip.s3.bucket"],
49
- :url => Radiant.config["paperclip.url"],
50
- :path => Radiant.config["paperclip.path"]
42
+ :storage => RadiantClippedExtension::Cloud.storage ||
43
+ :filesystem,
44
+ :path => Radiant.config["paperclip.path"],
45
+ :fog_credentials => RadiantClippedExtension::Cloud.credentials,
46
+ :fog_directory => Radiant.config["paperclip.fog.directory"] ||
47
+ Radiant.config["paperclip.s3.bucket"],
48
+ :fog_public => Radiant.config["paperclip.fog.public?"] ||
49
+ true,
50
+ :fog_host => Radiant.config["paperclip.fog.host"] ||
51
+ "http://#{Radiant.config['paperclip.s3.host_alias']}" ||
52
+ "http://#{Radiant.config['paperclip.url']}"
51
53
 
52
54
  before_save :assign_title
53
55
  before_save :assign_uuid
data/clipped_extension.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'radiant-clipped-extension'
2
2
  require 'acts_as_list'
3
3
  require 'uuidtools'
4
+ require 'cloud'
4
5
 
5
6
  class ClippedExtension < Radiant::Extension
6
7
  version RadiantClippedExtension::VERSION
@@ -3,16 +3,49 @@ Radiant.config do |config|
3
3
  pc.define 'url', :default => '/:class/:id/:basename:no_original_style.:extension'
4
4
  pc.define 'path', :default => ':rails_root/public/:class/:id/:basename:no_original_style.:extension', :allow_change => true
5
5
  pc.define 'skip_filetype_validation', :default => true, :type => :boolean
6
- pc.define 'storage', :default => 'filesystem',
7
- :select_from => {'File System' => 'filesystem', 'Amazon S3' => 's3'},
8
- :allow_blank => false,
6
+ pc.define 'storage', :default => 'filesystem',
7
+ :select_from => {
8
+ 'File System' => 'filesystem',
9
+ 'Amazon S3' => 'fog',
10
+ 'Google Storage' => 'fog',
11
+ 'Rackspace Cloud Files' => 'fog'
12
+ },
13
+ :allow_blank => false,
9
14
  :allow_display => false
10
-
15
+
16
+ pc.namespace 'fog' do |fog|
17
+ fog.define 'provider', :select_from => {
18
+ 'Amazon S3' => 'AWS',
19
+ 'Google Storage' => 'Google',
20
+ 'Rackspace Cloud Files' => 'Rackspace'
21
+ }
22
+ fog.define 'directory'
23
+ fog.define 'public?', :default => true
24
+ fog.define 'host'
25
+ end
26
+
27
+ pc.namespace 'google_storage' do |gs|
28
+ gs.define 'access_key_id'
29
+ gs.define 'secret_access_key'
30
+ end
31
+
32
+ pc.namespace 'rackspace' do |rs|
33
+ rs.define 'username'
34
+ rs.define 'api_key'
35
+ end
36
+
11
37
  pc.namespace 's3' do |s3|
12
38
  s3.define 'bucket'
13
39
  s3.define 'key'
14
40
  s3.define 'secret'
15
41
  s3.define 'host_alias'
42
+ s3.define 'region', :select_from => {
43
+ 'Asia North East' => 'ap-northeast-1',
44
+ 'Asia South East' => 'ap-southeast-1',
45
+ 'EU West' => 'eu-west-1',
46
+ 'US East' => 'us-east-1',
47
+ 'US West' => 'us-west-1'
48
+ }
16
49
  end
17
50
  end
18
51
 
data/lib/cloud.rb ADDED
@@ -0,0 +1,39 @@
1
+ module RadiantClippedExtension
2
+
3
+ module Cloud
4
+
5
+ def self.credentials
6
+ case Radiant.config["paperclip.fog.provider"]
7
+ when "AWS"
8
+ return {
9
+ :provider => "AWS",
10
+ :aws_access_key_id => Radiant.config["paperclip.s3.key"],
11
+ :aws_secret_access_key => Radiant.config["paperclip.s3.secret"],
12
+ :region => Radiant.config["paperclip.s3.region"],
13
+ }
14
+ when "Google"
15
+ return {
16
+ :provider => "Google",
17
+ :rackspace_username => Radiant.config["paperclip.google_storage.access_key_id"],
18
+ :rackspace_api_key => Radiant.config["paperclip.google_storage.secret_access_key"]
19
+ }
20
+ when "Rackspace"
21
+ return {
22
+ :provider => "Rackspace",
23
+ :rackspace_username => Radiant.config["paperclip.rackspace.username"],
24
+ :rackspace_api_key => Radiant.config["paperclip.rackspace.api_key"]
25
+ }
26
+ end
27
+ end
28
+
29
+ def self.storage
30
+ if Radiant.config["paperclip.storage"] == "s3"
31
+ :fog
32
+ else
33
+ Radiant.config["paperclip.storage"]
34
+ end
35
+ end
36
+
37
+ end
38
+
39
+ end
@@ -1,8 +1,8 @@
1
1
  module RadiantClippedExtension
2
- VERSION = "1.0.12"
2
+ VERSION = "1.0.13"
3
3
  SUMMARY = %q{Assets for Radiant CMS}
4
4
  DESCRIPTION = %q{Asset-management derived from Keith Bingman's Paperclipped extension.}
5
5
  URL = "http://radiantcms.org"
6
- AUTHORS = ["Keith Bingman", "Benny Degezelle", "William Ross", "John W. Long"]
6
+ AUTHORS = ["Keith Bingman", "Benny Degezelle", "William Ross", "John W. Long", "John Muhl"]
7
7
  EMAIL = ["radiant@radiantcms.org"]
8
8
  end
metadata CHANGED
@@ -1,24 +1,26 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: radiant-clipped-extension
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 12
10
- version: 1.0.12
9
+ - 13
10
+ version: 1.0.13
11
11
  platform: ruby
12
12
  authors:
13
13
  - Keith Bingman
14
14
  - Benny Degezelle
15
15
  - William Ross
16
16
  - John W. Long
17
+ - John Muhl
17
18
  autorequire:
18
19
  bindir: bin
19
20
  cert_chain: []
20
21
 
21
- date: 2011-10-30 00:00:00 Z
22
+ date: 2011-11-08 00:00:00 +00:00
23
+ default_executable:
22
24
  dependencies:
23
25
  - !ruby/object:Gem::Dependency
24
26
  name: acts_as_list
@@ -131,6 +133,7 @@ files:
131
133
  - features/support/paths.rb
132
134
  - lib/asset_tags.rb
133
135
  - lib/clipped_admin_ui.rb
136
+ - lib/cloud.rb
134
137
  - lib/page_asset_associations.rb
135
138
  - lib/paperclip/frame_grab.rb
136
139
  - lib/paperclip/geometry_transformation.rb
@@ -200,6 +203,7 @@ files:
200
203
  - wireframes/edit-page-assets.png
201
204
  - wireframes/edit-page.bmml
202
205
  - wireframes/edit-page.png
206
+ has_rdoc: true
203
207
  homepage: http://radiantcms.org
204
208
  licenses: []
205
209
 
@@ -229,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
229
233
  requirements: []
230
234
 
231
235
  rubyforge_project:
232
- rubygems_version: 1.8.10
236
+ rubygems_version: 1.5.3
233
237
  signing_key:
234
238
  specification_version: 3
235
239
  summary: Assets for Radiant CMS