hydeweb 0.0.8.pre2 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/{CHANGELOG → HISTORY.md} +6 -0
- data/Rakefile +2 -52
- data/bin/hyde +3 -23
- data/bin/hyde01 +7 -0
- data/data/new_site/README.md +1 -1
- data/data/new_site/hyde.conf +9 -6
- data/lib/hyde/cli/helpers.rb +40 -0
- data/lib/hyde/cli.rb +86 -0
- data/lib/hyde/config.rb +37 -0
- data/lib/hyde/helpers.rb +6 -47
- data/lib/hyde/layout.rb +17 -9
- data/lib/hyde/meta.rb +5 -21
- data/lib/hyde/page.rb +207 -159
- data/lib/hyde/partial.rb +10 -5
- data/lib/hyde/project.rb +58 -208
- data/lib/hyde/server.rb +57 -0
- data/lib/hyde.rb +28 -51
- data/test/fixture/extensions/extensions/a/a.rb +1 -0
- data/test/fixture/extensions/hyde.conf +8 -0
- data/test/fixture/extensions/site/index.haml +1 -0
- data/test/fixture/fail_type/control/about/index.html +2 -0
- data/test/fixture/fail_type/control/about/us.html +2 -0
- data/test/fixture/fail_type/control/index.html +1 -0
- data/test/fixture/fail_type/hyde.conf +8 -0
- data/test/fixture/fail_type/site/index.haml +4 -0
- data/test/fixture/nested_layout/control/index.html +2 -0
- data/test/fixture/nested_layout/hyde.conf +8 -0
- data/test/fixture/nested_layout/layouts/default.haml +2 -0
- data/test/{fixtures/content_for/site/default.html.haml → fixture/nested_layout/layouts/post.haml} +1 -0
- data/test/fixture/nested_layout/site/index.haml +4 -0
- data/test/fixture/one/control/about/index.css +2 -0
- data/test/fixture/one/control/cheers.html +5 -0
- data/test/fixture/one/control/css/style.css +2 -0
- data/test/fixture/one/control/hello.html +5 -0
- data/test/fixture/one/control/hi.html +1 -0
- data/test/fixture/one/control/index.html +7 -0
- data/test/fixture/one/hyde.conf +9 -0
- data/test/fixture/one/layouts/default.haml +4 -0
- data/test/fixture/one/partials/menu.haml +3 -0
- data/test/fixture/one/site/about/index.scss +1 -0
- data/test/fixture/one/site/cheers.html.haml +1 -0
- data/test/fixture/one/site/css/style.scss +2 -0
- data/test/fixture/one/site/hello.haml +1 -0
- data/test/fixture/one/site/hi.html +1 -0
- data/test/fixture/one/site/index.haml +7 -0
- data/test/fixture/parent/control/about/index.html +2 -0
- data/test/fixture/parent/control/about/us.html +2 -0
- data/test/fixture/parent/control/index.html +1 -0
- data/test/fixture/parent/hyde.conf +8 -0
- data/test/fixture/parent/site/about/index.haml +3 -0
- data/test/fixture/parent/site/about/us.haml +3 -0
- data/test/fixture/parent/site/index.haml +3 -0
- data/test/fixture/sort/hyde.conf +8 -0
- data/test/fixture/sort/site/about/hardy.haml +4 -0
- data/test/fixture/sort/site/about/intrepid.haml +4 -0
- data/test/fixture/sort/site/about.haml +3 -0
- data/test/fixture/subclass/control/index.html +1 -0
- data/test/fixture/subclass/extensions/a/a.rb +12 -0
- data/test/fixture/subclass/hyde.conf +8 -0
- data/test/fixture/subclass/layouts/default.haml +1 -0
- data/test/fixture/subclass/layouts/post.haml +1 -0
- data/test/fixture/subclass/site/index.haml +4 -0
- data/test/helper.rb +15 -21
- data/test/unit/extensions_test.rb +16 -0
- data/test/unit/fixture_test.rb +77 -0
- data/test/unit/hyde_test.rb +30 -0
- metadata +107 -153
- data/.yardopts +0 -5
- data/LICENSE +0 -20
- data/VERSION +0 -1
- data/data/new_site/.gitignore +0 -24
- data/data/pages/404.html +0 -3
- data/hydeweb.gemspec +0 -159
- data/lib/hyde/clicommand.rb +0 -60
- data/lib/hyde/clicommands.rb +0 -128
- data/lib/hyde/ostruct.rb +0 -13
- data/lib/hyde/page_factory.rb +0 -90
- data/lib/hyde/renderer.rb +0 -133
- data/lib/hyde/renderers.rb +0 -100
- data/lib/hyde/sinatra/init.rb +0 -64
- data/lib/hyde/utils.rb +0 -43
- data/lib/hyde_misc/console.rb +0 -4
- data/manual/Extending/ExtendingHyde.md +0 -118
- data/manual/Hyde.md +0 -63
- data/manual/Introduction/Configuration.md +0 -70
- data/manual/Introduction/GettingStarted.md +0 -64
- data/manual/Introduction/Installation.md +0 -16
- data/manual/Introduction/Layouts.md +0 -14
- data/manual/Introduction/Metadata.md +0 -94
- data/manual/Introduction/Partials.md +0 -73
- data/manual/Introduction/TemplateLanguages.md +0 -59
- data/manual/Tips/Tips.md +0 -42
- data/test/fixtures/content_for/_config.yml +0 -8
- data/test/fixtures/content_for/layouts/cf-args.haml +0 -2
- data/test/fixtures/content_for/layouts/cf.haml +0 -14
- data/test/fixtures/content_for/layouts/default.haml +0 -4
- data/test/fixtures/content_for/layouts/shared/test.haml +0 -4
- data/test/fixtures/content_for/site/cf-args-default.haml +0 -2
- data/test/fixtures/content_for/site/cf-args.haml +0 -5
- data/test/fixtures/content_for/site/cf.haml +0 -6
- data/test/fixtures/content_for/site/cf2.haml +0 -3
- data/test/fixtures/content_for/site/index.html.haml +0 -9
- data/test/fixtures/content_for/site/var.html.haml +0 -5
- data/test/fixtures/content_for/www_control/cf-args-default.html +0 -1
- data/test/fixtures/content_for/www_control/cf-args.html +0 -2
- data/test/fixtures/content_for/www_control/cf.html +0 -17
- data/test/fixtures/content_for/www_control/cf2.html +0 -19
- data/test/fixtures/content_for/www_control/default.html +0 -2
- data/test/fixtures/content_for/www_control/index.html +0 -10
- data/test/fixtures/content_for/www_control/var.html +0 -2
- data/test/fixtures/custom/_config.yml +0 -8
- data/test/fixtures/custom/extensions/custom/custom.rb +0 -9
- data/test/fixtures/custom/layouts/default.haml +0 -8
- data/test/fixtures/custom/layouts/erbtest.erb +0 -2
- data/test/fixtures/custom/layouts/shared/sidebar.haml +0 -4
- data/test/fixtures/custom/site/about/index.html +0 -1
- data/test/fixtures/custom/site/assets/common.css.less +0 -1
- data/test/fixtures/custom/site/assets/style.css.less +0 -3
- data/test/fixtures/custom/site/foo.html.haml +0 -3
- data/test/fixtures/custom/site/index.html.haml +0 -6
- data/test/fixtures/custom/site/layout_test.html.haml +0 -6
- data/test/fixtures/custom/site/lol.html.erb +0 -7
- data/test/fixtures/custom/site/markdown.html.md +0 -8
- data/test/fixtures/custom/site/yes.html +0 -2
- data/test/fixtures/custom/www_control/about/index.html +0 -1
- data/test/fixtures/custom/www_control/assets/common.css +0 -1
- data/test/fixtures/custom/www_control/assets/style.css +0 -6
- data/test/fixtures/custom/www_control/foo.html +0 -1
- data/test/fixtures/custom/www_control/index.html +0 -16
- data/test/fixtures/custom/www_control/layout_test.html +0 -16
- data/test/fixtures/custom/www_control/lol.html +0 -5
- data/test/fixtures/custom/www_control/markdown.html +0 -17
- data/test/fixtures/custom/www_control/yes.html +0 -2
- data/test/fixtures/default/_config.yml +0 -8
- data/test/fixtures/default/extensions/custom/custom.rb +0 -2
- data/test/fixtures/default/layouts/default.haml +0 -5
- data/test/fixtures/default/site/about/index.html +0 -1
- data/test/fixtures/default/site/foo.html.haml +0 -3
- data/test/fixtures/default/site/index.html.haml +0 -6
- data/test/fixtures/default/site/layout_test.html.haml +0 -6
- data/test/fixtures/default/site/yes.html +0 -2
- data/test/fixtures/default/www_control/about/index.html +0 -1
- data/test/fixtures/default/www_control/foo.html +0 -1
- data/test/fixtures/default/www_control/index.html +0 -9
- data/test/fixtures/default/www_control/layout_test.html +0 -9
- data/test/fixtures/default/www_control/yes.html +0 -2
- data/test/test_all_fixtures.rb +0 -51
- data/test/test_build.rb +0 -20
- data/test/test_hyde.rb +0 -75
- data/test/test_page.rb +0 -26
- data/test/test_utils.rb +0 -22
data/manual/Tips/Tips.md
DELETED
@@ -1,42 +0,0 @@
|
|
1
|
-
Tips
|
2
|
-
====
|
3
|
-
|
4
|
-
Here are some tips and tricks!
|
5
|
-
|
6
|
-
Simpler folder structure
|
7
|
-
------------------------
|
8
|
-
|
9
|
-
The default folder structure looks like this:
|
10
|
-
|
11
|
-
project/
|
12
|
-
hyde.conf
|
13
|
-
layouts/
|
14
|
-
partials/
|
15
|
-
public/
|
16
|
-
extensions/
|
17
|
-
site/
|
18
|
-
about.html
|
19
|
-
contact.html
|
20
|
-
|
21
|
-
Here is a cleaner structure often used in simpler projects:
|
22
|
-
|
23
|
-
project/
|
24
|
-
about.html
|
25
|
-
contact.html
|
26
|
-
|
27
|
-
.hyderc
|
28
|
-
_/
|
29
|
-
layouts/
|
30
|
-
partials/
|
31
|
-
public/
|
32
|
-
extensions/
|
33
|
-
|
34
|
-
You may do this by editing your Hyde config file like so:
|
35
|
-
|
36
|
-
site_path: .
|
37
|
-
layouts_path: _/layouts
|
38
|
-
extensions_path: _/extensions
|
39
|
-
partials_path: _/partials
|
40
|
-
output_path: _/public
|
41
|
-
|
42
|
-
Optionally, you can rename `hyde.conf` to `.hyderc` to make it even cleaner.
|
@@ -1 +0,0 @@
|
|
1
|
-
Hola, Aaron!
|
@@ -1,17 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html lang='en'>
|
3
|
-
<head>
|
4
|
-
<meta charset='UTF-8' />
|
5
|
-
<title>Document</title>
|
6
|
-
</head>
|
7
|
-
<body>
|
8
|
-
<div id='all'>
|
9
|
-
<div id='content'>
|
10
|
-
Content here
|
11
|
-
</div>
|
12
|
-
<div id='sidebar'>
|
13
|
-
Sidebor
|
14
|
-
</div>
|
15
|
-
</div>
|
16
|
-
</body>
|
17
|
-
</html>
|
@@ -1,19 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html lang='en'>
|
3
|
-
<head>
|
4
|
-
<meta charset='UTF-8' />
|
5
|
-
<title>Document</title>
|
6
|
-
</head>
|
7
|
-
<body>
|
8
|
-
<div id='all'>
|
9
|
-
<div id='content'>
|
10
|
-
Content here, no sidebar
|
11
|
-
</div>
|
12
|
-
<div id='sidebar'>
|
13
|
-
<div>
|
14
|
-
Default sidebar
|
15
|
-
</div>
|
16
|
-
</div>
|
17
|
-
</div>
|
18
|
-
</body>
|
19
|
-
</html>
|
@@ -1 +0,0 @@
|
|
1
|
-
About page.
|
@@ -1 +0,0 @@
|
|
1
|
-
body { background: white; }
|
@@ -1 +0,0 @@
|
|
1
|
-
About page.
|
@@ -1 +0,0 @@
|
|
1
|
-
body { background: white; }
|
@@ -1 +0,0 @@
|
|
1
|
-
<h2>"Hellerrr"</h2>
|
@@ -1,16 +0,0 @@
|
|
1
|
-
<title>This is the meta title</title>
|
2
|
-
<!-- (default layout) -->
|
3
|
-
<h2>Template</h2>
|
4
|
-
<div>
|
5
|
-
<div id='sidebar'>
|
6
|
-
<ul>
|
7
|
-
<li>
|
8
|
-
Hello!
|
9
|
-
</li>
|
10
|
-
</ul>
|
11
|
-
</div>
|
12
|
-
This is the index
|
13
|
-
<strong>
|
14
|
-
Welcome to the index page!
|
15
|
-
</strong>
|
16
|
-
</div>
|
@@ -1,17 +0,0 @@
|
|
1
|
-
<title>Site</title>
|
2
|
-
<!-- (default layout) -->
|
3
|
-
<h2>Template</h2>
|
4
|
-
<div>
|
5
|
-
<div id='sidebar'>
|
6
|
-
<ul>
|
7
|
-
<li>
|
8
|
-
Hello!
|
9
|
-
</li>
|
10
|
-
</ul>
|
11
|
-
</div>
|
12
|
-
<h1 id='markdown_test'>Markdown test</h1>
|
13
|
-
|
14
|
-
<ul>
|
15
|
-
<li>This file is generated from Markdown. * …</li>
|
16
|
-
</ul>
|
17
|
-
</div>
|
@@ -1 +0,0 @@
|
|
1
|
-
|
@@ -1 +0,0 @@
|
|
1
|
-
|
@@ -1 +0,0 @@
|
|
1
|
-
<h2>"Hellerrr"</h2>
|
data/test/test_all_fixtures.rb
DELETED
@@ -1,51 +0,0 @@
|
|
1
|
-
require "helper"
|
2
|
-
require 'fileutils'
|
3
|
-
|
4
|
-
class TestAllFixtures < Test::Unit::TestCase
|
5
|
-
@@root = File.join(Dir.pwd, 'test', 'fixtures')
|
6
|
-
|
7
|
-
def setup
|
8
|
-
@original_pwd = Dir.pwd
|
9
|
-
end
|
10
|
-
|
11
|
-
def teardown
|
12
|
-
# Remove all the generated www's
|
13
|
-
Dir["#{@@root}/**/www"].each do |match|
|
14
|
-
FileUtils.rm_rf match
|
15
|
-
end
|
16
|
-
Dir.chdir @original_pwd
|
17
|
-
end
|
18
|
-
|
19
|
-
def self.all_sites
|
20
|
-
@@sites ||= Dir["#{@@root}/*"] \
|
21
|
-
.select { |f| File.directory? f } \
|
22
|
-
.map { |f| File.basename(f) }
|
23
|
-
end
|
24
|
-
|
25
|
-
all_sites.each do |site|
|
26
|
-
describe "Test `#{site}`" do
|
27
|
-
should "Build #{site} properly and have identical files to the control" do
|
28
|
-
@project = Hyde::Project.new File.join(@@root, site)
|
29
|
-
@project.build
|
30
|
-
|
31
|
-
unknown_root = @project.root :output
|
32
|
-
control_root = @project.root 'www_control'
|
33
|
-
|
34
|
-
if not File.directory? control_root
|
35
|
-
flunk "No www_control"
|
36
|
-
else
|
37
|
-
@project.files.reject { |f| File.directory? f }.each do |path|
|
38
|
-
unknown_path = File.join(unknown_root, path)
|
39
|
-
flunk "file #{unknown_path} doesn't exist" \
|
40
|
-
unless File.exists?(unknown_path)
|
41
|
-
|
42
|
-
unknown = File.open(File.join(unknown_root, path)).read
|
43
|
-
control = File.open(File.join(control_root, path)).read
|
44
|
-
|
45
|
-
assert_equal control, unknown
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
data/test/test_build.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class TestBuild < Test::Unit::TestCase
|
4
|
-
def setup
|
5
|
-
@original_pwd = Dir.pwd
|
6
|
-
@pwd = File.join(@original_pwd, 'test','fixtures','default')
|
7
|
-
Dir.chdir @pwd
|
8
|
-
@project = Hyde::Project.new(@pwd)
|
9
|
-
end
|
10
|
-
|
11
|
-
def teardown
|
12
|
-
Dir.chdir @original_pwd
|
13
|
-
end
|
14
|
-
|
15
|
-
should "build" do
|
16
|
-
@project.build
|
17
|
-
# Test existence of files
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
data/test/test_hyde.rb
DELETED
@@ -1,75 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class TestHyde < Test::Unit::TestCase
|
4
|
-
def setup(site = 'default')
|
5
|
-
@project = get_project site
|
6
|
-
end
|
7
|
-
|
8
|
-
should "return the right paths" do
|
9
|
-
root_path = fixture 'default'
|
10
|
-
assert_same_file root_path, @project.root
|
11
|
-
assert_same_file File.join(root_path, 'layouts'), \
|
12
|
-
@project.root(:layouts)
|
13
|
-
assert_same_file File.join(root_path, 'layouts', 'abc'), \
|
14
|
-
@project.root(:layouts, 'abc')
|
15
|
-
assert_same_file File.join(root_path, 'layouts', 'abc'), \
|
16
|
-
@project.root('layouts', 'abc')
|
17
|
-
end
|
18
|
-
|
19
|
-
should "Do things" do
|
20
|
-
@project.render 'yes.html'
|
21
|
-
@project.render 'foo.html'
|
22
|
-
end
|
23
|
-
|
24
|
-
should "recognize not found" do
|
25
|
-
assert_raises Hyde::NotFound do
|
26
|
-
@project.render 'garbage.html'
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
should "load extensions" do
|
31
|
-
begin
|
32
|
-
CustomExtensionClass # Defined in the site's extensions/custom/custom.rb
|
33
|
-
rescue NameError
|
34
|
-
flunk "Extension wasn't loaded"
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
should "use layouts" do
|
39
|
-
output = @project['layout_test.html'].render
|
40
|
-
assert_match /This is the meta title/, output
|
41
|
-
assert_match /<!-- \(default layout\) -->/, output
|
42
|
-
end
|
43
|
-
|
44
|
-
should "account for index.html" do
|
45
|
-
home_output = @project['index.html'].render
|
46
|
-
assert_equal home_output, @project['/'].render
|
47
|
-
assert_equal home_output, @project['/index.html'].render
|
48
|
-
|
49
|
-
about_output = @project['/about/index.html'].render
|
50
|
-
assert_equal about_output, @project['/about'].render
|
51
|
-
assert_equal about_output, @project['/about/'].render
|
52
|
-
end
|
53
|
-
|
54
|
-
should "get types right" do
|
55
|
-
page = @project['index.html']
|
56
|
-
assert page.is_a? Hyde::Page
|
57
|
-
|
58
|
-
layout = @project['default', Hyde::Layout]
|
59
|
-
assert layout.is_a? Hyde::Layout
|
60
|
-
assert layout.is_a? Hyde::Page
|
61
|
-
end
|
62
|
-
|
63
|
-
should "list the project files properly" do
|
64
|
-
files = @project.files
|
65
|
-
assert files.include? 'index.html'
|
66
|
-
assert files.include? 'about/index.html'
|
67
|
-
assert files.include? 'layout_test.html'
|
68
|
-
assert !files.include?('about')
|
69
|
-
assert !files.include?('about/')
|
70
|
-
assert !files.include?('_config.yml')
|
71
|
-
assert !files.include?('layout/default')
|
72
|
-
assert !files.include?('layout/default.haml')
|
73
|
-
assert !files.include?('layout_test.html.haml')
|
74
|
-
end
|
75
|
-
end
|
data/test/test_page.rb
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class TestPage < Test::Unit::TestCase
|
4
|
-
def setup(site = 'default')
|
5
|
-
@project = get_project site
|
6
|
-
@page = Hyde::Page['index.html', @project]
|
7
|
-
end
|
8
|
-
|
9
|
-
should "raise a method missing error" do
|
10
|
-
assert_raises NoMethodError do
|
11
|
-
@page.xxx
|
12
|
-
end
|
13
|
-
|
14
|
-
# Should NOT raise a method missing error
|
15
|
-
@page.layout
|
16
|
-
@page.filename
|
17
|
-
@page.renderer
|
18
|
-
@page.meta
|
19
|
-
@page.layout
|
20
|
-
@page.project
|
21
|
-
end
|
22
|
-
|
23
|
-
should "register the right project" do
|
24
|
-
assert_equal @project, @page.project
|
25
|
-
end
|
26
|
-
end
|
data/test/test_utils.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'helper'
|
2
|
-
|
3
|
-
class TestUtils < Test::Unit::TestCase
|
4
|
-
def setup
|
5
|
-
@original_pwd = Dir.pwd
|
6
|
-
@pwd = File.join(@original_pwd, 'test')
|
7
|
-
Dir.chdir @pwd
|
8
|
-
end
|
9
|
-
|
10
|
-
def teardown
|
11
|
-
system 'rm -rf aaa'
|
12
|
-
system 'rm -rf bbb'
|
13
|
-
Dir.chdir @original_pwd
|
14
|
-
end
|
15
|
-
|
16
|
-
should "force_file_open" do
|
17
|
-
f = force_file_open File.join(@pwd, 'bbb/ccc/test.txt')
|
18
|
-
assert File.directory? 'bbb'
|
19
|
-
assert File.directory? 'bbb/ccc'
|
20
|
-
assert File.exists? 'bbb/ccc/test.txt'
|
21
|
-
end
|
22
|
-
end
|