roda-sprocket_assets 0.0.3 → 0.0.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 +4 -4
- data/lib/roda/plugins/sprocket_assets.rb +5 -4
- data/lib/roda/plugins/sprocket_assets_task.rb +33 -0
- data/roda-sprocket_assets.gemspec +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 59fb874d5a049e75c66234cee655275eb121d67a
|
|
4
|
+
data.tar.gz: 127b593dd11c63ab355b2d4ca78214b5f8c3eac7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0cc8f90d1e787a409fd64b68a4076222a0d97bda8a5a8b1076ed4de30a0eb50549b1d4f7f7493b1abe7a2214e5b9109d85b0ff579843f542a17775b5f797f27a
|
|
7
|
+
data.tar.gz: e10a78d9b75a05eb65ade401b9a2dfbe072afdda09a37a189967cec8c74196140dec420d5d33f478c429a8016d394da0470d6af164a5522f0811a53ee3f8f795
|
|
@@ -9,8 +9,8 @@ class Roda
|
|
|
9
9
|
sprockets: Sprockets::Environment.new,
|
|
10
10
|
precompile: %w(app.js app.css *.png *.jpg *.svg *.eot *.ttf *.woff *.woff2),
|
|
11
11
|
prefix: %w(assets vendor/assets),
|
|
12
|
-
root:
|
|
13
|
-
|
|
12
|
+
root: false,
|
|
13
|
+
public_path: false,
|
|
14
14
|
path_prefix: nil,
|
|
15
15
|
protocol: :http,
|
|
16
16
|
css_compressor: nil,
|
|
@@ -30,6 +30,8 @@ class Roda
|
|
|
30
30
|
opts = app.opts[:sprocket_assets].merge! plugin_opts
|
|
31
31
|
DEFAULTS.each { |k, v| opts[k] = v unless opts.key?(k) }
|
|
32
32
|
|
|
33
|
+
%i(root public_path).each { |type| raise "#{type} needs to be set." unless opts[type] }
|
|
34
|
+
|
|
33
35
|
opts[:prefix].each do |prefix|
|
|
34
36
|
# Support absolute asset paths
|
|
35
37
|
# https://github.com/kalasjocke/sinatra-asset-pipeline/pull/54
|
|
@@ -46,7 +48,6 @@ class Roda
|
|
|
46
48
|
require 'opal/sprockets/processor'
|
|
47
49
|
|
|
48
50
|
Opal.paths.each do |path|
|
|
49
|
-
puts path
|
|
50
51
|
opts[:sprockets].append_path path
|
|
51
52
|
end
|
|
52
53
|
end
|
|
@@ -63,7 +64,7 @@ class Roda
|
|
|
63
64
|
opts[:sprockets].js_compressor = opts[:js_compressor] unless opts[:js_compressor].nil?
|
|
64
65
|
|
|
65
66
|
Sprockets::Helpers.configure do |config|
|
|
66
|
-
config.manifest = Sprockets::Manifest.new(opts[:sprockets], opts[:
|
|
67
|
+
config.manifest = Sprockets::Manifest.new(opts[:sprockets], opts[:public_path])
|
|
67
68
|
config.prefix = opts[:path_prefix] unless opts[:path_prefix].nil?
|
|
68
69
|
config.protocol = opts[:protocol]
|
|
69
70
|
config.asset_host = opts[:host] unless opts[:host].nil?
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
require 'rake'
|
|
2
|
+
require 'rake/tasklib'
|
|
3
|
+
require 'rake/sprocketstask'
|
|
4
|
+
|
|
5
|
+
class Roda
|
|
6
|
+
module RodaPlugins
|
|
7
|
+
module SprocketAssets
|
|
8
|
+
class Task < Rake::TaskLib
|
|
9
|
+
def initialize(app_klass)
|
|
10
|
+
opts = app_klass.sprocket_assets_opts
|
|
11
|
+
|
|
12
|
+
namespace :assets do
|
|
13
|
+
desc "Precompile assets"
|
|
14
|
+
task :precompile do
|
|
15
|
+
environment = opts[:sprockets]
|
|
16
|
+
manifest = Sprockets::Manifest.new(environment.index, opts[:public_path])
|
|
17
|
+
manifest.compile(opts[:precompile])
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
desc "Clean assets"
|
|
21
|
+
task :clean do
|
|
22
|
+
FileUtils.rm_rf(opts[:public_path])
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def self.define!(app_klass)
|
|
28
|
+
self.new app_klass
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
|
4
4
|
|
|
5
5
|
Gem::Specification.new do |spec|
|
|
6
6
|
spec.name = "roda-sprocket_assets"
|
|
7
|
-
spec.version = '0.0.
|
|
7
|
+
spec.version = '0.0.4'
|
|
8
8
|
spec.authors = ["cj"]
|
|
9
9
|
spec.email = ["cjlazell@gmail.com"]
|
|
10
10
|
spec.summary = %q{Use sprockets to serve assets in roda.}
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: roda-sprocket_assets
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- cj
|
|
@@ -93,6 +93,7 @@ files:
|
|
|
93
93
|
- README.md
|
|
94
94
|
- Rakefile
|
|
95
95
|
- lib/roda/plugins/sprocket_assets.rb
|
|
96
|
+
- lib/roda/plugins/sprocket_assets_task.rb
|
|
96
97
|
- lib/roda/sprocket_assets.rb
|
|
97
98
|
- roda-sprocket_assets.gemspec
|
|
98
99
|
homepage: ''
|