specific-assets-compiler 0.0.0
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 +7 -0
- data/lib/override.rb +24 -0
- data/lib/specific-assets-compiler.rake +27 -0
- metadata +45 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a922a8a23686b3160dd75a54c8bd56ad900d9846
|
4
|
+
data.tar.gz: b4ad11df78f814fda75f746672eecdd04f2e7e49
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1ca696b7d758e1922c241b04d36b369431be55d3a1c408f99af0cd63da1df1e1e15cf2d502f24a5640a892e9cd78b622dc1fa963e1ebcc2dde41f620c8b8a3c8
|
7
|
+
data.tar.gz: 6fc3ce4bc9b5fcafdaa756410a3df6d50ada7f4a911ecd8002ea992965a741f800f78d6a33deea51a6b0238d8bb30ed6a1c8ef81c6076f5ab56a03a9a9792227
|
data/lib/override.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require "fileutils"
|
2
|
+
require 'action_view'
|
3
|
+
require 'sprockets/static_compiler'
|
4
|
+
|
5
|
+
module Sprockets
|
6
|
+
class StaticCompiler
|
7
|
+
def compile_specific
|
8
|
+
if @manifest && File.exist?("#{@manifest_path}/manifest.yml")
|
9
|
+
manifest = YAML.load(File.read("#{@manifest_path}/manifest.yml"))
|
10
|
+
else
|
11
|
+
manifest = {}
|
12
|
+
end
|
13
|
+
env.each_logical_path(paths) do |logical_path|
|
14
|
+
if asset = env.find_asset(logical_path)
|
15
|
+
digest_path = write_asset(asset)
|
16
|
+
manifest[asset.logical_path] = digest_path
|
17
|
+
manifest[aliased_path_for(asset.logical_path)] = digest_path
|
18
|
+
end
|
19
|
+
end
|
20
|
+
write_manifest(manifest) if @manifest
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "fileutils"
|
2
|
+
require 'action_view'
|
3
|
+
require 'sprockets/static_compiler'
|
4
|
+
|
5
|
+
namespace :assets do
|
6
|
+
# execute this task for specific file precompile.
|
7
|
+
task :precompile_specific do
|
8
|
+
# Ensure that action view is loaded and the appropriate
|
9
|
+
# sprockets hooks get executed
|
10
|
+
digest = nil
|
11
|
+
_ = ActionView::Base
|
12
|
+
target_file = (ENV["ASSET_FILES"].gsub("[","").gsub("]","").split(",") rescue [])
|
13
|
+
config = Rails.application.config
|
14
|
+
config.assets.compile = true
|
15
|
+
config.assets.digest = digest unless digest.nil?
|
16
|
+
config.assets.digests = {}
|
17
|
+
env = Rails.application.assets
|
18
|
+
target = File.join(Rails.public_path, config.assets.prefix)
|
19
|
+
compiler = Sprockets::StaticCompiler.new(env,
|
20
|
+
target,
|
21
|
+
[config.assets.precompile[0]]+target_file,
|
22
|
+
:manifest_path => config.assets.manifest,
|
23
|
+
:digest => config.assets.digest,
|
24
|
+
:manifest => digest.nil?)
|
25
|
+
compiler.compile_specific
|
26
|
+
end
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: specific-assets-compiler
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tanapat Sainak
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-09-07 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Specific Asset files to compile
|
14
|
+
email: tanapat@computerlogy.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/override.rb
|
20
|
+
- lib/specific-assets-compiler.rake
|
21
|
+
homepage: http://www.computerlogy.com
|
22
|
+
licenses:
|
23
|
+
- "-"
|
24
|
+
metadata: {}
|
25
|
+
post_install_message:
|
26
|
+
rdoc_options: []
|
27
|
+
require_paths:
|
28
|
+
- lib
|
29
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
35
|
+
requirements:
|
36
|
+
- - ">="
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
requirements: []
|
40
|
+
rubyforge_project:
|
41
|
+
rubygems_version: 2.4.8
|
42
|
+
signing_key:
|
43
|
+
specification_version: 4
|
44
|
+
summary: Specific Asset files
|
45
|
+
test_files: []
|