jenner 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +18 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +110 -0
- data/Rakefile +10 -0
- data/bin/jenner +20 -0
- data/jenner.gemspec +25 -0
- data/lib/jenner/item.rb +65 -0
- data/lib/jenner/site.rb +68 -0
- data/lib/jenner/template.rb +17 -0
- data/lib/jenner/template_file_system.rb +30 -0
- data/lib/jenner/version.rb +3 -0
- data/lib/jenner.rb +18 -0
- data/test/fixtures/source/_site/_hidden.html +0 -0
- data/test/fixtures/source/_site/markdown_test.markdown +8 -0
- data/test/fixtures/source/_site/subdirectory/subfile.html +7 -0
- data/test/fixtures/source/_site/subdirectory/test.png +0 -0
- data/test/fixtures/source/_site/test.html +11 -0
- data/test/fixtures/source/_site/test.scss +5 -0
- data/test/fixtures/source/_templates/simple.html +1 -0
- data/test/fixtures/source/_templates/test.html +1 -0
- data/test/fixtures/source/_templates/wrapper.html +6 -0
- data/test/helper.rb +25 -0
- data/test/jenner/test_item.rb +63 -0
- data/test/jenner/test_site.rb +39 -0
- data/test/jenner/test_template.rb +23 -0
- metadata +166 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Jay Strybis
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
# Jenner
|
2
|
+
|
3
|
+
Jenner is a static site generator, named after another Doctor.
|
4
|
+
|
5
|
+

|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'jenner'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install jenner
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
TODO: add a `jenner new` command to create site skeleton
|
24
|
+
|
25
|
+
1. `mkdir my_jenner_site`
|
26
|
+
2. `cd my_jenner_site`
|
27
|
+
3. `mkdir _site`
|
28
|
+
4. `mkdir _templates`
|
29
|
+
5. Create a template in `_templates` (e.g. page.html)
|
30
|
+
6. Start creating items (pages) in `_site`
|
31
|
+
7. `jenner build`
|
32
|
+
|
33
|
+
Your generated site will be in `./public`.
|
34
|
+
|
35
|
+
### Items
|
36
|
+
|
37
|
+
Here's an example (example.html):
|
38
|
+
|
39
|
+
---
|
40
|
+
title: 'Example Page'
|
41
|
+
date: 2014-01-23 17:02:00 -6
|
42
|
+
template: 'page'
|
43
|
+
---
|
44
|
+
|
45
|
+
<p>This is an example page.</p>
|
46
|
+
|
47
|
+
This item will be rendered using the `page` template. The `page`
|
48
|
+
template can use the following data:
|
49
|
+
|
50
|
+
{{item.title}} => "Example Page"
|
51
|
+
{{item.data}} => 2014-01-23 17:02:00 -6
|
52
|
+
{{item.template_name}} => "page"
|
53
|
+
{{item.body}} => "<p>This is an example page.</p>
|
54
|
+
|
55
|
+
You can define additional pieces of data in the item header like this:
|
56
|
+
|
57
|
+
---
|
58
|
+
title: 'Example Page'
|
59
|
+
date: 2014-01-23 17:02:00 -6
|
60
|
+
template: 'page'
|
61
|
+
foo: 'bar'
|
62
|
+
answer: 42
|
63
|
+
---
|
64
|
+
|
65
|
+
This item has a couple additional pieces of data:
|
66
|
+
|
67
|
+
{{item.data.foo}} => "bar"
|
68
|
+
{{item.data.answer}} => 42
|
69
|
+
|
70
|
+
You can also create markdown items with the file extension `.markdown`.
|
71
|
+
These will be go through the Liquid templating engine first, and then
|
72
|
+
they will be processed as Markdown.
|
73
|
+
|
74
|
+
---
|
75
|
+
title: 'Example Markdown Page'
|
76
|
+
date: 2014-01-23 17:02:00 -6
|
77
|
+
template: 'page'
|
78
|
+
---
|
79
|
+
|
80
|
+
# This is an example page
|
81
|
+
|
82
|
+
|
83
|
+
### Templates
|
84
|
+
|
85
|
+
Templates are just HTML files that use Liquid markup. Every item you
|
86
|
+
create is rendered with a template that you specify in the item's
|
87
|
+
header.
|
88
|
+
|
89
|
+
Every item provides the following data at minimum:
|
90
|
+
|
91
|
+
{{item.title}}
|
92
|
+
{{item.date}}
|
93
|
+
{{item.template_name}}
|
94
|
+
{{item.body}}
|
95
|
+
|
96
|
+
Additional pieces of data are available within `{{item.data}}` if they
|
97
|
+
are defined in the item's YAML header.
|
98
|
+
|
99
|
+
You can include other templates with the `{% include %}` tag.
|
100
|
+
|
101
|
+
{% include 'some_other_template' %}
|
102
|
+
|
103
|
+
|
104
|
+
## Contributing
|
105
|
+
|
106
|
+
1. Fork it
|
107
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
108
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
109
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
110
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
data/bin/jenner
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
STDOUT.sync = true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'jenner'
|
6
|
+
require 'mercenary'
|
7
|
+
|
8
|
+
Mercenary.program(:jenner) do |p|
|
9
|
+
p.version Jenner::VERSION
|
10
|
+
p.description 'Jenner is an opinionated static site generator'
|
11
|
+
|
12
|
+
p.command(:build) do |c|
|
13
|
+
c.syntax "jenner build"
|
14
|
+
c.description "Builds your Jenner site"
|
15
|
+
|
16
|
+
c.action do |args, options|
|
17
|
+
Jenner.build(args, options)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/jenner.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'jenner/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "jenner"
|
8
|
+
gem.version = Jenner::VERSION
|
9
|
+
gem.authors = ["Jay Strybis"]
|
10
|
+
gem.email = ["jay.strybis@gmail.com"]
|
11
|
+
gem.description = %q{Jenner is an opinionated static site generator}
|
12
|
+
gem.summary = %q{Jenner is an opinionated static site generator}
|
13
|
+
gem.homepage = "http://github.com/unreal/jenner"
|
14
|
+
|
15
|
+
gem.files = `git ls-files`.split($/)
|
16
|
+
gem.executables = ["jenner"]
|
17
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
18
|
+
gem.require_paths = ["lib"]
|
19
|
+
|
20
|
+
gem.add_dependency "liquid", "~> 2.6.1"
|
21
|
+
gem.add_dependency "maruku", "~> 0.7.1"
|
22
|
+
gem.add_dependency "mercenary", "~> 0.2.1"
|
23
|
+
gem.add_dependency "sass", "~> 3.2.13"
|
24
|
+
gem.add_development_dependency "test-unit", "~> 2.5.5"
|
25
|
+
end
|
data/lib/jenner/item.rb
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
module Jenner
|
2
|
+
class Item
|
3
|
+
attr_reader :body, :title, :date, :template_name, :data
|
4
|
+
def initialize(filename, site)
|
5
|
+
@filename = filename
|
6
|
+
@site = site
|
7
|
+
|
8
|
+
@body = File.read(File.join(@site.root,'_site',@filename), encoding: "US-ASCII")
|
9
|
+
|
10
|
+
if @body =~ /\A(---\s*\n.*?\n?)^(---\s*$\n?)/m
|
11
|
+
@body = $'
|
12
|
+
@header = YAML.load($1)
|
13
|
+
end
|
14
|
+
|
15
|
+
@title = @header.delete("title")
|
16
|
+
@date = @header.delete("date")
|
17
|
+
@template_name = @header.delete("template")
|
18
|
+
@tags = @header.delete("tags")
|
19
|
+
@data = @header
|
20
|
+
end
|
21
|
+
|
22
|
+
def url
|
23
|
+
"/#{@filename}"
|
24
|
+
end
|
25
|
+
|
26
|
+
def template
|
27
|
+
Jenner::Template.from_file(File.join(@site.root,'_templates',"#{@template_name}.html"), @site)
|
28
|
+
end
|
29
|
+
|
30
|
+
def to_liquid
|
31
|
+
{
|
32
|
+
'title' => @title,
|
33
|
+
'date' => @date,
|
34
|
+
'template_name' => @template_name,
|
35
|
+
'tags' => @tags,
|
36
|
+
'data' => @data,
|
37
|
+
'url' => url
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
def markdown(s)
|
42
|
+
return s unless @filename.split('.').last == "markdown"
|
43
|
+
|
44
|
+
Maruku.new(s).to_html
|
45
|
+
end
|
46
|
+
|
47
|
+
def body
|
48
|
+
markdown(Liquid::Template.parse(@body).render('self' => self))
|
49
|
+
end
|
50
|
+
|
51
|
+
def render
|
52
|
+
template.render(
|
53
|
+
'item' => self.to_liquid.merge('body' => body)
|
54
|
+
)
|
55
|
+
end
|
56
|
+
|
57
|
+
def public_path
|
58
|
+
File.join(@site.root,'public',@filename)
|
59
|
+
end
|
60
|
+
|
61
|
+
def generate!
|
62
|
+
File.write(public_path,render)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
data/lib/jenner/site.rb
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
module Jenner
|
2
|
+
class Site
|
3
|
+
attr_reader :root
|
4
|
+
def initialize(root)
|
5
|
+
@root = root
|
6
|
+
|
7
|
+
Liquid::Template.file_system = Jenner::TemplateFileSystem.new(File.join(@root,'_templates'))
|
8
|
+
end
|
9
|
+
|
10
|
+
def site_path
|
11
|
+
File.join(@root,"_site")
|
12
|
+
end
|
13
|
+
|
14
|
+
def files
|
15
|
+
Dir.glob(File.join(site_path,"[^_]*.{html,markdown}")) +
|
16
|
+
Dir.glob(File.join(site_path,"**","[^_]*.{html,markdown}"))
|
17
|
+
end
|
18
|
+
|
19
|
+
def relative_path(item)
|
20
|
+
(item.split("/") - site_path.split("/")).join("/")
|
21
|
+
end
|
22
|
+
|
23
|
+
def items
|
24
|
+
files.inject([]) { |a,i|
|
25
|
+
a << Jenner::Item.new(relative_path(i), self)
|
26
|
+
}
|
27
|
+
end
|
28
|
+
|
29
|
+
def public_dir
|
30
|
+
File.join(@root, "public")
|
31
|
+
end
|
32
|
+
|
33
|
+
def site_dir
|
34
|
+
File.join(@root, "_site")
|
35
|
+
end
|
36
|
+
|
37
|
+
def site_dirs
|
38
|
+
site_dir.split("/")
|
39
|
+
end
|
40
|
+
|
41
|
+
def relative_path_to_public(item)
|
42
|
+
(item.split("/") - site_dirs).join("/")
|
43
|
+
end
|
44
|
+
|
45
|
+
def generate!
|
46
|
+
FileUtils.rm_rf(public_dir)
|
47
|
+
FileUtils.mkdir(public_dir)
|
48
|
+
|
49
|
+
base_dirs = File.join(site_dir).split("/")
|
50
|
+
Dir.glob(File.join(@root,"_site","**","*")).each do |item|
|
51
|
+
if File.directory?(item)
|
52
|
+
FileUtils.mkdir_p(File.join(public_dir,relative_path_to_public(item)))
|
53
|
+
else
|
54
|
+
next if [".html",".markdown"].include? File.extname(item)
|
55
|
+
if File.extname(item) == ".scss"
|
56
|
+
engine = Sass::Engine.new(File.read(item), :syntax => :scss)
|
57
|
+
item = item.sub(".scss",".css")
|
58
|
+
File.write(File.join(public_dir,relative_path_to_public(item)),engine.render)
|
59
|
+
else
|
60
|
+
destination = File.join(public_dir,relative_path_to_public(item))
|
61
|
+
FileUtils.cp item, destination
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
items.map(&:generate!)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Jenner
|
2
|
+
class Template
|
3
|
+
attr_reader :body
|
4
|
+
def initialize(body, site)
|
5
|
+
@body = body
|
6
|
+
@site = site
|
7
|
+
end
|
8
|
+
|
9
|
+
def render(context)
|
10
|
+
Liquid::Template.parse(@body).render(context)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.from_file(file_path, site)
|
14
|
+
new(File.read(file_path, encoding: 'US-ASCII'), site)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Jenner
|
2
|
+
class TemplateFileSystem
|
3
|
+
attr_reader :root
|
4
|
+
def initialize(root)
|
5
|
+
@root = root
|
6
|
+
@pattern = "%s.html"
|
7
|
+
end
|
8
|
+
|
9
|
+
def read_template_file(template_path, context)
|
10
|
+
full_path = full_path(template_path)
|
11
|
+
raise FileSystemError, "No such template '#{template_path}'" unless File.exists?(full_path)
|
12
|
+
|
13
|
+
File.read(full_path)
|
14
|
+
end
|
15
|
+
|
16
|
+
def full_path(template_path)
|
17
|
+
raise FileSystemError, "Illegal template name '#{template_path}'" unless template_path =~ /^[^.\/][a-zA-Z0-9_\/]+$/
|
18
|
+
|
19
|
+
full_path = if template_path.include?('/')
|
20
|
+
File.join(root, File.dirname(template_path), @pattern % File.basename(template_path))
|
21
|
+
else
|
22
|
+
File.join(root, @pattern % template_path)
|
23
|
+
end
|
24
|
+
|
25
|
+
raise FileSystemError, "Illegal template path '#{File.expand_path(full_path)}'" unless File.expand_path(full_path) =~ /^#{File.expand_path(root)}/
|
26
|
+
|
27
|
+
full_path
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/jenner.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
require "liquid"
|
3
|
+
require "maruku"
|
4
|
+
require "sass"
|
5
|
+
|
6
|
+
require "jenner/item"
|
7
|
+
require "jenner/site"
|
8
|
+
require "jenner/template"
|
9
|
+
require "jenner/template_file_system"
|
10
|
+
require "jenner/version"
|
11
|
+
|
12
|
+
module Jenner
|
13
|
+
def self.build(args, options={})
|
14
|
+
@site = Site.new(File.expand_path('.'))
|
15
|
+
puts "Building a site at #{@site.root}"
|
16
|
+
@site.generate!
|
17
|
+
end
|
18
|
+
end
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
item: {{item.title}}
|
@@ -0,0 +1 @@
|
|
1
|
+
hi, {{name}}
|
data/test/helper.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
require 'test-unit'
|
3
|
+
require 'jenner'
|
4
|
+
|
5
|
+
module Test
|
6
|
+
module Unit
|
7
|
+
class TestCase
|
8
|
+
def setup
|
9
|
+
@site = Jenner::Site.new(File.join(File.dirname(__FILE__),'fixtures','source'))
|
10
|
+
end
|
11
|
+
|
12
|
+
def template_file(file_name)
|
13
|
+
File.join(File.dirname(__FILE__),'fixtures','source','_templates',file_name)
|
14
|
+
end
|
15
|
+
|
16
|
+
def site_file(path)
|
17
|
+
File.join(File.dirname(__FILE__),'fixtures','source', path)
|
18
|
+
end
|
19
|
+
|
20
|
+
def teardown
|
21
|
+
FileUtils.rm_rf(File.join(File.dirname(__FILE__),'fixtures','source','public'))
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestItem < Test::Unit::TestCase
|
4
|
+
def test_initialize
|
5
|
+
item = Jenner::Item.new('test.html',@site)
|
6
|
+
assert_equal "test", item.title
|
7
|
+
assert_equal Time.new(2014,1,23,17,2,0,"-06:00"), item.date
|
8
|
+
assert_equal "wrapper", item.template_name
|
9
|
+
assert_equal({ "foo" => "bar" }, item.data)
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_template_is_a_jenner_template
|
13
|
+
item = Jenner::Item.new('test.html',@site)
|
14
|
+
assert_equal Jenner::Template, item.template.class
|
15
|
+
end
|
16
|
+
|
17
|
+
def test_render
|
18
|
+
item = Jenner::Item.new('test.html',@site)
|
19
|
+
assert_equal "top\ntest\n2014-01-23 17:02:00 -0600\nwrapper\ntest\nbar\nitem content\n\nbottom\n", item.render
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_public_path
|
23
|
+
item = Jenner::Item.new('test.html',@site)
|
24
|
+
assert_equal site_file('public/test.html'), item.public_path
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_generate!
|
28
|
+
item = Jenner::Item.new('test.html',@site)
|
29
|
+
# make the public dir for the item, since @site normally does it
|
30
|
+
FileUtils.mkdir(File.join(@site.root,'public'))
|
31
|
+
item.generate!
|
32
|
+
assert File.exists?(File.join(@site.root,'public','test.html'))
|
33
|
+
assert_equal item.render, File.read(File.join(@site.root,'public','test.html'), encoding: "US-ASCII")
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_markdown_template
|
37
|
+
item = Jenner::Item.new('markdown_test.markdown', @site)
|
38
|
+
assert_equal "top\nmarkdown test\n2014-01-23 17:02:00 -0600\nwrapper\n\n<h1 id=\"markdown_test\">markdown test</h1>\n\n<p>item content</p>\n\nbottom\n", item.render
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_public_path_on_subdir_item
|
42
|
+
item = Jenner::Item.new("subdirectory/subfile.html",@site)
|
43
|
+
assert_equal site_file("public/subdirectory/subfile.html"), item.public_path
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_generate_on_subdir_item
|
47
|
+
item = Jenner::Item.new("subdirectory/subfile.html",@site)
|
48
|
+
FileUtils.mkdir_p(File.join(@site.root,'public','subdirectory'))
|
49
|
+
item.generate!
|
50
|
+
assert File.exists?(File.join(@site.root,'public','subdirectory','subfile.html'))
|
51
|
+
assert_equal "item: subfile\n", File.read(File.join(@site.root,'public','subdirectory','subfile.html'))
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_url
|
55
|
+
item = Jenner::Item.new('test.html',@site)
|
56
|
+
assert_equal "/test.html", item.url
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_url_on_subdir_item
|
60
|
+
item = Jenner::Item.new('subdirectory/subfile.html',@site)
|
61
|
+
assert_equal "/subdirectory/subfile.html", item.url
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestSite < Test::Unit::TestCase
|
4
|
+
def test_array_of_items
|
5
|
+
assert_equal Array, @site.items.class
|
6
|
+
assert @site.items.size > 0
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_generate!
|
10
|
+
@site.generate!
|
11
|
+
assert File.exists?(site_file('public/test.html'))
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_generate_creates_subdirectories
|
15
|
+
@site.generate!
|
16
|
+
assert Dir.exists?(File.join(@site.root,'public','subdirectory'))
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_copies_files_in_subdirectories
|
20
|
+
@site.generate!
|
21
|
+
assert File.exists?(File.join(@site.root,'public','subdirectory','test.png'))
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_creates_items_in_subdirectories
|
25
|
+
@site.generate!
|
26
|
+
assert File.exists?(File.join(@site.root,'public','subdirectory','subfile.html'))
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_underscored_items_dont_get_copied
|
30
|
+
@site.generate!
|
31
|
+
assert !File.exists?(site_file('public/_hidden.html'))
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_generates_sass
|
35
|
+
@site.generate!
|
36
|
+
assert File.exists?(site_file("public/test.css"))
|
37
|
+
assert_equal "body {\n background-color: blue; }\n", File.read(site_file("public/test.css"), encoding: "US-ASCII")
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
class TestTemplate < Test::Unit::TestCase
|
4
|
+
def test_initialize_with_a_string
|
5
|
+
template = Jenner::Template.new("test", @site)
|
6
|
+
assert_equal "test", template.body
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_render_with_a_hash_context_returns_a_rendered_liquid_template
|
10
|
+
template = Jenner::Template.new("hi, {{name}}", @site)
|
11
|
+
assert_equal "hi, jay", template.render('name' => 'jay')
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_initialize_from_file
|
15
|
+
template = Jenner::Template.from_file(template_file('test.html'), @site)
|
16
|
+
assert_equal "hi, {{name}}\n", template.body
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_include
|
20
|
+
template = Jenner::Template.new("{% include 'test' %}", @site)
|
21
|
+
assert_equal "hi, jay\n", template.render('name' => 'jay')
|
22
|
+
end
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,166 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jenner
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Jay Strybis
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2014-01-25 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: liquid
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 2.6.1
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 2.6.1
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: maruku
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.7.1
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.7.1
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: mercenary
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.2.1
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.2.1
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: sass
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 3.2.13
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 3.2.13
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: test-unit
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ~>
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 2.5.5
|
86
|
+
type: :development
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ~>
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: 2.5.5
|
94
|
+
description: Jenner is an opinionated static site generator
|
95
|
+
email:
|
96
|
+
- jay.strybis@gmail.com
|
97
|
+
executables:
|
98
|
+
- jenner
|
99
|
+
extensions: []
|
100
|
+
extra_rdoc_files: []
|
101
|
+
files:
|
102
|
+
- .gitignore
|
103
|
+
- Gemfile
|
104
|
+
- LICENSE.txt
|
105
|
+
- README.md
|
106
|
+
- Rakefile
|
107
|
+
- bin/jenner
|
108
|
+
- jenner.gemspec
|
109
|
+
- lib/jenner.rb
|
110
|
+
- lib/jenner/item.rb
|
111
|
+
- lib/jenner/site.rb
|
112
|
+
- lib/jenner/template.rb
|
113
|
+
- lib/jenner/template_file_system.rb
|
114
|
+
- lib/jenner/version.rb
|
115
|
+
- test/fixtures/source/_site/_hidden.html
|
116
|
+
- test/fixtures/source/_site/markdown_test.markdown
|
117
|
+
- test/fixtures/source/_site/subdirectory/subfile.html
|
118
|
+
- test/fixtures/source/_site/subdirectory/test.png
|
119
|
+
- test/fixtures/source/_site/test.html
|
120
|
+
- test/fixtures/source/_site/test.scss
|
121
|
+
- test/fixtures/source/_templates/simple.html
|
122
|
+
- test/fixtures/source/_templates/test.html
|
123
|
+
- test/fixtures/source/_templates/wrapper.html
|
124
|
+
- test/helper.rb
|
125
|
+
- test/jenner/test_item.rb
|
126
|
+
- test/jenner/test_site.rb
|
127
|
+
- test/jenner/test_template.rb
|
128
|
+
homepage: http://github.com/unreal/jenner
|
129
|
+
licenses: []
|
130
|
+
post_install_message:
|
131
|
+
rdoc_options: []
|
132
|
+
require_paths:
|
133
|
+
- lib
|
134
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
135
|
+
none: false
|
136
|
+
requirements:
|
137
|
+
- - ! '>='
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
141
|
+
none: false
|
142
|
+
requirements:
|
143
|
+
- - ! '>='
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
requirements: []
|
147
|
+
rubyforge_project:
|
148
|
+
rubygems_version: 1.8.25
|
149
|
+
signing_key:
|
150
|
+
specification_version: 3
|
151
|
+
summary: Jenner is an opinionated static site generator
|
152
|
+
test_files:
|
153
|
+
- test/fixtures/source/_site/_hidden.html
|
154
|
+
- test/fixtures/source/_site/markdown_test.markdown
|
155
|
+
- test/fixtures/source/_site/subdirectory/subfile.html
|
156
|
+
- test/fixtures/source/_site/subdirectory/test.png
|
157
|
+
- test/fixtures/source/_site/test.html
|
158
|
+
- test/fixtures/source/_site/test.scss
|
159
|
+
- test/fixtures/source/_templates/simple.html
|
160
|
+
- test/fixtures/source/_templates/test.html
|
161
|
+
- test/fixtures/source/_templates/wrapper.html
|
162
|
+
- test/helper.rb
|
163
|
+
- test/jenner/test_item.rb
|
164
|
+
- test/jenner/test_site.rb
|
165
|
+
- test/jenner/test_template.rb
|
166
|
+
has_rdoc:
|