Vagrant support

Add vagrant support for easy local development
This commit is contained in:
Administrator 2015-11-21 14:33:33 -02:00
parent 015630eaad
commit 5d503fe83c
6 changed files with 209 additions and 1 deletions

9
.gitignore vendored Normal file
View File

@ -0,0 +1,9 @@
# project
_site
.sass-cache
.vagrant
# general
.DS_Store
Thumbs.db
ehthumbs.db

5
Gemfile Normal file
View File

@ -0,0 +1,5 @@
source 'https://rubygems.org'
gem 'execjs'
gem 'therubyracer'
gem 'github-pages'

136
Gemfile.lock Normal file
View File

@ -0,0 +1,136 @@
GEM
remote: https://rubygems.org/
specs:
RedCloth (4.2.9)
activesupport (4.2.4)
i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1)
addressable (2.3.8)
blankslate (2.1.2.4)
classifier-reborn (2.0.4)
fast-stemmer (~> 1.0)
coffee-script (2.4.1)
coffee-script-source
execjs
coffee-script-source (1.9.1.1)
colorator (0.1)
ethon (0.8.0)
ffi (>= 1.3.0)
execjs (2.6.0)
fast-stemmer (1.0.2)
ffi (1.9.10)
gemoji (2.1.0)
github-pages (39)
RedCloth (= 4.2.9)
github-pages-health-check (~> 0.2)
jekyll (= 2.4.0)
jekyll-coffeescript (= 1.0.1)
jekyll-feed (= 0.3.1)
jekyll-mentions (= 0.2.1)
jekyll-redirect-from (= 0.8.0)
jekyll-sass-converter (= 1.3.0)
jekyll-sitemap (= 0.8.1)
jemoji (= 0.5.0)
kramdown (= 1.5.0)
liquid (= 2.6.2)
maruku (= 0.7.0)
mercenary (~> 0.3)
pygments.rb (= 0.6.3)
rdiscount (= 2.1.7)
redcarpet (= 3.3.2)
terminal-table (~> 1.4)
github-pages-health-check (0.5.3)
addressable (~> 2.3)
net-dns (~> 0.8)
public_suffix (~> 1.4)
typhoeus (~> 0.7)
html-pipeline (1.9.0)
activesupport (>= 2)
nokogiri (~> 1.4)
i18n (0.7.0)
jekyll (2.4.0)
classifier-reborn (~> 2.0)
colorator (~> 0.1)
jekyll-coffeescript (~> 1.0)
jekyll-gist (~> 1.0)
jekyll-paginate (~> 1.0)
jekyll-sass-converter (~> 1.0)
jekyll-watch (~> 1.1)
kramdown (~> 1.3)
liquid (~> 2.6.1)
mercenary (~> 0.3.3)
pygments.rb (~> 0.6.0)
redcarpet (~> 3.1)
safe_yaml (~> 1.0)
toml (~> 0.1.0)
jekyll-coffeescript (1.0.1)
coffee-script (~> 2.2)
jekyll-feed (0.3.1)
jekyll-gist (1.3.5)
jekyll-mentions (0.2.1)
html-pipeline (~> 1.9.0)
jekyll (~> 2.0)
jekyll-paginate (1.1.0)
jekyll-redirect-from (0.8.0)
jekyll (>= 2.0)
jekyll-sass-converter (1.3.0)
sass (~> 3.2)
jekyll-sitemap (0.8.1)
jekyll-watch (1.3.0)
listen (~> 3.0)
jemoji (0.5.0)
gemoji (~> 2.0)
html-pipeline (~> 1.9)
jekyll (>= 2.0)
json (1.8.3)
kramdown (1.5.0)
libv8 (3.16.14.13)
liquid (2.6.2)
listen (3.0.4)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
maruku (0.7.0)
mercenary (0.3.5)
mini_portile (0.6.2)
minitest (5.8.2)
net-dns (0.8.0)
nokogiri (1.6.6.2)
mini_portile (~> 0.6.0)
parslet (1.5.0)
blankslate (~> 2.0)
posix-spawn (0.3.11)
public_suffix (1.5.2)
pygments.rb (0.6.3)
posix-spawn (~> 0.3.6)
yajl-ruby (~> 1.2.0)
rb-fsevent (0.9.6)
rb-inotify (0.9.5)
ffi (>= 0.5.0)
rdiscount (2.1.7)
redcarpet (3.3.2)
ref (2.0.0)
safe_yaml (1.0.4)
sass (3.4.19)
terminal-table (1.5.2)
therubyracer (0.12.2)
libv8 (~> 3.16.14.0)
ref
thread_safe (0.3.5)
toml (0.1.2)
parslet (~> 1.5.0)
typhoeus (0.8.0)
ethon (>= 0.8.0)
tzinfo (1.2.2)
thread_safe (~> 0.1)
yajl-ruby (1.2.1)
PLATFORMS
ruby
DEPENDENCIES
execjs
github-pages
therubyracer

View File

@ -13,6 +13,7 @@ If you need a bit of help or have comments, feel free to [contact me](http://dea
- [Prerequisites](#prerequisites) - [Prerequisites](#prerequisites)
- [Build your website in 3 steps](#build-your-website-in-3-steps) - [Build your website in 3 steps](#build-your-website-in-3-steps)
- [Add your own content](#add-your-own-content) - [Add your own content](#add-your-own-content)
- [Local Development](#local-development)
- [Last important thing: YAML front matter](#last-important-thing-yaml-front-matter) - [Last important thing: YAML front matter](#last-important-thing-yaml-front-matter)
- [Features](#features) - [Features](#features)
- [More advanced features](#more-advanced-features) - [More advanced features](#more-advanced-features)
@ -64,6 +65,13 @@ Any file that you add inside the [`_posts`](./_posts) directory will be treated
As mentioned previously, you can use [prose.io](http://prose.io/) to add or edit files instead of doing it directly on GitHub, it can be a little easier that way. As mentioned previously, you can use [prose.io](http://prose.io/) to add or edit files instead of doing it directly on GitHub, it can be a little easier that way.
###Local Development on *nix and windows
- 1) Install [VirtualBox](http://virtualbox.org) and [Vagrant](https://www.vagrantup.com).
- 2) Clone down your fork `git clone git@github.com:yourusername/yourusername.github.io.git`
- 3) Inside your repository folder call `vagrant up`
- 4) View your website at http://0.0.0.0:4000 on *nix or http://127.0.0.1:4000 on windows.
- 5) Commit any changes and push everything to the master branch of your GitHub user repository. GitHub Pages will then rebuild and serve your website.
### Last important thing: YAML front matter ### Last important thing: YAML front matter
In order to have your new pages use this template and not just be plain pages, you need to add [YAML front matter](http://jekyllrb.com/docs/frontmatter/) to the top of each page. This is where you'll give each page some parameters that I made available, such as a title and subtitle. I'll go into more detail about what parameters are available later. If you don't want to use any parameters on your new page (this also means having no title), then use the empty YAML front matter: In order to have your new pages use this template and not just be plain pages, you need to add [YAML front matter](http://jekyllrb.com/docs/frontmatter/) to the top of each page. This is where you'll give each page some parameters that I made available, such as a title and subtitle. I'll go into more detail about what parameters are available later. If you don't want to use any parameters on your new page (this also means having no title), then use the empty YAML front matter:

47
Vagrantfile vendored Normal file
View File

@ -0,0 +1,47 @@
# -*- mode: ruby -*-
# vi: set ft=ruby :
$script_provision = <<SCRIPT
echo Provisioning...
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
curl -sSL https://get.rvm.io | bash -s stable --rails
source /usr/local/rvm/scripts/rvm
cd /vagrant
bundle install
echo "#!/bin/bash" > /usr/local/bin/jekyll-start.sh
echo "cd /vagrant" >> /usr/local/bin/jekyll-start.sh
echo "source /usr/local/rvm/scripts/rvm" >> /usr/local/bin/jekyll-start.sh
echo "bundle exec jekyll serve --force_polling" >> /usr/local/bin/jekyll-start.sh
chmod +x /usr/local/bin/jekyll-start.sh
echo Provisioned!!!
SCRIPT
Vagrant.configure("2") do |config|
# Base box.
config.vm.box = "xnerv/standard-debian-7.9.0-i386.box"
# Shared folders.
config.vm.synced_folder "./", "/vagrant"
# Forwarded ports.
config.vm.network :forwarded_port, guest: 4000, host: 4000
# Remote access.
config.ssh.forward_agent = true
# Virtualization provider.
config.vm.provider :virtualbox do |vb|
# Don't boot with headless mode.
vb.gui = false
# Use VBoxManage to customize the VM.
vb.customize ["modifyvm", :id, "--memory", "512"]
end
config.vm.provision "shell", inline: $script_provision, run: "once"
config.vm.provision "shell", inline: "/usr/local/bin/jekyll-start.sh", run: "always"
end

View File

@ -92,9 +92,12 @@ defaults:
# Exclude these files from production site # Exclude these files from production site
exclude: exclude:
- CNAME - Gemfile
- Gemfile.lock
- LICENSE - LICENSE
- README.md - README.md
- CNAME
- Vagrantfile
# prose.io config # prose.io config
prose: prose: