sinatra-asset-pipeline 2.0.0 → 2.0.1

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: 7332da4671d23881422a9d8c860d2d7c9c660f99b2c251fac14691a4dbd6450d
4
- data.tar.gz: e448fe3ad55a5b1d84e59ef487138fc381f61caf51381c0c72514776119143fa
3
+ metadata.gz: 8940b084da32484db38b94dee13ccaf39091f07ec2cdd7178b50139054478fd3
4
+ data.tar.gz: 73323e81756b6d29e89388f9a5d2b0f3618d29df29a9199e733886dd5c796b60
5
5
  SHA512:
6
- metadata.gz: 8804eacdc6820769cfdd0d905ad9977bb45c1827a9d1416d4b444b419ee31275cb3bc53d911c3b5817d005c5ad6ca631dc0ed6947a8724350450b3128057b4b7
7
- data.tar.gz: 0d26692d3f625b86b17b839e03c8a1c3f934763a11c8d12184911c9a9f398d8b2a3a6f2ee1deed96b89c599ead93b9a9c4bd9d7a1f20c7f8efc335a5d5f07285
6
+ metadata.gz: d2b4d32d885d3f618399601ac2a41f6a6773459ae21e2591ff9b7900fb88f63229a400c829e4d75d9a5a24db85a5e8836df65d6830f42bbfd54273abb90676da
7
+ data.tar.gz: bc13a552c3928a04a1deb6bf858893c7e4b99fe2eb7ea90849f5354e9c4d4407faf7f54316d8d2b501a0e221479f6d577365ab790d9fc0242d29aaa7bfc0e05e
@@ -1,28 +1,58 @@
1
1
  require 'rake'
2
- require 'rake/tasklib'
3
2
  require 'rake/sprocketstask'
3
+ require 'sprockets'
4
4
 
5
5
  module Sinatra
6
6
  module AssetPipeline
7
- class Task < Rake::TaskLib
8
- def initialize(app_klass)
7
+ class Task < Rake::SprocketsTask
8
+ attr_accessor :app
9
+
10
+ def initialize(app = nil)
11
+ self.app = app
12
+ super()
13
+ end
14
+
15
+ def environment
16
+ app ? app.sprockets : super
17
+ end
18
+
19
+ def assets
20
+ app ? app.assets_precompile : super
21
+ end
22
+
23
+ def manifest
24
+ app ? Sprockets::Manifest.new(environment.index, app.assets_public_path) : super
25
+ end
26
+
27
+ def define
9
28
  namespace :assets do
10
- desc "Precompile assets"
29
+ %w( precompile clean clobber ).each { |task| Rake::Task[task].clear if Rake::Task.task_defined?(task) }
30
+
31
+ desc "Compile all assets"
11
32
  task :precompile do
12
- environment = app_klass.sprockets
13
- manifest = ::Sprockets::Manifest.new(environment.index, app_klass.assets_public_path)
14
- manifest.compile(app_klass.assets_precompile)
33
+ with_logger do
34
+ manifest.compile(assets)
35
+ end
36
+ end
37
+
38
+ desc "Remove old compiled assets"
39
+ task :clean, [:keep] do |t, args|
40
+ with_logger do
41
+ manifest.clean(Integer(args.keep || self.keep))
42
+ end
15
43
  end
16
44
 
17
- desc "Clean assets"
18
- task :clean do
19
- FileUtils.rm_rf(app_klass.assets_public_path)
45
+ desc "Remove compiled assets"
46
+ task :clobber do
47
+ with_logger do
48
+ manifest.clobber
49
+ end
20
50
  end
21
51
  end
22
52
  end
23
53
 
24
- def self.define!(app_klass)
25
- self.new app_klass
54
+ def self.define!(app)
55
+ self.new(app)
26
56
  end
27
57
  end
28
58
  end
@@ -1,5 +1,5 @@
1
1
  module Sinatra
2
2
  module AssetPipeline
3
- VERSION = '2.0.0'
3
+ VERSION = '2.0.1'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sinatra-asset-pipeline
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joakim Ekberg
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-17 00:00:00.000000000 Z
11
+ date: 2018-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake