Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

moved default location constraint logic from config_loader.rb to endp…

…oint.rb
  • Loading branch information...
commit da35da4b979181956e33a4cc5d22f9e0c7aa55f3 1 parent ef19f16
@adelevie adelevie authored
View
1  lib/jekyll-s3/config_loader.rb
@@ -24,7 +24,6 @@ def self.check_s3_configuration(site_dir)
# Raise MalformedConfigurationFileError if the configuration file does not contain the keys we expect
def self.load_configuration(site_dir)
config = load_yaml_file_and_validate site_dir
- config['s3_endpoint'] = config['s3_endpoint'] || 'us-east-1'
return config
end
View
4 lib/jekyll-s3/endpoint.rb
@@ -1,9 +1,11 @@
module Jekyll
module S3
class Endpoint
+ DEFAULT_LOCATION_CONSTRAINT = 'us-east-1'
attr_reader :region, :location_constraint, :hostname, :website_hostname
- def initialize(location_constraint)
+ def initialize(location_constraint=nil)
+ location_constraint = DEFAULT_LOCATION_CONSTRAINT if location_constraint.nil?
raise "Invalid S3 location constraint #{location_constraint}" unless
location_constraints.has_key?location_constraint
@region = location_constraints.fetch(location_constraint)[:region]
View
5 spec/lib/config_loader_spec.rb
@@ -8,11 +8,6 @@
config['s3_bucket'].should eq('galaxy')
end
- it 'uses the "us-east-1" as the default endpoint' do
- config = Jekyll::S3::ConfigLoader.load_configuration('spec/sample_files/hyde_site/_site')
- config['s3_endpoint'].should eq('us-east-1')
- end
-
it 'reads the S3 endpoint setting from _jekyll_s3.yml' do
config = Jekyll::S3::ConfigLoader.load_configuration('spec/sample_files/tokyo_site/_site')
config['s3_endpoint'].should eq('ap-northeast-1')
View
11 spec/lib/endpoint_spec.rb
@@ -0,0 +1,11 @@
+require 'spec_helper'
+require 'pp'
+
+describe Jekyll::S3::Endpoint do
+
+ it 'uses the "us-east-1" as the default location' do
+ endpoint = Jekyll::S3::Endpoint.new
+ endpoint.location_constraint.should eq(Jekyll::S3::Endpoint::DEFAULT_LOCATION_CONSTRAINT)
+ end
+
+end
Please sign in to comment.
Something went wrong with that request. Please try again.