From befe7404cfb2251541c75903a8de1cdd219c273b Mon Sep 17 00:00:00 2001 From: Jose Luis Salas Date: Thu, 8 May 2014 16:12:40 +0000 Subject: [PATCH 1/3] Support for fog_path_style config option --- lib/asset_sync/config.rb | 3 +++ spec/fixtures/aws_with_yml/config/asset_sync.yml | 1 + spec/unit/asset_sync_spec.rb | 9 +++++++++ 3 files changed, 13 insertions(+) diff --git a/lib/asset_sync/config.rb b/lib/asset_sync/config.rb index 88d88510..e704d36f 100644 --- a/lib/asset_sync/config.rb +++ b/lib/asset_sync/config.rb @@ -24,6 +24,7 @@ class Invalid < StandardError; end attr_accessor :fog_provider # Currently Supported ['AWS', 'Rackspace'] attr_accessor :fog_directory # e.g. 'the-bucket-name' attr_accessor :fog_region # e.g. 'eu-west-1' + attr_accessor :fog_path_style # e.g true # Amazon AWS attr_accessor :aws_access_key_id, :aws_secret_access_key, :aws_reduced_redundancy, :aws_iam_roles @@ -139,6 +140,7 @@ def load_yml! self.fog_provider = yml["fog_provider"] self.fog_directory = yml["fog_directory"] self.fog_region = yml["fog_region"] + self.fog_path_style = yml["fog_path_style"] self.aws_access_key_id = yml["aws_access_key_id"] self.aws_secret_access_key = yml["aws_secret_access_key"] self.aws_reduced_redundancy = yml["aws_reduced_redundancy"] @@ -207,6 +209,7 @@ def fog_options end options.merge!({:region => fog_region}) if fog_region && !rackspace? + options.merge!({:path_style => fog_path_style}) if fog_path_style && aws? return options end diff --git a/spec/fixtures/aws_with_yml/config/asset_sync.yml b/spec/fixtures/aws_with_yml/config/asset_sync.yml index e5817515..daf8f271 100644 --- a/spec/fixtures/aws_with_yml/config/asset_sync.yml +++ b/spec/fixtures/aws_with_yml/config/asset_sync.yml @@ -4,6 +4,7 @@ defaults: &defaults aws_secret_access_key: "zzzz" region: "eu-west-1" run_on_precompile: false + fog_path_style: true development: <<: *defaults diff --git a/spec/unit/asset_sync_spec.rb b/spec/unit/asset_sync_spec.rb index 7b6317ef..f4e37ff2 100644 --- a/spec/unit/asset_sync_spec.rb +++ b/spec/unit/asset_sync_spec.rb @@ -12,6 +12,7 @@ config.aws_secret_access_key = 'bbbb' config.fog_directory = 'mybucket' config.fog_region = 'eu-west-1' + config.fog_path_style = 'true' config.existing_remote_files = "keep" end end @@ -50,6 +51,10 @@ expect(AssetSync.config.fog_region).to eq("eu-west-1") end + it "should configure path_style" do + AssetSync.config.fog_path_style.should be_truthy + end + it "should configure existing_remote_files" do expect(AssetSync.config.existing_remote_files).to eq("keep") end @@ -106,6 +111,10 @@ expect(AssetSync.config.fog_region).to eq("eu-west-1") end + it "should configure path_style" do + AssetSync.config.fog_path_style.should be_truthy + end + it "should configure existing_remote_files" do expect(AssetSync.config.existing_remote_files).to eq("keep") end From 354cd47c93c5d6b039b9bfe0565c919e9ad7d093 Mon Sep 17 00:00:00 2001 From: Jose Luis Salas Date: Wed, 20 Apr 2016 15:33:22 +0000 Subject: [PATCH 2/3] Use expect syntax and update README --- README.md | 6 ++++++ spec/unit/asset_sync_spec.rb | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 55e0e863..5f5e32ee 100644 --- a/README.md +++ b/README.md @@ -193,6 +193,9 @@ AssetSync.configure do |config| # # Fail silently. Useful for environments such as Heroku # config.fail_silently = true + # + # Use fog_path_style to use buckets with dot in names + # config.fog_path_style = true end ``` @@ -228,6 +231,8 @@ defaults: &defaults # always_upload: ['application.js', 'application.css'] # Ignored files. Useful if there are some files that are created dynamically on the server and you don't want to upload on deploy. # ignored_files: ['ignore_me.js', !ruby/regexp '/ignore_some/\d{32}\.css/'] + # Use fog_path_style to use buckets with dot in names + # fog_path_style: true development: <<: *defaults @@ -269,6 +274,7 @@ AssetSync.config.gzip_compression == ENV['ASSET_SYNC_GZIP_COMPRESSION'] #### Fog (Optional) * **fog\_region**: the region your storage bucket is in e.g. *eu-west-1* +* **fog\_path\_style**: To use buckets with dot in names, check https://github.com/fog/fog/issues/2381#issuecomment-28088524 #### AWS diff --git a/spec/unit/asset_sync_spec.rb b/spec/unit/asset_sync_spec.rb index f4e37ff2..ed4008a3 100644 --- a/spec/unit/asset_sync_spec.rb +++ b/spec/unit/asset_sync_spec.rb @@ -52,7 +52,7 @@ end it "should configure path_style" do - AssetSync.config.fog_path_style.should be_truthy + expect(AssetSync.config.fog_path_style).to be_truthy end it "should configure existing_remote_files" do @@ -112,7 +112,7 @@ end it "should configure path_style" do - AssetSync.config.fog_path_style.should be_truthy + expect(AssetSync.config.fog_path_style).to be_truthy end it "should configure existing_remote_files" do From d5f148548a48660b0854f0db5b71646b418b281d Mon Sep 17 00:00:00 2001 From: Jose Luis Salas Date: Sun, 24 Apr 2016 00:01:44 +0200 Subject: [PATCH 3/3] Remove fog_path_style from generator doc --- README.md | 5 ----- 1 file changed, 5 deletions(-) diff --git a/README.md b/README.md index 5f5e32ee..e6688a28 100644 --- a/README.md +++ b/README.md @@ -193,9 +193,6 @@ AssetSync.configure do |config| # # Fail silently. Useful for environments such as Heroku # config.fail_silently = true - # - # Use fog_path_style to use buckets with dot in names - # config.fog_path_style = true end ``` @@ -231,8 +228,6 @@ defaults: &defaults # always_upload: ['application.js', 'application.css'] # Ignored files. Useful if there are some files that are created dynamically on the server and you don't want to upload on deploy. # ignored_files: ['ignore_me.js', !ruby/regexp '/ignore_some/\d{32}\.css/'] - # Use fog_path_style to use buckets with dot in names - # fog_path_style: true development: <<: *defaults