Permalink
Browse files

Remove whitespaces

  • Loading branch information...
1 parent d46a1af commit e90de5daccc0e689484709f3fd273f16f5e3f4bb @sikachu sikachu committed Jun 15, 2012
Showing with 15 additions and 15 deletions.
  1. +6 −6 lib/paperclip/storage/fog.rb
  2. +9 −9 test/storage/fog_test.rb
@@ -119,14 +119,14 @@ def public_url(style = default_style)
end
end
end
-
+
def expiring_url(time = 3600, style = default_style)
expiring_url = directory.files.get_http_url(path(style), time)
-
+
if @options[:fog_host]
expiring_url.gsub!(/#{host_name_for_directory}/, dynamic_fog_host_for_style(style))
end
-
+
return expiring_url
end
@@ -148,20 +148,20 @@ def copy_to_local_file(style, local_dest_path)
end
private
-
+
def dynamic_fog_host_for_style(style)
if @options[:fog_host].respond_to?(:call)
@options[:fog_host].call(self)
else
(@options[:fog_host] =~ /%d/) ? @options[:fog_host] % (path(style).hash % 4) : @options[:fog_host]
end
end
-
+
def host_name_for_directory
if @options[:fog_directory].to_s =~ Fog::AWS_BUCKET_SUBDOMAIN_RESTRICTON_REGEX
# This:
"#{@options[:fog_directory]}."
-
+
# Should be modified to this:
# "#{@options[:fog_directory]}.s3.amazonaws.com"
# When fog with https://github.com/fog/fog/pull/857 gets released
View
@@ -208,7 +208,7 @@ class FogTest < Test::Unit::TestCase
# For now, use this passing one:
assert_match /^https:\/\/papercliptests.\/avatars\/5k.png\?\d*$/, @dummy.avatar.url
end
-
+
should "provide an url that expires in subdomain style" do
# The following line is the correct one when this pull request in Fog is released:
# https://github.com/fog/fog/pull/857
@@ -236,7 +236,7 @@ class FogTest < Test::Unit::TestCase
should "provide an url in folder style" do
assert_match /^https:\/\/s3.amazonaws.com\/this_is_invalid\/avatars\/5k.png\?\d*$/, @dummy.avatar.url
end
-
+
should "provide a url that expires in folder style" do
assert_match /^http:\/\/s3.amazonaws.com\/this_is_invalid\/avatars\/5k.png\?AWSAccessKeyId=.+$/, @dummy.avatar.expiring_url
end
@@ -271,38 +271,38 @@ class FogTest < Test::Unit::TestCase
should "provide a public url" do
assert_match /http:\/\/dynamicfoghost\.com/, @dummy.avatar.url
end
-
+
end
-
+
context "with a custom fog_host" do
setup do
rebuild_model(@options.merge(:fog_host => "http://dynamicfoghost.com"))
@dummy = Dummy.new
@dummy.avatar = @file
@dummy.save
end
-
+
should "provide a public url" do
assert_match /http:\/\/dynamicfoghost\.com/, @dummy.avatar.url
end
-
+
should "provide an expiring url" do
assert_match /http:\/\/dynamicfoghost\.com/, @dummy.avatar.expiring_url
end
-
+
context "with an invalid bucket name for a subdomain" do
setup do
rebuild_model(@options.merge({:fog_directory => "this_is_invalid", :fog_host => "http://dynamicfoghost.com"}))
@dummy = Dummy.new
@dummy.avatar = @file
@dummy.save
end
-
+
should "provide an expiring url" do
assert_match /http:\/\/dynamicfoghost\.com/, @dummy.avatar.expiring_url
end
end
-
+
end
context "with a proc for the fog_credentials evaluating a model method" do

6 comments on commit e90de5d

Oh man, you are my arch nemesis. I am OCD about making sure the tabs are there on blank lines so that they match the indentation of the surrounding lines. ;)

Contributor

sikachu replied Jun 15, 2012

Hahahaha. I actually have a script to highlight the whitespaces in the file, and those whitespaces bugged me >_<

Owner

mike-burns replied Jun 15, 2012

@mhuggins That makes it so you can't use { and } to jump between paragraphs!

@mike-burns What IDE are you talking about? I've never had any issues.

Owner

mike-burns replied Jun 16, 2012

@mhuggins vim. Which IDE do you use?

TextMate. :) Can't stand vim. :P

Please sign in to comment.