asset_pages 0.9.11
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/config/application.rb +47 -0
- data/config/boot.rb +23 -0
- data/config/environment.rb +23 -0
- data/config/environments/test.rb +38 -0
- data/lib/asset_pages/jekyll/liquid_helper.rb +121 -0
- data/lib/asset_pages/jekyll/plugins/asset_filter.rb +37 -0
- data/lib/asset_pages/jekyll/plugins/asset_tag.rb +63 -0
- data/lib/asset_pages/jekyll/plugins/image_tag.rb +29 -0
- data/lib/asset_pages/jekyll/plugins/javascript_include_tag.rb +29 -0
- data/lib/asset_pages/jekyll/plugins/prefetch.rb +43 -0
- data/lib/asset_pages/jekyll/plugins/requirejs_include_tag.rb +65 -0
- data/lib/asset_pages/jekyll/plugins/stylesheet_link_tag.rb +29 -0
- data/lib/asset_pages/jekyll/plugins.rb +23 -0
- data/lib/asset_pages/monkey_patches.rb +39 -0
- data/lib/asset_pages/rails/engine.rb +28 -0
- data/lib/asset_pages/rails/rake_helper.rb +34 -0
- data/lib/asset_pages/rails.rb +18 -0
- data/lib/asset_pages/util.rb +52 -0
- data/lib/asset_pages/version.rb +34 -0
- data/lib/asset_pages.rb +17 -0
- data/lib/tasks/asset_pages/build.rake +41 -0
- data/lib/tasks/asset_pages/prepare_assets.rake +22 -0
- data/lib/tasks/gh_pages/push.rake +90 -0
- data/spec/spec_helper.rb +52 -0
- metadata +146 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ec9460789005bd689ab8741b50c058345db09708
|
4
|
+
data.tar.gz: 133ce206424ee96e6d41f7f8588c7a4886ed950e
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4315c5ccff77dabbe34063c7056b774311e9925fea8338dfc5fa51884174a7e4ca660f03ca38ffd82e646e610481d8024618017538c4d92fe9ad771d0124b7d9
|
7
|
+
data.tar.gz: 150bef25b3f3d8c6322bddc4f33cb3e05c6566a9713498825ee6d70b7579fd8bb73af69c9486370e68aaf737247ea0245236c7f98f85bdf00a5eb7637f8830e3
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright 2014 Roy Liu
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
6
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
7
|
+
# the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
13
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
+
# License for the specific language governing permissions and limitations under
|
15
|
+
# the License.
|
16
|
+
|
17
|
+
require "pathname"
|
18
|
+
require Pathname.new("../boot").expand_path(__FILE__)
|
19
|
+
require "rails"
|
20
|
+
require "rails/test_unit/railtie"
|
21
|
+
|
22
|
+
if defined?(Bundler)
|
23
|
+
Bundler.require(:default, :assets, Rails.env)
|
24
|
+
end
|
25
|
+
|
26
|
+
class Application < Rails::Application
|
27
|
+
# Settings in `config/environments.rb` take precedence over those specified here. Application configuration should go
|
28
|
+
# into files in config/initializers: All `.rb` files in that directory are automatically loaded.
|
29
|
+
|
30
|
+
# Set the default encoding used in templates for Ruby 1.9.
|
31
|
+
config.encoding = "utf-8"
|
32
|
+
|
33
|
+
# Set sensitive parameters which will be filtered from the log file.
|
34
|
+
config.filter_parameters += [:password]
|
35
|
+
|
36
|
+
# Enable escaping HTML in JSON.
|
37
|
+
config.active_support.escape_html_entities_in_json = true
|
38
|
+
|
39
|
+
# Set the assets version: Change this if you want to expire them.
|
40
|
+
config.assets.version = "1.0"
|
41
|
+
|
42
|
+
# Add Haml as a template engine.
|
43
|
+
config.generators { |g| g.template_engine :haml }
|
44
|
+
|
45
|
+
# Validate locales.
|
46
|
+
config.i18n.enforce_available_locales = true
|
47
|
+
end
|
data/config/boot.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright 2014 Roy Liu
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
6
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
7
|
+
# the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
13
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
+
# License for the specific language governing permissions and limitations under
|
15
|
+
# the License.
|
16
|
+
|
17
|
+
require "pathname"
|
18
|
+
|
19
|
+
# Set up gems listed in the Gemfile.
|
20
|
+
ENV["BUNDLE_GEMFILE"] ||= Pathname.new("../../Gemfile").expand_path(__FILE__).to_s
|
21
|
+
|
22
|
+
require "bundler/setup" \
|
23
|
+
if Pathname.new(ENV["BUNDLE_GEMFILE"]).file?
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright 2014 Roy Liu
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
6
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
7
|
+
# the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
13
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
+
# License for the specific language governing permissions and limitations under
|
15
|
+
# the License.
|
16
|
+
|
17
|
+
require "pathname"
|
18
|
+
|
19
|
+
# Load the Rails application.
|
20
|
+
require Pathname.new("../application").expand_path(__FILE__)
|
21
|
+
|
22
|
+
# Initialize the Rails application.
|
23
|
+
Rails.application.initialize!
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright 2014 Roy Liu
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
6
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
7
|
+
# the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
13
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
+
# License for the specific language governing permissions and limitations under
|
15
|
+
# the License.
|
16
|
+
|
17
|
+
Rails.application.configure do
|
18
|
+
# Settings specified here will take precedence over those in `config/application.rb`.
|
19
|
+
|
20
|
+
# Enable caching of classes and don't reload them with each request.
|
21
|
+
config.cache_classes = true
|
22
|
+
|
23
|
+
# Enable full error reports and disable caching.
|
24
|
+
config.consider_all_requests_local = true
|
25
|
+
|
26
|
+
# Print deprecation notices to stderr.
|
27
|
+
config.active_support.deprecation = :stderr
|
28
|
+
|
29
|
+
# Enable Rails' static asset server and tune it.
|
30
|
+
config.serve_static_assets = true
|
31
|
+
config.static_cache_control = "public, max-age=3600"
|
32
|
+
|
33
|
+
# Disable rendering of exception templates, and instead raise exceptions.
|
34
|
+
config.action_dispatch.show_exceptions = false
|
35
|
+
|
36
|
+
# Disable eager loading.
|
37
|
+
config.eager_load = false
|
38
|
+
end
|
@@ -0,0 +1,121 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright 2014 Roy Liu
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
6
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
7
|
+
# the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
13
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
+
# License for the specific language governing permissions and limitations under
|
15
|
+
# the License.
|
16
|
+
|
17
|
+
require "pathname"
|
18
|
+
require "sprockets/rails/helper"
|
19
|
+
require "asset_pages/monkey_patches"
|
20
|
+
|
21
|
+
module AssetPages
|
22
|
+
module Jekyll
|
23
|
+
module LiquidHelper
|
24
|
+
Root = Pathname.new("/")
|
25
|
+
|
26
|
+
def self.included(klass)
|
27
|
+
klass.class_eval do
|
28
|
+
include Sprockets::Rails::Helper
|
29
|
+
include InstanceMethods
|
30
|
+
|
31
|
+
::Rails.application.configure do
|
32
|
+
manifest_dir = config.assets.manifest \
|
33
|
+
|| Pathname.new(config.paths["public"].first) \
|
34
|
+
+ Pathname.new(config.assets.prefix).relative_path_from(Root)
|
35
|
+
|
36
|
+
klass.debug_assets = config.assets.debug
|
37
|
+
klass.digest_assets = config.assets.digest
|
38
|
+
klass.assets_prefix = config.assets.prefix
|
39
|
+
|
40
|
+
if config.assets.compile
|
41
|
+
klass.assets_environment = assets
|
42
|
+
klass.assets_manifest = Sprockets::Manifest.new(assets, manifest_dir)
|
43
|
+
else
|
44
|
+
klass.assets_manifest = Sprockets::Manifest.new(manifest_dir)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def config
|
49
|
+
::Rails.application.config
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
module InstanceMethods
|
55
|
+
def compute_asset_path(path, options = {})
|
56
|
+
asset = lookup_asset_for_path(path, options)
|
57
|
+
|
58
|
+
if asset
|
59
|
+
if debug_assets && options[:debug] != false
|
60
|
+
asset.to_a.each do |subasset|
|
61
|
+
write_static_asset({}.tap { |h| subasset.encode_with(h) }.tap { |h| h["source"] ||= subasset.source })
|
62
|
+
end
|
63
|
+
else
|
64
|
+
write_static_asset({}.tap { |h| asset.encode_with(h) }.tap { |h| h["source"] ||= asset.source })
|
65
|
+
end
|
66
|
+
elsif !assets_environment
|
67
|
+
asset_filename = assets_manifest.assets[path]
|
68
|
+
|
69
|
+
write_static_asset({"filename" => asset_filename}) \
|
70
|
+
if asset_filename
|
71
|
+
end
|
72
|
+
|
73
|
+
# Use relative paths, since the filesystem might be used to serve up pages.
|
74
|
+
super(path, options)
|
75
|
+
end
|
76
|
+
|
77
|
+
protected
|
78
|
+
|
79
|
+
def site
|
80
|
+
@context.registers[:site]
|
81
|
+
end
|
82
|
+
|
83
|
+
def page_dir
|
84
|
+
Pathname.new(@context.registers[:page]["dir"])
|
85
|
+
end
|
86
|
+
|
87
|
+
private
|
88
|
+
|
89
|
+
def write_static_asset(asset_hash)
|
90
|
+
assets_dir = Pathname.new(assets_prefix).relative_path_from(Root)
|
91
|
+
|
92
|
+
if !asset_hash["filename"]
|
93
|
+
staging_dir = ::Rails.application.root + "tmp/cache/_#{::Rails.env}"
|
94
|
+
site_file_relative = assets_dir + asset_hash["logical_path"]
|
95
|
+
site_file = staging_dir + site_file_relative
|
96
|
+
|
97
|
+
parent_dir = site_file.parent
|
98
|
+
|
99
|
+
parent_dir.mkpath \
|
100
|
+
if !parent_dir.directory?
|
101
|
+
|
102
|
+
# Write the asset into the staging directory.
|
103
|
+
site_file.open("wb") { |f| f.write(asset_hash["source"]) } \
|
104
|
+
if !site_file.file? || site_file.mtime < Time.at(asset_hash["mtime"])
|
105
|
+
else
|
106
|
+
staging_dir = Root.relative_path_from(Pathname.new(assets_prefix)).expand_path(assets_manifest.dir)
|
107
|
+
site_file_relative = assets_dir + asset_hash["filename"]
|
108
|
+
end
|
109
|
+
|
110
|
+
# Add to Jekyll's static file manifest, which ensures that said asset is moved into place.
|
111
|
+
site.static_files \
|
112
|
+
.push(::Jekyll::StaticFile.new(self,
|
113
|
+
staging_dir,
|
114
|
+
site_file_relative.dirname,
|
115
|
+
site_file_relative.basename)) \
|
116
|
+
.uniq!
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright 2014 Roy Liu
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
6
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
7
|
+
# the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
13
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
+
# License for the specific language governing permissions and limitations under
|
15
|
+
# the License.
|
16
|
+
|
17
|
+
require "pathname"
|
18
|
+
require "asset_pages/jekyll/liquid_helper"
|
19
|
+
|
20
|
+
module Jekyll
|
21
|
+
module AssetFilter
|
22
|
+
class Proxy
|
23
|
+
include AssetPages::Jekyll::LiquidHelper
|
24
|
+
|
25
|
+
def initialize(context)
|
26
|
+
@context = context
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def asset_path(path)
|
31
|
+
Proxy.new(@context).asset_path(path)
|
32
|
+
end
|
33
|
+
|
34
|
+
Liquid::Template.register_filter(self)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright 2014 Roy Liu
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
6
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
7
|
+
# the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
13
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
+
# License for the specific language governing permissions and limitations under
|
15
|
+
# the License.
|
16
|
+
|
17
|
+
require "pathname"
|
18
|
+
require "liquid"
|
19
|
+
require "asset_pages/jekyll/liquid_helper"
|
20
|
+
|
21
|
+
module Jekyll
|
22
|
+
class AssetTag < Liquid::Tag
|
23
|
+
include AssetPages::Jekyll::LiquidHelper
|
24
|
+
|
25
|
+
SourcePattern = Regexp.new("#{Liquid::QuotedFragment}+")
|
26
|
+
|
27
|
+
attr_reader :sources
|
28
|
+
attr_reader :options
|
29
|
+
|
30
|
+
def initialize(name, markup, tokens)
|
31
|
+
super
|
32
|
+
|
33
|
+
@sources = []
|
34
|
+
@options, markup = AssetTag.parse_options(markup)
|
35
|
+
|
36
|
+
markup.scan(SourcePattern) do |path|
|
37
|
+
sources.push(path)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def render(context)
|
42
|
+
@context = context
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.parse_options(markup)
|
46
|
+
options = {}
|
47
|
+
|
48
|
+
markup = markup.gsub(Liquid::TagAttributes) do |matched|
|
49
|
+
attr_name = $1
|
50
|
+
attr_value = $2
|
51
|
+
|
52
|
+
raise ArgumentError, "Please qualify the attribute value #{attr_value.dump} with quotes" \
|
53
|
+
if !(attr_value.size >= 2 && attr_value[0] == "\"" && attr_value[-1] == "\"")
|
54
|
+
|
55
|
+
options[attr_name] = attr_value[1...-1]
|
56
|
+
|
57
|
+
""
|
58
|
+
end
|
59
|
+
|
60
|
+
[options, markup]
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright 2014 Roy Liu
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
6
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
7
|
+
# the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
13
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
+
# License for the specific language governing permissions and limitations under
|
15
|
+
# the License.
|
16
|
+
|
17
|
+
require "asset_pages/jekyll/plugins/asset_tag"
|
18
|
+
|
19
|
+
module Jekyll
|
20
|
+
class ImageTag < AssetTag
|
21
|
+
def render(context)
|
22
|
+
super
|
23
|
+
|
24
|
+
image_tag(*sources, options)
|
25
|
+
end
|
26
|
+
|
27
|
+
Liquid::Template.register_tag("image_tag", self)
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright 2014 Roy Liu
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
6
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
7
|
+
# the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
13
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
+
# License for the specific language governing permissions and limitations under
|
15
|
+
# the License.
|
16
|
+
|
17
|
+
require "asset_pages/jekyll/plugins/asset_tag"
|
18
|
+
|
19
|
+
module Jekyll
|
20
|
+
class JavaScriptIncludeTag < AssetTag
|
21
|
+
def render(context)
|
22
|
+
super
|
23
|
+
|
24
|
+
javascript_include_tag(*sources, options)
|
25
|
+
end
|
26
|
+
|
27
|
+
Liquid::Template.register_tag("javascript_include_tag", self)
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright 2014 Roy Liu
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
6
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
7
|
+
# the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
13
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
+
# License for the specific language governing permissions and limitations under
|
15
|
+
# the License.
|
16
|
+
|
17
|
+
require "pathname"
|
18
|
+
require "liquid"
|
19
|
+
require "asset_pages/jekyll/liquid_helper"
|
20
|
+
|
21
|
+
module Jekyll
|
22
|
+
class Prefetch < Liquid::Block
|
23
|
+
include AssetPages::Jekyll::LiquidHelper
|
24
|
+
|
25
|
+
AssetPathPattern = Regexp.new("#{Liquid::QuotedFragment}+")
|
26
|
+
|
27
|
+
def render(context)
|
28
|
+
@context = context
|
29
|
+
|
30
|
+
super.split("\n", -1).each do |line|
|
31
|
+
options, line = AssetTag.parse_options(line)
|
32
|
+
|
33
|
+
line.scan(AssetPathPattern) do |path|
|
34
|
+
asset_path(path, options.merge(debug: false))
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
""
|
39
|
+
end
|
40
|
+
|
41
|
+
Liquid::Template.register_tag("prefetch", self)
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright 2014 Roy Liu
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
6
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
7
|
+
# the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
13
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
+
# License for the specific language governing permissions and limitations under
|
15
|
+
# the License.
|
16
|
+
|
17
|
+
require "pathname"
|
18
|
+
require "yaml"
|
19
|
+
|
20
|
+
begin
|
21
|
+
require "requirejs/rails"
|
22
|
+
rescue LoadError
|
23
|
+
end
|
24
|
+
|
25
|
+
require "asset_pages/jekyll/plugins/asset_tag"
|
26
|
+
|
27
|
+
module Jekyll
|
28
|
+
class RequireJsIncludeTag < AssetTag
|
29
|
+
include RequirejsHelper
|
30
|
+
|
31
|
+
class << self
|
32
|
+
attr_accessor :precompiled_modules
|
33
|
+
end
|
34
|
+
|
35
|
+
klass = self
|
36
|
+
|
37
|
+
Rails.application.configure do
|
38
|
+
rjs_manifest_file = config.requirejs.manifest_path
|
39
|
+
|
40
|
+
if !config.assets.compile
|
41
|
+
klass.assets_manifest.assets.merge!(YAML.load(rjs_manifest_file.open { |f| f.read })) \
|
42
|
+
if rjs_manifest_file.file?
|
43
|
+
|
44
|
+
klass.precompiled_modules = Set.new(config.requirejs.build_config["modules"].map do |mod|
|
45
|
+
config.requirejs.module_name_for(mod)
|
46
|
+
end)
|
47
|
+
else
|
48
|
+
klass.precompiled_modules = Set.new
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def render(context)
|
53
|
+
super
|
54
|
+
|
55
|
+
raise ArgumentError, "Please provide exactly one argument to `requirejs_include_tag`" \
|
56
|
+
if sources.size != 1
|
57
|
+
|
58
|
+
source = sources[0]
|
59
|
+
requirejs_include_tag(source)
|
60
|
+
end
|
61
|
+
|
62
|
+
Liquid::Template.register_tag("requirejs_include_tag", self)
|
63
|
+
end \
|
64
|
+
if defined?(Requirejs::Rails)
|
65
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright 2014 Roy Liu
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
6
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
7
|
+
# the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
13
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
+
# License for the specific language governing permissions and limitations under
|
15
|
+
# the License.
|
16
|
+
|
17
|
+
require "asset_pages/jekyll/plugins/asset_tag"
|
18
|
+
|
19
|
+
module Jekyll
|
20
|
+
class StylesheetLinkTag < AssetTag
|
21
|
+
def render(context)
|
22
|
+
super
|
23
|
+
|
24
|
+
stylesheet_link_tag(*sources, options)
|
25
|
+
end
|
26
|
+
|
27
|
+
Liquid::Template.register_tag("stylesheet_link_tag", self)
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright 2014 Roy Liu
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
6
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
7
|
+
# the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
13
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
+
# License for the specific language governing permissions and limitations under
|
15
|
+
# the License.
|
16
|
+
|
17
|
+
require "asset_pages/jekyll/plugins/asset_filter"
|
18
|
+
require "asset_pages/jekyll/plugins/asset_tag"
|
19
|
+
require "asset_pages/jekyll/plugins/image_tag"
|
20
|
+
require "asset_pages/jekyll/plugins/javascript_include_tag"
|
21
|
+
require "asset_pages/jekyll/plugins/prefetch"
|
22
|
+
require "asset_pages/jekyll/plugins/requirejs_include_tag"
|
23
|
+
require "asset_pages/jekyll/plugins/stylesheet_link_tag"
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright 2014 Roy Liu
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
6
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
7
|
+
# the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
13
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
+
# License for the specific language governing permissions and limitations under
|
15
|
+
# the License.
|
16
|
+
|
17
|
+
require "jekyll/static_file"
|
18
|
+
|
19
|
+
module Jekyll
|
20
|
+
class StaticFile
|
21
|
+
attr_reader :site
|
22
|
+
attr_reader :base
|
23
|
+
attr_reader :dir
|
24
|
+
attr_reader :name
|
25
|
+
|
26
|
+
def ==(o)
|
27
|
+
@site == o.site \
|
28
|
+
&& @base == o.base \
|
29
|
+
&& @dir == o.dir \
|
30
|
+
&& @name == o.name
|
31
|
+
end
|
32
|
+
|
33
|
+
alias_method :eql?, :==
|
34
|
+
|
35
|
+
def hash
|
36
|
+
@site.hash ^ @base.hash ^ @dir.hash ^ @name.hash
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright 2014 Roy Liu
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
6
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
7
|
+
# the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
13
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
+
# License for the specific language governing permissions and limitations under
|
15
|
+
# the License.
|
16
|
+
|
17
|
+
require "sprockets/rails"
|
18
|
+
|
19
|
+
module AssetPages
|
20
|
+
module Rails
|
21
|
+
class Engine < ::Rails::Engine
|
22
|
+
config.before_initialize do |app|
|
23
|
+
app.config.relative_url_root = ::Rails.application.root + "_#{::Rails.env}" \
|
24
|
+
if app.config.assets.compile
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright 2014 Roy Liu
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
6
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
7
|
+
# the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
13
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
+
# License for the specific language governing permissions and limitations under
|
15
|
+
# the License.
|
16
|
+
|
17
|
+
require "pathname"
|
18
|
+
|
19
|
+
if defined?(Rake.application)
|
20
|
+
Rake.application.top_level_tasks.each do |task_name|
|
21
|
+
if !ENV["RAILS_ENV"]
|
22
|
+
case task_name
|
23
|
+
when "asset_pages", "asset_pages:build"
|
24
|
+
ENV["RAILS_ENV"] = "development"
|
25
|
+
when "asset_pages:precompile", "gh_pages:push"
|
26
|
+
ENV["RAILS_ENV"] = "production"
|
27
|
+
end
|
28
|
+
else
|
29
|
+
break
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
require Pathname.pwd + "config/environment"
|
34
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright 2014 Roy Liu
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
6
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
7
|
+
# the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
13
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
+
# License for the specific language governing permissions and limitations under
|
15
|
+
# the License.
|
16
|
+
|
17
|
+
require "asset_pages/version"
|
18
|
+
require "asset_pages/rails/engine"
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright 2014 Roy Liu
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
6
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
7
|
+
# the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
13
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
+
# License for the specific language governing permissions and limitations under
|
15
|
+
# the License.
|
16
|
+
|
17
|
+
require "pathname"
|
18
|
+
require "jekyll/configuration"
|
19
|
+
|
20
|
+
module AssetPages
|
21
|
+
module Util
|
22
|
+
def self.find_yaml_configs
|
23
|
+
root = ::Rails.application.root
|
24
|
+
configs = []
|
25
|
+
|
26
|
+
default_config = root + "_config.yml"
|
27
|
+
|
28
|
+
configs.push(default_config) \
|
29
|
+
if default_config.file?
|
30
|
+
|
31
|
+
configs += (root + "config/jekyll").children.select do |pathname|
|
32
|
+
pathname.file? && pathname.extname == ".yml"
|
33
|
+
end
|
34
|
+
|
35
|
+
configs
|
36
|
+
end
|
37
|
+
|
38
|
+
def self.jekyll_config
|
39
|
+
::Jekyll.configuration(config: find_yaml_configs)
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.fetch_nested(hash, *keys)
|
43
|
+
keys.reduce(hash) do |hash, key|
|
44
|
+
if hash.respond_to?(:[])
|
45
|
+
hash[key]
|
46
|
+
else
|
47
|
+
nil
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright 2014 Roy Liu
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
6
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
7
|
+
# the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
13
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
+
# License for the specific language governing permissions and limitations under
|
15
|
+
# the License.
|
16
|
+
|
17
|
+
module AssetPages
|
18
|
+
# A module containing the gem version information.
|
19
|
+
module Version
|
20
|
+
# The major version.
|
21
|
+
MAJOR = 0
|
22
|
+
|
23
|
+
# The minor version.
|
24
|
+
MINOR = 9
|
25
|
+
|
26
|
+
# The patch version.
|
27
|
+
PATCH = 11
|
28
|
+
|
29
|
+
# Gets the String representation of the gem version.
|
30
|
+
def self.to_s
|
31
|
+
"#{MAJOR}.#{MINOR}.#{PATCH}"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/asset_pages.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright 2014 Roy Liu
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
6
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
7
|
+
# the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
13
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
+
# License for the specific language governing permissions and limitations under
|
15
|
+
# the License.
|
16
|
+
|
17
|
+
require "asset_pages/rails"
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright 2014 Roy Liu
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
6
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
7
|
+
# the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
13
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
+
# License for the specific language governing permissions and limitations under
|
15
|
+
# the License.
|
16
|
+
|
17
|
+
require "jekyll"
|
18
|
+
require "asset_pages/util"
|
19
|
+
|
20
|
+
desc "An alias for asset_pages:build"
|
21
|
+
task asset_pages: "asset_pages:build"
|
22
|
+
|
23
|
+
namespace :asset_pages do
|
24
|
+
desc "Run `jekyll build` for development"
|
25
|
+
task build: "prepare_assets" do
|
26
|
+
# Load plugins at the last possible moment.
|
27
|
+
require "asset_pages/jekyll/plugins"
|
28
|
+
|
29
|
+
root = ::Rails.application.root
|
30
|
+
|
31
|
+
Jekyll::Commands::Build.process(
|
32
|
+
config: AssetPages::Util.find_yaml_configs,
|
33
|
+
source: root + "public",
|
34
|
+
destination: root + "_#{Rails.env}",
|
35
|
+
exclude: ["assets"]
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
desc "Precompile assets and run `jekyll build` for production"
|
40
|
+
task precompile: "build"
|
41
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright 2014 Roy Liu
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
6
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
7
|
+
# the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
13
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
+
# License for the specific language governing permissions and limitations under
|
15
|
+
# the License.
|
16
|
+
|
17
|
+
namespace :asset_pages do
|
18
|
+
task :prepare_assets do
|
19
|
+
Rake::Task["assets:precompile"].invoke \
|
20
|
+
if Rails.env == "production"
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright 2014 Roy Liu
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
6
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
7
|
+
# the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
13
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
+
# License for the specific language governing permissions and limitations under
|
15
|
+
# the License.
|
16
|
+
|
17
|
+
require "fileutils"
|
18
|
+
require "rugged"
|
19
|
+
require "yaml"
|
20
|
+
require "asset_pages/util"
|
21
|
+
|
22
|
+
namespace :gh_pages do
|
23
|
+
desc "Build the site, commit it along with GitHub Pages metadata, and push it to GitHub"
|
24
|
+
task push: "asset_pages:precompile" do
|
25
|
+
dest_dir = Pathname.new("_#{Rails.env}")
|
26
|
+
|
27
|
+
# Touch the `.nojekyll` file, since we precompiled everything.
|
28
|
+
FileUtils.touch(dest_dir + ".nojekyll")
|
29
|
+
|
30
|
+
jekyll_config = AssetPages::Util.jekyll_config
|
31
|
+
project_cname = AssetPages::Util.fetch_nested(jekyll_config, "asset_pages", "gh_pages", "cname")
|
32
|
+
|
33
|
+
# Did a user provide a custom domain name? If so, write out the CNAME file.
|
34
|
+
(dest_dir + "CNAME").open("wb") { |f| f.write("#{project_cname}\n") } \
|
35
|
+
if project_cname
|
36
|
+
|
37
|
+
repo = Rugged::Repository.init_at(dest_dir.to_s)
|
38
|
+
main_repo = Rugged::Repository.new(".")
|
39
|
+
main_repo_origin = main_repo.remotes["origin"]
|
40
|
+
|
41
|
+
repo_path_pattern = Regexp.new("[/:]([a-zA-Z_0-9\\-]+)/\\1\\.github\\.(?:com|io)\\z")
|
42
|
+
|
43
|
+
# Guess the target branch based on the `origin` remote's URL.
|
44
|
+
if !repo_path_pattern.match(main_repo_origin.url)
|
45
|
+
branch_name = "gh-pages"
|
46
|
+
else
|
47
|
+
branch_name = "master"
|
48
|
+
end
|
49
|
+
|
50
|
+
index = repo.index
|
51
|
+
|
52
|
+
# These glob patterns should pick up everything.
|
53
|
+
index.remove_all(["*", ".*"])
|
54
|
+
index.write
|
55
|
+
index.add_all(["*", ".*"])
|
56
|
+
index.write
|
57
|
+
|
58
|
+
# Write the index to a tree object for committing.
|
59
|
+
tree = index.write_tree
|
60
|
+
|
61
|
+
# Have commits write to the branch.
|
62
|
+
repo.references.update("HEAD", "refs/heads/#{branch_name}")
|
63
|
+
|
64
|
+
# Derive the author information from the main repository's HEAD.
|
65
|
+
author = main_repo.head.target.author
|
66
|
+
repo.config["user.name"] = author[:name]
|
67
|
+
repo.config["user.email"] = author[:email]
|
68
|
+
|
69
|
+
# Create the commit with the given tree object.
|
70
|
+
if !repo.head_unborn?
|
71
|
+
repo.head.target.amend(
|
72
|
+
update_ref: "HEAD",
|
73
|
+
tree: tree
|
74
|
+
)
|
75
|
+
else
|
76
|
+
Rugged::Commit.create(
|
77
|
+
repo,
|
78
|
+
message: "asset_pages: Automated GitHub Pages build",
|
79
|
+
parents: [],
|
80
|
+
update_ref: "HEAD",
|
81
|
+
tree: tree
|
82
|
+
)
|
83
|
+
end
|
84
|
+
|
85
|
+
# Shell out to `git` for pushing.
|
86
|
+
Dir.chdir(dest_dir) do
|
87
|
+
sh "git", "push", "--force", "--", main_repo_origin.url, branch_name
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
#
|
3
|
+
# Copyright 2014 Roy Liu
|
4
|
+
#
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
6
|
+
# use this file except in compliance with the License. You may obtain a copy of
|
7
|
+
# the License at
|
8
|
+
#
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
#
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
13
|
+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
14
|
+
# License for the specific language governing permissions and limitations under
|
15
|
+
# the License.
|
16
|
+
|
17
|
+
require "pathname"
|
18
|
+
ENV["RAILS_ENV"] ||= "test"
|
19
|
+
require Pathname.new("../../config/environment").expand_path(__FILE__)
|
20
|
+
require "rspec/rails"
|
21
|
+
require "rspec/autorun"
|
22
|
+
|
23
|
+
Pathname.glob("spec/support/**/*.rb").each { |f| require f }
|
24
|
+
|
25
|
+
# Checks for pending migrations before tests are run.
|
26
|
+
ActiveRecord::Migration.check_pending! \
|
27
|
+
if defined?(ActiveRecord::Migration)
|
28
|
+
|
29
|
+
RSpec.configure do |config|
|
30
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures.
|
31
|
+
config.fixture_path = Rails.application.root + "spec/fixtures"
|
32
|
+
|
33
|
+
# If you're not using ActiveRecord, or you'd prefer not to run each of your examples within a transaction, remove the
|
34
|
+
# following line or assign `false` instead of `true`.
|
35
|
+
config.use_transactional_fixtures = true
|
36
|
+
|
37
|
+
# If `true`, the base class of anonymous controllers will be inferred automatically. This will be the default behavior
|
38
|
+
# in future versions of rspec-rails.
|
39
|
+
config.infer_base_class_for_anonymous_controllers = false
|
40
|
+
|
41
|
+
# Run specs in random order to surface order dependencies. If you find an order dependency and want to debug it, you
|
42
|
+
# can fix the order by providing the seed, which is printed after each run.
|
43
|
+
#
|
44
|
+
# --seed 1234
|
45
|
+
config.order = "random"
|
46
|
+
|
47
|
+
# Use color.
|
48
|
+
config.color_enabled = true
|
49
|
+
|
50
|
+
# Use the given formatter.
|
51
|
+
config.formatter = :documentation
|
52
|
+
end
|
metadata
ADDED
@@ -0,0 +1,146 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: asset_pages
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.11
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Roy Liu
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-09-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: jekyll
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.4.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.4.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rails
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 4.1.6
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 4.1.6
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rugged
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.21.1b1
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.21.1b1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: uglifier
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.5.3
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.5.3
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: yui-compressor
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.12.0
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.12.0
|
83
|
+
description: 'Asset Pages is a library that augments the Jekyll static site generator
|
84
|
+
with the Rails asset pipeline. Its collection of Jekyll plugins and Rake tasks constitute
|
85
|
+
a workflow for precompiling and linking to assets, as well as deploying the Jekyll-generated
|
86
|
+
site to platforms like GitHub Pages. In terms of usability, Asset Pages aims to
|
87
|
+
support Rails conventions: Structure your project as you would with a Rails app,
|
88
|
+
but end up with a static site and production-ready assets.'
|
89
|
+
email:
|
90
|
+
- carsomyr@gmail.com
|
91
|
+
executables: []
|
92
|
+
extensions: []
|
93
|
+
extra_rdoc_files: []
|
94
|
+
files:
|
95
|
+
- config/application.rb
|
96
|
+
- config/boot.rb
|
97
|
+
- config/environment.rb
|
98
|
+
- config/environments/test.rb
|
99
|
+
- lib/asset_pages.rb
|
100
|
+
- lib/asset_pages/jekyll/liquid_helper.rb
|
101
|
+
- lib/asset_pages/jekyll/plugins.rb
|
102
|
+
- lib/asset_pages/jekyll/plugins/asset_filter.rb
|
103
|
+
- lib/asset_pages/jekyll/plugins/asset_tag.rb
|
104
|
+
- lib/asset_pages/jekyll/plugins/image_tag.rb
|
105
|
+
- lib/asset_pages/jekyll/plugins/javascript_include_tag.rb
|
106
|
+
- lib/asset_pages/jekyll/plugins/prefetch.rb
|
107
|
+
- lib/asset_pages/jekyll/plugins/requirejs_include_tag.rb
|
108
|
+
- lib/asset_pages/jekyll/plugins/stylesheet_link_tag.rb
|
109
|
+
- lib/asset_pages/monkey_patches.rb
|
110
|
+
- lib/asset_pages/rails.rb
|
111
|
+
- lib/asset_pages/rails/engine.rb
|
112
|
+
- lib/asset_pages/rails/rake_helper.rb
|
113
|
+
- lib/asset_pages/util.rb
|
114
|
+
- lib/asset_pages/version.rb
|
115
|
+
- lib/tasks/asset_pages/build.rake
|
116
|
+
- lib/tasks/asset_pages/prepare_assets.rake
|
117
|
+
- lib/tasks/gh_pages/push.rake
|
118
|
+
- spec/spec_helper.rb
|
119
|
+
homepage: https://github.com/carsomyr/asset_pages
|
120
|
+
licenses:
|
121
|
+
- Apache-2.0
|
122
|
+
metadata: {}
|
123
|
+
post_install_message:
|
124
|
+
rdoc_options: []
|
125
|
+
require_paths:
|
126
|
+
- lib
|
127
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - ">="
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: '0'
|
137
|
+
requirements: []
|
138
|
+
rubyforge_project:
|
139
|
+
rubygems_version: 2.2.2
|
140
|
+
signing_key:
|
141
|
+
specification_version: 4
|
142
|
+
summary: Asset Pages is a library that augments the Jekyll static site generator with
|
143
|
+
the Rails asset pipeline
|
144
|
+
test_files:
|
145
|
+
- spec/spec_helper.rb
|
146
|
+
has_rdoc:
|