bunto-assets 1.0.0.pre.alpha

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.
Files changed (48) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +19 -0
  3. data/LICENSE +21 -0
  4. data/README.md +275 -0
  5. data/Rakefile +3 -0
  6. data/lib/bunto/assets/addons/autoprefixer.rb +13 -0
  7. data/lib/bunto/assets/addons/bootstrap.rb +7 -0
  8. data/lib/bunto/assets/addons/font_awesome.rb +7 -0
  9. data/lib/bunto/assets/addons/javascript.rb +11 -0
  10. data/lib/bunto/assets/cached.rb +20 -0
  11. data/lib/bunto/assets/config.rb +76 -0
  12. data/lib/bunto/assets/env.rb +207 -0
  13. data/lib/bunto/assets/hook.rb +78 -0
  14. data/lib/bunto/assets/hooks/bunto/drops.rb +9 -0
  15. data/lib/bunto/assets/hooks/bunto/setup.rb +13 -0
  16. data/lib/bunto/assets/hooks/bunto/write.rb +9 -0
  17. data/lib/bunto/assets/hooks/cache.rb +15 -0
  18. data/lib/bunto/assets/hooks/compression.rb +17 -0
  19. data/lib/bunto/assets/hooks/configuration.rb +12 -0
  20. data/lib/bunto/assets/hooks/context.rb +11 -0
  21. data/lib/bunto/assets/hooks/erb.rb +15 -0
  22. data/lib/bunto/assets/hooks/helpers.rb +14 -0
  23. data/lib/bunto/assets/hooks/logger.rb +9 -0
  24. data/lib/bunto/assets/hooks/sources.rb +13 -0
  25. data/lib/bunto/assets/hooks/sprockets.rb +9 -0
  26. data/lib/bunto/assets/hooks/version.rb +11 -0
  27. data/lib/bunto/assets/hooks.rb +20 -0
  28. data/lib/bunto/assets/liquid/drop.rb +76 -0
  29. data/lib/bunto/assets/liquid/filters.rb +28 -0
  30. data/lib/bunto/assets/liquid/tag/defaults/image.rb +69 -0
  31. data/lib/bunto/assets/liquid/tag/defaults.rb +23 -0
  32. data/lib/bunto/assets/liquid/tag/parser.rb +200 -0
  33. data/lib/bunto/assets/liquid/tag/proxied_asset.rb +114 -0
  34. data/lib/bunto/assets/liquid/tag/proxies.rb +118 -0
  35. data/lib/bunto/assets/liquid/tag.rb +203 -0
  36. data/lib/bunto/assets/liquid.rb +15 -0
  37. data/lib/bunto/assets/logger.rb +59 -0
  38. data/lib/bunto/assets/patches/bunto/cleaner.rb +16 -0
  39. data/lib/bunto/assets/patches/bunto/site.rb +11 -0
  40. data/lib/bunto/assets/patches/kernel.rb +29 -0
  41. data/lib/bunto/assets/patches/sprockets/asset.rb +21 -0
  42. data/lib/bunto/assets/patches.rb +10 -0
  43. data/lib/bunto/assets/processors/liquid.rb +42 -0
  44. data/lib/bunto/assets/proxies/magick.rb +155 -0
  45. data/lib/bunto/assets/version.rb +11 -0
  46. data/lib/bunto/assets.rb +24 -0
  47. data/lib/bunto-assets.rb +7 -0
  48. metadata +197 -0
@@ -0,0 +1,78 @@
1
+ # ----------------------------------------------------------------------------
2
+ # Frozen-string-literal: true
3
+ # Copyright: 2016-present - MIT License
4
+ # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
6
+
7
+ module Bunto
8
+ module Assets
9
+ class Hook
10
+ class UnknownHookError < RuntimeError
11
+ def initialize(base: nil, point: nil)
12
+ super "Unknown hook #{base ? "base" : "point"} '#{base || point}'"
13
+ end
14
+ end
15
+
16
+ # ----------------------------------------------------------------------
17
+
18
+ HOOK_ALIASES = {
19
+ :env => {
20
+ :post_init => :init,
21
+ :pre_init => :init
22
+ }
23
+ }
24
+
25
+ # ----------------------------------------------------------------------
26
+
27
+ HOOK_POINTS = {
28
+ :env => [
29
+ :init
30
+ ]
31
+ }
32
+
33
+ # ----------------------------------------------------------------------
34
+
35
+ def self.all
36
+ @_all ||= {}
37
+ end
38
+
39
+ # ----------------------------------------------------------------------
40
+ # Trigger a hook, giving an optional block where we pass you the,
41
+ # proc we got and then you can do as you please (such as instance eval)
42
+ # but if you do not give us one then we simply pass the args.
43
+ # ----------------------------------------------------------------------
44
+
45
+ def self.trigger(base, point_, *args, &block)
46
+ raise ArgumentError, "Do not give args with a block" if args.size > 0 && block_given?
47
+ if all.key?(base) && all[base].key?(point_)
48
+ Set.new.merge(point(base, point_, :early)).merge(point(base, point_)).map do |v|
49
+ block_given?? block.call(v) : v.call(*args)
50
+ end
51
+ end
52
+ end
53
+
54
+ # ----------------------------------------------------------------------
55
+
56
+ def self.point(base, point, when_ = :late)
57
+ point = all[base][point] ||= {
58
+ :early => Set.new,
59
+ :late => Set.new
60
+ }
61
+
62
+ point[when_]
63
+ end
64
+
65
+ # ----------------------------------------------------------------------
66
+
67
+ def self.register(base, point, when_ = :late, &block)
68
+ raise UnknownHookError, base: base unless HOOK_POINTS.key?(base)
69
+ point = HOOK_ALIASES[base][point] if HOOK_ALIASES.fetch(base, {}).key?(point)
70
+ raise UnknownHookError, point: point unless HOOK_POINTS[base].include?(point)
71
+ all[base] ||= {}
72
+
73
+ point(base, point, when_) \
74
+ .add(block)
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,9 @@
1
+ # ----------------------------------------------------------------------------
2
+ # Frozen-string-literal: true
3
+ # Copyright: 2016-present - MIT License
4
+ # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
6
+
7
+ Bunto::Hooks.register :site, :pre_render do |bunto, payload|
8
+ payload["assets"] = bunto.sprockets.to_liquid_payload
9
+ end
@@ -0,0 +1,13 @@
1
+ # ----------------------------------------------------------------------------
2
+ # Frozen-string-literal: true
3
+ # Copyright: 2016-present - MIT License
4
+ # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
6
+
7
+ Bunto::Hooks.register :site, :after_reset do |bunto|
8
+ Bunto::Assets::Env.new(bunto)
9
+
10
+ excludes = Set.new(bunto.config["exclude"])
11
+ bunto.sprockets.excludes.map(&excludes.method(:add))
12
+ bunto.config["exclude"] = excludes.to_a
13
+ end
@@ -0,0 +1,9 @@
1
+ # ----------------------------------------------------------------------------
2
+ # Frozen-string-literal: true
3
+ # Copyright: 2016-present - MIT License
4
+ # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
6
+
7
+ Bunto::Hooks.register :site, :post_write do |bunto|
8
+ bunto.sprockets.write_all
9
+ end
@@ -0,0 +1,15 @@
1
+ # ----------------------------------------------------------------------------
2
+ # Frozen-string-literal: true
3
+ # Copyright: 2016-present - MIT License
4
+ # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
6
+
7
+ Bunto::Assets::Hook.register :env, :init do
8
+ cache_dir = asset_config.fetch("cache", ".asset-cache")
9
+
10
+ if cache_dir
11
+ self.cache = Sprockets::Cache::FileStore.new(
12
+ bunto.in_source_dir(cache_dir)
13
+ )
14
+ end
15
+ end
@@ -0,0 +1,17 @@
1
+ # ----------------------------------------------------------------------------
2
+ # Frozen-string-literal: true
3
+ # Copyright: 2016-present - MIT License
4
+ # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
6
+
7
+ Bunto::Assets::Hook.register :env, :init do
8
+ if compress?("css")
9
+ self.css_compressor = :sass
10
+ end
11
+
12
+ if compress?("js")
13
+ try_require "uglifier" do
14
+ self.js_compressor = :uglify
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,12 @@
1
+ # ----------------------------------------------------------------------------
2
+ # Frozen-string-literal: true
3
+ # Copyright: 2016-present - MIT License
4
+ # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
6
+
7
+ Bunto::Assets::Hook.register :env, :init, :early do
8
+ bunto.config["assets"] = Bunto::Assets::Config.merge(asset_config)
9
+ Bunto::Assets::Config.merge_sources(
10
+ bunto, asset_config
11
+ )
12
+ end
@@ -0,0 +1,11 @@
1
+ # ----------------------------------------------------------------------------
2
+ # Frozen-string-literal: true
3
+ # Copyright: 2016-present - MIT License
4
+ # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
6
+
7
+ Bunto::Assets::Hook.register :env, :init do
8
+ context_class.class_eval(
9
+ &self.class.context_patches
10
+ )
11
+ end
@@ -0,0 +1,15 @@
1
+ # ----------------------------------------------------------------------------
2
+ # Frozen-string-literal: true
3
+ # Copyright: 2016-present - MIT License
4
+ # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
6
+
7
+ Bunto::Assets::Hook.register :env, :init, :early do
8
+ self.config = hash_reassoc(config, :engines) do |hash|
9
+ hash.delete(
10
+ ".erb"
11
+ )
12
+
13
+ hash
14
+ end
15
+ end
@@ -0,0 +1,14 @@
1
+ # ----------------------------------------------------------------------------
2
+ # Frozen-string-literal: true
3
+ # Copyright: 2016-present - MIT License
4
+ # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
6
+
7
+ require "sprockets/helpers"
8
+
9
+ Bunto::Assets::Hook.register :env, :init do
10
+ Sprockets::Helpers.configure do |config|
11
+ config.prefix = prefix_path
12
+ config.digest = digest?
13
+ end
14
+ end
@@ -0,0 +1,9 @@
1
+ # ----------------------------------------------------------------------------
2
+ # Frozen-string-literal: true
3
+ # Copyright: 2016-present - MIT License
4
+ # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
6
+
7
+ Bunto::Assets::Hook.register :env, :init do
8
+ self.logger = Bunto::Assets::Logger.new
9
+ end
@@ -0,0 +1,13 @@
1
+ # ----------------------------------------------------------------------------
2
+ # Frozen-string-literal: true
3
+ # Copyright: 2016-present - MIT License
4
+ # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
6
+
7
+ Bunto::Assets::Hook.register :env, :init do
8
+ asset_config["sources"] ||= []
9
+
10
+ asset_config["sources"].each do |path|
11
+ append_path bunto.in_source_dir(path)
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ # ----------------------------------------------------------------------------
2
+ # Frozen-string-literal: true
3
+ # Copyright: 2016-present - MIT License
4
+ # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
6
+
7
+ Bunto::Assets::Hook.register :env, :init do
8
+ bunto.sprockets = self
9
+ end
@@ -0,0 +1,11 @@
1
+ # ----------------------------------------------------------------------------
2
+ # Frozen-string-literal: true
3
+ # Copyright: 2016-present - MIT License
4
+ # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
6
+
7
+ Bunto::Assets::Hook.register :env, :init do
8
+ self.version = Digest::MD5.hexdigest(
9
+ asset_config.inspect
10
+ )
11
+ end
@@ -0,0 +1,20 @@
1
+ # ----------------------------------------------------------------------------
2
+ # Frozen-string-literal: true
3
+ # Copyright: 2016-present - MIT License
4
+ # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
6
+
7
+ require_relative "hooks/bunto/drops"
8
+ require_relative "hooks/bunto/setup"
9
+ require_relative "hooks/bunto/write"
10
+
11
+ require_relative "hooks/context"
12
+ require_relative "hooks/compression"
13
+ require_relative "hooks/configuration"
14
+ require_relative "hooks/helpers"
15
+ require_relative "hooks/logger"
16
+ require_relative "hooks/sources"
17
+ require_relative "hooks/sprockets"
18
+ require_relative "hooks/version"
19
+ require_relative "hooks/cache"
20
+ require_relative "hooks/erb"
@@ -0,0 +1,76 @@
1
+ # ----------------------------------------------------------------------------
2
+ # Frozen-string-literal: true
3
+ # Copyright: 2016-present - MIT License
4
+ # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
6
+
7
+ require "fastimage"
8
+
9
+ module Bunto
10
+ module Assets
11
+ module Liquid
12
+ class Drop < ::Liquid::Drop
13
+ extend Forwardable
14
+ def initialize(path, bunto)
15
+ @path = path
16
+ @bunto = bunto
17
+ @asset = nil
18
+ end
19
+
20
+ # --------------------------------------------------------------------
21
+
22
+ def_delegator :asset, :digest_path
23
+ def_delegator :asset, :logical_path
24
+ def_delegator :asset, :content_type, :type
25
+ def_delegator :asset, :content_type
26
+ def_delegator :asset, :filename
27
+
28
+ # --------------------------------------------------------------------
29
+
30
+ def basename
31
+ File.basename(@path)
32
+ end
33
+
34
+ # --------------------------------------------------------------------
35
+
36
+ def width
37
+ if image?
38
+ dimensions.first
39
+ end
40
+ end
41
+
42
+ # --------------------------------------------------------------------
43
+
44
+ def height
45
+ if image?
46
+ dimensions.last
47
+ end
48
+ end
49
+
50
+ # --------------------------------------------------------------------
51
+
52
+ def dimensions
53
+ if image?
54
+ @dimensions ||= FastImage.new(asset.filename).size
55
+ end
56
+ end
57
+
58
+ # --------------------------------------------------------------------
59
+
60
+ private
61
+ def image?
62
+ %W(image/png image/jpeg image/gif).include?(
63
+ asset.content_type
64
+ )
65
+ end
66
+
67
+ # --------------------------------------------------------------------
68
+
69
+ private
70
+ def asset
71
+ @asset ||= @bunto.sprockets.find_asset(@path)
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,28 @@
1
+ # Frozen-string-literal: true
2
+ # Copyright: 2016-present - MIT License
3
+ # Encoding: utf-8
4
+
5
+ module Bunto
6
+ module Assets
7
+ module Liquid
8
+ module Filters
9
+ ACCEPTABLE_FILTERS = [:css, :img, :asset_path, :stylesheet,
10
+ :javascript, :style, :img, :js]
11
+
12
+ # --------------------------------------------------------------------
13
+
14
+ ACCEPTABLE_FILTERS.each do |val|
15
+ define_method val do |path, args = ""|
16
+ Tag.send(:new, val, "#{path} #{args}", "").render(@context)
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+
24
+ # ----------------------------------------------------------------------------
25
+ # Register it with Liquid, good luck from here.
26
+ # ----------------------------------------------------------------------------
27
+
28
+ Liquid::Template.register_filter(Bunto::Assets::Liquid::Filters)
@@ -0,0 +1,69 @@
1
+ # ----------------------------------------------------------------------------
2
+ # Frozen-string-literal: true
3
+ # Copyright: 2016-present - MIT License
4
+ # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
6
+
7
+ module Bunto
8
+ module Assets
9
+ module Liquid
10
+ class Tag
11
+ module Defaults
12
+ class Image
13
+ def self.for?(tag)
14
+ tag == "img" || tag == "image"
15
+ end
16
+
17
+ # ----------------------------------------------------------------
18
+ # TODO: In 3.0 env needs to be enforced if this is not changed,
19
+ # for now it's not enforced to maintain the 2.0 API.
20
+ # ----------------------------------------------------------------
21
+
22
+ def initialize(args, asset, env = nil)
23
+ @args = args
24
+ @asset = asset
25
+ @env = env
26
+ end
27
+
28
+ # ----------------------------------------------------------------
29
+
30
+ def set!
31
+ set_img_dimensions
32
+ set_img_alt
33
+ end
34
+
35
+ # ----------------------------------------------------------------
36
+ # TODO: 3.0 - Remove the `!@env`
37
+ # ----------------------------------------------------------------
38
+
39
+ private
40
+ def set_img_alt
41
+ if !@env || @env.asset_config["features"]["automatic_img_alt"]
42
+ @args[:html] ||= {}
43
+ unless @args[:html].key?("alt")
44
+ @args[:html]["alt"] = @asset.logical_path
45
+ end
46
+ end
47
+ end
48
+
49
+ # ----------------------------------------------------------------
50
+ # TODO: 3.0 - Remove the `!@env`
51
+ # ----------------------------------------------------------------
52
+
53
+ private
54
+ def set_img_dimensions
55
+ if !@env || @env.asset_config["features"]["automatic_img_size"]
56
+ dimensions = FastImage.new(@asset.filename).size
57
+ return unless dimensions
58
+ @args[:html] ||= {}
59
+
60
+ @args[:html][ "width"] ||= dimensions.first
61
+ @args[:html]["height"] ||= dimensions. last
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,23 @@
1
+ module Bunto
2
+ module Assets
3
+ module Liquid
4
+ class Tag
5
+ module Defaults
6
+ require_relative "defaults/image"
7
+
8
+ # ------------------------------------------------------------------
9
+ # TODO: In 1.0 env needs to be enforced, right now it's not
10
+ # because it's maintain 2.0 API.
11
+ # ------------------------------------------------------------------
12
+
13
+ module_function
14
+ def set_defaults_for!(tag, args, asset, env = nil)
15
+ constants.select { |const| const_get(const).for?(tag) }.each do |const|
16
+ const_get(const).new(args, asset, env).set!
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,200 @@
1
+ # ----------------------------------------------------------------------------
2
+ # Frozen-string-literal: true
3
+ # Copyright: 2016-present - MIT License
4
+ # Encoding: utf-8
5
+ # ----------------------------------------------------------------------------
6
+
7
+ require_relative "proxies"
8
+ require "forwardable"
9
+
10
+ module Bunto
11
+ module Assets
12
+ module Liquid
13
+
14
+ # ----------------------------------------------------------------------
15
+ # Examples:
16
+ # - {% tag value argument:value %}
17
+ # - {% tag value "argument:value" %}
18
+ # - {% tag value argument:"I have spaces" %}
19
+ # - {% tag value argument:value\:with\:colon %}
20
+ # - {% tag value argument:"I can even escape \\: here too!" %}
21
+ # - {% tag value proxy:key:value %}
22
+ # ----------------------------------------------------------------------
23
+
24
+ class Tag
25
+ class Parser
26
+ attr_reader :args, :raw_args
27
+ extend Forwardable
28
+
29
+ def_delegator :@args, :each
30
+ def_delegator :@args, :key?
31
+ def_delegator :@args, :fetch
32
+ def_delegator :@args, :store
33
+ def_delegator :@args, :to_h
34
+ def_delegator :@args, :[]=
35
+ def_delegator :@args, :[]
36
+
37
+ # ------------------------------------------------------------------
38
+
39
+ ACCEPT = {
40
+ "css" => "text/css", "js" => "application/javascript"
41
+ }
42
+
43
+ # ------------------------------------------------------------------
44
+
45
+ class UnescapedColonError < StandardError
46
+ def initialize
47
+ super "Unescaped double colon argument."
48
+ end
49
+ end
50
+
51
+ # ------------------------------------------------------------------
52
+
53
+ class UnknownProxyError < StandardError
54
+ def initialize
55
+ super "Unknown proxy argument."
56
+ end
57
+ end
58
+
59
+ # ------------------------------------------------------------------
60
+
61
+ def initialize(args, tag, processed: false, raw_args: nil)
62
+ if processed && raw_args
63
+ @args = args
64
+ @raw_args = raw_args
65
+ @tag = tag
66
+
67
+ elsif processed && !raw_args
68
+ raise ArgumentError, "You must provide raw_args if you pre-process." \
69
+ "Please provide the raw args."
70
+
71
+ else
72
+ @tag = tag
73
+ @raw_args = args
74
+ parse_raw
75
+ set_accept
76
+ end
77
+ end
78
+
79
+ # ------------------------------------------------------------------
80
+
81
+ def parse_liquid(context)
82
+ return self unless context.is_a?(Object::Liquid::Context)
83
+ liquid = context.registers[:site].liquid_renderer.file("(bunto:assets)")
84
+ out = parse_hash_liquid(to_h, liquid, context)
85
+ self.class.new(out, @tag, raw_args: @raw_args, \
86
+ processed: true)
87
+ end
88
+
89
+ # ------------------------------------------------------------------
90
+
91
+ def to_html
92
+ (self[:html] || {}).map do |key, val|
93
+ %{ #{key}="#{val}"}
94
+ end.join
95
+ end
96
+
97
+ # ------------------------------------------------------------------
98
+
99
+ def proxies
100
+ keys = (args.keys - Proxies.base_keys - [:file, :html])
101
+ args.select do |key, _|
102
+ keys.include?(key)
103
+ end
104
+ end
105
+
106
+ # ------------------------------------------------------------------
107
+
108
+ def proxies?
109
+ proxies.any?
110
+ end
111
+
112
+ # ------------------------------------------------------------------
113
+
114
+ private
115
+ def parse_hash_liquid(hash_, liquid, context)
116
+ hash_.each_with_object({}) do |(key, val), hash|
117
+ val = liquid.parse(val).render(context) if val.is_a?(String)
118
+ val = parse_hash_liquid(val, liquid, context) if val.is_a?(Hash)
119
+ hash[key] = val
120
+ end
121
+ end
122
+
123
+ # ------------------------------------------------------------------
124
+
125
+ private
126
+ def parse_raw
127
+ @args = from_shellwords.each_with_index.each_with_object({}) do |(key, index), hash|
128
+ if index == 0 then hash.store(:file, key)
129
+ elsif key =~ /:/ && (key = key.split(/(?<!\\):/))
130
+ parse_col hash, key
131
+
132
+ else
133
+ (hash[:html] ||= {})[key] = true
134
+ end
135
+
136
+ hash
137
+ end
138
+ end
139
+
140
+ # ------------------------------------------------------------------
141
+
142
+ private
143
+ def parse_col(hash, key)
144
+ key.push(key.delete_at(-1).gsub(/\\:/, ":"))
145
+ return as_proxy hash, key if key.size == 3
146
+ return as_bool_or_html hash, key if key.size == 2
147
+ raise UnescapedColonError
148
+ end
149
+
150
+ # ------------------------------------------------------------------
151
+
152
+ private
153
+ def as_bool_or_html(hash, key)
154
+ okey = key
155
+ key, sub_key = key
156
+ if Proxies.has?(key, @tag, "@#{sub_key}")
157
+ (hash[key.to_sym] ||= {})[sub_key.to_sym] = true
158
+ else
159
+ (hash[:html] ||= {})[key] = \
160
+ okey[1]
161
+ end
162
+ end
163
+
164
+ # ------------------------------------------------------------------
165
+
166
+ private
167
+ def as_proxy(hash, key)
168
+ key, sub_key, val = key
169
+ if Proxies.has?(key, @tag, sub_key)
170
+ (hash[key.to_sym] ||= {})[sub_key.to_sym] = \
171
+ val
172
+
173
+ elsif Proxies.has?(key)
174
+ raise UnknownProxyError
175
+ end
176
+ end
177
+
178
+ # ------------------------------------------------------------------
179
+
180
+ private
181
+ def set_accept
182
+ if ACCEPT.key?(@tag) && (!@args.key?(:sprockets) || \
183
+ !@args[:sprockets].key?(:accept))
184
+
185
+ (@args[:sprockets] ||= {})[:accept] = \
186
+ ACCEPT[@tag]
187
+ end
188
+ end
189
+
190
+ # ------------------------------------------------------------------
191
+
192
+ private
193
+ def from_shellwords
194
+ Shellwords.shellwords(@raw_args)
195
+ end
196
+ end
197
+ end
198
+ end
199
+ end
200
+ end