actionview-rev_manifest 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +35 -0
- data/.rubocop.yml +14 -0
- data/Gemfile +3 -0
- data/LICENSE +22 -0
- data/README.md +42 -0
- data/Rakefile +1 -0
- data/actionview-rev_manifest.gemspec +22 -0
- data/lib/actionview-rev_manifest.rb +52 -0
- data/lib/rev_manifest/actionview/base.rb +13 -0
- data/lib/rev_manifest/version.rb +3 -0
- metadata +111 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9a2b7b51a9c31a0ac93dffa41db69ffc29359fb1
|
4
|
+
data.tar.gz: 1931b942f48c052748ab453b583683e1dc1cd46f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9573f6d8547b4ca257b44398145c363cbd6ba1a14c2946e71d03a3d444f086391a47e8cb88868055b2d4c392771f3635afe1a22028f2ac59be0c77b1a3a6f15b
|
7
|
+
data.tar.gz: 8b3bc339c9a229ce673f1e059c3ea8df28cdb7fc6bc7b59888db36384a16ac05ac1e54573a72b09ee89fbef5282f599736fd0bfdd775a266ffddd9b38dca34ae
|
data/.gitignore
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/test/tmp/
|
9
|
+
/test/version_tmp/
|
10
|
+
/tmp/
|
11
|
+
|
12
|
+
## Specific to RubyMotion:
|
13
|
+
.dat*
|
14
|
+
.repl_history
|
15
|
+
build/
|
16
|
+
|
17
|
+
## Documentation cache and generated files:
|
18
|
+
/.yardoc/
|
19
|
+
/_yardoc/
|
20
|
+
/doc/
|
21
|
+
/rdoc/
|
22
|
+
|
23
|
+
## Environment normalisation:
|
24
|
+
/.bundle/
|
25
|
+
/vendor/bundle
|
26
|
+
/lib/bundler/man/
|
27
|
+
|
28
|
+
# for a library or gem, you might want to ignore these files since the code is
|
29
|
+
# intended to run in multiple environments; otherwise, check them in:
|
30
|
+
# Gemfile.lock
|
31
|
+
# .ruby-version
|
32
|
+
# .ruby-gemset
|
33
|
+
|
34
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
35
|
+
.rvmrc
|
data/.rubocop.yml
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Yuku TAKAHASHI
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/README.md
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# ActionView::RevManifest
|
2
|
+
|
3
|
+
Let Rails load rev-manifest.json generated by [gulp-rev](https://github.com/sindresorhus/gulp-rev).
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
Add to your Gemfile:
|
8
|
+
|
9
|
+
```rb
|
10
|
+
gem "actionview-rev_manifest"
|
11
|
+
```
|
12
|
+
|
13
|
+
Run:
|
14
|
+
|
15
|
+
```
|
16
|
+
bundle install
|
17
|
+
```
|
18
|
+
|
19
|
+
## Setup
|
20
|
+
|
21
|
+
```rb
|
22
|
+
#config/initializers/actionview-rev_manifest.rb
|
23
|
+
|
24
|
+
RevManifest.enabled = Rails.env.production?
|
25
|
+
```
|
26
|
+
|
27
|
+
## Sample gulpfile.coffee
|
28
|
+
|
29
|
+
```coffee
|
30
|
+
gulp = require "gulp"
|
31
|
+
rev = require "gulp-rev"
|
32
|
+
|
33
|
+
gulp.task "precompile", ->
|
34
|
+
gulp.src([
|
35
|
+
"public/assets/javascripts/*.js",
|
36
|
+
"public/assets/stylesheets/*.css"
|
37
|
+
], base: "public")
|
38
|
+
.pipe(rev())
|
39
|
+
.pipe(gulp.dest("public"))
|
40
|
+
.pipe(rev.manifest())
|
41
|
+
.pipe(gulp.dest("public/assets"))
|
42
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
@@ -0,0 +1,22 @@
|
|
1
|
+
file = File.open(File.expand_path("../lib/rev_manifest/version.rb", __FILE__))
|
2
|
+
version = file.read.scan(/\d+\.\d+\.\d+/).first
|
3
|
+
file.close
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "actionview-rev_manifest"
|
7
|
+
spec.version = version
|
8
|
+
spec.authors = ["Yuku Takahashi"]
|
9
|
+
spec.email = ["yuku@qiita.com"]
|
10
|
+
spec.summary = "Let Rails load rev-manifest.json generated by gulp-rev"
|
11
|
+
spec.homepage = "https://github.com/yuku-t/actionview-rev_manifest"
|
12
|
+
spec.license = "MIT"
|
13
|
+
|
14
|
+
spec.files = `git ls-files -z`.split("\x0")
|
15
|
+
spec.require_paths = ["lib"]
|
16
|
+
|
17
|
+
spec.add_dependency "actionview"
|
18
|
+
|
19
|
+
spec.add_development_dependency "bundler", "~> 1.7"
|
20
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
21
|
+
spec.add_development_dependency "rubocop", "~> 0.34.2"
|
22
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require "rev_manifest/version"
|
2
|
+
require "rev_manifest/actionview/base"
|
3
|
+
|
4
|
+
module RevManifest
|
5
|
+
DEFAULT_ASSET_PUBLIC_DIRECTORIES = {
|
6
|
+
audio: "/assets/audios",
|
7
|
+
font: "/assets/fonts",
|
8
|
+
image: "/assets/images",
|
9
|
+
javascript: "/assets/javascripts",
|
10
|
+
stylesheet: "/assets/stylesheets",
|
11
|
+
video: "/assets/videos"
|
12
|
+
}
|
13
|
+
|
14
|
+
DEFAULT_ASSET_PREFIXES = {
|
15
|
+
audio: "assets/audios/",
|
16
|
+
font: "assets/fonts/",
|
17
|
+
image: "assets/images/",
|
18
|
+
javascript: "assets/javascripts/",
|
19
|
+
stylesheet: "assets/stylesheets/",
|
20
|
+
video: "assets/videos/"
|
21
|
+
}
|
22
|
+
|
23
|
+
DEFAULT_MANIFEST_PATH = "public/assets/rev-manifest.json"
|
24
|
+
|
25
|
+
class << self
|
26
|
+
attr_writer :enabled, :asset_prefixes, :asset_public_directories, :manifest_path
|
27
|
+
|
28
|
+
# @return [true, false]
|
29
|
+
def enabled?
|
30
|
+
!!@enabled
|
31
|
+
end
|
32
|
+
|
33
|
+
# @return [Hash]
|
34
|
+
def asset_prefixes
|
35
|
+
@asset_prefixes || DEFAULT_ASSET_PREFIXES
|
36
|
+
end
|
37
|
+
|
38
|
+
# @return [Hash]
|
39
|
+
def asset_public_directories
|
40
|
+
@asset_public_directories || DEFAULT_ASSET_PUBLIC_DIRECTORIES
|
41
|
+
end
|
42
|
+
|
43
|
+
# @return [String]
|
44
|
+
def manifest_path
|
45
|
+
@manifest_path || Rails.root.join(DEFAULT_MANIFEST_PATH)
|
46
|
+
end
|
47
|
+
|
48
|
+
def manifest
|
49
|
+
@manifest ||= JSON.load(File.read(manifest_path))
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module ActionView
|
2
|
+
class Base
|
3
|
+
# @note Override {ActionView::Helpers::AssetUrlHelper#compute_asset_path}.
|
4
|
+
def compute_asset_path(source, options = {})
|
5
|
+
if RevManifest.enabled?
|
6
|
+
RevManifest.manifest[RevManifest.asset_prefixes[options[:type]] + source]
|
7
|
+
else
|
8
|
+
dir = RevManifest.asset_public_directories[options[:type]] || ""
|
9
|
+
File.join(dir, source)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
metadata
ADDED
@@ -0,0 +1,111 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: actionview-rev_manifest
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yuku Takahashi
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-10-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: actionview
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.7'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.7'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rubocop
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.34.2
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.34.2
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- yuku@qiita.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rubocop.yml"
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- actionview-rev_manifest.gemspec
|
83
|
+
- lib/actionview-rev_manifest.rb
|
84
|
+
- lib/rev_manifest/actionview/base.rb
|
85
|
+
- lib/rev_manifest/version.rb
|
86
|
+
homepage: https://github.com/yuku-t/actionview-rev_manifest
|
87
|
+
licenses:
|
88
|
+
- MIT
|
89
|
+
metadata: {}
|
90
|
+
post_install_message:
|
91
|
+
rdoc_options: []
|
92
|
+
require_paths:
|
93
|
+
- lib
|
94
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
requirements: []
|
105
|
+
rubyforge_project:
|
106
|
+
rubygems_version: 2.4.5.1
|
107
|
+
signing_key:
|
108
|
+
specification_version: 4
|
109
|
+
summary: Let Rails load rev-manifest.json generated by gulp-rev
|
110
|
+
test_files: []
|
111
|
+
has_rdoc:
|