jekyll-minibundle 1.4.3 → 1.4.4
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Rakefile +1 -1
- data/lib/jekyll/minibundle/asset_file_registry.rb +1 -1
- data/lib/jekyll/minibundle/asset_stamp.rb +1 -1
- data/lib/jekyll/minibundle/bundle_file.rb +6 -6
- data/lib/jekyll/minibundle/development_file_collection.rb +5 -5
- data/lib/jekyll/minibundle/environment.rb +1 -3
- data/lib/jekyll/minibundle/mini_bundle_block.rb +1 -1
- data/lib/jekyll/minibundle/mini_stamp_tag.rb +1 -1
- data/lib/jekyll/minibundle/version.rb +1 -1
- data/test/integration/minibundle_development_mode_test.rb +4 -4
- data/test/support/test_case.rb +1 -1
- metadata +2 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 27c6e3e700c2d0f5767edcebbb8df218df565536
         | 
| 4 | 
            +
              data.tar.gz: 1fc68af34209d4556fcb726088fca486a318a33a
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: c68cdff97eecd9343ea90498ff73e0c04987ef7020ee360d0c9a7c74d28782877e996cedd3e8ab8d1cdfbc5a9279bc8b18842c34a62d5206ff7320b46a056563
         | 
| 7 | 
            +
              data.tar.gz: 6f6873bc41f2bfde2e7d38b5e4091672fb3a59cff7d026e2d18580ea706527920c035c5b27d6833773ebdce9eeb2d4687b76aebab42b0b02317d00ac3613a230
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,3 +1,10 @@ | |
| 1 | 
            +
            # 1.4.4 / 2014-01-16
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            * Conserve memory when calculating fingerprint for an asset.
         | 
| 4 | 
            +
              Previously, we read the whole asset file into memory and then
         | 
| 5 | 
            +
              calculated the MD5 digest. This is bad for big assets. Now, we read
         | 
| 6 | 
            +
              the file in chunks.
         | 
| 7 | 
            +
             | 
| 1 8 | 
             
            # 1.4.3 / 2014-01-16
         | 
| 2 9 |  | 
| 3 10 | 
             
            * Do not leak read pipe file descriptor upon minifier command failure
         | 
    
        data/Rakefile
    CHANGED
    
    | @@ -42,7 +42,7 @@ end | |
| 42 42 |  | 
| 43 43 | 
             
            desc 'Run tests; envars: tests=<test_path> to select a particular suite, debug=1 to require Pry and PP'
         | 
| 44 44 | 
             
            task :test do
         | 
| 45 | 
            -
              glob = ENV | 
| 45 | 
            +
              glob = ENV.fetch('tests', 'test/{unit,integration}/*_test.rb')
         | 
| 46 46 | 
             
              files = Dir[glob].
         | 
| 47 47 | 
             
                map { |file| %r{^test/(.+)\.rb$}.match(file)[1] }.
         | 
| 48 48 | 
             
                shelljoin
         | 
| @@ -11,7 +11,7 @@ module Jekyll::Minibundle | |
| 11 11 | 
             
                  end
         | 
| 12 12 |  | 
| 13 13 | 
             
                  def bundle_file(config)
         | 
| 14 | 
            -
                    asset_destination_path = "#{config | 
| 14 | 
            +
                    asset_destination_path = "#{config.fetch('destination_path')}.#{config.fetch('type')}"
         | 
| 15 15 | 
             
                    @_instances[asset_destination_path] ||= register_bundle_file(config)
         | 
| 16 16 | 
             
                  end
         | 
| 17 17 |  | 
| @@ -8,12 +8,12 @@ module Jekyll::Minibundle | |
| 8 8 | 
             
                include AssetFileOperations
         | 
| 9 9 |  | 
| 10 10 | 
             
                def initialize(config)
         | 
| 11 | 
            -
                  @type = config | 
| 12 | 
            -
                  @site_source_dir = config | 
| 13 | 
            -
                  asset_source_dir = File.join(@site_source_dir, config | 
| 14 | 
            -
                  @assets = config | 
| 15 | 
            -
                  @destination_path = config | 
| 16 | 
            -
                  @attributes = config | 
| 11 | 
            +
                  @type = config.fetch('type')
         | 
| 12 | 
            +
                  @site_source_dir = config.fetch('site_dir')
         | 
| 13 | 
            +
                  asset_source_dir = File.join(@site_source_dir, config.fetch('source_dir'))
         | 
| 14 | 
            +
                  @assets = config.fetch('assets').map { |asset_path| File.join(asset_source_dir, "#{asset_path}.#{@type}") }
         | 
| 15 | 
            +
                  @destination_path = config.fetch('destination_path')
         | 
| 16 | 
            +
                  @attributes = config.fetch('attributes')
         | 
| 17 17 | 
             
                  @stamped_at = nil
         | 
| 18 18 | 
             
                  @is_modified = false
         | 
| 19 19 | 
             
                end
         | 
| @@ -4,18 +4,18 @@ require 'jekyll/minibundle/development_file' | |
| 4 4 | 
             
            module Jekyll::Minibundle
         | 
| 5 5 | 
             
              class DevelopmentFileCollection
         | 
| 6 6 | 
             
                def initialize(config)
         | 
| 7 | 
            -
                  @type = config | 
| 8 | 
            -
                  asset_source_dir = File.join(config | 
| 9 | 
            -
                  destination_path = config | 
| 7 | 
            +
                  @type = config.fetch('type')
         | 
| 8 | 
            +
                  asset_source_dir = File.join(config.fetch('site_dir'), config.fetch('source_dir'))
         | 
| 9 | 
            +
                  destination_path = config.fetch('destination_path')
         | 
| 10 10 |  | 
| 11 | 
            -
                  @files = config | 
| 11 | 
            +
                  @files = config.fetch('assets').map do |asset_path|
         | 
| 12 12 | 
             
                    asset_basename = "#{asset_path}.#{@type}"
         | 
| 13 13 | 
             
                    asset_source = File.join(asset_source_dir, asset_basename)
         | 
| 14 14 | 
             
                    asset_destination = File.join(destination_path, asset_basename)
         | 
| 15 15 | 
             
                    DevelopmentFile.new(asset_source, asset_destination)
         | 
| 16 16 | 
             
                  end
         | 
| 17 17 |  | 
| 18 | 
            -
                  @attributes = config | 
| 18 | 
            +
                  @attributes = config.fetch('attributes')
         | 
| 19 19 | 
             
                end
         | 
| 20 20 |  | 
| 21 21 | 
             
                def static_file!(site)
         | 
| @@ -3,9 +3,7 @@ module Jekyll::Minibundle | |
| 3 3 | 
             
                class << self
         | 
| 4 4 | 
             
                  def command_for(type)
         | 
| 5 5 | 
             
                    key = "JEKYLL_MINIBUNDLE_CMD_#{type.upcase}"
         | 
| 6 | 
            -
                     | 
| 7 | 
            -
                    fail "You need to set command for minification in $#{key}" if !cmd
         | 
| 8 | 
            -
                    cmd
         | 
| 6 | 
            +
                    ENV.fetch(key) { fail "You need to set command for minification in $#{key}" }
         | 
| 9 7 | 
             
                  end
         | 
| 10 8 |  | 
| 11 9 | 
             
                  def development?
         | 
| @@ -9,7 +9,7 @@ module Jekyll::Minibundle | |
| 9 9 | 
             
                end
         | 
| 10 10 |  | 
| 11 11 | 
             
                def render(context)
         | 
| 12 | 
            -
                  site = context.registers | 
| 12 | 
            +
                  site = context.registers.fetch(:site)
         | 
| 13 13 | 
             
                  config = get_current_config(YAML.load(super), site)
         | 
| 14 14 | 
             
                  file = AssetFileRegistry.bundle_file(config)
         | 
| 15 15 | 
             
                  file.static_file!(site)
         | 
| @@ -8,7 +8,7 @@ module Jekyll::Minibundle | |
| 8 8 | 
             
                end
         | 
| 9 9 |  | 
| 10 10 | 
             
                def render(context)
         | 
| 11 | 
            -
                  site = context.registers | 
| 11 | 
            +
                  site = context.registers.fetch(:site)
         | 
| 12 12 | 
             
                  file = AssetFileRegistry.stamp_file(File.join(site.source, @asset_source), @asset_destination)
         | 
| 13 13 | 
             
                  file.static_file!(site)
         | 
| 14 14 | 
             
                  file.markup
         | 
| @@ -54,13 +54,13 @@ module Jekyll::Minibundle::Test | |
| 54 54 | 
             
                 {desc: "changing", action: ->(source) { File.write(source, 'h1 {}') }},
         | 
| 55 55 | 
             
                 {desc: "touching", action: ->(source) { FileUtils.touch(source) }}
         | 
| 56 56 | 
             
                ].each do |spec|
         | 
| 57 | 
            -
                  define_method :"test_#{spec | 
| 57 | 
            +
                  define_method :"test_#{spec.fetch(:desc)}_css_asset_source_rewrites_destination" do
         | 
| 58 58 | 
             
                    with_site do
         | 
| 59 59 | 
             
                      generate_site(:development)
         | 
| 60 60 | 
             
                      destination = destination_path(CSS_BUNDLE_DESTINATION_PATH, 'common.css')
         | 
| 61 61 | 
             
                      org_mtime = mtime_of(destination)
         | 
| 62 62 | 
             
                      source = source_path(CSS_BUNDLE_SOURCE_DIR, 'common.css')
         | 
| 63 | 
            -
                      ensure_file_mtime_changes { spec | 
| 63 | 
            +
                      ensure_file_mtime_changes { spec.fetch(:action).call(source) }
         | 
| 64 64 | 
             
                      generate_site(:development, clear_cache: false)
         | 
| 65 65 |  | 
| 66 66 | 
             
                      assert_equal File.read(destination), File.read(source)
         | 
| @@ -73,13 +73,13 @@ module Jekyll::Minibundle::Test | |
| 73 73 | 
             
                 {desc: "changing", action: ->(source) { File.write(source, '(function() {})()') }},
         | 
| 74 74 | 
             
                 {desc: "touching", action: ->(source) { FileUtils.touch(source) }}
         | 
| 75 75 | 
             
                ].each do |spec|
         | 
| 76 | 
            -
                  define_method :"test_#{spec | 
| 76 | 
            +
                  define_method :"test_#{spec.fetch(:desc)}_js_asset_source_rewrites_destination" do
         | 
| 77 77 | 
             
                    with_site do
         | 
| 78 78 | 
             
                      generate_site(:development)
         | 
| 79 79 | 
             
                      destination = destination_path(JS_BUNDLE_DESTINATION_PATH, 'app.js')
         | 
| 80 80 | 
             
                      org_mtime = mtime_of(destination)
         | 
| 81 81 | 
             
                      source = source_path(JS_BUNDLE_SOURCE_DIR, 'app.js')
         | 
| 82 | 
            -
                      ensure_file_mtime_changes { spec | 
| 82 | 
            +
                      ensure_file_mtime_changes { spec.fetch(:action).call(source) }
         | 
| 83 83 | 
             
                      generate_site(:development, clear_cache: false)
         | 
| 84 84 |  | 
| 85 85 | 
             
                      assert_equal File.read(destination), File.read(source)
         | 
    
        data/test/support/test_case.rb
    CHANGED
    
    | @@ -108,7 +108,7 @@ module Jekyll::Minibundle::Test | |
| 108 108 | 
             
                end
         | 
| 109 109 |  | 
| 110 110 | 
             
                def _generate_site(test_options)
         | 
| 111 | 
            -
                  AssetFileRegistry.clear if test_options | 
| 111 | 
            +
                  AssetFileRegistry.clear if test_options.fetch(:clear_cache)
         | 
| 112 112 |  | 
| 113 113 | 
             
                  capture_io do
         | 
| 114 114 | 
             
                    Jekyll::Site.new(Jekyll.configuration(TestCase.site_generation_jekyll_options)).process
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: jekyll-minibundle
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.4. | 
| 4 | 
            +
              version: 1.4.4
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Tuomas Kareinen
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date: 2014-01- | 
| 11 | 
            +
            date: 2014-01-16 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: jekyll
         |