Browse Source

Vagrant support

Add vagrant support for easy local development
Administrator 4 years ago
parent
commit
5d503fe83c
6 changed files with 209 additions and 1 deletions
  1. 9
    0
      .gitignore
  2. 5
    0
      Gemfile
  3. 136
    0
      Gemfile.lock
  4. 8
    0
      README.md
  5. 47
    0
      Vagrantfile
  6. 4
    1
      _config.yml

+ 9
- 0
.gitignore View File

@@ -0,0 +1,9 @@
1
+# project
2
+_site
3
+.sass-cache
4
+.vagrant
5
+
6
+# general
7
+.DS_Store
8
+Thumbs.db
9
+ehthumbs.db

+ 5
- 0
Gemfile View File

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

+ 136
- 0
Gemfile.lock View File

@@ -0,0 +1,136 @@
1
+GEM
2
+  remote: https://rubygems.org/
3
+  specs:
4
+    RedCloth (4.2.9)
5
+    activesupport (4.2.4)
6
+      i18n (~> 0.7)
7
+      json (~> 1.7, >= 1.7.7)
8
+      minitest (~> 5.1)
9
+      thread_safe (~> 0.3, >= 0.3.4)
10
+      tzinfo (~> 1.1)
11
+    addressable (2.3.8)
12
+    blankslate (2.1.2.4)
13
+    classifier-reborn (2.0.4)
14
+      fast-stemmer (~> 1.0)
15
+    coffee-script (2.4.1)
16
+      coffee-script-source
17
+      execjs
18
+    coffee-script-source (1.9.1.1)
19
+    colorator (0.1)
20
+    ethon (0.8.0)
21
+      ffi (>= 1.3.0)
22
+    execjs (2.6.0)
23
+    fast-stemmer (1.0.2)
24
+    ffi (1.9.10)
25
+    gemoji (2.1.0)
26
+    github-pages (39)
27
+      RedCloth (= 4.2.9)
28
+      github-pages-health-check (~> 0.2)
29
+      jekyll (= 2.4.0)
30
+      jekyll-coffeescript (= 1.0.1)
31
+      jekyll-feed (= 0.3.1)
32
+      jekyll-mentions (= 0.2.1)
33
+      jekyll-redirect-from (= 0.8.0)
34
+      jekyll-sass-converter (= 1.3.0)
35
+      jekyll-sitemap (= 0.8.1)
36
+      jemoji (= 0.5.0)
37
+      kramdown (= 1.5.0)
38
+      liquid (= 2.6.2)
39
+      maruku (= 0.7.0)
40
+      mercenary (~> 0.3)
41
+      pygments.rb (= 0.6.3)
42
+      rdiscount (= 2.1.7)
43
+      redcarpet (= 3.3.2)
44
+      terminal-table (~> 1.4)
45
+    github-pages-health-check (0.5.3)
46
+      addressable (~> 2.3)
47
+      net-dns (~> 0.8)
48
+      public_suffix (~> 1.4)
49
+      typhoeus (~> 0.7)
50
+    html-pipeline (1.9.0)
51
+      activesupport (>= 2)
52
+      nokogiri (~> 1.4)
53
+    i18n (0.7.0)
54
+    jekyll (2.4.0)
55
+      classifier-reborn (~> 2.0)
56
+      colorator (~> 0.1)
57
+      jekyll-coffeescript (~> 1.0)
58
+      jekyll-gist (~> 1.0)
59
+      jekyll-paginate (~> 1.0)
60
+      jekyll-sass-converter (~> 1.0)
61
+      jekyll-watch (~> 1.1)
62
+      kramdown (~> 1.3)
63
+      liquid (~> 2.6.1)
64
+      mercenary (~> 0.3.3)
65
+      pygments.rb (~> 0.6.0)
66
+      redcarpet (~> 3.1)
67
+      safe_yaml (~> 1.0)
68
+      toml (~> 0.1.0)
69
+    jekyll-coffeescript (1.0.1)
70
+      coffee-script (~> 2.2)
71
+    jekyll-feed (0.3.1)
72
+    jekyll-gist (1.3.5)
73
+    jekyll-mentions (0.2.1)
74
+      html-pipeline (~> 1.9.0)
75
+      jekyll (~> 2.0)
76
+    jekyll-paginate (1.1.0)
77
+    jekyll-redirect-from (0.8.0)
78
+      jekyll (>= 2.0)
79
+    jekyll-sass-converter (1.3.0)
80
+      sass (~> 3.2)
81
+    jekyll-sitemap (0.8.1)
82
+    jekyll-watch (1.3.0)
83
+      listen (~> 3.0)
84
+    jemoji (0.5.0)
85
+      gemoji (~> 2.0)
86
+      html-pipeline (~> 1.9)
87
+      jekyll (>= 2.0)
88
+    json (1.8.3)
89
+    kramdown (1.5.0)
90
+    libv8 (3.16.14.13)
91
+    liquid (2.6.2)
92
+    listen (3.0.4)
93
+      rb-fsevent (>= 0.9.3)
94
+      rb-inotify (>= 0.9)
95
+    maruku (0.7.0)
96
+    mercenary (0.3.5)
97
+    mini_portile (0.6.2)
98
+    minitest (5.8.2)
99
+    net-dns (0.8.0)
100
+    nokogiri (1.6.6.2)
101
+      mini_portile (~> 0.6.0)
102
+    parslet (1.5.0)
103
+      blankslate (~> 2.0)
104
+    posix-spawn (0.3.11)
105
+    public_suffix (1.5.2)
106
+    pygments.rb (0.6.3)
107
+      posix-spawn (~> 0.3.6)
108
+      yajl-ruby (~> 1.2.0)
109
+    rb-fsevent (0.9.6)
110
+    rb-inotify (0.9.5)
111
+      ffi (>= 0.5.0)
112
+    rdiscount (2.1.7)
113
+    redcarpet (3.3.2)
114
+    ref (2.0.0)
115
+    safe_yaml (1.0.4)
116
+    sass (3.4.19)
117
+    terminal-table (1.5.2)
118
+    therubyracer (0.12.2)
119
+      libv8 (~> 3.16.14.0)
120
+      ref
121
+    thread_safe (0.3.5)
122
+    toml (0.1.2)
123
+      parslet (~> 1.5.0)
124
+    typhoeus (0.8.0)
125
+      ethon (>= 0.8.0)
126
+    tzinfo (1.2.2)
127
+      thread_safe (~> 0.1)
128
+    yajl-ruby (1.2.1)
129
+
130
+PLATFORMS
131
+  ruby
132
+
133
+DEPENDENCIES
134
+  execjs
135
+  github-pages
136
+  therubyracer

+ 8
- 0
README.md View File

@@ -13,6 +13,7 @@ If you need a bit of help or have comments, feel free to [contact me](http://dea
13 13
 - [Prerequisites](#prerequisites)
14 14
 - [Build your website in 3 steps](#build-your-website-in-3-steps)
15 15
 - [Add your own content](#add-your-own-content)
16
+- [Local Development](#local-development)
16 17
 - [Last important thing: YAML front matter](#last-important-thing-yaml-front-matter)
17 18
 - [Features](#features)
18 19
 - [More advanced features](#more-advanced-features)
@@ -64,6 +65,13 @@ Any file that you add inside the [`_posts`](./_posts) directory will be treated
64 65
 
65 66
 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.
66 67
 
68
+###Local Development on *nix and windows
69
+ - 1) Install [VirtualBox](http://virtualbox.org) and [Vagrant](https://www.vagrantup.com).
70
+ - 2) Clone down your fork `git clone git@github.com:yourusername/yourusername.github.io.git`
71
+ - 3) Inside your repository folder call `vagrant up`
72
+ - 4) View your website at http://0.0.0.0:4000 on *nix or http://127.0.0.1:4000 on windows. 
73
+ - 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.
74
+
67 75
 ### Last important thing: YAML front matter
68 76
 
69 77
 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
- 0
Vagrantfile View File

@@ -0,0 +1,47 @@
1
+# -*- mode: ruby -*-
2
+# vi: set ft=ruby :
3
+
4
+$script_provision = <<SCRIPT
5
+  echo Provisioning...
6
+  
7
+  gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
8
+  curl -sSL https://get.rvm.io | bash -s stable --rails
9
+  source /usr/local/rvm/scripts/rvm
10
+  
11
+  cd /vagrant
12
+  bundle install
13
+
14
+  echo "#!/bin/bash"                               >  /usr/local/bin/jekyll-start.sh
15
+  echo "cd /vagrant"                               >> /usr/local/bin/jekyll-start.sh
16
+  echo "source /usr/local/rvm/scripts/rvm"         >> /usr/local/bin/jekyll-start.sh
17
+  echo "bundle exec jekyll serve --force_polling"  >> /usr/local/bin/jekyll-start.sh
18
+  chmod +x                                            /usr/local/bin/jekyll-start.sh
19
+ 
20
+  echo Provisioned!!!
21
+SCRIPT
22
+
23
+Vagrant.configure("2") do |config|
24
+  # Base box.
25
+  config.vm.box = "xnerv/standard-debian-7.9.0-i386.box"
26
+  
27
+  # Shared folders.
28
+  config.vm.synced_folder "./", "/vagrant"
29
+  
30
+  # Forwarded ports.
31
+  config.vm.network :forwarded_port, guest: 4000, host: 4000
32
+
33
+  # Remote access.
34
+  config.ssh.forward_agent = true
35
+  
36
+  # Virtualization provider.
37
+  config.vm.provider :virtualbox do |vb|
38
+    # Don't boot with headless mode.
39
+    vb.gui = false
40
+ 
41
+    # Use VBoxManage to customize the VM.
42
+    vb.customize ["modifyvm", :id, "--memory", "512"]
43
+  end
44
+
45
+  config.vm.provision "shell", inline: $script_provision, run: "once"
46
+  config.vm.provision "shell", inline: "/usr/local/bin/jekyll-start.sh", run: "always"
47
+end

+ 4
- 1
_config.yml View File

@@ -92,9 +92,12 @@ defaults:
92 92
 
93 93
 # Exclude these files from production site
94 94
 exclude:
95
-  - CNAME
95
+  - Gemfile
96
+  - Gemfile.lock
96 97
   - LICENSE
97 98
   - README.md
99
+  - CNAME
100
+  - Vagrantfile
98 101
 
99 102
 # prose.io config
100 103
 prose:

Loading…
Cancel
Save