update build/publish scripts; gallery changes
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,4 +1,4 @@
|
||||
/_build
|
||||
/_build/target
|
||||
/_layouts/private-*
|
||||
/_site
|
||||
/asset
|
||||
|
||||
14
_build/aws/publish-asset.sh
Executable file
14
_build/aws/publish-asset.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
# args: s3cmd-config
|
||||
|
||||
set -e
|
||||
|
||||
s3cmd sync \
|
||||
--config "$1" \
|
||||
--acl-public \
|
||||
--no-preserve \
|
||||
--add-header 'cache-control:max-age=86400' \
|
||||
--verbose \
|
||||
"./asset/$2" \
|
||||
"s3://dpb587-assets-us-west-2/asset/$2"
|
||||
17
_build/aws/publish.sh
Executable file
17
_build/aws/publish.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
|
||||
# args: s3cmd-config
|
||||
|
||||
set -e
|
||||
|
||||
s3cmd sync \
|
||||
--config "$1" \
|
||||
--acl-public \
|
||||
--no-delete-removed \
|
||||
--no-preserve \
|
||||
--exclude 'private/*' \
|
||||
--exclude 'asset/*' \
|
||||
--add-header 'cache-control:max-age=3600' \
|
||||
--verbose \
|
||||
"$ARTIFACT_PATH" \
|
||||
s3://dpb587-us-west-2
|
||||
33
_build/build.sh
Executable file
33
_build/build.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
# args: follow-script follow-args...
|
||||
|
||||
set -e
|
||||
|
||||
[ -e _build/target ] && rm -fr _build/target
|
||||
|
||||
mkdir _build/target
|
||||
|
||||
export ARTIFACT_COMMIT=`git rev-parse HEAD`
|
||||
export ARTIFACT_BRANCH=`git rev-parse --abbrev-ref HEAD`
|
||||
|
||||
echo "--> building $ARTIFACT_BRANCH/$ARTIFACT_COMMIT..."
|
||||
|
||||
(
|
||||
echo 'artifact_commit:' "$ARTIFACT_COMMIT" ;
|
||||
echo 'artifact_branch:' "$ARTIFACT_BRANCH" ;
|
||||
echo 'destination: _build/target/artifact' ;
|
||||
echo 'asset_prefix: //assets.dpb587.me/asset' ;
|
||||
echo 'environment: prod'
|
||||
) > _build/target/_config.yml
|
||||
|
||||
jekyll build --config _config.yml,_build/target/_config.yml
|
||||
|
||||
export ARTIFACT_PATH="$PWD/_build/target/artifact"
|
||||
|
||||
if [[ "" != "$1" ]] ; then
|
||||
exec $@
|
||||
else
|
||||
env | grep '^ARTIFACT_' | sed 's/^/export /'
|
||||
fi
|
||||
|
||||
@@ -3,4 +3,9 @@ paginate: 7
|
||||
pygments: true
|
||||
safe: false
|
||||
environment: dev
|
||||
static_version: dev
|
||||
artifact_commit: dev
|
||||
artifact_branch: master
|
||||
asset_prefix: /asset
|
||||
exclude:
|
||||
- LICENSE
|
||||
- README
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# args: s3cmd-config
|
||||
|
||||
set -e
|
||||
|
||||
[ -e _build ] && rm -fr _build
|
||||
|
||||
mkdir _build
|
||||
|
||||
STATIC_VERSION=`git rev-parse HEAD | cut -c -10`
|
||||
|
||||
(
|
||||
echo 'static_version:' "$STATIC_VERSION" ;
|
||||
echo 'destination: _build/_site'
|
||||
echo 'environment: prod'
|
||||
) > _build/_config.yml
|
||||
|
||||
jekyll build --config _config.yml,_build/_config.yml
|
||||
|
||||
mv _build/_site/static/dev _build/_site/static/$STATIC_VERSION
|
||||
|
||||
s3cmd sync \
|
||||
--config "$1" \
|
||||
--acl-public \
|
||||
--no-delete-removed \
|
||||
--no-preserve \
|
||||
--exclude 'private/*' \
|
||||
--add-header 'cache-control:max-age=3600' \
|
||||
--verbose \
|
||||
_build/_site/ \
|
||||
s3://dpb587-us-west-2
|
||||
9
_doc/notes.md
Normal file
9
_doc/notes.md
Normal file
@@ -0,0 +1,9 @@
|
||||
Publish the site:
|
||||
|
||||
git commit ...snip...
|
||||
./_build/build.sh ./_build/aws/publish.sh "$AWS_S3CMD_CONFIG"
|
||||
|
||||
Create a photo gallery:
|
||||
|
||||
osascript enumerate.scpt 'London-Iceland Trip' | php -dmemory_limit=1G convert.php ~/code/dpb587.me/ 2014-london-iceland-trip
|
||||
./_build/aws/publish-asset.sh gallery/2014-london-iceland-trip
|
||||
@@ -6,9 +6,9 @@
|
||||
<title>{% if page.title != "Home" %}{{ page.title }} – {% endif %}Danny Berger</title>
|
||||
|
||||
<link href="http://fonts.googleapis.com/css?family=Lato:300,400,700,300italic,400italic,700italic" rel="stylesheet" type="text/css" />
|
||||
<link href="/static/{{ site.static_version }}/style/default-common.css" rel="stylesheet" type="text/css" />
|
||||
<link href="/static/{{ site.static_version }}/style/default-print.css" media="print" rel="stylesheet" type="text/css" />
|
||||
<link href="/static/{{ site.static_version }}/style/pygments.css" rel="stylesheet" type="text/css" />
|
||||
<link href="/static/{{ site.artifact_commit|truncate:10 }}/style/default-common.css" rel="stylesheet" type="text/css" />
|
||||
<link href="/static/{{ site.artifact_commit|truncate:10 }}/style/default-print.css" media="print" rel="stylesheet" type="text/css" />
|
||||
<link href="/static/{{ site.artifact_commit|truncate:10 }}/style/pygments.css" rel="stylesheet" type="text/css" />
|
||||
<link href="/blog/atom.xml" type="application/atom+xml" rel="alternate" title="Danny Berger (blog)" />
|
||||
|
||||
{% if page.path %}
|
||||
|
||||
@@ -12,9 +12,15 @@
|
||||
<a href="{{ page.code }}"><img alt="code" height="49" src="/include/icons/code.png" width="49" /></a>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="social screen-only">
|
||||
|
||||
</div>
|
||||
<ul style="margin-top:0;">
|
||||
{% if page.previous %}
|
||||
<li><a href="{{ page.previous }}.html" rel="prev"> « </a></li>
|
||||
{% endif %}
|
||||
|
||||
{% if page.next %}
|
||||
<li><a href="{{ page.next }}.html" rel="next"> » </a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
<h1>
|
||||
{{ page.title }}
|
||||
<small class="print-only">{{ page.date|date:'%A, %B %d, %Y' }}</small>
|
||||
@@ -22,7 +28,7 @@
|
||||
</header>
|
||||
<section class="post-content">
|
||||
<p style="text-align:center;">
|
||||
<a href="/asset{{ page.url|replace:".html","~1280.jpg" }}"><img alt="Photo: {{ page.title }}" src="/asset{{ page.url|replace:".html","~640.jpg" }}" style="max-width:630px;" /></a>
|
||||
<a href="{{ site.asset_prefix }}{{ page.url|replace:".html","~1280.jpg" }}"><img alt="Photo: {{ page.title }}" src="{{ site.asset_prefix }}{{ page.url|replace:".html","~640.jpg" }}" style="max-width:630px;" /></a>
|
||||
</p>
|
||||
|
||||
{{ content }}
|
||||
@@ -32,7 +38,7 @@
|
||||
<div style="float:left;width:359px;">
|
||||
<dl style="margin-top:0;">
|
||||
<dt>Date</dt>
|
||||
<dd>{{ page.date|date:'%A, %B %d, %Y at %I:%M %p'|replace:' 0',' '|replace:' AM',' am'|replace:' PM',' pm' }}
|
||||
<dd>{{ page.date|date:'%A, %B %d at %I:%M %p'|replace:' 0',' '|replace:' AM',' am'|replace:' PM',' pm' }}
|
||||
|
||||
<dt>Camera</dt>
|
||||
<dd>{{ page.exif.make }} {{ page.exif.model }}
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<a href="https://maps.google.com/maps?hl=en&ll={{ page.location.latitude }},{{ page.location.longitude }}&t=w&z=12"><img alt="map" height="49" src="https://maps.googleapis.com/maps/api/staticmap?center={{ page.location.latitude }},{{ page.location.longitude }}&zoom=9&size=98x98&sensor=false" title="{{ page.location.title }}" width="49" /></a>
|
||||
{% endif %}
|
||||
{% if page.code %}
|
||||
<a href="{{ page.code }}"><img alt="code" height="49" src="/static/{{ site.static_version }}/icon/code.png" width="49" /></a>
|
||||
<a href="{{ page.code }}"><img alt="code" height="49" src="/static/{{ site.artifact_commit|truncate:10 }}/icon/code.png" width="49" /></a>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="social screen-only">
|
||||
|
||||
@@ -13,7 +13,7 @@ module Jekyll
|
||||
@attributes['path'] = nil;
|
||||
@attributes['parse'] = 'true';
|
||||
@attributes['match'] = '*';
|
||||
@attributes['sort'] = 'asc';
|
||||
@attributes['sort'] = 'path';
|
||||
|
||||
markup.scan(Liquid::TagAttributes) do | key, value |
|
||||
@attributes[key] = value
|
||||
@@ -35,47 +35,54 @@ module Jekyll
|
||||
def render(context)
|
||||
context.registers[:loopdir] ||= Hash.new(0)
|
||||
|
||||
files = Dir.glob(File.join(@attributes['path'], @attributes['match']))
|
||||
|
||||
if @attributes['sort'].casecmp('desc') == 0
|
||||
files.sort! do | x, y |
|
||||
y <=> x
|
||||
end
|
||||
else
|
||||
files.sort!
|
||||
end
|
||||
items = []
|
||||
|
||||
result = []
|
||||
|
||||
context.stack do
|
||||
files.each do |pathname|
|
||||
if @attributes['parse']
|
||||
data = {}
|
||||
Dir.glob(File.join(@attributes['path'], @attributes['match'])).each do |pathname|
|
||||
if @attributes['parse']
|
||||
item = {}
|
||||
|
||||
content = File.read(pathname)
|
||||
content = File.read(pathname)
|
||||
|
||||
if content =~ /^(---\s*\n.*?\n?)^(---\s*$\n?)/m
|
||||
content = $POSTMATCH
|
||||
if content =~ /^(---\s*\n.*?\n?)^(---\s*$\n?)/m
|
||||
content = $POSTMATCH
|
||||
|
||||
begin
|
||||
data = YAML.load($1)
|
||||
rescue => e
|
||||
puts "YAML Exception reading #{name}: #{e.message}"
|
||||
end
|
||||
begin
|
||||
item = YAML.load($1)
|
||||
rescue => e
|
||||
puts "YAML Exception reading #{name}: #{e.message}"
|
||||
end
|
||||
|
||||
data['name'] = File.basename(pathname, @attributes['match'].sub('*', ''))
|
||||
data['path'] = pathname
|
||||
data['content'] = content
|
||||
|
||||
context['item'] = data
|
||||
else
|
||||
context['item'] = pathname
|
||||
end
|
||||
|
||||
item['content'] = content
|
||||
else
|
||||
context['item'] = pathname
|
||||
end
|
||||
|
||||
item['name'] = File.basename(pathname, @attributes['match'].sub('*', ''))
|
||||
item['path'] = pathname
|
||||
|
||||
items.push item
|
||||
end
|
||||
|
||||
sortby = @attributes['sort'].gsub(/^-/, '')
|
||||
|
||||
items.sort! do | x, y |
|
||||
x[sortby] <=> y[sortby]
|
||||
end
|
||||
|
||||
if sortby != @attributes['sort']
|
||||
items.reverse!
|
||||
end
|
||||
|
||||
context.stack do
|
||||
result = []
|
||||
|
||||
items.each do | item |
|
||||
context['item'] = item
|
||||
|
||||
result << render_all(@nodelist, context)
|
||||
end
|
||||
|
||||
|
||||
result
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
User-agent: *
|
||||
Disallow:
|
||||
Disallow: /static/
|
||||
|
||||
@@ -14,6 +14,14 @@ body > header, article > section {
|
||||
width: 640px;
|
||||
}
|
||||
|
||||
body.layout-gallery-photo > header {
|
||||
display: none;
|
||||
}
|
||||
|
||||
body.layout-gallery-photo article > section {
|
||||
padding-top: 14px;
|
||||
}
|
||||
|
||||
body > footer {
|
||||
color: #999999;
|
||||
font-size: 11px;
|
||||
@@ -162,6 +170,7 @@ section .timeline > * {
|
||||
}
|
||||
|
||||
body.layout-post section .timeline > *,
|
||||
body.layout-gallery-photo section .timeline > *,
|
||||
section:hover .timeline > * {
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user