Skip to content

[WIP] Upgrade for Alpine, Node, Jekyll #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
5b11ec4
Version bump
smashwilson Nov 20, 2015
6b8c946
Track renames a little.
smashwilson Nov 20, 2015
f77a5b3
We don't need a JS engine anymore
smashwilson Nov 20, 2015
af04b0e
Include an asset.
smashwilson Nov 20, 2015
ff2fc88
Separate out the image asset test.
smashwilson Nov 20, 2015
4a6279d
Separate the maximum and minimum envelope cases.
smashwilson Nov 20, 2015
d674fde
Report stdout and stderr on failing tests too.
smashwilson Nov 20, 2015
16197b5
Exclude the asset directory itself.
smashwilson Nov 20, 2015
20ae2a0
updating to latest alpine for latest node, updating maintainer, fixin…
nimbinatus Oct 4, 2017
581a2d1
working on fixing the gem
nimbinatus Oct 6, 2017
64eea22
fixed nokogiri, fixed renamed call to Sprockets::Index to Sprockets::…
nimbinatus Apr 2, 2018
7016d52
updating Travis to the current version of Ruby on Alpine 3.6
nimbinatus Apr 3, 2018
2c77b6a
BREAK - jekyll_assets uses asset plus @path now instead of asset_path
nimbinatus Apr 3, 2018
9af3f69
fixing deprecated call for Jekyll
nimbinatus Apr 3, 2018
811d9b0
forgot to update the Gemfile when bumping the version...
nimbinatus Apr 3, 2018
1ae9baa
the tests did not like that one
nimbinatus Apr 3, 2018
0281ec4
attempting to do a lift-and-shift to the current API without much muc…
nimbinatus Apr 3, 2018
a88e629
I can Ruby
nimbinatus Apr 3, 2018
1b42c7e
might have found the replacement class...
nimbinatus Apr 3, 2018
e988905
hiding test artifacts
nimbinatus Apr 4, 2018
6d6a02c
(fix): still trying to fix the API calls to jekyll-assets; posting so…
nimbinatus Apr 11, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ build/
env

preparer-test-*
.asset-cache
.jekyll-cache
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
language: ruby
rvm:
- "2.2.3"
- "2.4.4"
script: bin/test
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM alpine:3.3
MAINTAINER Ash Wilson <ash.wilson@rackspace.com>
FROM alpine:3.6
LABEL maintainer="Laura Santamaria <laura.santamaria@rackspace.com>"

RUN apk add --no-cache ruby ruby-io-console ruby-irb ruby-rdoc ruby-dev \
git build-base libffi-dev nodejs python
git build-base libffi-dev nodejs python ruby-nokogiri libxml2-dev libxslt-dev

RUN adduser -D -g "" -u 1000 preparer
RUN mkdir -p /usr/src/app /usr/content-repo
Expand Down
204 changes: 102 additions & 102 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,129 +1,129 @@
PATH
remote: .
specs:
preparermd (0.1.0)
faraday (= 0.9.1)
jekyll (= 2.5.3)
jekyll-assets (= 0.14.0)
json (= 1.8.3)
therubyracer (= 0.12.2)
preparermd (1.0.0)
faraday (= 0.14.0)
jekyll (= 3.7.3)
jekyll-assets (= 3.0.8)
json (= 2.1.0)
redcarpet (= 3.4.0)

GEM
remote: https://rubygems.org/
specs:
addressable (2.3.8)
blankslate (2.1.2.4)
classifier-reborn (2.0.3)
fast-stemmer (~> 1.0)
coderay (1.1.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.9.1.1)
colorator (0.1)
execjs (2.6.0)
faraday (0.9.1)
activesupport (5.1.6)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0)
coderay (1.1.2)
colorator (1.1.0)
concurrent-ruby (1.0.5)
em-websocket (0.5.1)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
eventmachine (1.2.5)
execjs (2.7.0)
extras (0.3.0)
forwardable-extended (~> 2.5)
faraday (0.14.0)
multipart-post (>= 1.2, < 3)
fast-stemmer (1.0.2)
fastimage (1.7.0)
addressable (~> 2.3, >= 2.3.5)
ffi (1.9.10)
hashdiff (0.2.3)
hike (1.2.3)
jekyll (2.5.3)
classifier-reborn (~> 2.0)
colorator (~> 0.1)
jekyll-coffeescript (~> 1.0)
jekyll-gist (~> 1.0)
jekyll-paginate (~> 1.0)
fastimage (2.1.1)
ffi (1.9.23)
forwardable-extended (2.6.0)
hashdiff (0.3.7)
http_parser.rb (0.6.0)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
jekyll (3.7.3)
addressable (~> 2.4)
colorator (~> 1.0)
em-websocket (~> 0.5)
i18n (~> 0.7)
jekyll-sass-converter (~> 1.0)
jekyll-watch (~> 1.1)
kramdown (~> 1.3)
liquid (~> 2.6.1)
jekyll-watch (~> 2.0)
kramdown (~> 1.14)
liquid (~> 4.0)
mercenary (~> 0.3.3)
pygments.rb (~> 0.6.0)
redcarpet (~> 3.1)
pathutil (~> 0.9)
rouge (>= 1.7, < 4)
safe_yaml (~> 1.0)
toml (~> 0.1.0)
jekyll-assets (0.14.0)
fastimage (~> 1.6)
jekyll (~> 2.0)
mini_magick (~> 4.1)
sass (~> 3.2)
sprockets (~> 2.10)
sprockets-helpers
sprockets-sass
jekyll-coffeescript (1.0.1)
coffee-script (~> 2.2)
jekyll-gist (1.3.4)
jekyll-paginate (1.1.0)
jekyll-sass-converter (1.3.0)
sass (~> 3.2)
jekyll-watch (1.3.0)
jekyll-assets (3.0.8)
activesupport (~> 5.0)
execjs (~> 2.7)
extras (~> 0.2)
fastimage (~> 2.0, >= 1.8)
jekyll (>= 3.5, < 4.0)
jekyll-sanity (~> 1.2)
liquid-tag-parser (~> 1.0)
nokogiri (~> 1.8)
pathutil (~> 0.16)
sprockets (>= 3.3, < 4.1.beta)
jekyll-sanity (1.2.0)
jekyll (~> 3.1)
jekyll-sass-converter (1.5.2)
sass (~> 3.4)
jekyll-watch (2.0.0)
listen (~> 3.0)
json (1.8.3)
kramdown (1.8.0)
libv8 (3.16.14.11)
liquid (2.6.3)
listen (3.0.3)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
mercenary (0.3.5)
method_source (0.8.2)
mini_magick (4.3.3)
multi_json (1.11.2)
json (2.1.0)
kramdown (1.16.2)
liquid (4.0.0)
liquid-tag-parser (1.8.0)
extras (~> 0.3)
liquid (>= 3.0, < 5.0)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
mercenary (0.3.6)
method_source (0.9.0)
mini_portile2 (2.3.0)
minitest (5.11.3)
multipart-post (2.0.0)
parslet (1.5.0)
blankslate (~> 2.0)
posix-spawn (0.3.11)
pry (0.10.1)
nokogiri (1.8.2)
mini_portile2 (~> 2.3.0)
pathutil (0.16.1)
forwardable-extended (~> 2.6)
pry (0.11.3)
coderay (~> 1.1.0)
method_source (~> 0.8.1)
slop (~> 3.4)
pygments.rb (0.6.3)
posix-spawn (~> 0.3.6)
yajl-ruby (~> 1.2.0)
rack (1.6.4)
rake (10.4.2)
rb-fsevent (0.9.6)
rb-inotify (0.9.5)
ffi (>= 0.5.0)
redcarpet (3.3.3)
ref (2.0.0)
method_source (~> 0.9.0)
public_suffix (3.0.2)
rack (2.0.4)
rake (12.3.1)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
ffi (>= 0.5.0, < 2)
redcarpet (3.4.0)
rouge (3.1.1)
ruby_dep (1.5.0)
safe_yaml (1.0.4)
sass (3.4.18)
slop (3.6.0)
sprockets (2.12.4)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-helpers (1.2.1)
sprockets (>= 2.2)
sprockets-sass (1.3.1)
sprockets (~> 2.0)
tilt (~> 1.1)
term-ansicolor (1.3.2)
sass (3.5.6)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
sprockets (4.0.0.beta7)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
term-ansicolor (1.6.0)
tins (~> 1.0)
therubyracer (0.12.2)
libv8 (~> 3.16.14.0)
ref
tilt (1.4.1)
tins (1.7.0)
toml (0.1.2)
parslet (~> 1.5.0)
yajl-ruby (1.2.1)
thread_safe (0.3.6)
tins (1.16.3)
tzinfo (1.2.5)
thread_safe (~> 0.1)

PLATFORMS
ruby

DEPENDENCIES
bundler (~> 1.9)
bundler (~> 1.15)
hashdiff
preparermd!
pry
rake (~> 10.0)
rake (~> 12.1)
term-ansicolor

BUNDLED WITH
1.10.6
1.15.4
23 changes: 10 additions & 13 deletions lib/preparermd/overrides/environment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

require 'faraday'
require 'sprockets'
require 'jekyll/assets_plugin/environment'
require 'jekyll/assets/env'

# Module to be mixed in to each uploaded Asset to ensure that the correct URLs are generated.
#
Expand All @@ -16,7 +16,7 @@ module AssetPatch

# Custom Index subclass that uploads each built asset to the content service as it is discovered.
#
class Index < Sprockets::Index
class Index < Sprockets::CachedEnvironment
def build_asset(path, pathname, options)
super.tap do |asset|
dest = File.join(PreparerMD.config.asset_dir, asset.logical_path)
Expand All @@ -41,23 +41,20 @@ def build_asset(path, pathname, options)

# Custom Sprockets Environment subclass that uses our injected Index subclass.
#
class Environment < Jekyll::AssetsPlugin::Environment
class Env < Jekyll::Assets::Env
def index
Index.new(self)
end
end

# Monkey-patch the Jekyll Assets plugin AssetPath class to use the #asset_render_url
# Monkey-patch the Jekyll Assets plugin SassFunctions module (run from the
# Functions module) to use the #asset_render_url if present.
#
module Jekyll
module AssetsPlugin

class AssetPath
alias_method :orig_to_s, :to_s
def to_s
@asset.respond_to?(:asset_render_url) ? @asset.asset_render_url : orig_to_s
end
module Sprockets
class Asset
alias_method :orig_to_s, :to_s
def to_s
@asset.respond_to?(:asset_render_url) ? @asset.asset_render_url : orig_to_s
end

end
end
2 changes: 1 addition & 1 deletion lib/preparermd/plugins/metadata_envelopes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def generate(site)
end
end

site.posts.each do |post|
site.posts.docs.each do |post|
render_json(post, site)
end

Expand Down
2 changes: 1 addition & 1 deletion lib/preparermd/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module PreparerMD
VERSION = "0.1.0"
VERSION = "1.0.0"
end
14 changes: 7 additions & 7 deletions preparermd.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ Gem::Specification.new do |spec|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]

spec.add_development_dependency "bundler", "~> 1.9"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "bundler", "~> 1.15"
spec.add_development_dependency "rake", "~> 12.1"

spec.add_runtime_dependency "jekyll", "2.5.3"
spec.add_runtime_dependency "faraday", "0.9.1"
spec.add_runtime_dependency "jekyll-assets", "0.14.0"
spec.add_runtime_dependency "therubyracer", "0.12.2"
spec.add_runtime_dependency "json", "1.8.3"
spec.add_runtime_dependency "jekyll", "3.7.3"
spec.add_runtime_dependency "faraday", "0.14.0"
spec.add_runtime_dependency "jekyll-assets", "3.0.8"
spec.add_runtime_dependency "redcarpet", "3.4.0"
spec.add_runtime_dependency "json", "2.1.0"
end
3 changes: 2 additions & 1 deletion test/all.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ def asset_set_from dir
return assets unless File.directory? base

Find.find(base) do |path|
next if path == base
assets << path[base.size..-1]
end
assets.sort
Expand All @@ -126,7 +127,7 @@ def report

case @outcome
when :fail
header, diff = true, true
header, output, diff = true, true, true
when :error
header, output, stacktrace = true, true, true
end
Expand Down
2 changes: 1 addition & 1 deletion test/assets/src/useit.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@

Including some actual markup before it to test the offsets.

![here it is]({% asset_path somepath/coffee-selfie-small.jpg %})
![here it is]({% asset somepath/coffee-selfie-small.jpg @path %})

And a little markup after it to keep things interesting.
3 changes: 0 additions & 3 deletions test/envelopes/src/_deconst.json

This file was deleted.

Binary file added test/image-asset/dest/assets/wheatley-icon.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions test/image-asset/dest/image-asset-base%2Fasset
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"title":null,"body":"<p>This document contains a reference to an <a href=\"/assets/wheatley-icon.jpg\">asset</a>.</p>\n","categories":[],"meta":{"layout":null},"tags":[]}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
3 changes: 3 additions & 0 deletions test/image-asset/src/_deconst.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"contentIDBase": "image-asset-base"
}
4 changes: 4 additions & 0 deletions test/image-asset/src/asset.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
---

This document contains a reference to an [asset]({% asset wheatley-icon @path %}).
9 changes: 9 additions & 0 deletions test/maximum-envelope/src/_config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Site settings
title: The site title
description: The site description

# Build settings
markdown: redcarpet
encoding: UTF-8
redcarpet:
extensions: ["with_toc_data"]
3 changes: 3 additions & 0 deletions test/maximum-envelope/src/_deconst.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"contentIDBase": "maximum-base"
}
File renamed without changes.
Loading