jekyll-s3 2.4.2 → 2.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.travis.yml CHANGED
@@ -3,3 +3,4 @@ rvm:
3
3
  - 1.8.7
4
4
  - 1.9.2
5
5
  - 1.9.3
6
+ - 2.0.0
data/README.md CHANGED
@@ -125,6 +125,16 @@ bucket that are not on your local computer.
125
125
  Enable the headless mode by adding the `--headless` or `-h` argument after
126
126
  `jekyll-s3`.
127
127
 
128
+ ## Using `jekyll-s3` as a library
129
+
130
+ By nature, `jekyll-s3` is a command-line interface tool. You can, however, use
131
+ it programmatically by calling the same API as the executable `jekyll-s3` does:
132
+
133
+ ````ruby
134
+ is_headless = true
135
+ Jekyll::S3::CLI.new.run('/path/to/your/jekyll-site/_site/', is_headless)
136
+ ````
137
+
128
138
  ## Known issues
129
139
 
130
140
  None. Please send a pull request if you spot any.
data/changelog.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  This project uses [Semantic Versioning](http://semver.org).
4
4
 
5
+ ## 2.4.3
6
+
7
+ * Make `s3_endpoint` optional in `_jekyll_s3.yml` when using `jekyll-s3` as a
8
+ library
9
+ * Load dotfiles also with Ruby 2.0.0
10
+
11
+ The `Dir.glob` implementation changed a bit in Ruby 2, and this resulted in
12
+ `jekyll-s3` not uploading files that start with a dot.
13
+
5
14
  ## 2.4.2
6
15
 
7
16
  * Fix problem where gzipped files were always re-uploaded
data/jekyll-s3.gemspec CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "jekyll-s3"
6
- s.version = "2.4.2"
6
+ s.version = "2.4.3"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Philippe Creux", "Lauri Lehmijoki"]
9
9
  s.email = ["pcreux@gmail.com", "lauri.lehmijoki@iki.fi"]
@@ -24,7 +24,6 @@ s3_bucket: your.blog.bucket.com
24
24
  # Raise MalformedConfigurationFileError if the configuration file does not contain the keys we expect
25
25
  def self.load_configuration(site_dir)
26
26
  config = load_yaml_file_and_validate site_dir
27
- config['s3_endpoint'] = config['s3_endpoint'] || 'us-east-1'
28
27
  return config
29
28
  end
30
29
 
@@ -1,9 +1,11 @@
1
1
  module Jekyll
2
2
  module S3
3
3
  class Endpoint
4
+ DEFAULT_LOCATION_CONSTRAINT = 'us-east-1'
4
5
  attr_reader :region, :location_constraint, :hostname, :website_hostname
5
6
 
6
- def initialize(location_constraint)
7
+ def initialize(location_constraint=nil)
8
+ location_constraint = DEFAULT_LOCATION_CONSTRAINT if location_constraint.nil?
7
9
  raise "Invalid S3 location constraint #{location_constraint}" unless
8
10
  location_constraints.has_key?location_constraint
9
11
  @region = location_constraints.fetch(location_constraint)[:region]
@@ -90,7 +90,7 @@ module Jekyll
90
90
  end
91
91
 
92
92
  def self.load_all_local_files(site_dir)
93
- Dir[site_dir + '/**/{*,.*}'].
93
+ Dir.glob(site_dir + '/**/*', File::FNM_DOTMATCH).
94
94
  delete_if { |f| File.directory?(f) }.
95
95
  map { |f| f.gsub(site_dir + '/', '') }
96
96
  end
@@ -8,9 +8,9 @@ describe Jekyll::S3::ConfigLoader do
8
8
  config['s3_bucket'].should eq('galaxy')
9
9
  end
10
10
 
11
- it 'uses the "us-east-1" as the default endpoint' do
11
+ it 'does not define default endpoint' do
12
12
  config = Jekyll::S3::ConfigLoader.load_configuration('spec/sample_files/hyde_site/_site')
13
- config['s3_endpoint'].should eq('us-east-1')
13
+ config['s3_endpoint'].should be_nil
14
14
  end
15
15
 
16
16
  it 'reads the S3 endpoint setting from _jekyll_s3.yml' do
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+ require 'pp'
3
+
4
+ describe Jekyll::S3::Endpoint do
5
+
6
+ it 'uses the "us-east-1" as the default location' do
7
+ endpoint = Jekyll::S3::Endpoint.new
8
+ endpoint.location_constraint.should eq(Jekyll::S3::Endpoint::DEFAULT_LOCATION_CONSTRAINT)
9
+ end
10
+
11
+ it 'takes a valid location constraint as a constructor parameter' do
12
+ endpoint = Jekyll::S3::Endpoint.new('EU')
13
+ endpoint.location_constraint.should eq('EU')
14
+ end
15
+
16
+ it 'fails if the location constraint is invalid' do
17
+ expect {
18
+ Jekyll::S3::Endpoint.new('andromeda')
19
+ }.to raise_error
20
+ end
21
+ end
@@ -41,12 +41,6 @@ describe Jekyll::S3::Keyboard do
41
41
  deleted_keys.should eq([])
42
42
  end
43
43
 
44
- it 'can keep all s3 objects' do
45
- standard_input.stub(:gets).and_return("k", "k", "k")
46
- deleted_keys = call_keyboard(s3_object_keys, standard_input)
47
- deleted_keys.should eq([])
48
- end
49
-
50
44
  it 'can keep all s3 objects' do
51
45
  standard_input.stub(:gets).and_return("K")
52
46
  deleted_keys = call_keyboard(s3_object_keys, standard_input)
@@ -1,9 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Jekyll::S3::Uploader do
4
- context '#upload_file' do
5
- end
6
-
7
4
  context '#load_all_local_files' do
8
5
  let(:files) {
9
6
  Jekyll::S3::Uploader.send(:load_all_local_files,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jekyll-s3
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.2
4
+ version: 2.4.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-03-14 00:00:00.000000000 Z
13
+ date: 2013-04-09 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: aws-sdk
@@ -305,6 +305,7 @@ files:
305
305
  - lib/jekyll-s3/upload.rb
306
306
  - lib/jekyll-s3/uploader.rb
307
307
  - spec/lib/config_loader_spec.rb
308
+ - spec/lib/endpoint_spec.rb
308
309
  - spec/lib/keyboard_spec.rb
309
310
  - spec/lib/retry_spec.rb
310
311
  - spec/lib/upload_spec.rb
@@ -396,6 +397,7 @@ test_files:
396
397
  - features/support/test_site_dirs/unpublish-a-post.com/_site/css/styles.css
397
398
  - features/support/vcr.rb
398
399
  - spec/lib/config_loader_spec.rb
400
+ - spec/lib/endpoint_spec.rb
399
401
  - spec/lib/keyboard_spec.rb
400
402
  - spec/lib/retry_spec.rb
401
403
  - spec/lib/upload_spec.rb