mill 0.8.4 → 0.9

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
  SHA256:
3
- metadata.gz: c8b00dde07ebc45e2b31e617fbd4172cc2466acf9530543e3b9411bfdc7befee
4
- data.tar.gz: 132eb25e65ad17e7cc79e4b97f7c5f4f9bd6599d55e7579672ea568fdc9aa361
3
+ metadata.gz: 1e59024a120fab01c1be04139e6b1e755fc5c8c03df9b60dc135d8019835b7b3
4
+ data.tar.gz: bc42f2545ee344df15d4d823eceec401596fc7f037504a9c696449d6014d11c3
5
5
  SHA512:
6
- metadata.gz: b4a8c81b1c31e4931e1b0008a615f0b34369ca4158a2eb7fbefc6e1413c2f087f8fa04e504eea72bb772b869c1baae091b378df8bdb65b6c91d9bcb51ab5b014
7
- data.tar.gz: 735816537e112036967833b72fab301211138e471d5bb326855acf93bee7ce6016880e4bbc403206ac832b85de92def7737e22e58093cdb844d0d110e7a09098
6
+ metadata.gz: 0eecd05938e2fca88be4ede5eb43f831df2e6b661b7a67e2b582a2c25d52913f9a827ecc936d52d44d5fdf25f03b438d8fbff4371bfebaab3fc260c49e1c4e0a
7
+ data.tar.gz: 8e0fc3c3f4daee988d511584507362fd9bee8c9bc28f2385308636e0de08632790f4992baeebe3a3668093ce7131eba1214a6aee94435b65aadca6dcd61ccdeb
@@ -15,6 +15,7 @@ require 'mill/error'
15
15
  require 'mill/html_helpers'
16
16
  require 'mill/navigator'
17
17
  require 'mill/resource'
18
+ require 'mill/resources/blob'
18
19
  require 'mill/resources/feed'
19
20
  require 'mill/resources/google_site_verification'
20
21
  require 'mill/resources/image'
@@ -0,0 +1,42 @@
1
+ module Mill
2
+
3
+ class Resource
4
+
5
+ class Blob < Resource
6
+
7
+ FileTypes = %w{
8
+ application/pdf
9
+
10
+ application/zip
11
+
12
+ application/ecmascript
13
+ application/javascript
14
+ text/ecmascript
15
+ text/javascript
16
+ application/x-javascript
17
+
18
+ font/otf
19
+ application/font-sfnt
20
+ application/x-font-opentype
21
+ application/x-font-otf
22
+
23
+ application/mp4
24
+ audio/mpeg
25
+ audio/mp4
26
+ video/mp4
27
+ video/vnd.objectvideo
28
+ video/quicktime
29
+
30
+ application/msword
31
+ application/word
32
+ application/x-msword
33
+ application/x-word
34
+ application/vnd.ms-powerpoint
35
+ application/powerpoint
36
+ }
37
+
38
+ end
39
+
40
+ end
41
+
42
+ end
@@ -157,9 +157,33 @@ module Mill
157
157
  end
158
158
 
159
159
  def list
160
+
161
+ list_keys = {
162
+ class: proc { |v| v.to_s.sub(/::Resource::/, '::') },
163
+ input_file: proc { |v| v.relative_to(@input_dir) },
164
+ output_file: proc { |v| v.relative_to(@output_dir) },
165
+ public: proc { |v| v },
166
+ content: proc { |v| '%dKB' % (v.to_s.length / 1024.0).ceil },
167
+ }
168
+
160
169
  build
161
- on_each_resource do |resource|
162
- puts resource.inspect
170
+ list = @resources.map do |resource|
171
+ Hash[
172
+ list_keys.map do |k, p|
173
+ v = resource.send(k)
174
+ [
175
+ k,
176
+ v ? p.call(v).to_s : '-'
177
+ ]
178
+ end
179
+ ]
180
+ end
181
+ format = list_keys.keys.map do |key|
182
+ '%%-%ds' % list.map { |item| item[key].length }.max
183
+ end.join(' ')
184
+ puts format % list_keys.keys
185
+ list.each do |item|
186
+ puts format % item.values
163
187
  end
164
188
  end
165
189
 
@@ -269,7 +293,7 @@ module Mill
269
293
  if type && (klass = @file_types[type.content_type])
270
294
  klass
271
295
  else
272
- Resource
296
+ raise Error, "Unknown file type: #{file.to_s.inspect} (#{MIME::Types.of(file.to_s).join(', ')})"
273
297
  end
274
298
  end
275
299
 
@@ -1,5 +1,5 @@
1
1
  module Mill
2
2
 
3
- VERSION = '0.8.4'
3
+ VERSION = '0.9'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mill
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.4
4
+ version: '0.9'
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Labovitz
@@ -196,6 +196,7 @@ files:
196
196
  - lib/mill/html_helpers.rb
197
197
  - lib/mill/navigator.rb
198
198
  - lib/mill/resource.rb
199
+ - lib/mill/resources/blob.rb
199
200
  - lib/mill/resources/dir.rb
200
201
  - lib/mill/resources/feed.rb
201
202
  - lib/mill/resources/google_site_verification.rb