Fix deploy

This commit is contained in:
Flaviu Tamas 2016-11-07 11:22:11 -05:00
commit 89c4bb2625
3 changed files with 24 additions and 15 deletions

18
Rules
View file

@ -20,14 +20,14 @@ end
compile '/assets/js/*' do compile '/assets/js/*' do
filter :erb filter :erb
filter :uglify_js if File.basename(item[:content_filename], ".*") == 'all' :uglify_js if File.basename(item[:content_filename], ".*") == 'all'
end end
compile '/content/*' do compile '/content/*' do
if item.identifier == '/content/toc/' if item.identifier.to_s == '/content/toc/'
filter :kramdown filter :kramdown
layout 'blank' layout 'blank'
elsif item.identifier == '/content/footer/' elsif item.identifier.to_s == '/content/footer/'
layout 'blank' layout 'blank'
elsif item[:extension] == 'md' elsif item[:extension] == 'md'
filter :kramdown, {:input => 'GFM'} filter :kramdown, {:input => 'GFM'}
@ -43,18 +43,18 @@ end
route '/assets/css/*' do route '/assets/css/*' do
# if not debug mode, only let all.css through # if not debug mode, only let all.css through
unless @config[:debug] unless @config[:debug]
item.identifier.chop + '.css' if File.basename(item[:content_filename], ".*") == 'all' item.identifier.to_s.chop + '.css' if File.basename(item[:content_filename], ".*") == 'all'
else else
item.identifier.chop + '.css' item.identifier.to_s.chop + '.css'
end end
end end
route '/assets/js/*' do route '/assets/js/*' do
# if not debug mode, only let all.js through # if not debug mode, only let all.js through
unless @config[:debug] unless @config[:debug]
item.identifier.chop + '.js' if File.basename(item[:content_filename], ".*") == 'all' item.identifier.to_s.chop + '.js' if File.basename(item[:content_filename], ".*") == 'all'
else else
item.identifier.chop + '.js' item.identifier.to_s.chop + '.js'
end end
end end
@ -62,10 +62,10 @@ end
route '/content/*' do route '/content/*' do
if item.binary? if item.binary?
# Write item with identifier /foo/ to /foo.ext # Write item with identifier /foo/ to /foo.ext
item.identifier.sub("/content", "").chop + '.' + item[:extension] item.identifier.to_s.sub("/content", "").chop + '.' + item[:extension]
else else
# Write item with identifier /foo/ to /foo/index.html # Write item with identifier /foo/ to /foo/index.html
item.identifier.sub("/content", "") + 'index.html' item.identifier.to_s.sub("/content", "") + 'index.html'
end end
end end

View file

@ -29,6 +29,8 @@ prune:
# .git, .svn etc. # .git, .svn etc.
exclude: [ '.git', '.hg', '.svn', 'CVS' ] exclude: [ '.git', '.hg', '.svn', 'CVS' ]
string_pattern_type: legacy
# The data sources where nanoc loads its data from. This is an array of # The data sources where nanoc loads its data from. This is an array of
# hashes; each array element represents a single data source. By default, # hashes; each array element represents a single data source. By default,
# there is only a single data source that reads data from the “content/” and # there is only a single data source that reads data from the “content/” and
@ -38,6 +40,8 @@ data_sources:
# The type is the identifier of the data source. By default, this will be # The type is the identifier of the data source. By default, this will be
# `filesystem_unified`. # `filesystem_unified`.
type: filesystem_unified type: filesystem_unified
identifier_type: legacy
encoding: utf-c8
# The path where items should be mounted (comparable to mount points in # The path where items should be mounted (comparable to mount points in
# Unix-like systems). This is “/” by default, meaning that items will have # Unix-like systems). This is “/” by default, meaning that items will have

View file

@ -1,13 +1,14 @@
box: flaviut/nim-by-example-build-vm@0.0.7 box: flaviut/nim-by-example-build-vm:0.1.2
build: build:
steps: steps:
- script: - script:
name: build name: build
code: | code: |
source /home/ubuntu/.rvm/scripts/rvm source /usr/local/rvm/scripts/rvm
git remote add publish 'git@github.com:nim-by-example/nim-by-example.github.io.git' git remote add publish 'git@github.com:nim-by-example/nim-by-example.github.io.git'
git config --global user.email 'nim-by-example.github.io' git config --global user.email 'nim-by-example.github.io'
git config --global user.name 'Builder' git config --global user.name 'Builder'
git config --global push.default simple
git checkout master git checkout master
nanoc nanoc
cp -r ./output/. ./ cp -r ./output/. ./
@ -16,11 +17,15 @@ build:
git commit -am'Build Site' git commit -am'Build Site'
deploy: deploy:
steps: steps:
- script:
name: ssh-keys
code: |
mkdir -p ~/.ssh/
echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==' > ~/.ssh/known_hosts
echo -e "$GIT_CREDENTIALS" > ~/.ssh/id_rsa
chmod 0600 ~/.ssh/id_rsa
chmod 0644 ~/.ssh/known_hosts
- script: - script:
name: deploy name: deploy
code: | code: |
mkdir ~/.ssh/
echo 'github.com ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAq2A7hRGmdnm9tUDbO9IDSwBK6TbQa+PXYPCPy6rbTrTtw7PHkccKrpp0yVhp5HdEIcKr6pLlVDBfOLX9QUsyCOV0wzfjIJNlGEYsdlLJizHhbn2mUjvSAHQqZETYP81eFzLQNnPHt4EVVUh7VfDESU84KezmD5QlWpXLmvU31/yMf+Se8xhHTvKSCZIFImWwoG6mbUoWf9nzpIoaSjB+weqqUUmpaaasXVal72J+UX2B+2RPW3RcT0eOzQgqlJL3RKrTJvdsjE3JEAvGq3lGHSZXy28G3skua2SmVi/w4yCE6gbODqnTWlg7+wC604ydGXA8VJiS5ap43JXiUFFAaQ==' > ~/.ssh/known_hosts
echo "$GIT_CREDENTIALS" > ~/.ssh/id_rsa
chmod 0600 ~/.ssh/id_rsa
git push --force publish git push --force publish