content_caching 0.0.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.
- checksums.yaml +7 -0
 - data/.coveralls.yml +1 -0
 - data/.gitignore +22 -0
 - data/.rspec +3 -0
 - data/.ruby-gemset +1 -0
 - data/.ruby-version +1 -0
 - data/.travis.yml +3 -0
 - data/CHANGELOG.md +19 -0
 - data/Gemfile +8 -0
 - data/LICENSE.txt +22 -0
 - data/README.md +33 -0
 - data/Rakefile +13 -0
 - data/content_caching.gemspec +28 -0
 - data/lib/content_caching/adapters/abstract.rb +24 -0
 - data/lib/content_caching/adapters/aws.rb +50 -0
 - data/lib/content_caching/adapters/aws_adapter.rb +38 -0
 - data/lib/content_caching/adapters/base.rb +27 -0
 - data/lib/content_caching/adapters/fs.rb +19 -0
 - data/lib/content_caching/adapters/fs_adapter.rb +39 -0
 - data/lib/content_caching/adapters/implementation.rb +30 -0
 - data/lib/content_caching/configuration.rb +9 -0
 - data/lib/content_caching/version.rb +3 -0
 - data/lib/content_caching.rb +39 -0
 - data/spec/content_caching/adapters/fs_adapter_spec.rb +0 -0
 - data/spec/content_caching/configuration_spec.rb +15 -0
 - data/spec/content_caching_spec.rb +108 -0
 - data/spec/fixtures/page.html +9 -0
 - data/spec/spec_helper.rb +26 -0
 - metadata +175 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            SHA1:
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 8f76b31f135b71b97dae7f0b560366afd49d65fe
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 47b2f2a7756927158656355120605006ad701f1b
         
     | 
| 
      
 5 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: f49f744dad7212723fd9f42451824ef08e19edbf5ee17b8df29784d998709562322cb923f93cc201fea5e16d32a3b8adc2fcd3bb52fae87fcd8aff090eece266
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: d9a7187010d2d3d420b18f58ff0001f6c35f8fe68befeead4507ae4b8fbd8c2f7bb4e3c865e202e4510f58b9a00ebebf11c05e083d3a375cd2585c76ff161e4a
         
     | 
    
        data/.coveralls.yml
    ADDED
    
    | 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            service_name: travis-ci
         
     | 
    
        data/.gitignore
    ADDED
    
    | 
         @@ -0,0 +1,22 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            *.gem
         
     | 
| 
      
 2 
     | 
    
         
            +
            *.rbc
         
     | 
| 
      
 3 
     | 
    
         
            +
            .bundle
         
     | 
| 
      
 4 
     | 
    
         
            +
            .config
         
     | 
| 
      
 5 
     | 
    
         
            +
            .yardoc
         
     | 
| 
      
 6 
     | 
    
         
            +
            Gemfile.lock
         
     | 
| 
      
 7 
     | 
    
         
            +
            InstalledFiles
         
     | 
| 
      
 8 
     | 
    
         
            +
            _yardoc
         
     | 
| 
      
 9 
     | 
    
         
            +
            coverage
         
     | 
| 
      
 10 
     | 
    
         
            +
            doc/
         
     | 
| 
      
 11 
     | 
    
         
            +
            lib/bundler/man
         
     | 
| 
      
 12 
     | 
    
         
            +
            pkg
         
     | 
| 
      
 13 
     | 
    
         
            +
            rdoc
         
     | 
| 
      
 14 
     | 
    
         
            +
            spec/reports
         
     | 
| 
      
 15 
     | 
    
         
            +
            test/tmp
         
     | 
| 
      
 16 
     | 
    
         
            +
            test/version_tmp
         
     | 
| 
      
 17 
     | 
    
         
            +
            tmp
         
     | 
| 
      
 18 
     | 
    
         
            +
            *.bundle
         
     | 
| 
      
 19 
     | 
    
         
            +
            *.so
         
     | 
| 
      
 20 
     | 
    
         
            +
            *.o
         
     | 
| 
      
 21 
     | 
    
         
            +
            *.a
         
     | 
| 
      
 22 
     | 
    
         
            +
            mkmf.log
         
     | 
    
        data/.rspec
    ADDED
    
    
    
        data/.ruby-gemset
    ADDED
    
    | 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            content_caching
         
     | 
    
        data/.ruby-version
    ADDED
    
    | 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            2.1.1
         
     | 
    
        data/.travis.yml
    ADDED
    
    
    
        data/CHANGELOG.md
    ADDED
    
    
    
        data/Gemfile
    ADDED
    
    
    
        data/LICENSE.txt
    ADDED
    
    | 
         @@ -0,0 +1,22 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            Copyright (c) 2014 Joel AZEMAR
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            MIT License
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining
         
     | 
| 
      
 6 
     | 
    
         
            +
            a copy of this software and associated documentation files (the
         
     | 
| 
      
 7 
     | 
    
         
            +
            "Software"), to deal in the Software without restriction, including
         
     | 
| 
      
 8 
     | 
    
         
            +
            without limitation the rights to use, copy, modify, merge, publish,
         
     | 
| 
      
 9 
     | 
    
         
            +
            distribute, sublicense, and/or sell copies of the Software, and to
         
     | 
| 
      
 10 
     | 
    
         
            +
            permit persons to whom the Software is furnished to do so, subject to
         
     | 
| 
      
 11 
     | 
    
         
            +
            the following conditions:
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be
         
     | 
| 
      
 14 
     | 
    
         
            +
            included in all copies or substantial portions of the Software.
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
         
     | 
| 
      
 17 
     | 
    
         
            +
            EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
         
     | 
| 
      
 18 
     | 
    
         
            +
            MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
         
     | 
| 
      
 19 
     | 
    
         
            +
            NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
         
     | 
| 
      
 20 
     | 
    
         
            +
            LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
         
     | 
| 
      
 21 
     | 
    
         
            +
            OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
         
     | 
| 
      
 22 
     | 
    
         
            +
            WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
         
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,33 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # ContentCaching
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            [](http://badge.fury.io/rb/content_caching)
         
     | 
| 
      
 4 
     | 
    
         
            +
            [](https://codeclimate.com/github/joel/content_caching)
         
     | 
| 
      
 5 
     | 
    
         
            +
            [](https://gemnasium.com/joel/content_caching)
         
     | 
| 
      
 6 
     | 
    
         
            +
            [](https://travis-ci.org/joel/content_caching)
         
     | 
| 
      
 7 
     | 
    
         
            +
            [](https://coveralls.io/r/joel/content_caching)
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            ## Installation
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            Add this line to your application's Gemfile:
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                gem 'content_caching'
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            And then execute:
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                $ bundle
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            Or install it yourself as:
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                $ gem install content_caching
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            ## Usage
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            TODO: Write usage instructions here
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
            ## Contributing
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            1. Fork it ( https://github.com/[my-github-username]/content_caching/fork )
         
     | 
| 
      
 30 
     | 
    
         
            +
            2. Create your feature branch (`git checkout -b my-new-feature`)
         
     | 
| 
      
 31 
     | 
    
         
            +
            3. Commit your changes (`git commit -am 'Add some feature'`)
         
     | 
| 
      
 32 
     | 
    
         
            +
            4. Push to the branch (`git push origin my-new-feature`)
         
     | 
| 
      
 33 
     | 
    
         
            +
            5. Create a new Pull Request
         
     | 
    
        data/Rakefile
    ADDED
    
    
| 
         @@ -0,0 +1,28 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_relative 'lib/content_caching/version'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Gem::Specification.new do |spec|
         
     | 
| 
      
 4 
     | 
    
         
            +
              spec.name          = 'content_caching'
         
     | 
| 
      
 5 
     | 
    
         
            +
              spec.version       = ContentCaching::VERSION
         
     | 
| 
      
 6 
     | 
    
         
            +
              spec.authors       = ['Joel AZEMAR']
         
     | 
| 
      
 7 
     | 
    
         
            +
              spec.email         = ['joel.azemar@gmail.com']
         
     | 
| 
      
 8 
     | 
    
         
            +
              spec.summary       = %q{Library for help and speed up views render manipulation}
         
     | 
| 
      
 9 
     | 
    
         
            +
              spec.description   = %q{Library for help and speed up views render manipulation based on aws and local storage}
         
     | 
| 
      
 10 
     | 
    
         
            +
              spec.homepage      = 'https://github.com/joel/content_caching'
         
     | 
| 
      
 11 
     | 
    
         
            +
              spec.license       = 'MIT'
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
              spec.files         = `git ls-files -z`.split("\x0")
         
     | 
| 
      
 14 
     | 
    
         
            +
              spec.executables   = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
         
     | 
| 
      
 15 
     | 
    
         
            +
              spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
         
     | 
| 
      
 16 
     | 
    
         
            +
              spec.require_paths = ['lib']
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
              spec.add_development_dependency 'bundler', '~> 1.6'
         
     | 
| 
      
 19 
     | 
    
         
            +
              spec.add_development_dependency 'rake',    '~> 10.3'
         
     | 
| 
      
 20 
     | 
    
         
            +
              spec.add_development_dependency 'rspec',   '~> 2.14'
         
     | 
| 
      
 21 
     | 
    
         
            +
              spec.add_development_dependency 'webmock', '~> 1.18'
         
     | 
| 
      
 22 
     | 
    
         
            +
              spec.add_development_dependency 'vcr',     '~> 2.9'
         
     | 
| 
      
 23 
     | 
    
         
            +
              spec.add_development_dependency 'right_http_connection', '~> 1.4'
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
              spec.add_dependency 'aws', '~> 2.10'
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
              spec.required_ruby_version = '~> 2.1'
         
     | 
| 
      
 28 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,24 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module ContentCaching
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Adapter
         
     | 
| 
      
 3 
     | 
    
         
            +
                class Abstract
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                  def initialize wrapper, options
         
     | 
| 
      
 6 
     | 
    
         
            +
                    @wrapper = wrapper
         
     | 
| 
      
 7 
     | 
    
         
            +
                    @options = options
         
     | 
| 
      
 8 
     | 
    
         
            +
                  end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  def store content
         
     | 
| 
      
 11 
     | 
    
         
            +
                    raise NotImplementedError
         
     | 
| 
      
 12 
     | 
    
         
            +
                  end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                  def url
         
     | 
| 
      
 15 
     | 
    
         
            +
                    raise NotImplementedError
         
     | 
| 
      
 16 
     | 
    
         
            +
                  end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                  def delete
         
     | 
| 
      
 19 
     | 
    
         
            +
                    raise NotImplementedError
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                end
         
     | 
| 
      
 23 
     | 
    
         
            +
              end
         
     | 
| 
      
 24 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,50 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'aws'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module ContentCaching
         
     | 
| 
      
 4 
     | 
    
         
            +
              module Adapter
         
     | 
| 
      
 5 
     | 
    
         
            +
                class Aws
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                  T_1_DAY = 86400.freeze
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                  attr_reader :options
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                  def initialize options
         
     | 
| 
      
 12 
     | 
    
         
            +
                    @options = options
         
     | 
| 
      
 13 
     | 
    
         
            +
                  end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                  def store document_path, content
         
     | 
| 
      
 16 
     | 
    
         
            +
                    retry_3_times do
         
     | 
| 
      
 17 
     | 
    
         
            +
                      content.rewind if content.respond_to?(:rewind)
         
     | 
| 
      
 18 
     | 
    
         
            +
                      s3_interface.put self.options[:directory], document_path, content.read
         
     | 
| 
      
 19 
     | 
    
         
            +
                    end
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                  def url document_path
         
     | 
| 
      
 23 
     | 
    
         
            +
                    s3_interface.get_link self.options[:directory], document_path, T_1_DAY
         
     | 
| 
      
 24 
     | 
    
         
            +
                  end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                  def delete document_path
         
     | 
| 
      
 27 
     | 
    
         
            +
                    retry_3_times do
         
     | 
| 
      
 28 
     | 
    
         
            +
                      s3_interface.delete self.options[:directory], document_path
         
     | 
| 
      
 29 
     | 
    
         
            +
                    end
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                  private
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                  def s3_interface
         
     | 
| 
      
 35 
     | 
    
         
            +
                    @s3_interface ||= ::Aws::S3Interface.new self.options[:aws_access_key_id],
         
     | 
| 
      
 36 
     | 
    
         
            +
                                                             self.options[:aws_secret_access_key]
         
     | 
| 
      
 37 
     | 
    
         
            +
                  end
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
                  def retry_3_times
         
     | 
| 
      
 40 
     | 
    
         
            +
                    tries = 0
         
     | 
| 
      
 41 
     | 
    
         
            +
                    begin
         
     | 
| 
      
 42 
     | 
    
         
            +
                      yield
         
     | 
| 
      
 43 
     | 
    
         
            +
                    rescue
         
     | 
| 
      
 44 
     | 
    
         
            +
                      (tries += 1) <3 ? retry : raise
         
     | 
| 
      
 45 
     | 
    
         
            +
                    end
         
     | 
| 
      
 46 
     | 
    
         
            +
                  end
         
     | 
| 
      
 47 
     | 
    
         
            +
             
     | 
| 
      
 48 
     | 
    
         
            +
                end
         
     | 
| 
      
 49 
     | 
    
         
            +
              end
         
     | 
| 
      
 50 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,38 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_relative 'abstract'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require_relative 'implementation'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require_relative 'aws'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            module ContentCaching
         
     | 
| 
      
 6 
     | 
    
         
            +
              module Adapter
         
     | 
| 
      
 7 
     | 
    
         
            +
                class AwsAdapter < Abstract
         
     | 
| 
      
 8 
     | 
    
         
            +
                  include Implementation
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  def initialize(wrapper, options)
         
     | 
| 
      
 11 
     | 
    
         
            +
                    super
         
     | 
| 
      
 12 
     | 
    
         
            +
                  end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                  def url
         
     | 
| 
      
 15 
     | 
    
         
            +
                    adapter.url document_path
         
     | 
| 
      
 16 
     | 
    
         
            +
                  end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                  def store content
         
     | 
| 
      
 19 
     | 
    
         
            +
                    adapter.store document_path, content
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                  def delete
         
     | 
| 
      
 23 
     | 
    
         
            +
                    adapter.delete document_path
         
     | 
| 
      
 24 
     | 
    
         
            +
                  end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                  private
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                  def document_path
         
     | 
| 
      
 29 
     | 
    
         
            +
                    @wrapper.document_path
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                  def adapter
         
     | 
| 
      
 33 
     | 
    
         
            +
                    @adapter ||= Aws::new(@options)
         
     | 
| 
      
 34 
     | 
    
         
            +
                  end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                end
         
     | 
| 
      
 37 
     | 
    
         
            +
              end
         
     | 
| 
      
 38 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,27 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module ContentCaching
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Adapter
         
     | 
| 
      
 3 
     | 
    
         
            +
                class Base
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                  class UnsupportedAdapter < StandardError ; end
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                  def self.create(adapter_infos, wrapper)
         
     | 
| 
      
 8 
     | 
    
         
            +
                    adapter_type = adapter_infos[:adapter]
         
     | 
| 
      
 9 
     | 
    
         
            +
                    options = adapter_infos[:options]
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                    load "content_caching/adapters/#{adapter_type}_adapter.rb"
         
     | 
| 
      
 12 
     | 
    
         
            +
                    ContentCaching::Adapter.const_get(klass_adapter(adapter_type)).new(wrapper, options)
         
     | 
| 
      
 13 
     | 
    
         
            +
                  end
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
                  private
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                  def self.klass_adapter adapter_symbol
         
     | 
| 
      
 18 
     | 
    
         
            +
                    case adapter_symbol
         
     | 
| 
      
 19 
     | 
    
         
            +
                    when :fs then :FsAdapter
         
     | 
| 
      
 20 
     | 
    
         
            +
                    when :aws then :AwsAdapter
         
     | 
| 
      
 21 
     | 
    
         
            +
                    else raise UnsupportedAdapter.new
         
     | 
| 
      
 22 
     | 
    
         
            +
                    end
         
     | 
| 
      
 23 
     | 
    
         
            +
                  end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                end
         
     | 
| 
      
 26 
     | 
    
         
            +
              end
         
     | 
| 
      
 27 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,19 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module ContentCaching
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Adapter
         
     | 
| 
      
 3 
     | 
    
         
            +
                class Fs
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                  def store document_path, document_name, content
         
     | 
| 
      
 6 
     | 
    
         
            +
                    Pathname(url(document_path, document_name)).write content.read
         
     | 
| 
      
 7 
     | 
    
         
            +
                  end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                  def url document_path, document_name
         
     | 
| 
      
 10 
     | 
    
         
            +
                    "#{document_path}/#{document_name}"
         
     | 
| 
      
 11 
     | 
    
         
            +
                  end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                  def delete document_path, document_name
         
     | 
| 
      
 14 
     | 
    
         
            +
                    Pathname(url(document_path, document_name)).delete
         
     | 
| 
      
 15 
     | 
    
         
            +
                  end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                end
         
     | 
| 
      
 18 
     | 
    
         
            +
              end
         
     | 
| 
      
 19 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,39 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_relative 'abstract'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require_relative 'implementation'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require_relative 'fs'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            module ContentCaching
         
     | 
| 
      
 6 
     | 
    
         
            +
              module Adapter
         
     | 
| 
      
 7 
     | 
    
         
            +
                class FsAdapter < Abstract
         
     | 
| 
      
 8 
     | 
    
         
            +
                  include Implementation
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  def initialize(wrapper, options)
         
     | 
| 
      
 11 
     | 
    
         
            +
                    super
         
     | 
| 
      
 12 
     | 
    
         
            +
                  end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                  def url
         
     | 
| 
      
 15 
     | 
    
         
            +
                    adapter.url document_path, document_name
         
     | 
| 
      
 16 
     | 
    
         
            +
                  end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                  def store content
         
     | 
| 
      
 19 
     | 
    
         
            +
                    adapter.store document_path, document_name, content
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                  def delete
         
     | 
| 
      
 23 
     | 
    
         
            +
                    adapter.delete document_path, document_name
         
     | 
| 
      
 24 
     | 
    
         
            +
                  end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                  private
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                  def document_path
         
     | 
| 
      
 29 
     | 
    
         
            +
                    return @wrapper.document_path unless @options[:directory]
         
     | 
| 
      
 30 
     | 
    
         
            +
                    Pathname([@options[:directory], @wrapper.document_path].join('/')).cleanpath.to_path
         
     | 
| 
      
 31 
     | 
    
         
            +
                  end
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
                  def adapter
         
     | 
| 
      
 34 
     | 
    
         
            +
                    @adapter ||= Fs::new
         
     | 
| 
      
 35 
     | 
    
         
            +
                  end
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
                end
         
     | 
| 
      
 38 
     | 
    
         
            +
              end
         
     | 
| 
      
 39 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,30 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module ContentCaching
         
     | 
| 
      
 2 
     | 
    
         
            +
              module Adapter
         
     | 
| 
      
 3 
     | 
    
         
            +
                module Implementation
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                  def store content
         
     | 
| 
      
 6 
     | 
    
         
            +
                    adapter.store content
         
     | 
| 
      
 7 
     | 
    
         
            +
                  end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                  def url
         
     | 
| 
      
 10 
     | 
    
         
            +
                    adapter.url
         
     | 
| 
      
 11 
     | 
    
         
            +
                  end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                  def delete
         
     | 
| 
      
 14 
     | 
    
         
            +
                    adapter.delete
         
     | 
| 
      
 15 
     | 
    
         
            +
                  end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                  private
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
                  def document_name
         
     | 
| 
      
 20 
     | 
    
         
            +
                    @wrapper.document_name
         
     | 
| 
      
 21 
     | 
    
         
            +
                  end
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
                  def document_path
         
     | 
| 
      
 24 
     | 
    
         
            +
                    return @wrapper.document_path unless @options[:directory]
         
     | 
| 
      
 25 
     | 
    
         
            +
                    Pathname([@options[:directory], @wrapper.document_path].join('/')).cleanpath.to_path
         
     | 
| 
      
 26 
     | 
    
         
            +
                  end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                end
         
     | 
| 
      
 29 
     | 
    
         
            +
              end
         
     | 
| 
      
 30 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,39 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_relative 'content_caching/version'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require_relative 'content_caching/configuration'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require_relative 'content_caching/adapters/base'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            begin
         
     | 
| 
      
 6 
     | 
    
         
            +
              require 'pry'
         
     | 
| 
      
 7 
     | 
    
         
            +
            rescue LoadError
         
     | 
| 
      
 8 
     | 
    
         
            +
            end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            require 'forwardable'
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            module ContentCaching
         
     | 
| 
      
 13 
     | 
    
         
            +
              class << self
         
     | 
| 
      
 14 
     | 
    
         
            +
                attr_writer :configuration
         
     | 
| 
      
 15 
     | 
    
         
            +
              end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
              def self.configuration
         
     | 
| 
      
 18 
     | 
    
         
            +
                @configuration ||= Configuration.new
         
     | 
| 
      
 19 
     | 
    
         
            +
              end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
              def self.reset
         
     | 
| 
      
 22 
     | 
    
         
            +
                @configuration = Configuration.new
         
     | 
| 
      
 23 
     | 
    
         
            +
              end
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
              def self.configure
         
     | 
| 
      
 26 
     | 
    
         
            +
                yield(configuration)
         
     | 
| 
      
 27 
     | 
    
         
            +
              end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
              class Document
         
     | 
| 
      
 30 
     | 
    
         
            +
                extend Forwardable
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                def_delegators :adapter, :store, :url, :delete
         
     | 
| 
      
 33 
     | 
    
         
            +
                attr_accessor :adapter
         
     | 
| 
      
 34 
     | 
    
         
            +
             
     | 
| 
      
 35 
     | 
    
         
            +
                def initialize wrapper
         
     | 
| 
      
 36 
     | 
    
         
            +
                  self.adapter = ContentCaching::Adapter::Base.create(ContentCaching.configuration.adapter, wrapper)
         
     | 
| 
      
 37 
     | 
    
         
            +
                end
         
     | 
| 
      
 38 
     | 
    
         
            +
              end
         
     | 
| 
      
 39 
     | 
    
         
            +
            end
         
     | 
| 
         
            File without changes
         
     | 
| 
         @@ -0,0 +1,15 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module ContentCaching
         
     | 
| 
      
 4 
     | 
    
         
            +
              describe Configuration do
         
     | 
| 
      
 5 
     | 
    
         
            +
                let(:configuration) { Configuration.new }
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                describe '#adapter' do
         
     | 
| 
      
 8 
     | 
    
         
            +
                  let(:adapter) {{ adapter: :fs, options: { directory: 'tmp' }}}
         
     | 
| 
      
 9 
     | 
    
         
            +
                  it 'the default is fs' do
         
     | 
| 
      
 10 
     | 
    
         
            +
                    expect(configuration.adapter).to eq(adapter)
         
     | 
| 
      
 11 
     | 
    
         
            +
                  end
         
     | 
| 
      
 12 
     | 
    
         
            +
                end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
              end
         
     | 
| 
      
 15 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,108 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'spec_helper'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            require 'pathname'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            module ContentCaching
         
     | 
| 
      
 6 
     | 
    
         
            +
              describe Document do
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                context 'fs' do
         
     | 
| 
      
 9 
     | 
    
         
            +
                  let(:wrapper)         { OpenStruct.new(options) }
         
     | 
| 
      
 10 
     | 
    
         
            +
                  let(:content_caching) { Document.new(wrapper) }
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                  context 'options' do
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                    context 'without document path' do
         
     | 
| 
      
 15 
     | 
    
         
            +
                      let(:options) {{ document_name: 'page.html', document_path: nil }}
         
     | 
| 
      
 16 
     | 
    
         
            +
                      specify do
         
     | 
| 
      
 17 
     | 
    
         
            +
                        expect(content_caching.url).to eq('tmp/page.html')
         
     | 
| 
      
 18 
     | 
    
         
            +
                      end
         
     | 
| 
      
 19 
     | 
    
         
            +
                    end
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                    context 'with document path' do
         
     | 
| 
      
 22 
     | 
    
         
            +
                      let(:options) {{ document_name: 'page.html', document_path: 'pages' }}
         
     | 
| 
      
 23 
     | 
    
         
            +
                      specify do
         
     | 
| 
      
 24 
     | 
    
         
            +
                        expect(content_caching.url).to eq('tmp/pages/page.html')
         
     | 
| 
      
 25 
     | 
    
         
            +
                      end
         
     | 
| 
      
 26 
     | 
    
         
            +
                    end
         
     | 
| 
      
 27 
     | 
    
         
            +
                  end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
                  describe '#store' do
         
     | 
| 
      
 30 
     | 
    
         
            +
                    let(:options) {{ document_name: 'page.html', document_path: 'public/pages' }}
         
     | 
| 
      
 31 
     | 
    
         
            +
             
     | 
| 
      
 32 
     | 
    
         
            +
                    before do
         
     | 
| 
      
 33 
     | 
    
         
            +
                      content_caching.store Pathname('spec/fixtures/page.html')
         
     | 
| 
      
 34 
     | 
    
         
            +
                    end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                    specify do
         
     | 
| 
      
 37 
     | 
    
         
            +
                      expect(Pathname('tmp/public/pages/page.html')).to be_exist
         
     | 
| 
      
 38 
     | 
    
         
            +
                    end
         
     | 
| 
      
 39 
     | 
    
         
            +
             
     | 
| 
      
 40 
     | 
    
         
            +
                    describe '#delete' do
         
     | 
| 
      
 41 
     | 
    
         
            +
                      before do content_caching.delete end
         
     | 
| 
      
 42 
     | 
    
         
            +
                      specify do
         
     | 
| 
      
 43 
     | 
    
         
            +
                        expect(Pathname('tmp/public/pages/page.html')).to_not be_exist
         
     | 
| 
      
 44 
     | 
    
         
            +
                      end
         
     | 
| 
      
 45 
     | 
    
         
            +
                    end
         
     | 
| 
      
 46 
     | 
    
         
            +
                  end
         
     | 
| 
      
 47 
     | 
    
         
            +
                end
         
     | 
| 
      
 48 
     | 
    
         
            +
             
     | 
| 
      
 49 
     | 
    
         
            +
                context 'aws', pending: true do
         
     | 
| 
      
 50 
     | 
    
         
            +
                  let(:wrapper)         { OpenStruct.new(options) }
         
     | 
| 
      
 51 
     | 
    
         
            +
                  let(:options)         {{ document_name: nil, document_path: 'test/page.html' }}
         
     | 
| 
      
 52 
     | 
    
         
            +
                  let(:content_caching) { Document.new(wrapper) }
         
     | 
| 
      
 53 
     | 
    
         
            +
                  let(:adapter) do
         
     | 
| 
      
 54 
     | 
    
         
            +
                    { adapter: :aws,
         
     | 
| 
      
 55 
     | 
    
         
            +
                      options: { directory: 'bucket-name', aws_access_key_id: 'aws_access_key_id',
         
     | 
| 
      
 56 
     | 
    
         
            +
                                 aws_secret_access_key: 'aws_secret_access_key' }
         
     | 
| 
      
 57 
     | 
    
         
            +
                    }
         
     | 
| 
      
 58 
     | 
    
         
            +
                  end
         
     | 
| 
      
 59 
     | 
    
         
            +
             
     | 
| 
      
 60 
     | 
    
         
            +
                  before do
         
     | 
| 
      
 61 
     | 
    
         
            +
                    ContentCaching.configure do |config|
         
     | 
| 
      
 62 
     | 
    
         
            +
                      config.adapter = adapter
         
     | 
| 
      
 63 
     | 
    
         
            +
                    end
         
     | 
| 
      
 64 
     | 
    
         
            +
                  end
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
                  describe '#url' do
         
     | 
| 
      
 67 
     | 
    
         
            +
             
     | 
| 
      
 68 
     | 
    
         
            +
                    let(:url) { 'https://bucket-name.s3.amazonaws.com:443/test/page.html' }
         
     | 
| 
      
 69 
     | 
    
         
            +
             
     | 
| 
      
 70 
     | 
    
         
            +
                    specify do
         
     | 
| 
      
 71 
     | 
    
         
            +
                      expect(content_caching.url).to match(url)
         
     | 
| 
      
 72 
     | 
    
         
            +
                    end
         
     | 
| 
      
 73 
     | 
    
         
            +
                  end
         
     | 
| 
      
 74 
     | 
    
         
            +
             
     | 
| 
      
 75 
     | 
    
         
            +
                  describe '#store' do
         
     | 
| 
      
 76 
     | 
    
         
            +
                    let(:s3) do
         
     | 
| 
      
 77 
     | 
    
         
            +
                      Aws::S3.new(
         
     | 
| 
      
 78 
     | 
    
         
            +
                        adapter[:options][:aws_access_key_id],
         
     | 
| 
      
 79 
     | 
    
         
            +
                        adapter[:options][:aws_secret_access_key])
         
     | 
| 
      
 80 
     | 
    
         
            +
                    end
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
                    let(:bucket) { Aws::S3::Bucket.new(s3, adapter[:options][:directory]) }
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
                    before do
         
     | 
| 
      
 85 
     | 
    
         
            +
                      # VCR.use_cassette('store') do
         
     | 
| 
      
 86 
     | 
    
         
            +
                        content_caching.store Pathname('spec/fixtures/page.html')
         
     | 
| 
      
 87 
     | 
    
         
            +
                      # end
         
     | 
| 
      
 88 
     | 
    
         
            +
                    end
         
     | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
      
 90 
     | 
    
         
            +
                    specify do
         
     | 
| 
      
 91 
     | 
    
         
            +
                      expect(
         
     | 
| 
      
 92 
     | 
    
         
            +
                        Aws::S3::Key.new(bucket, options[:document_path])
         
     | 
| 
      
 93 
     | 
    
         
            +
                      ).to be_exists
         
     | 
| 
      
 94 
     | 
    
         
            +
                    end
         
     | 
| 
      
 95 
     | 
    
         
            +
             
     | 
| 
      
 96 
     | 
    
         
            +
                    describe '#delete' do
         
     | 
| 
      
 97 
     | 
    
         
            +
                      before do content_caching.delete end
         
     | 
| 
      
 98 
     | 
    
         
            +
                      specify do
         
     | 
| 
      
 99 
     | 
    
         
            +
                        expect(
         
     | 
| 
      
 100 
     | 
    
         
            +
                          Aws::S3::Key.new(bucket, options[:document_path])
         
     | 
| 
      
 101 
     | 
    
         
            +
                        ).to_not be_exists
         
     | 
| 
      
 102 
     | 
    
         
            +
                      end
         
     | 
| 
      
 103 
     | 
    
         
            +
                    end
         
     | 
| 
      
 104 
     | 
    
         
            +
                  end
         
     | 
| 
      
 105 
     | 
    
         
            +
                end
         
     | 
| 
      
 106 
     | 
    
         
            +
             
     | 
| 
      
 107 
     | 
    
         
            +
              end
         
     | 
| 
      
 108 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,9 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <!doctype html>
         
     | 
| 
      
 2 
     | 
    
         
            +
            <html>
         
     | 
| 
      
 3 
     | 
    
         
            +
              <head>
         
     | 
| 
      
 4 
     | 
    
         
            +
                <title>Title</title>
         
     | 
| 
      
 5 
     | 
    
         
            +
              </head>
         
     | 
| 
      
 6 
     | 
    
         
            +
              <body>
         
     | 
| 
      
 7 
     | 
    
         
            +
                Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin luctus tortor eu hendrerit scelerisque. Cras sed tellus quis ipsum fringilla vulputate pulvinar vitae risus. Aenean dapibus mi enim, nec volutpat ante lacinia nec. Morbi facilisis mi vel nibh pulvinar, eu auctor lacus rutrum. Praesent in tristique tortor. Quisque sed pharetra leo, vitae accumsan metus. Ut convallis elementum nibh ut egestas.
         
     | 
| 
      
 8 
     | 
    
         
            +
              </body>
         
     | 
| 
      
 9 
     | 
    
         
            +
            </html>
         
     | 
    
        data/spec/spec_helper.rb
    ADDED
    
    | 
         @@ -0,0 +1,26 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'rubygems'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'bundler/setup'
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            begin
         
     | 
| 
      
 5 
     | 
    
         
            +
              require 'pry'
         
     | 
| 
      
 6 
     | 
    
         
            +
            rescue LoadError
         
     | 
| 
      
 7 
     | 
    
         
            +
            end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            # require 'right_http_connection'
         
     | 
| 
      
 10 
     | 
    
         
            +
            # require 'webmock'
         
     | 
| 
      
 11 
     | 
    
         
            +
            # require 'webmock/rspec'
         
     | 
| 
      
 12 
     | 
    
         
            +
            # require 'vcr'
         
     | 
| 
      
 13 
     | 
    
         
            +
            #
         
     | 
| 
      
 14 
     | 
    
         
            +
            # VCR.configure do |c|
         
     | 
| 
      
 15 
     | 
    
         
            +
            #   c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
         
     | 
| 
      
 16 
     | 
    
         
            +
            #   c.hook_into :webmock
         
     | 
| 
      
 17 
     | 
    
         
            +
            # end
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            require_relative '../lib/content_caching'
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            RSpec.configure do |config|
         
     | 
| 
      
 22 
     | 
    
         
            +
              config.filter_run focused: true
         
     | 
| 
      
 23 
     | 
    
         
            +
              config.run_all_when_everything_filtered = true
         
     | 
| 
      
 24 
     | 
    
         
            +
              # config.before { }
         
     | 
| 
      
 25 
     | 
    
         
            +
              # config.after  { }
         
     | 
| 
      
 26 
     | 
    
         
            +
            end
         
     | 
    
        metadata
    ADDED
    
    | 
         @@ -0,0 +1,175 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            --- !ruby/object:Gem::Specification
         
     | 
| 
      
 2 
     | 
    
         
            +
            name: content_caching
         
     | 
| 
      
 3 
     | 
    
         
            +
            version: !ruby/object:Gem::Version
         
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.1
         
     | 
| 
      
 5 
     | 
    
         
            +
            platform: ruby
         
     | 
| 
      
 6 
     | 
    
         
            +
            authors:
         
     | 
| 
      
 7 
     | 
    
         
            +
            - Joel AZEMAR
         
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire: 
         
     | 
| 
      
 9 
     | 
    
         
            +
            bindir: bin
         
     | 
| 
      
 10 
     | 
    
         
            +
            cert_chain: []
         
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2014-05-22 00:00:00.000000000 Z
         
     | 
| 
      
 12 
     | 
    
         
            +
            dependencies:
         
     | 
| 
      
 13 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 14 
     | 
    
         
            +
              name: bundler
         
     | 
| 
      
 15 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 16 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 17 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 18 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 19 
     | 
    
         
            +
                    version: '1.6'
         
     | 
| 
      
 20 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 21 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 22 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 23 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 24 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 25 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 26 
     | 
    
         
            +
                    version: '1.6'
         
     | 
| 
      
 27 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 28 
     | 
    
         
            +
              name: rake
         
     | 
| 
      
 29 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 30 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 31 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 32 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 33 
     | 
    
         
            +
                    version: '10.3'
         
     | 
| 
      
 34 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 35 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 36 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 37 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 38 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 39 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 40 
     | 
    
         
            +
                    version: '10.3'
         
     | 
| 
      
 41 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 42 
     | 
    
         
            +
              name: rspec
         
     | 
| 
      
 43 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 44 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 45 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 46 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 47 
     | 
    
         
            +
                    version: '2.14'
         
     | 
| 
      
 48 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 49 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 50 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 51 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 52 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 53 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 54 
     | 
    
         
            +
                    version: '2.14'
         
     | 
| 
      
 55 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 56 
     | 
    
         
            +
              name: webmock
         
     | 
| 
      
 57 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 58 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 59 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 60 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 61 
     | 
    
         
            +
                    version: '1.18'
         
     | 
| 
      
 62 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 63 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 64 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 65 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 66 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 67 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 68 
     | 
    
         
            +
                    version: '1.18'
         
     | 
| 
      
 69 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 70 
     | 
    
         
            +
              name: vcr
         
     | 
| 
      
 71 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 72 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 73 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 74 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 75 
     | 
    
         
            +
                    version: '2.9'
         
     | 
| 
      
 76 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 77 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 78 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 79 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 80 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 81 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 82 
     | 
    
         
            +
                    version: '2.9'
         
     | 
| 
      
 83 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 84 
     | 
    
         
            +
              name: right_http_connection
         
     | 
| 
      
 85 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 86 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 87 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 88 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 89 
     | 
    
         
            +
                    version: '1.4'
         
     | 
| 
      
 90 
     | 
    
         
            +
              type: :development
         
     | 
| 
      
 91 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 92 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 93 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 94 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 95 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 96 
     | 
    
         
            +
                    version: '1.4'
         
     | 
| 
      
 97 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 98 
     | 
    
         
            +
              name: aws
         
     | 
| 
      
 99 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 100 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 101 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 102 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 103 
     | 
    
         
            +
                    version: '2.10'
         
     | 
| 
      
 104 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 105 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 106 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 107 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 108 
     | 
    
         
            +
                - - "~>"
         
     | 
| 
      
 109 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 110 
     | 
    
         
            +
                    version: '2.10'
         
     | 
| 
      
 111 
     | 
    
         
            +
            description: Library for help and speed up views render manipulation based on aws
         
     | 
| 
      
 112 
     | 
    
         
            +
              and local storage
         
     | 
| 
      
 113 
     | 
    
         
            +
            email:
         
     | 
| 
      
 114 
     | 
    
         
            +
            - joel.azemar@gmail.com
         
     | 
| 
      
 115 
     | 
    
         
            +
            executables: []
         
     | 
| 
      
 116 
     | 
    
         
            +
            extensions: []
         
     | 
| 
      
 117 
     | 
    
         
            +
            extra_rdoc_files: []
         
     | 
| 
      
 118 
     | 
    
         
            +
            files:
         
     | 
| 
      
 119 
     | 
    
         
            +
            - ".coveralls.yml"
         
     | 
| 
      
 120 
     | 
    
         
            +
            - ".gitignore"
         
     | 
| 
      
 121 
     | 
    
         
            +
            - ".rspec"
         
     | 
| 
      
 122 
     | 
    
         
            +
            - ".ruby-gemset"
         
     | 
| 
      
 123 
     | 
    
         
            +
            - ".ruby-version"
         
     | 
| 
      
 124 
     | 
    
         
            +
            - ".travis.yml"
         
     | 
| 
      
 125 
     | 
    
         
            +
            - CHANGELOG.md
         
     | 
| 
      
 126 
     | 
    
         
            +
            - Gemfile
         
     | 
| 
      
 127 
     | 
    
         
            +
            - LICENSE.txt
         
     | 
| 
      
 128 
     | 
    
         
            +
            - README.md
         
     | 
| 
      
 129 
     | 
    
         
            +
            - Rakefile
         
     | 
| 
      
 130 
     | 
    
         
            +
            - content_caching.gemspec
         
     | 
| 
      
 131 
     | 
    
         
            +
            - lib/content_caching.rb
         
     | 
| 
      
 132 
     | 
    
         
            +
            - lib/content_caching/adapters/abstract.rb
         
     | 
| 
      
 133 
     | 
    
         
            +
            - lib/content_caching/adapters/aws.rb
         
     | 
| 
      
 134 
     | 
    
         
            +
            - lib/content_caching/adapters/aws_adapter.rb
         
     | 
| 
      
 135 
     | 
    
         
            +
            - lib/content_caching/adapters/base.rb
         
     | 
| 
      
 136 
     | 
    
         
            +
            - lib/content_caching/adapters/fs.rb
         
     | 
| 
      
 137 
     | 
    
         
            +
            - lib/content_caching/adapters/fs_adapter.rb
         
     | 
| 
      
 138 
     | 
    
         
            +
            - lib/content_caching/adapters/implementation.rb
         
     | 
| 
      
 139 
     | 
    
         
            +
            - lib/content_caching/configuration.rb
         
     | 
| 
      
 140 
     | 
    
         
            +
            - lib/content_caching/version.rb
         
     | 
| 
      
 141 
     | 
    
         
            +
            - spec/content_caching/adapters/fs_adapter_spec.rb
         
     | 
| 
      
 142 
     | 
    
         
            +
            - spec/content_caching/configuration_spec.rb
         
     | 
| 
      
 143 
     | 
    
         
            +
            - spec/content_caching_spec.rb
         
     | 
| 
      
 144 
     | 
    
         
            +
            - spec/fixtures/page.html
         
     | 
| 
      
 145 
     | 
    
         
            +
            - spec/spec_helper.rb
         
     | 
| 
      
 146 
     | 
    
         
            +
            homepage: https://github.com/joel/content_caching
         
     | 
| 
      
 147 
     | 
    
         
            +
            licenses:
         
     | 
| 
      
 148 
     | 
    
         
            +
            - MIT
         
     | 
| 
      
 149 
     | 
    
         
            +
            metadata: {}
         
     | 
| 
      
 150 
     | 
    
         
            +
            post_install_message: 
         
     | 
| 
      
 151 
     | 
    
         
            +
            rdoc_options: []
         
     | 
| 
      
 152 
     | 
    
         
            +
            require_paths:
         
     | 
| 
      
 153 
     | 
    
         
            +
            - lib
         
     | 
| 
      
 154 
     | 
    
         
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 155 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 156 
     | 
    
         
            +
              - - "~>"
         
     | 
| 
      
 157 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 158 
     | 
    
         
            +
                  version: '2.1'
         
     | 
| 
      
 159 
     | 
    
         
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
      
 160 
     | 
    
         
            +
              requirements:
         
     | 
| 
      
 161 
     | 
    
         
            +
              - - ">="
         
     | 
| 
      
 162 
     | 
    
         
            +
                - !ruby/object:Gem::Version
         
     | 
| 
      
 163 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
      
 164 
     | 
    
         
            +
            requirements: []
         
     | 
| 
      
 165 
     | 
    
         
            +
            rubyforge_project: 
         
     | 
| 
      
 166 
     | 
    
         
            +
            rubygems_version: 2.1.11
         
     | 
| 
      
 167 
     | 
    
         
            +
            signing_key: 
         
     | 
| 
      
 168 
     | 
    
         
            +
            specification_version: 4
         
     | 
| 
      
 169 
     | 
    
         
            +
            summary: Library for help and speed up views render manipulation
         
     | 
| 
      
 170 
     | 
    
         
            +
            test_files:
         
     | 
| 
      
 171 
     | 
    
         
            +
            - spec/content_caching/adapters/fs_adapter_spec.rb
         
     | 
| 
      
 172 
     | 
    
         
            +
            - spec/content_caching/configuration_spec.rb
         
     | 
| 
      
 173 
     | 
    
         
            +
            - spec/content_caching_spec.rb
         
     | 
| 
      
 174 
     | 
    
         
            +
            - spec/fixtures/page.html
         
     | 
| 
      
 175 
     | 
    
         
            +
            - spec/spec_helper.rb
         
     |