alula 0.4.3 → 0.4.4

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.3
1
+ 0.4.4
data/lib/alula/config.rb CHANGED
@@ -107,6 +107,7 @@ module Alula
107
107
  assets: {
108
108
  production: {
109
109
  compress: true,
110
+ gzip: true,
110
111
  },
111
112
  },
112
113
 
@@ -1,5 +1,4 @@
1
1
  require 'alula/core_ext/tag'
2
2
  require 'alula/core_ext/filter'
3
3
 
4
- require 'alula/core_ext/manifest'
5
4
  require 'alula/core_ext/environment'
data/lib/alula/site.rb CHANGED
@@ -335,11 +335,16 @@ module Alula
335
335
  progress.create :assets, title: "Compiling assets", total: @environment.each_logical_path.count
336
336
  progress.display
337
337
 
338
- @manifest = Manifest.new(@environment, @storage.path(:assets))
339
- @manifest.progress = -> { progress.step(:assets) }
340
-
341
- @manifest.compile
342
-
338
+ @environment.each_logical_path do |logical_path|
339
+ if asset = @environment.find_asset(logical_path)
340
+ target = File.join(@storage.path(:assets), asset.digest_path)
341
+ asset.write_to(target)
342
+ asset.write_to("#{target}.gz") if target =~ /\.(css|js)$/ and self.config.assets.gzip
343
+ end
344
+
345
+ progress.step :assets
346
+ end
347
+
343
348
  progress.finish(:assets)
344
349
  progress.hide
345
350
  end
@@ -394,10 +399,12 @@ module Alula
394
399
  say "==> Cleaning up"
395
400
 
396
401
  asset_path = @storage.path(:assets)
397
- assets = @environment.used
398
- .collect{|u| @environment[u]}
399
- .reject{|u| u.nil?}
400
- .collect{|u| File.join(asset_path, u.digest_path)}
402
+ assets = @environment.used.collect do |asset_name|
403
+ if asset = @environment[asset_name]
404
+ filename = File.join(asset_path, asset.digest_path)
405
+ [filename, self.config.assets.gzip ? "#{filename}.gz" : ""]
406
+ end
407
+ end.flatten.reject { |u| u.nil? or !File.exists?(u) }
401
408
  outputted = @storage.outputted.reject{|o|o[/^#{asset_path}/]}
402
409
 
403
410
  keep = (assets + outputted).collect{|p| File.expand_path(p)}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alula
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -478,7 +478,6 @@ files:
478
478
  - lib/alula/core_ext/environment.rb
479
479
  - lib/alula/core_ext/filter.rb
480
480
  - lib/alula/core_ext/filters/smilies.rb
481
- - lib/alula/core_ext/manifest.rb
482
481
  - lib/alula/core_ext/tag.rb
483
482
  - lib/alula/core_ext/tags/attachment.rb
484
483
  - lib/alula/core_ext/tags/blockquote.rb
@@ -644,7 +643,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
644
643
  version: '0'
645
644
  segments:
646
645
  - 0
647
- hash: -1741549545950359513
646
+ hash: -1743979110796598187
648
647
  required_rubygems_version: !ruby/object:Gem::Requirement
649
648
  none: false
650
649
  requirements:
@@ -653,7 +652,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
653
652
  version: '0'
654
653
  segments:
655
654
  - 0
656
- hash: -1741549545950359513
655
+ hash: -1743979110796598187
657
656
  requirements: []
658
657
  rubyforge_project:
659
658
  rubygems_version: 1.8.23
@@ -1,30 +0,0 @@
1
- require 'sprockets/manifest'
2
-
3
- module Alula
4
- class Manifest < Sprockets::Manifest
5
- attr_accessor :progress
6
-
7
- def assets_with_tracking
8
- @_assets ||= AssetTracker.new assets_without_tracking, @progress
9
- end
10
- alias_method :assets_without_tracking, :assets
11
- alias_method :assets, :assets_with_tracking
12
-
13
- private
14
- class AssetTracker
15
- def initialize(hash, progress_callback)
16
- @hash = hash
17
- @progress_cb = progress_callback
18
- end
19
-
20
- def [](key)
21
- @hash[key]
22
- end
23
-
24
- def []=(key, value)
25
- @hash[key] = value
26
- @progress_cb.call if @progress_cb
27
- end
28
- end
29
- end
30
- end