Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

make `paperclip.storage = "s3"` an alias

for `paperclip.storage = "fog"`
  • Loading branch information...
commit ab2c0bad7ccb94e38746e1525c58f2c7218287a1 1 parent 071733b
@johnmuhl johnmuhl authored
View
4 app/models/asset.rb
@@ -39,10 +39,10 @@ class Asset < ActiveRecord::Base
asset.paperclip_processors
},
:whiny => false,
- :storage => Radiant.config["paperclip.storage"] ||
+ :storage => RadiantClippedExtension::Cloud.storage ||
:filesystem,
:path => Radiant.config["paperclip.path"],
- :fog_credentials => RadiantClippedExtension.cloud_credentials,
+ :fog_credentials => RadiantClippedExtension::Cloud.credentials,
:fog_directory => Radiant.config["paperclip.fog.directory"] ||
Radiant.config["paperclip.s3.bucket"],
:fog_public => Radiant.config["paperclip.fog.public?"] ||
View
2  clipped_extension.rb
@@ -1,7 +1,7 @@
require 'radiant-clipped-extension'
require 'acts_as_list'
require 'uuidtools'
-require 'cloud_credentials'
+require 'cloud'
class ClippedExtension < Radiant::Extension
version RadiantClippedExtension::VERSION
View
39 lib/cloud.rb
@@ -0,0 +1,39 @@
+module RadiantClippedExtension
+
+ module Cloud
+
+ def self.credentials
+ case Radiant.config["paperclip.fog.provider"]
+ when "AWS"
+ return {
+ :provider => "AWS",
+ :aws_access_key_id => Radiant.config["paperclip.s3.key"],
+ :aws_secret_access_key => Radiant.config["paperclip.s3.secret"],
+ :region => Radiant.config["paperclip.s3.region"],
+ }
+ when "Google"
+ return {
+ :provider => "Google",
+ :rackspace_username => Radiant.config["paperclip.google_storage.access_key_id"],
+ :rackspace_api_key => Radiant.config["paperclip.google_storage.secret_access_key"]
+ }
+ when "Rackspace"
+ return {
+ :provider => "Rackspace",
+ :rackspace_username => Radiant.config["paperclip.rackspace.username"],
+ :rackspace_api_key => Radiant.config["paperclip.rackspace.api_key"]
+ }
+ end
+ end
+
+ def self.storage
+ if Radiant.config["paperclip.storage"] == "s3"
+ :fog
+ else
+ Radiant.config["paperclip.storage"]
+ end
+ end
+
+ end
+
+end
View
27 lib/cloud_credentials.rb
@@ -1,27 +0,0 @@
-module RadiantClippedExtension
-
- def self.cloud_credentials
- case Radiant.config["paperclip.fog.provider"]
- when "AWS"
- return {
- :provider => "AWS",
- :aws_access_key_id => Radiant.config["paperclip.s3.key"],
- :aws_secret_access_key => Radiant.config["paperclip.s3.secret"],
- :region => Radiant.config["paperclip.s3.region"],
- }
- when "Google"
- return {
- :provider => "Google",
- :rackspace_username => Radiant.config["paperclip.google_storage.access_key_id"],
- :rackspace_api_key => Radiant.config["paperclip.google_storage.secret_access_key"]
- }
- when "Rackspace"
- return {
- :provider => "Rackspace",
- :rackspace_username => Radiant.config["paperclip.rackspace.username"],
- :rackspace_api_key => Radiant.config["paperclip.rackspace.api_key"]
- }
- end
- end
-
-end
Please sign in to comment.
Something went wrong with that request. Please try again.