dassets 0.14.0 → 0.14.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- data.tar.gz: 42a4505c113f65ab11aba8c4eb4b8e8ffc6ad909
4
- metadata.gz: fe45e83de311469fdb752d0d002c99a458ec4391
3
+ metadata.gz: 89a17e9e4689219cffdda2b968a4c481f9813591
4
+ data.tar.gz: 2a74fdbbc78e44ec82d23f1aabbc284d70f03397
5
5
  SHA512:
6
- data.tar.gz: 43319a4222a6daefb725ce87b9d8c0c8dc6169a518f5cef67176ef8f9acae20cfe60f360bbef5f6e29dc138e4047d3797f9950de5728ae91b2aa4fb5ca74d96a
7
- metadata.gz: b648a9c3df1e2f01196aba0aaf3add9a967fb93fee069f54c714b419f34d82117671a43740b68143759de8e9e580db0c2f1f7cd3a47e061a88be0a8c96d509c6
6
+ metadata.gz: d19a0f7587afb5d0d19a9878a0667973474ef55a3d684d363a66cb750394249a97cf957cac9e99df6662fd72d32be6e9eb46794c7d121c7d7b45558f85dd0dd7
7
+ data.tar.gz: bf6bfb399f0ab12d21f50d58db6b6e39b22da71768660236ae21f287ebf3470477598dc95a397a39395c960980fd428bf6cf1968145975a65ab7db67da28041b
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
18
18
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
19
  gem.require_paths = ["lib"]
20
20
 
21
- gem.add_development_dependency("assert", ["~> 2.16.1"])
21
+ gem.add_development_dependency("assert", ["~> 2.16.3"])
22
22
  gem.add_development_dependency('assert-rack-test', ["~> 1.0.4"])
23
23
  gem.add_development_dependency("sinatra", ["~> 1.4"])
24
24
 
@@ -1,6 +1,7 @@
1
1
  require 'dassets/version'
2
2
  require 'dassets/asset_file'
3
3
  require 'dassets/config'
4
+ require 'dassets/source_file'
4
5
 
5
6
  module Dassets
6
7
 
@@ -10,21 +11,33 @@ module Dassets
10
11
  end
11
12
 
12
13
  def self.init
13
- @asset_files ||= {}
14
+ @asset_files ||= {}
15
+ @source_files = SourceFiles.new(self.config.sources)
14
16
  end
15
17
 
16
18
  def self.[](digest_path)
17
19
  @asset_files[digest_path] ||= AssetFile.new(digest_path)
18
20
  end
19
21
 
20
- def self.source_list
21
- SourceList.new(self.config.sources)
22
+ def self.source_files
23
+ @source_files
22
24
  end
23
25
 
24
- module SourceList
26
+ module SourceFiles
27
+
25
28
  def self.new(sources)
26
- sources.inject([]){ |list, source| list += source.files }
29
+ # use a hash to store the source files so in the case two source files
30
+ # have the same digest path, the last one *should* be correct since it
31
+ # was last to be configured
32
+ sources.inject({}) do |hash, source|
33
+ source.files.each do |file_path|
34
+ s = SourceFile.new(file_path)
35
+ hash[s.digest_path] = s
36
+ end
37
+ hash
38
+ end
27
39
  end
40
+
28
41
  end
29
42
 
30
43
  end
@@ -8,10 +8,10 @@ class Dassets::AssetFile
8
8
  attr_reader :digest_path, :dirname, :extname, :basename, :source_proxy
9
9
 
10
10
  def initialize(digest_path)
11
- @digest_path = digest_path
12
- @dirname = File.dirname(@digest_path)
13
- @extname = File.extname(@digest_path)
14
- @basename = File.basename(@digest_path, @extname)
11
+ @digest_path = digest_path
12
+ @dirname = File.dirname(@digest_path)
13
+ @extname = File.extname(@digest_path)
14
+ @basename = File.basename(@digest_path, @extname)
15
15
  @source_proxy = Dassets::SourceProxy.new(@digest_path, {
16
16
  :content_cache => Dassets.config.content_cache,
17
17
  :fingerprint_cache => Dassets.config.fingerprint_cache
@@ -6,7 +6,7 @@ module Dassets
6
6
  attr_reader :root
7
7
 
8
8
  def initialize(root)
9
- @root = root
9
+ @root = root
10
10
  @save_mutex = ::Mutex.new
11
11
  end
12
12
 
@@ -6,9 +6,9 @@ class Dassets::Source
6
6
  attr_reader :path, :engines, :response_headers
7
7
 
8
8
  def initialize(path)
9
- @path = path.to_s
10
- @filter = proc{ |paths| paths }
11
- @engines = Hash.new{ |h,k| Dassets::NullEngine.new }
9
+ @path = path.to_s
10
+ @filter = proc{ |paths| paths }
11
+ @engines = Hash.new{ |h,k| Dassets::NullEngine.new }
12
12
  @response_headers = Hash.new
13
13
  end
14
14
 
@@ -8,19 +8,14 @@ module Dassets
8
8
  class SourceFile
9
9
 
10
10
  def self.find_by_digest_path(path, options = nil)
11
- # look in the configured source list
12
- source_files = Dassets.source_list.map{ |p| self.new(p) }
13
-
14
- # get the last matching one (in case two source files have the same digest
15
- # path the last one *should* be correct since it was last to be configured)
16
- source_files.select{ |s| s.digest_path == path }.last || NullSourceFile.new(path, options)
11
+ Dassets.source_files[path] || NullSourceFile.new(path, options)
17
12
  end
18
13
 
19
14
  attr_reader :file_path
20
15
 
21
16
  def initialize(file_path)
22
17
  @file_path = file_path.to_s
23
- @ext_list = File.basename(@file_path).split('.').reverse
18
+ @ext_list = File.basename(@file_path).split('.').reverse
24
19
  end
25
20
 
26
21
  # get the last matching one (in the case two sources with the same path are
@@ -1,3 +1,3 @@
1
1
  module Dassets
2
- VERSION = "0.14.0"
2
+ VERSION = "0.14.1"
3
3
  end
@@ -41,3 +41,5 @@ Dassets.configure do |c|
41
41
  s.response_headers[Factory.string] = Factory.string
42
42
  end
43
43
  end
44
+
45
+ Dassets.init
@@ -11,7 +11,7 @@ module Dassets
11
11
  subject{ Dassets }
12
12
 
13
13
  should have_imeths :config, :configure, :init, :[]
14
- should have_imeths :source_list
14
+ should have_imeths :source_files
15
15
 
16
16
  should "return a `Config` instance with the `config` method" do
17
17
  assert_kind_of Config, subject.config
@@ -38,8 +38,8 @@ module Dassets
38
38
  end
39
39
 
40
40
  should "know its list of configured source files" do
41
- exp_configured_list = Dassets::SourceList.new(Dassets.config.sources)
42
- assert_equal exp_configured_list, subject.source_list
41
+ exp = Dassets::SourceFiles.new(Dassets.config.sources)
42
+ assert_equal exp, subject.source_files
43
43
  end
44
44
 
45
45
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dassets
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.14.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kelly Redding
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2016-06-14 00:00:00 Z
13
+ date: 2017-05-10 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: assert
@@ -19,7 +19,7 @@ dependencies:
19
19
  requirements:
20
20
  - - ~>
21
21
  - !ruby/object:Gem::Version
22
- version: 2.16.1
22
+ version: 2.16.3
23
23
  type: :development
24
24
  version_requirements: *id001
25
25
  - !ruby/object:Gem::Dependency
@@ -135,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  requirements: []
136
136
 
137
137
  rubyforge_project:
138
- rubygems_version: 2.6.4
138
+ rubygems_version: 2.6.6
139
139
  signing_key:
140
140
  specification_version: 4
141
141
  summary: Digested asset files