linner 0.6.3 → 0.6.4

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: 56eddb6bdd3b9a4d268b59282e61043e30d25fca
4
- data.tar.gz: 873ebb2984003054d1e79a2a0c60b5e30e949270
3
+ metadata.gz: e785dfaa4d3d75d851dc95472e4b4c67498136cb
4
+ data.tar.gz: 5b7fca59e81147ce0d9038c702620399e6391d91
5
5
  SHA512:
6
- metadata.gz: 1c27b05cd161ec9099c94a716ad2f330774f48d7429202820a7bfb77316b0b22110f2e24c24f4c027d906fa4235dccaee8c718c534abd0294c450c661f1e3e35
7
- data.tar.gz: 7a1a5eec0c249738b742487f73c944870902fee854fe34901fa4d394602e51cc3b05057d7918e9d5116ec01521d19d22690c1d98dc3082486d8b7bc7bf7937c5
6
+ metadata.gz: c8b479fc61a9697c2122ab51001ba0f0df96d0b9aeed1b0644fc66620ab9e46f0eeae4138aebc66f7acb588d568f4cb28589daf6550e115f34dfaa0d03e6ca92
7
+ data.tar.gz: 1df1468c43a72ab91ed8f5c2e3d1b47eb7f98dc6400ab878fe85621d58c13d5f820e6a6a420136caa55b331c17c304433eebf53969593fcd1527b7c0a589222e
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ v0.6.4
2
+ - copy task now support render and compress
3
+ - fix cache problem when same asset in different linner task
4
+
1
5
  v0.6.3
2
6
  - support sprite revision
3
7
 
data/lib/linner.rb CHANGED
@@ -118,7 +118,7 @@ module Linner
118
118
  config["concat"].each_with_index do |pair, index|
119
119
  dest, pattern, order = pair.first, pair.last, config["order"]||[]
120
120
  matches = Dir.glob(pattern).sort_by(&:downcase).order_by(order)
121
- next if matches.select {|p| cache.miss? p}.empty?
121
+ next if matches.select {|path| cache.miss?(dest, path)}.empty?
122
122
  write_asset(dest, matches)
123
123
  end
124
124
  end
@@ -126,11 +126,20 @@ module Linner
126
126
  def copy(config)
127
127
  config["copy"].each do |dest, pattern|
128
128
  Dir.glob(pattern).each do |path|
129
- next if not cache.miss?(path)
130
- logical_path = Asset.new(path).logical_path
131
- dest_path = File.join(env.public_folder, dest, logical_path)
132
- FileUtils.mkdir_p File.dirname(dest_path)
133
- FileUtils.cp_r path, dest_path
129
+ next if not cache.miss?(dest, path)
130
+ asset = Asset.new(path)
131
+ dest_path = File.join(env.public_folder, dest, asset.logical_path)
132
+ if asset.javascript? or asset.stylesheet?
133
+ asset.content
134
+ asset.compress if compile?
135
+ dest_path = dest_path.sub(/[^.]+\z/,"js") if asset.javascript?
136
+ dest_path = dest_path.sub(/[^.]+\z/,"css") if asset.stylesheet?
137
+ asset.path = dest_path
138
+ asset.write
139
+ else
140
+ FileUtils.mkdir_p File.dirname(dest_path)
141
+ FileUtils.cp_r path, dest_path
142
+ end
134
143
  end
135
144
  end
136
145
  end
@@ -138,7 +147,7 @@ module Linner
138
147
  def precompile(config)
139
148
  config["precompile"].each do |dest, pattern|
140
149
  matches = Dir.glob(pattern).sort_by(&:downcase)
141
- next if matches.select { |p| cache.miss? p }.empty?
150
+ next if matches.select { |path| cache.miss?(dest, path) }.empty?
142
151
  write_template(dest, matches)
143
152
  end
144
153
  end
@@ -146,7 +155,7 @@ module Linner
146
155
  def sprite(config)
147
156
  config["sprite"].each do |dest, pattern|
148
157
  matches = Dir.glob(pattern).sort_by(&:downcase)
149
- next if matches.select { |p| cache.miss? p }.empty?
158
+ next if matches.select { |path| cache.miss?(dest, path) }.empty?
150
159
  paint_sprite(dest, matches)
151
160
  end
152
161
  end
@@ -183,7 +192,7 @@ module Linner
183
192
 
184
193
  def write_template(dest, child_assets)
185
194
  asset = Asset.new(File.join env.public_folder, dest)
186
- content = child_assets.inject("") {|s, m| s << cache[m].content}
195
+ content = child_assets.inject("") {|s, m| s << cache["#{dest}:#{m}"].content}
187
196
  asset.content = Wrapper::Template.definition(content)
188
197
  asset.compress if compile?
189
198
  asset.write
@@ -192,7 +201,7 @@ module Linner
192
201
  def write_asset(dest, child_assets)
193
202
  asset = Asset.new(File.join env.public_folder, dest)
194
203
  definition = (asset.path == env.definition ? Wrapper::Module.definition : "")
195
- asset.content = child_assets.inject(definition) {|s, m| s << cache[m].content}
204
+ asset.content = child_assets.inject(definition) {|s, m| s << cache["#{dest}:#{m}"].content}
196
205
  asset.compress if compile?
197
206
  asset.write
198
207
  end
data/lib/linner/cache.rb CHANGED
@@ -1,11 +1,11 @@
1
1
  module Linner
2
2
  class Cache < Hash
3
- def miss? path
3
+ def miss? ns, path
4
4
  asset = Asset.new path
5
- if self[path] and self[path].mtime == asset.mtime
5
+ if self["#{ns}:#{path}"] and self["#{ns}:#{path}"].mtime == asset.mtime
6
6
  false
7
7
  else
8
- self[path] = asset
8
+ self["#{ns}:#{path}"] = asset
9
9
  end
10
10
  end
11
11
 
@@ -9,6 +9,8 @@ module Linner
9
9
  Uglifier.compile asset.content, comments: "none"
10
10
  elsif asset.stylesheet?
11
11
  CSSminify.new.compress asset.content
12
+ else
13
+ asset.content
12
14
  end
13
15
  end
14
16
  end
@@ -1,3 +1,3 @@
1
1
  module Linner
2
- VERSION = "0.6.3"
2
+ VERSION = "0.6.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.3
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Saito
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-28 00:00:00.000000000 Z
11
+ date: 2014-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: reel
@@ -312,7 +312,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
312
312
  version: '0'
313
313
  requirements: []
314
314
  rubyforge_project:
315
- rubygems_version: 2.2.0
315
+ rubygems_version: 2.2.2
316
316
  signing_key:
317
317
  specification_version: 4
318
318
  summary: HTML5 Application Assembler