jekyll-s3 2.4.0 → 2.4.1
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/changelog.md +9 -1
- data/features/jekyll-s3-upload.feature +0 -1
- data/features/jekyll-s3-website-performance.feature +1 -2
- data/jekyll-s3.gemspec +1 -1
- data/lib/jekyll-s3/upload.rb +12 -10
- data/spec/lib/upload_spec.rb +5 -5
- metadata +2 -2
    
        data/changelog.md
    CHANGED
    
    | @@ -1,8 +1,16 @@ | |
| 1 1 | 
             
            # Changelog
         | 
| 2 2 |  | 
| 3 | 
            +
            This project uses [Semantic Versioning](http://semver.org).
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            ## 2.4.1
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            * Declare internal methods private in `upload.rb`
         | 
| 8 | 
            +
             | 
| 9 | 
            +
              This eases future refactorings
         | 
| 10 | 
            +
             | 
| 3 11 | 
             
            ## 2.4.0
         | 
| 4 12 |  | 
| 5 | 
            -
            * Add gzip  | 
| 13 | 
            +
            * Add support for specifying `Content-Encoding: gzip` HTTP header
         | 
| 6 14 | 
             
            * Add support for specifying `Cache-Control: max-age` HTTP header
         | 
| 7 15 |  | 
| 8 16 | 
             
            ## 2.3.0
         | 
| @@ -33,7 +33,7 @@ Feature: improve response times of your Jekyll website | |
| 33 33 | 
             
                  """
         | 
| 34 34 |  | 
| 35 35 | 
             
              @new-files
         | 
| 36 | 
            -
              Scenario: Set Content-Encoding: gzip HTTP header
         | 
| 36 | 
            +
              Scenario: Set Content-Encoding: gzip HTTP header for HTML files
         | 
| 37 37 | 
             
                When my Jekyll site is in "features/support/test_site_dirs/site.with.gzipped-html.com"
         | 
| 38 38 | 
             
                Then jekyll-s3 will push my blog to S3
         | 
| 39 39 | 
             
                And the output should equal
         | 
| @@ -47,7 +47,6 @@ Feature: improve response times of your Jekyll website | |
| 47 47 | 
             
                  """
         | 
| 48 48 |  | 
| 49 49 | 
             
              @new-files
         | 
| 50 | 
            -
              @wip
         | 
| 51 50 | 
             
              Scenario: Set both the Content-Encoding: gzip and Cache-Control: max-age headers
         | 
| 52 51 | 
             
                When my Jekyll site is in "features/support/test_site_dirs/site.with.gzipped-and-max-aged-content.com"
         | 
| 53 52 | 
             
                Then jekyll-s3 will push my blog to S3
         | 
    
        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. | 
| 6 | 
            +
              s.version     = "2.4.1"
         | 
| 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"]
         | 
    
        data/lib/jekyll-s3/upload.rb
    CHANGED
    
    | @@ -20,6 +20,12 @@ module Jekyll | |
| 20 20 | 
             
                    success
         | 
| 21 21 | 
             
                  end
         | 
| 22 22 |  | 
| 23 | 
            +
                  def details
         | 
| 24 | 
            +
                    "#{path}#{" [gzipped]" if gzip?}#{" [max-age=#{max_age}]" if cache_control?}"
         | 
| 25 | 
            +
                  end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                  private
         | 
| 28 | 
            +
             | 
| 23 29 | 
             
                  def upload_file
         | 
| 24 30 | 
             
                    @upload_file ||= gzip? ? gzipped_file : file
         | 
| 25 31 | 
             
                  end
         | 
| @@ -33,26 +39,22 @@ module Jekyll | |
| 33 39 |  | 
| 34 40 | 
             
                  def gzipped_file
         | 
| 35 41 | 
             
                    tempfile = Tempfile.new(File.basename(path))
         | 
| 36 | 
            -
             | 
| 42 | 
            +
             | 
| 37 43 | 
             
                    gz = Zlib::GzipWriter.new(tempfile, Zlib::BEST_COMPRESSION, Zlib::DEFAULT_STRATEGY)
         | 
| 38 | 
            -
             | 
| 44 | 
            +
             | 
| 39 45 | 
             
                    gz.mtime = File.mtime(full_path)
         | 
| 40 46 | 
             
                    gz.orig_name = File.basename(path)
         | 
| 41 47 | 
             
                    gz.write(file.read)
         | 
| 42 | 
            -
             | 
| 48 | 
            +
             | 
| 43 49 | 
             
                    gz.flush
         | 
| 44 50 | 
             
                    tempfile.flush
         | 
| 45 | 
            -
             | 
| 51 | 
            +
             | 
| 46 52 | 
             
                    gz.close
         | 
| 47 53 | 
             
                    tempfile.open
         | 
| 48 54 |  | 
| 49 55 | 
             
                    tempfile
         | 
| 50 56 | 
             
                  end
         | 
| 51 57 |  | 
| 52 | 
            -
                  def details
         | 
| 53 | 
            -
                    "#{path}#{" [gzipped]" if gzip?}#{" [max-age=#{max_age}]" if cache_control?}"
         | 
| 54 | 
            -
                  end
         | 
| 55 | 
            -
             | 
| 56 58 | 
             
                  def upload_options
         | 
| 57 59 | 
             
                    opts = {
         | 
| 58 60 | 
             
                      :content_type => mime_type,
         | 
| @@ -61,7 +63,7 @@ module Jekyll | |
| 61 63 |  | 
| 62 64 | 
             
                    opts[:content_encoding] = "gzip" if gzip?
         | 
| 63 65 | 
             
                    opts[:cache_control] = "max-age=#{max_age}" if cache_control?
         | 
| 64 | 
            -
             | 
| 66 | 
            +
             | 
| 65 67 | 
             
                    opts
         | 
| 66 68 | 
             
                  end
         | 
| 67 69 |  | 
| @@ -86,4 +88,4 @@ module Jekyll | |
| 86 88 | 
             
                  end
         | 
| 87 89 | 
             
                end
         | 
| 88 90 | 
             
              end
         | 
| 89 | 
            -
            end
         | 
| 91 | 
            +
            end
         | 
    
        data/spec/lib/upload_spec.rb
    CHANGED
    
    | @@ -92,7 +92,7 @@ describe Jekyll::S3::Upload do | |
| 92 92 |  | 
| 93 93 | 
             
                describe '#gzipped_file' do
         | 
| 94 94 | 
             
                  it 'should return a gzipped version of the file' do
         | 
| 95 | 
            -
                    gz = Zlib::GzipReader.new(subject.gzipped_file)
         | 
| 95 | 
            +
                    gz = Zlib::GzipReader.new(subject.send(:gzipped_file))
         | 
| 96 96 | 
             
                    gz.read.should == File.read('features/support/test_site_dirs/my.blog.com/_site/index.html')
         | 
| 97 97 | 
             
                  end
         | 
| 98 98 | 
             
                end
         | 
| @@ -126,17 +126,17 @@ describe Jekyll::S3::Upload do | |
| 126 126 |  | 
| 127 127 | 
             
                describe '#max_age' do
         | 
| 128 128 | 
             
                  it 'should be the universal value if one is set' do
         | 
| 129 | 
            -
                    subject.max_age.should == 300
         | 
| 129 | 
            +
                    subject.send(:max_age).should == 300
         | 
| 130 130 | 
             
                  end
         | 
| 131 131 |  | 
| 132 132 | 
             
                  it 'should be the file-specific value if one is set' do
         | 
| 133 133 | 
             
                    config['max_age'] = {'*index.html' => 500}
         | 
| 134 | 
            -
                    subject.max_age.should == 500
         | 
| 134 | 
            +
                    subject.send(:max_age).should == 500
         | 
| 135 135 | 
             
                  end
         | 
| 136 136 |  | 
| 137 137 | 
             
                  it 'should be zero if no file-specific value hit' do
         | 
| 138 138 | 
             
                    config['max_age'] = {'*.js' => 500}
         | 
| 139 | 
            -
                    subject.max_age.should == 0
         | 
| 139 | 
            +
                    subject.send(:max_age).should == 0
         | 
| 140 140 | 
             
                  end
         | 
| 141 141 | 
             
                end
         | 
| 142 142 | 
             
              end
         | 
| @@ -163,4 +163,4 @@ describe Jekyll::S3::Upload do | |
| 163 163 | 
             
                s3.stub(:buckets => buckets)
         | 
| 164 164 | 
             
                s3
         | 
| 165 165 | 
             
              end
         | 
| 166 | 
            -
            end
         | 
| 166 | 
            +
            end
         | 
    
        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. | 
| 4 | 
            +
              version: 2.4.1
         | 
| 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-02- | 
| 13 | 
            +
            date: 2013-02-24 00:00:00.000000000 Z
         | 
| 14 14 | 
             
            dependencies:
         | 
| 15 15 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 16 16 | 
             
              name: aws-sdk
         |