yokunai 0.1.5 → 0.1.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4b9c0e99195305885f6b8bb7fc5b95c12ecb3b97
4
- data.tar.gz: 6239c14f0ac81cc28209e2710a7bcf2c6d64c26e
3
+ metadata.gz: 5306a5167ecfbaa42133687d8a78a3a6ec6278c4
4
+ data.tar.gz: a969165747cddf523c13383b8f8f88418164874b
5
5
  SHA512:
6
- metadata.gz: 7fcd44d832c315b88c97ada60a21552d1961cbbaf8cbe7a97f59802e25972bd0a34d230b1f15cc3f81c6d910612a5ad1c579aea4ee4c3d06dff8922ff695cbe0
7
- data.tar.gz: 68302c4671305859f6ca29f4eb4794c041d98420fb61a8638bd18df731369b74d65aa70bd0ed185a2d325929a9415203f6ee59e365584ff13867f6b9ed84a3da
6
+ metadata.gz: '094e70a4ebfaf3fbe46d07b4d3ae9a41136dc4c7375c6b5d9d5f1be9479a7a00165e6d917651f510748fd576b415ff9ade4ef804da84f25ddafe99eb71bbe333'
7
+ data.tar.gz: cfa7566e59937c64d352f02e29d232907f4af25ec6dda244dab223866dfe30ddbcbe12175ba5b5d87581d91e5f0ec331cb7163a6d19d04745557ec1548ee8d2b
@@ -1,4 +1,6 @@
1
- # よくない [![Build Status](https://ci.blackieops.com/buildStatus/icon?job=yokunai-tests)](https://ci.blackieops.com/job/yokunai-tests/)
1
+ # よくない
2
+
3
+ [![CI Build Status](https://ci.blackieops.com/job/alexblackie/job/yokunai/job/master/badge/icon)](https://ci.blackieops.com/job/alexblackie/job/yokunai/job/master/)
2
4
 
3
5
  It's not very good.
4
6
 
@@ -6,7 +6,19 @@ module Yokunai
6
6
  # Any key in this hash can be overridden in your app's `config/*.yml`.
7
7
  DEFAULT_CONFIGURATION = {
8
8
  "template_dir" => "web/views",
9
- "asset_dir" => "web/assets"
9
+ "asset_dir" => "web/assets",
10
+
11
+ # This provides an extension point for pre-processing of static assets
12
+ # on-the-fly. Takes the mime type as a key, and the string of a classname
13
+ # as the value -- the class-level method `.process` will be called with
14
+ # the asset's body as the only argument.
15
+ #
16
+ # Example:
17
+ #
18
+ # { "text/css" => "MyApp::Minifier" }
19
+ #
20
+ # ... will call MyApp::Minifier.process(asset_body)
21
+ "asset_hooks" => {}
10
22
  }.freeze
11
23
 
12
24
  # Set the base directory path.
@@ -3,11 +3,17 @@ module Yokunai
3
3
 
4
4
  def get
5
5
  asset_dir = File.join(Yokunai::Config.base_dir, Yokunai::Config.get("asset_dir"))
6
+ asset_hooks = Yokunai::Config.get("asset_hooks")
6
7
  asset_file = File.join(asset_dir, @captures[:name])
7
8
 
8
9
  if File.exist?(asset_file)
9
10
  mime = Yokunai::Mime.detect_from_path(asset_file)
10
11
  asset_body = File.read(asset_file)
12
+ if processor = asset_hooks[mime]
13
+ asset_body = Object.
14
+ const_get(processor).
15
+ public_send(:process, asset_body)
16
+ end
11
17
 
12
18
  respond(body: asset_body, headers: { "Content-Type" => mime })
13
19
  else
@@ -1,3 +1,3 @@
1
1
  module Yokunai
2
- VERSION = "0.1.5".freeze
2
+ VERSION = "0.1.6".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yokunai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Blackie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-07 00:00:00.000000000 Z
11
+ date: 2018-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -78,7 +78,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
78
78
  version: '0'
79
79
  requirements: []
80
80
  rubyforge_project:
81
- rubygems_version: 2.6.13
81
+ rubygems_version: 2.6.11
82
82
  signing_key:
83
83
  specification_version: 4
84
84
  summary: Helps you make really simple dynamic Internet Web Pages.