dassets 0.9.0 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8eb00e1656956e770b1e509f47389da503b40842
4
+ data.tar.gz: f32473d4d3bc21276cc9e09dd8a0ad3ab8677614
5
+ SHA512:
6
+ metadata.gz: 8293311bd021e41fc50a334f38d3c8ac1a93b07147660faa0b23df81fe64299411c5b6f6e56f6ca22cacf7a4a77c5f275534c591dd11116d45961ffae5a5c75c
7
+ data.tar.gz: b3b9914524b148a2809b1596c3f5c229b3ccd5a027bccc220c0629f15aebcf98b22f2b754e5a4b20a14064b97eb2e1c17003d2ec2170dad728945e7e44e65389
data/README.md CHANGED
@@ -28,7 +28,6 @@ end
28
28
  ### Link To
29
29
 
30
30
  ```rb
31
- Dassets.init
32
31
  Dassets['css/site.css'].href # => "/css/site-123abc.css"
33
32
  Dassets['img/logos/main.jpg'].href # => "/img/logos/main-a1b2c3.jpg"
34
33
  ```
@@ -51,9 +50,11 @@ Engines are "registered" with dassets based on source extensions. Name your sou
51
50
 
52
51
  ### Some Dassets Engines
53
52
 
54
- Examples are key here, so check out some of the Dasset's engines available:
53
+ Examples are key here, so check out some of the Dasset engines available:
55
54
 
56
- TODO
55
+ * **Erb**: https://github.com/redding/dassets-erb
56
+ * **Sass**: https://github.com/redding/dassets-sass
57
+ * **Less (v1)**: https://github.com/redding/dassets-lessv1
57
58
 
58
59
  ### Creating your own Engine
59
60
 
@@ -64,11 +65,45 @@ TODO
64
65
 
65
66
  ## Sources
66
67
 
67
- TODO: filtering files, registering engines
68
+ Sources model a root location for asset files. They also provide configuration for how assets in that location should be processed and handled.
69
+
70
+ You can specify filters that control which paths in the location are considered. You can also register engines which determine how the contents of assets files are handled. For example:
71
+
72
+ ```ruby
73
+ Dassets.configure do |c|
74
+ c.source /path/to/assets do |s|
75
+ s.filter{ |paths| paths.reject{ |p| File.basename(p) =~ /^_/ } }
76
+
77
+ s.engine 'erb', Dassets::Erb::Engine
78
+ s.engine 'scss', Dassets::Sass::Engine, {
79
+ :syntax => 'scss'
80
+ # any other engine-specific options here
81
+ }
82
+ end
83
+ end
84
+ ```
85
+
86
+ This configuration says that Dassets, for assets in `/path/to/assets`, should 1) ignore any files beginning in `_` 2) process any files ending in `.erb` with the Erb engine and 3) process any files ending in `.scss` with the Sass engine (using 'scss' syntax).
87
+
88
+ The goal here is to allow you to control how certain asset files are handled based on their location root. This is handy for 3rd-paty gems that provide asset source files (such as [Romo](https://github.com/redding/romo)). See https://github.com/redding/romo/blob/master/lib/romo/dassets.rb for an example of how Romo integrates with Dassets.
68
89
 
69
90
  ## Combinations
70
91
 
71
- TODO
92
+ Combinations are a way to alias many asset files as a single asset. Dassets responds to requests for the combined asset by concatenating the combination's asset files into a single response. For example:
93
+
94
+ ```ruby
95
+ Dassets.configure do |c|
96
+ c.combination "css/special.css", [
97
+ 'css/romo/normalize.css',
98
+ 'css/romo/base.css',
99
+ 'css/romo/component1.css'
100
+ ]
101
+ end
102
+ ```
103
+
104
+ This example tells Dassets that if it receives a request for the `css/special.css` asset it should return the content of the 3 files concatenated in that order.
105
+
106
+ Combinations are treated just like regular asset files (think of them as a kind of alias). They can be cached/digested/etc just as if they were a true asset file. Again, see https://github.com/redding/romo/blob/master/lib/romo/dassets.rb for an example of using combinations to abstract the composition of 3rd-party asset files.
72
107
 
73
108
  ## Installation
74
109
 
@@ -1,3 +1,3 @@
1
1
  module Dassets
2
- VERSION = "0.9.0"
2
+ VERSION = "0.10.0"
3
3
  end
data/lib/dassets.rb CHANGED
@@ -28,3 +28,5 @@ module Dassets
28
28
  end
29
29
 
30
30
  end
31
+
32
+ Dassets.init
data/test/helper.rb CHANGED
@@ -31,5 +31,3 @@ Dassets.configure do |c|
31
31
  s.engine 'useless', @useless_engine
32
32
  end
33
33
  end
34
-
35
- Dassets.init
metadata CHANGED
@@ -1,110 +1,95 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: dassets
3
- version: !ruby/object:Gem::Version
4
- hash: 59
5
- prerelease:
6
- segments:
7
- - 0
8
- - 9
9
- - 0
10
- version: 0.9.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.10.0
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Kelly Redding
14
8
  - Collin Redding
15
9
  autorequire:
16
10
  bindir: bin
17
11
  cert_chain: []
18
-
19
- date: 2014-08-01 00:00:00 Z
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
22
- requirement: &id001 !ruby/object:Gem::Requirement
23
- none: false
24
- requirements:
25
- - - ~>
26
- - !ruby/object:Gem::Version
27
- hash: 27
28
- segments:
29
- - 2
30
- - 12
31
- version: "2.12"
32
- type: :development
12
+ date: 2015-05-29 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
33
15
  name: assert
34
- version_requirements: *id001
35
- prerelease: false
36
- - !ruby/object:Gem::Dependency
37
- requirement: &id002 !ruby/object:Gem::Requirement
38
- none: false
39
- requirements:
40
- - - ~>
41
- - !ruby/object:Gem::Version
42
- hash: 15
43
- segments:
44
- - 1
45
- - 0
46
- version: "1.0"
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '2.12'
47
21
  type: :development
48
- name: assert-rack-test
49
- version_requirements: *id002
50
22
  prerelease: false
51
- - !ruby/object:Gem::Dependency
52
- requirement: &id003 !ruby/object:Gem::Requirement
53
- none: false
54
- requirements:
55
- - - ~>
56
- - !ruby/object:Gem::Version
57
- hash: 7
58
- segments:
59
- - 1
60
- - 4
61
- version: "1.4"
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '2.12'
28
+ - !ruby/object:Gem::Dependency
29
+ name: assert-rack-test
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '1.0'
62
35
  type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - "~>"
40
+ - !ruby/object:Gem::Version
41
+ version: '1.0'
42
+ - !ruby/object:Gem::Dependency
63
43
  name: sinatra
64
- version_requirements: *id003
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - "~>"
47
+ - !ruby/object:Gem::Version
48
+ version: '1.4'
49
+ type: :development
65
50
  prerelease: false
66
- - !ruby/object:Gem::Dependency
67
- requirement: &id004 !ruby/object:Gem::Requirement
68
- none: false
69
- requirements:
70
- - - ~>
71
- - !ruby/object:Gem::Version
72
- hash: 13
73
- segments:
74
- - 1
75
- - 1
76
- version: "1.1"
77
- type: :runtime
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - "~>"
54
+ - !ruby/object:Gem::Version
55
+ version: '1.4'
56
+ - !ruby/object:Gem::Dependency
78
57
  name: ns-options
79
- version_requirements: *id004
80
- prerelease: false
81
- - !ruby/object:Gem::Dependency
82
- requirement: &id005 !ruby/object:Gem::Requirement
83
- none: false
84
- requirements:
85
- - - ~>
86
- - !ruby/object:Gem::Version
87
- hash: 15
88
- segments:
89
- - 1
90
- - 0
91
- version: "1.0"
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '1.1'
92
63
  type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '1.1'
70
+ - !ruby/object:Gem::Dependency
93
71
  name: rack
94
- version_requirements: *id005
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - "~>"
75
+ - !ruby/object:Gem::Version
76
+ version: '1.0'
77
+ type: :runtime
95
78
  prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: '1.0'
96
84
  description: Digest and serve HTML asset files
97
- email:
85
+ email:
98
86
  - kelly@kellyredding.com
99
87
  - collin.redding@me.com
100
88
  executables: []
101
-
102
89
  extensions: []
103
-
104
90
  extra_rdoc_files: []
105
-
106
- files:
107
- - .gitignore
91
+ files:
92
+ - ".gitignore"
108
93
  - Gemfile
109
94
  - LICENSE.txt
110
95
  - README.md
@@ -157,39 +142,30 @@ files:
157
142
  - test/unit/source_tests.rb
158
143
  - tmp/.gitkeep
159
144
  homepage: http://github.com/redding/dassets
160
- licenses:
145
+ licenses:
161
146
  - MIT
147
+ metadata: {}
162
148
  post_install_message:
163
149
  rdoc_options: []
164
-
165
- require_paths:
150
+ require_paths:
166
151
  - lib
167
- required_ruby_version: !ruby/object:Gem::Requirement
168
- none: false
169
- requirements:
152
+ required_ruby_version: !ruby/object:Gem::Requirement
153
+ requirements:
170
154
  - - ">="
171
- - !ruby/object:Gem::Version
172
- hash: 3
173
- segments:
174
- - 0
175
- version: "0"
176
- required_rubygems_version: !ruby/object:Gem::Requirement
177
- none: false
178
- requirements:
155
+ - !ruby/object:Gem::Version
156
+ version: '0'
157
+ required_rubygems_version: !ruby/object:Gem::Requirement
158
+ requirements:
179
159
  - - ">="
180
- - !ruby/object:Gem::Version
181
- hash: 3
182
- segments:
183
- - 0
184
- version: "0"
160
+ - !ruby/object:Gem::Version
161
+ version: '0'
185
162
  requirements: []
186
-
187
163
  rubyforge_project:
188
- rubygems_version: 1.8.25
164
+ rubygems_version: 2.4.5
189
165
  signing_key:
190
- specification_version: 3
166
+ specification_version: 4
191
167
  summary: Digested asset files
192
- test_files:
168
+ test_files:
193
169
  - test/helper.rb
194
170
  - test/support/app.rb
195
171
  - test/support/app/assets/file1.txt