jekyll-netlify 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +50 -0
- data/.travis.yml +11 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +99 -0
- data/LICENSE +21 -0
- data/README.md +44 -0
- data/Rakefile +8 -0
- data/jekyll-netlify.gemspec +28 -0
- data/lib/jekyll-netlify.rb +1 -0
- data/lib/jekyll/netlify.rb +8 -0
- data/lib/jekyll/netlify/generator.rb +60 -0
- data/lib/jekyll/netlify/version.rb +6 -0
- data/test/test_netlify.rb +192 -0
- data/test/test_site/.gitignore +1 -0
- data/test/test_site/_config.yml +5 -0
- data/test/test_site/_posts/2014-07-14-welcome-to-jekyll.markdown +30 -0
- data/test/test_site/about.md +11 -0
- data/test/test_site/index.html +20 -0
- metadata +152 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 19d6996452296df23ad6980f1bf2ed141bda74b2
|
4
|
+
data.tar.gz: 26971263d3b67fc4057c381087321189788b8ae8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: ae03615628732badd59741ddbdb35e0c705d1e60e3b4a3cae03a92ed4456eab545911c7e0a6aea53d9935b57ffbf17610241d3608ee53ba41ba8ffb5a30a0400
|
7
|
+
data.tar.gz: 8a12d798feaa1d2cd0c791a54f862efe154354f34747f687cff6397a6ae9996c927c4a31398265aca6ba89cf26e60bd6d782ee4e1d40e282dff0768b61d986c1
|
data/.gitignore
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
4
|
+
/coverage/
|
5
|
+
/InstalledFiles
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
11
|
+
/tmp/
|
12
|
+
|
13
|
+
# Used by dotenv library to load environment variables.
|
14
|
+
# .env
|
15
|
+
|
16
|
+
## Specific to RubyMotion:
|
17
|
+
.dat*
|
18
|
+
.repl_history
|
19
|
+
build/
|
20
|
+
*.bridgesupport
|
21
|
+
build-iPhoneOS/
|
22
|
+
build-iPhoneSimulator/
|
23
|
+
|
24
|
+
## Specific to RubyMotion (use of CocoaPods):
|
25
|
+
#
|
26
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
27
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
28
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
29
|
+
#
|
30
|
+
# vendor/Pods/
|
31
|
+
|
32
|
+
## Documentation cache and generated files:
|
33
|
+
/.yardoc/
|
34
|
+
/_yardoc/
|
35
|
+
/doc/
|
36
|
+
/rdoc/
|
37
|
+
|
38
|
+
## Environment normalization:
|
39
|
+
/.bundle/
|
40
|
+
/vendor/bundle
|
41
|
+
/lib/bundler/man/
|
42
|
+
|
43
|
+
# for a library or gem, you might want to ignore these files since the code is
|
44
|
+
# intended to run in multiple environments; otherwise, check them in:
|
45
|
+
# Gemfile.lock
|
46
|
+
# .ruby-version
|
47
|
+
# .ruby-gemset
|
48
|
+
|
49
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
50
|
+
.rvmrc
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
jekyll-netlify (0.1.0)
|
5
|
+
jekyll (~> 3.0)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
activesupport (5.1.4)
|
11
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
12
|
+
i18n (~> 0.7)
|
13
|
+
minitest (~> 5.1)
|
14
|
+
tzinfo (~> 1.1)
|
15
|
+
addressable (2.5.2)
|
16
|
+
public_suffix (>= 2.0.2, < 4.0)
|
17
|
+
ast (2.3.0)
|
18
|
+
colorator (1.1.0)
|
19
|
+
concurrent-ruby (1.0.5)
|
20
|
+
ffi (1.9.18)
|
21
|
+
forwardable-extended (2.6.0)
|
22
|
+
i18n (0.9.1)
|
23
|
+
concurrent-ruby (~> 1.0)
|
24
|
+
jekyll (3.6.2)
|
25
|
+
addressable (~> 2.4)
|
26
|
+
colorator (~> 1.0)
|
27
|
+
jekyll-sass-converter (~> 1.0)
|
28
|
+
jekyll-watch (~> 1.1)
|
29
|
+
kramdown (~> 1.14)
|
30
|
+
liquid (~> 4.0)
|
31
|
+
mercenary (~> 0.3.3)
|
32
|
+
pathutil (~> 0.9)
|
33
|
+
rouge (>= 1.7, < 3)
|
34
|
+
safe_yaml (~> 1.0)
|
35
|
+
jekyll-sass-converter (1.5.0)
|
36
|
+
sass (~> 3.4)
|
37
|
+
jekyll-watch (1.5.0)
|
38
|
+
listen (~> 3.0)
|
39
|
+
kramdown (1.15.0)
|
40
|
+
liquid (4.0.0)
|
41
|
+
listen (3.1.5)
|
42
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
43
|
+
mercenary (0.3.6)
|
44
|
+
metaclass (0.0.4)
|
45
|
+
minitest (5.10.3)
|
46
|
+
mocha (1.3.0)
|
47
|
+
metaclass (~> 0.0.1)
|
48
|
+
parallel (1.12.0)
|
49
|
+
parser (2.4.0.0)
|
50
|
+
ast (~> 2.2)
|
51
|
+
pathutil (0.16.0)
|
52
|
+
forwardable-extended (~> 2.6)
|
53
|
+
powerpack (0.1.1)
|
54
|
+
public_suffix (3.0.1)
|
55
|
+
rainbow (2.2.2)
|
56
|
+
rake
|
57
|
+
rake (12.2.1)
|
58
|
+
rb-fsevent (0.10.2)
|
59
|
+
rb-inotify (0.9.10)
|
60
|
+
ffi (>= 0.5.0, < 2)
|
61
|
+
rouge (2.2.1)
|
62
|
+
rubocop (0.51.0)
|
63
|
+
parallel (~> 1.10)
|
64
|
+
parser (>= 2.3.3.1, < 3.0)
|
65
|
+
powerpack (~> 0.1)
|
66
|
+
rainbow (>= 2.2.2, < 3.0)
|
67
|
+
ruby-progressbar (~> 1.7)
|
68
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
69
|
+
ruby-progressbar (1.9.0)
|
70
|
+
safe_yaml (1.0.4)
|
71
|
+
sass (3.5.3)
|
72
|
+
sass-listen (~> 4.0.0)
|
73
|
+
sass-listen (4.0.0)
|
74
|
+
rb-fsevent (~> 0.9, >= 0.9.4)
|
75
|
+
rb-inotify (~> 0.9, >= 0.9.7)
|
76
|
+
shoulda (3.5.0)
|
77
|
+
shoulda-context (~> 1.0, >= 1.0.1)
|
78
|
+
shoulda-matchers (>= 1.4.1, < 3.0)
|
79
|
+
shoulda-context (1.2.2)
|
80
|
+
shoulda-matchers (2.8.0)
|
81
|
+
activesupport (>= 3.0.0)
|
82
|
+
thread_safe (0.3.6)
|
83
|
+
tzinfo (1.2.4)
|
84
|
+
thread_safe (~> 0.1)
|
85
|
+
unicode-display_width (1.3.0)
|
86
|
+
|
87
|
+
PLATFORMS
|
88
|
+
ruby
|
89
|
+
|
90
|
+
DEPENDENCIES
|
91
|
+
bundler (~> 1.6)
|
92
|
+
jekyll-netlify!
|
93
|
+
mocha
|
94
|
+
rake
|
95
|
+
rubocop (~> 0.41)
|
96
|
+
shoulda
|
97
|
+
|
98
|
+
BUNDLED WITH
|
99
|
+
1.16.0
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2017 John Vandenberg
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/jayvdb/jekyll-netlify.svg?branch=master)](https://travis-ci.org/jayvdb/jekyll-netlify)
|
2
|
+
|
3
|
+
# Jekyll::Netlify
|
4
|
+
|
5
|
+
Expose Netlify deploy information to Jekyll templates
|
6
|
+
and set `site.environment=production`.
|
7
|
+
|
8
|
+
```
|
9
|
+
{{site.netlify.branch}} # => Will return the branch name
|
10
|
+
```
|
11
|
+
|
12
|
+
## Installation
|
13
|
+
|
14
|
+
Add to your `Gemfile`:
|
15
|
+
|
16
|
+
```
|
17
|
+
gem 'jekyll-netlify'
|
18
|
+
```
|
19
|
+
|
20
|
+
Add to your `_config.yml`:
|
21
|
+
|
22
|
+
```yml
|
23
|
+
plugins:
|
24
|
+
- jekyll-netlify
|
25
|
+
```
|
26
|
+
|
27
|
+
## Usage
|
28
|
+
|
29
|
+
This plugin adds hash of `site.netlify` containing
|
30
|
+
[Build Environment information](https://www.netlify.com/docs/continuous-deployment/#build-environment-variables):
|
31
|
+
|
32
|
+
- repository_url
|
33
|
+
- branch
|
34
|
+
- pull_request: bool
|
35
|
+
- head
|
36
|
+
- commit
|
37
|
+
- context
|
38
|
+
- deploy_url
|
39
|
+
- url
|
40
|
+
- deploy_prime_url
|
41
|
+
- webhook
|
42
|
+
- title
|
43
|
+
- url
|
44
|
+
- body
|
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'jekyll/netlify/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'jekyll-netlify'
|
8
|
+
spec.version = Jekyll::Netlify::VERSION
|
9
|
+
spec.authors = ['John Vandenberg']
|
10
|
+
spec.email = ['jayvdb@gmail.com']
|
11
|
+
spec.summary = 'Netlify metadata for Jekyll.'
|
12
|
+
spec.description = 'Access Netlify environment values in Jekyll templates'
|
13
|
+
spec.homepage = 'https://github.com/jayvdb/jekyll-netlify'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_dependency 'jekyll', '~> 3.0'
|
22
|
+
|
23
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
24
|
+
spec.add_development_dependency 'rake'
|
25
|
+
spec.add_development_dependency 'shoulda'
|
26
|
+
spec.add_development_dependency 'mocha'
|
27
|
+
spec.add_development_dependency 'rubocop', '~> 0.41'
|
28
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'jekyll/netlify'
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module Jekyll
|
2
|
+
module Netlify
|
3
|
+
# Netlify plugin generator
|
4
|
+
class Generator < Jekyll::Generator
|
5
|
+
safe true
|
6
|
+
|
7
|
+
def generate(site)
|
8
|
+
if netlify?
|
9
|
+
site.config['netlify'] = load_netlify_env
|
10
|
+
if production?
|
11
|
+
ENV['JEKYLL_ENV'] = 'production'
|
12
|
+
site.config['environment'] = 'production'
|
13
|
+
end
|
14
|
+
else
|
15
|
+
site.config['netlify'] = false
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def netlify?
|
20
|
+
return false unless ENV.key?('DEPLOY_URL')
|
21
|
+
deploy_url = ENV['DEPLOY_URL']
|
22
|
+
return false unless deploy_url.include? 'netlify'
|
23
|
+
|
24
|
+
true
|
25
|
+
end
|
26
|
+
|
27
|
+
def production?
|
28
|
+
ENV['CONTEXT'].eql?('production') ? true : false
|
29
|
+
end
|
30
|
+
|
31
|
+
def pull_request?
|
32
|
+
ENV['PULL_REQUEST'].eql?('true') ? true : false
|
33
|
+
end
|
34
|
+
|
35
|
+
def webhook?
|
36
|
+
ENV.key?('WEBHOOK_URL')
|
37
|
+
end
|
38
|
+
|
39
|
+
def load_netlify_env(env = ENV)
|
40
|
+
data = {
|
41
|
+
'repository_url' => env['REPOSITORY_URL'],
|
42
|
+
'branch' => env['BRANCH'],
|
43
|
+
'pull_request' => pull_request?,
|
44
|
+
'head' => env['HEAD'],
|
45
|
+
'commit' => env['COMMIT_REF'],
|
46
|
+
'context' => env['CONTEXT'],
|
47
|
+
'deploy_url' => env['DEPLOY_URL'],
|
48
|
+
'url' => ENV['URL'],
|
49
|
+
'deploy_prime_url' => env['DEPLOY_PRIME_URL'],
|
50
|
+
}
|
51
|
+
data['webhook'] = !webhook? ? false : {
|
52
|
+
'title' => env['WEBHOOK_TITLE'],
|
53
|
+
'body' => env['WEBHOOK_BODY'],
|
54
|
+
'url' => env['WEBHOOK_URL'],
|
55
|
+
}
|
56
|
+
data
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,192 @@
|
|
1
|
+
require 'minitest/autorun'
|
2
|
+
require 'minitest/unit'
|
3
|
+
require 'shoulda'
|
4
|
+
require 'mocha/mini_test'
|
5
|
+
require 'jekyll'
|
6
|
+
require 'jekyll-netlify'
|
7
|
+
|
8
|
+
def jekyll_test_site
|
9
|
+
File.join(File.dirname(__FILE__), 'test_site')
|
10
|
+
end
|
11
|
+
|
12
|
+
class Jekyll::NetlifyTest < Minitest::Test
|
13
|
+
context 'normal build' do
|
14
|
+
setup do
|
15
|
+
Jekyll.instance_variable_set(
|
16
|
+
:@logger, Jekyll::LogAdapter.new(Jekyll::Stevenson.new, :error)
|
17
|
+
)
|
18
|
+
|
19
|
+
ENV.clear
|
20
|
+
|
21
|
+
config = Jekyll.configuration(
|
22
|
+
source: jekyll_test_site,
|
23
|
+
destination: File.join(jekyll_test_site, '_site'),
|
24
|
+
plugins: nil,
|
25
|
+
)
|
26
|
+
@site = Jekyll::Site.new(config)
|
27
|
+
@site.read
|
28
|
+
@site.generate
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'netlify info' do
|
32
|
+
setup do
|
33
|
+
@netlify = @site.config['netlify']
|
34
|
+
end
|
35
|
+
|
36
|
+
should 'be false' do
|
37
|
+
assert_equal false, @netlify
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context 'netlify production deploy' do
|
43
|
+
setup do
|
44
|
+
Jekyll.instance_variable_set(
|
45
|
+
:@logger, Jekyll::LogAdapter.new(Jekyll::Stevenson.new, :error)
|
46
|
+
)
|
47
|
+
|
48
|
+
ENV.clear
|
49
|
+
|
50
|
+
ENV['URL'] = 'https://example.com'
|
51
|
+
ENV['BRANCH'] = 'master'
|
52
|
+
ENV['CONTEXT'] = 'production'
|
53
|
+
ENV['PULL_REQUEST'] = 'false'
|
54
|
+
ENV['DEPLOY_URL'] = 'https://578ab634d5d5cf960d620--open-api.netlify.com'
|
55
|
+
ENV['DEPLOY_PRIME_URL'] = 'https://beta--open-api.netlify.com'
|
56
|
+
|
57
|
+
config = Jekyll.configuration(
|
58
|
+
source: jekyll_test_site,
|
59
|
+
destination: File.join(jekyll_test_site, '_site'),
|
60
|
+
)
|
61
|
+
@site = Jekyll::Site.new(config)
|
62
|
+
@site.read
|
63
|
+
@site.generate
|
64
|
+
end
|
65
|
+
|
66
|
+
context 'info' do
|
67
|
+
setup do
|
68
|
+
@netlify = @site.config['netlify']
|
69
|
+
end
|
70
|
+
|
71
|
+
should 'be a Hash' do
|
72
|
+
assert_instance_of Hash, @netlify
|
73
|
+
end
|
74
|
+
|
75
|
+
should 'include URLs' do
|
76
|
+
assert_operator @netlify, :has_key?, 'url'
|
77
|
+
assert_equal 'https://example.com', @netlify['url']
|
78
|
+
end
|
79
|
+
|
80
|
+
should 'be production' do
|
81
|
+
assert_equal 'production', @site.config['environment']
|
82
|
+
end
|
83
|
+
|
84
|
+
should 'not be a pull request' do
|
85
|
+
assert_operator @netlify, :has_key?, 'pull_request'
|
86
|
+
assert_equal false, @netlify['pull_request']
|
87
|
+
end
|
88
|
+
|
89
|
+
should 'not include webhook data' do
|
90
|
+
assert_operator @netlify, :has_key?, 'webhook'
|
91
|
+
assert_equal false, @netlify['webhook']
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
context 'netlify pull request' do
|
97
|
+
setup do
|
98
|
+
Jekyll.instance_variable_set(
|
99
|
+
:@logger, Jekyll::LogAdapter.new(Jekyll::Stevenson.new, :error)
|
100
|
+
)
|
101
|
+
|
102
|
+
ENV.clear
|
103
|
+
|
104
|
+
ENV['URL'] = 'https://example.com'
|
105
|
+
ENV['BRANCH'] = 'master'
|
106
|
+
ENV['CONTEXT'] = 'deploy-preview'
|
107
|
+
ENV['PULL_REQUEST'] = 'true'
|
108
|
+
ENV['DEPLOY_URL'] = 'https://578ab634d5d5cf960d620--open-api.netlify.com'
|
109
|
+
ENV['DEPLOY_PRIME_URL'] = 'https://beta--open-api.netlify.com'
|
110
|
+
|
111
|
+
config = Jekyll.configuration(
|
112
|
+
source: jekyll_test_site,
|
113
|
+
destination: File.join(jekyll_test_site, '_site'),
|
114
|
+
)
|
115
|
+
@site = Jekyll::Site.new(config)
|
116
|
+
@site.read
|
117
|
+
@site.generate
|
118
|
+
end
|
119
|
+
|
120
|
+
context 'info' do
|
121
|
+
setup do
|
122
|
+
@netlify = @site.config['netlify']
|
123
|
+
end
|
124
|
+
|
125
|
+
should 'be a Hash' do
|
126
|
+
assert_instance_of Hash, @netlify
|
127
|
+
end
|
128
|
+
|
129
|
+
should 'include URLs' do
|
130
|
+
assert_operator @netlify, :has_key?, 'url'
|
131
|
+
assert_equal 'https://example.com', @netlify['url']
|
132
|
+
end
|
133
|
+
|
134
|
+
should 'not be production' do
|
135
|
+
assert_operator @site.config['environment'], :!=, 'production'
|
136
|
+
end
|
137
|
+
|
138
|
+
should 'be a pull request' do
|
139
|
+
assert_operator @netlify, :has_key?, 'pull_request'
|
140
|
+
assert_equal true, @netlify['pull_request']
|
141
|
+
end
|
142
|
+
|
143
|
+
should 'not include webhook data' do
|
144
|
+
assert_operator @netlify, :has_key?, 'webhook'
|
145
|
+
assert_equal false, @netlify['webhook']
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
context 'netlify webhook deploy' do
|
151
|
+
setup do
|
152
|
+
Jekyll.instance_variable_set(
|
153
|
+
:@logger, Jekyll::LogAdapter.new(Jekyll::Stevenson.new, :error)
|
154
|
+
)
|
155
|
+
|
156
|
+
ENV.clear
|
157
|
+
|
158
|
+
ENV['URL'] = 'https://example.com'
|
159
|
+
ENV['DEPLOY_URL'] = 'https://578ab634d5d5cf960d620--open-api.netlify.com'
|
160
|
+
ENV['DEPLOY_PRIME_URL'] = 'https://beta--open-api.netlify.com'
|
161
|
+
ENV['PULL_REQUEST'] = 'false'
|
162
|
+
ENV['WEBHOOK_TITLE'] = 'Title'
|
163
|
+
ENV['WEBHOOK_URL'] = 'http://webtask.io/foo'
|
164
|
+
ENV['WEBHOOK_BODY'] = '{}'
|
165
|
+
|
166
|
+
config = Jekyll.configuration(
|
167
|
+
source: jekyll_test_site,
|
168
|
+
destination: File.join(jekyll_test_site, '_site'),
|
169
|
+
)
|
170
|
+
@site = Jekyll::Site.new(config)
|
171
|
+
@site.read
|
172
|
+
@site.generate
|
173
|
+
end
|
174
|
+
|
175
|
+
context 'info' do
|
176
|
+
setup do
|
177
|
+
@netlify = @site.config['netlify']
|
178
|
+
end
|
179
|
+
|
180
|
+
should 'be a Hash' do
|
181
|
+
assert_operator @netlify, :has_key?, 'webhook'
|
182
|
+
assert_instance_of Hash, @netlify['webhook']
|
183
|
+
end
|
184
|
+
|
185
|
+
should 'include webhook data' do
|
186
|
+
assert_equal 'Title', @netlify['webhook']['title']
|
187
|
+
assert_equal '{}', @netlify['webhook']['body']
|
188
|
+
assert_equal 'http://webtask.io/foo', @netlify['webhook']['url']
|
189
|
+
end
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
_site
|
@@ -0,0 +1,30 @@
|
|
1
|
+
---
|
2
|
+
layout: post
|
3
|
+
title: "Welcome to Jekyll!"
|
4
|
+
date: 2014-07-14 02:00:29
|
5
|
+
categories: jekyll update
|
6
|
+
---
|
7
|
+
|
8
|
+
You'll find this post in your `_posts` directory - edit this post and re-build (or run with the `-w` switch) to see your changes!
|
9
|
+
To add new posts, simply add a file in the `_posts` directory that follows the convention: YYYY-MM-DD-name-of-post.ext.
|
10
|
+
|
11
|
+
Jekyll also offers powerful support for code snippets:
|
12
|
+
|
13
|
+
{% highlight ruby %}
|
14
|
+
def print_hi(name)
|
15
|
+
puts "Hi, #{name}"
|
16
|
+
end
|
17
|
+
print_hi('Tom')
|
18
|
+
#=> prints 'Hi, Tom' to STDOUT.
|
19
|
+
{% endhighlight %}
|
20
|
+
|
21
|
+
Check out the [Jekyll docs][jekyll] for more info on how to get the most out of Jekyll. File all bugs/feature requests at [Jekyll's GitHub repo][jekyll-gh].
|
22
|
+
|
23
|
+
Appending to a post.
|
24
|
+
|
25
|
+
---
|
26
|
+
|
27
|
+
I hope Jekyll::GitMetadata will be a useful plugin!
|
28
|
+
|
29
|
+
[jekyll-gh]: https://github.com/jekyll/jekyll
|
30
|
+
[jekyll]: http://jekyllrb.com
|
@@ -0,0 +1,11 @@
|
|
1
|
+
---
|
2
|
+
layout: page
|
3
|
+
title: About
|
4
|
+
permalink: /about/
|
5
|
+
---
|
6
|
+
|
7
|
+
This is a test Jekyll site for Jekyll::Netlify. You can view the plugin at [Github](https://github.com/jayvdb/jekyll-netlify).
|
8
|
+
|
9
|
+
You are welcome to submit pull requests or suggest ideas!
|
10
|
+
|
11
|
+
Adding some content
|
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
layout: default
|
3
|
+
---
|
4
|
+
|
5
|
+
<div class="home">
|
6
|
+
|
7
|
+
<h1>Posts</h1>
|
8
|
+
|
9
|
+
<ul class="posts">
|
10
|
+
{% for post in site.posts %}
|
11
|
+
<li>
|
12
|
+
<span class="post-date">{{ post.date | date: "%b %-d, %Y" }}</span>
|
13
|
+
<a class="post-link" href="{{ post.url | prepend: site.baseurl }}">{{ post.title }}</a>
|
14
|
+
</li>
|
15
|
+
{% endfor %}
|
16
|
+
</ul>
|
17
|
+
|
18
|
+
<p class="rss-subscribe">subscribe <a href="{{ "/feed.xml" | prepend: site.baseurl }}">via RSS</a></p>
|
19
|
+
|
20
|
+
</div>
|
metadata
ADDED
@@ -0,0 +1,152 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jekyll-netlify
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- John Vandenberg
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-11-10 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: jekyll
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '3.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.6'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.6'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: shoulda
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: mocha
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.41'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.41'
|
97
|
+
description: Access Netlify environment values in Jekyll templates
|
98
|
+
email:
|
99
|
+
- jayvdb@gmail.com
|
100
|
+
executables: []
|
101
|
+
extensions: []
|
102
|
+
extra_rdoc_files: []
|
103
|
+
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".travis.yml"
|
106
|
+
- Gemfile
|
107
|
+
- Gemfile.lock
|
108
|
+
- LICENSE
|
109
|
+
- README.md
|
110
|
+
- Rakefile
|
111
|
+
- jekyll-netlify.gemspec
|
112
|
+
- lib/jekyll-netlify.rb
|
113
|
+
- lib/jekyll/netlify.rb
|
114
|
+
- lib/jekyll/netlify/generator.rb
|
115
|
+
- lib/jekyll/netlify/version.rb
|
116
|
+
- test/test_netlify.rb
|
117
|
+
- test/test_site/.gitignore
|
118
|
+
- test/test_site/_config.yml
|
119
|
+
- test/test_site/_posts/2014-07-14-welcome-to-jekyll.markdown
|
120
|
+
- test/test_site/about.md
|
121
|
+
- test/test_site/index.html
|
122
|
+
homepage: https://github.com/jayvdb/jekyll-netlify
|
123
|
+
licenses:
|
124
|
+
- MIT
|
125
|
+
metadata: {}
|
126
|
+
post_install_message:
|
127
|
+
rdoc_options: []
|
128
|
+
require_paths:
|
129
|
+
- lib
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
requirements: []
|
141
|
+
rubyforge_project:
|
142
|
+
rubygems_version: 2.6.13
|
143
|
+
signing_key:
|
144
|
+
specification_version: 4
|
145
|
+
summary: Netlify metadata for Jekyll.
|
146
|
+
test_files:
|
147
|
+
- test/test_netlify.rb
|
148
|
+
- test/test_site/.gitignore
|
149
|
+
- test/test_site/_config.yml
|
150
|
+
- test/test_site/_posts/2014-07-14-welcome-to-jekyll.markdown
|
151
|
+
- test/test_site/about.md
|
152
|
+
- test/test_site/index.html
|