hydeweb 0.0.2.pre → 0.0.3.pre
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/.yardopts +2 -1
- data/README.md +1 -0
- data/VERSION +1 -1
- data/docs/Extending/ExtendingHyde.md +117 -0
- data/docs/Hyde.md +17 -0
- data/docs/Introduction/Configuration.md +2 -0
- data/docs/Introduction/GettingStarted.md +32 -0
- data/docs/Introduction/Installation.md +16 -0
- data/docs/Introduction/Layouts.md +4 -0
- data/docs/Introduction/Partials.md +2 -0
- data/docs/Introduction/TemplateLanguages.md +15 -0
- data/hydeweb.gemspec +128 -0
- data/lib/hyde/clicommand.rb +16 -0
- data/lib/hyde/clicommands.rb +41 -11
- data/lib/hyde/helpers.rb +8 -0
- data/lib/hyde/page.rb +2 -0
- data/lib/hyde/project.rb +20 -20
- data/lib/hyde/renderer.rb +3 -1
- data/lib/hyde/utils.rb +9 -0
- data/lib/hyde.rb +7 -1
- data/test/fixtures/custom/extensions/custom/custom.rb +9 -0
- data/test/fixtures/custom/site/lol.html.erb +1 -1
- data/test/fixtures/custom/www_control/lol.html +1 -1
- data/test/fixtures/default/_config.yml +3 -3
- metadata +21 -14
- data/docs/ExtendingHyde.md +0 -9
- data/docs/GettingStarted.md +0 -2
- data/lib/hyde/scope.rb +0 -12
- data/lib/hyde/template_helpers.rb +0 -6
- data/test/fixtures/default/www_control/Users/rsc/Workdesk/hyde/hyde/test/fixtures/default/about/index.html +0 -0
- /data/test/fixtures/default/{_layouts → layouts}/default.haml +0 -0
- /data/test/fixtures/default/{about → site/about}/index.html +0 -0
- /data/test/fixtures/default/{foo.html.haml → site/foo.html.haml} +0 -0
- /data/test/fixtures/default/{index.html.haml → site/index.html.haml} +0 -0
- /data/test/fixtures/default/{layout_test.html.haml → site/layout_test.html.haml} +0 -0
- /data/test/fixtures/default/{yes.html → site/yes.html} +0 -0
data/.yardopts
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
--files="docs
|
1
|
+
--files="docs/*/*"
|
2
|
+
--main="docs/Hyde.md"
|
data/README.md
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3.pre
|
@@ -0,0 +1,117 @@
|
|
1
|
+
Extending Hyde
|
2
|
+
==============
|
3
|
+
|
4
|
+
Creating extensions
|
5
|
+
-------------------
|
6
|
+
|
7
|
+
In your Hyde project's extensions folder (`extensions` by default), create a file called
|
8
|
+
`<name>/<name>.rb`, where `<name>` is the name of your extension. This file will automatically loaded.
|
9
|
+
|
10
|
+
Example:
|
11
|
+
|
12
|
+
# extensions/hyde-blog/hyde-blog.rb
|
13
|
+
module Hyde
|
14
|
+
# Set up autoload hooks for the other classes
|
15
|
+
prefix = File.dirname(__FILE__)
|
16
|
+
autoload :Blog, "#{prefix}/lib/blog.rb"
|
17
|
+
end
|
18
|
+
|
19
|
+
Creating extensions as gems
|
20
|
+
---------------------------
|
21
|
+
|
22
|
+
You may also create your extensions as gems. It is recommended to name them as `hyde-(name)`,
|
23
|
+
for instance, `hyde-blog`.
|
24
|
+
|
25
|
+
To load gem extensions in your Hyde project, add them to the `gems` section of your project's
|
26
|
+
config file (typically `hyde.conf`). Example:
|
27
|
+
|
28
|
+
# hyde.conf
|
29
|
+
gems:
|
30
|
+
- hyde-blog
|
31
|
+
- hyde-clean
|
32
|
+
|
33
|
+
Adding helpers
|
34
|
+
--------------
|
35
|
+
|
36
|
+
Make a module under `Hyde::Helpers`. Any functions here will be available to your files.
|
37
|
+
|
38
|
+
Example:
|
39
|
+
|
40
|
+
In this example, we'll create a simple helper function.
|
41
|
+
|
42
|
+
# extensions/hyde-blog/hyde-blog.rb
|
43
|
+
module Hyde
|
44
|
+
module Helpers
|
45
|
+
module BlogHelpers
|
46
|
+
def form_tag(meth, action, &b)
|
47
|
+
[ "<form method='#{meth}' action='#{action}'>",
|
48
|
+
b.call,
|
49
|
+
"</form>"
|
50
|
+
].join("\n")
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
In your project's site files, you can then now use this helper.
|
57
|
+
|
58
|
+
# site/my_page.html.haml
|
59
|
+
%h1 My form
|
60
|
+
= form_tag 'post', '/note/new' do
|
61
|
+
%p
|
62
|
+
%label Your name:
|
63
|
+
%input{ :type => 'text', :name => 'name' }
|
64
|
+
%p
|
65
|
+
%label Your email:
|
66
|
+
%input{ :type => 'text', :name => 'email' }
|
67
|
+
|
68
|
+
Adding commands
|
69
|
+
---------------
|
70
|
+
|
71
|
+
Create a subclass of the class {Hyde::CLICommand} and place it under the {Hyde::CLICommands} module.
|
72
|
+
The name of the class will be the command it will be accessible as.
|
73
|
+
|
74
|
+
This example below defines a new `clean` command, which will be accessible by typing `hyde clean`.
|
75
|
+
It will also show under `hyde --help` since it provides a `desc`.
|
76
|
+
|
77
|
+
# extensions/hyde-clean/hyde-clean.rb
|
78
|
+
module Hyde
|
79
|
+
module CLICommands
|
80
|
+
class Clean
|
81
|
+
desc "Cleans up your project's dirt"
|
82
|
+
|
83
|
+
def self.run(*a)
|
84
|
+
if a.size > 0
|
85
|
+
log "Unknown arguments: #{a.join(' ')}"
|
86
|
+
log "Type `hyde --help clean` for more information."
|
87
|
+
exit
|
88
|
+
end
|
89
|
+
|
90
|
+
log "Cleaning..."
|
91
|
+
# Do stuff here
|
92
|
+
log "All clean!"
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
This may now be used in the command line.
|
99
|
+
|
100
|
+
$ hyde clean all
|
101
|
+
Unknown arguments: all
|
102
|
+
Type `hyde --help clean` for more information.
|
103
|
+
|
104
|
+
$ hyde clean
|
105
|
+
Cleaning...
|
106
|
+
All done!
|
107
|
+
|
108
|
+
$ hyde --help
|
109
|
+
Usage: hyde <command> arguments
|
110
|
+
|
111
|
+
Commands:
|
112
|
+
....
|
113
|
+
clean Cleans up your project's dirt
|
114
|
+
|
115
|
+
Adding parsers
|
116
|
+
--------------
|
117
|
+
|
data/docs/Hyde.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
Hyde manual
|
2
|
+
===========
|
3
|
+
|
4
|
+
Introduction
|
5
|
+
------------
|
6
|
+
|
7
|
+
- `++++` {file:Installation Installation}
|
8
|
+
- `++--` {file:GettingStarted Getting started}
|
9
|
+
- `+---` {file:TemplateLanguages Template languages}
|
10
|
+
- `----` {file:Layouts Layouts}
|
11
|
+
- `----` {file:Partials Partials}
|
12
|
+
- `----` {file:Configuration Configuration}
|
13
|
+
|
14
|
+
Extending Hyde
|
15
|
+
--------------
|
16
|
+
|
17
|
+
- `+++-` {file:ExtendingHyde Extending Hyde}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
Getting started
|
2
|
+
===============
|
3
|
+
|
4
|
+
Starting your first project
|
5
|
+
---------------------------
|
6
|
+
|
7
|
+
Create your first project with:
|
8
|
+
|
9
|
+
hyde create <name>
|
10
|
+
|
11
|
+
Where `<name>` is the name of your project. This will create a folder with that
|
12
|
+
name, along with some sample files to get you started.
|
13
|
+
|
14
|
+
Starting
|
15
|
+
--------
|
16
|
+
|
17
|
+
hyde start
|
18
|
+
|
19
|
+
Making your site files
|
20
|
+
----------------------
|
21
|
+
|
22
|
+
Edit files under the `site` folder
|
23
|
+
|
24
|
+
(todo)
|
25
|
+
|
26
|
+
Building HTML files
|
27
|
+
-------------------
|
28
|
+
|
29
|
+
Build your files by typing
|
30
|
+
|
31
|
+
hyde build
|
32
|
+
|
@@ -0,0 +1,16 @@
|
|
1
|
+
Installation
|
2
|
+
============
|
3
|
+
|
4
|
+
First, make sure that you have Ruby (>= version 1.8) installed. You can do this
|
5
|
+
by typing `ruby --version` in the command line.
|
6
|
+
|
7
|
+
- For Mac users, there's no need to do anything. Ruby comes with the OS by default.
|
8
|
+
- For Windows users, I don't know.
|
9
|
+
- For Ubuntu users, `sudo apt-get install ruby`.
|
10
|
+
|
11
|
+
Install Hyde by typing:
|
12
|
+
|
13
|
+
gem install hyde
|
14
|
+
|
15
|
+
If this process fails, you can instead try `sudo gem install hyde`.
|
16
|
+
|
data/hydeweb.gemspec
ADDED
@@ -0,0 +1,128 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{hydeweb}
|
8
|
+
s.version = "0.0.3.pre"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Rico Sta. Cruz", "Sinefunc, Inc."]
|
12
|
+
s.date = %q{2010-05-04}
|
13
|
+
s.default_executable = %q{hyde}
|
14
|
+
s.description = %q{Website preprocessor}
|
15
|
+
s.email = %q{rico@sinefunc.com}
|
16
|
+
s.executables = ["hyde"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE",
|
19
|
+
"README.md"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".gitignore",
|
23
|
+
".yardopts",
|
24
|
+
"LICENSE",
|
25
|
+
"README.md",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"bin/hyde",
|
29
|
+
"data/new_site/.gitignore",
|
30
|
+
"data/new_site/README.md",
|
31
|
+
"data/new_site/hyde.conf",
|
32
|
+
"data/new_site/layouts/default.haml",
|
33
|
+
"data/new_site/site/index.html.haml",
|
34
|
+
"docs/Extending/ExtendingHyde.md",
|
35
|
+
"docs/Hyde.md",
|
36
|
+
"docs/Introduction/Configuration.md",
|
37
|
+
"docs/Introduction/GettingStarted.md",
|
38
|
+
"docs/Introduction/Installation.md",
|
39
|
+
"docs/Introduction/Layouts.md",
|
40
|
+
"docs/Introduction/Partials.md",
|
41
|
+
"docs/Introduction/TemplateLanguages.md",
|
42
|
+
"hydeweb.gemspec",
|
43
|
+
"lib/hyde.rb",
|
44
|
+
"lib/hyde/clicommand.rb",
|
45
|
+
"lib/hyde/clicommands.rb",
|
46
|
+
"lib/hyde/helpers.rb",
|
47
|
+
"lib/hyde/init.rb",
|
48
|
+
"lib/hyde/layout.rb",
|
49
|
+
"lib/hyde/ostruct.rb",
|
50
|
+
"lib/hyde/page.rb",
|
51
|
+
"lib/hyde/project.rb",
|
52
|
+
"lib/hyde/renderer.rb",
|
53
|
+
"lib/hyde/renderers.rb",
|
54
|
+
"lib/hyde/utils.rb",
|
55
|
+
"test/fixtures/custom/_config.yml",
|
56
|
+
"test/fixtures/custom/extensions/custom/custom.rb",
|
57
|
+
"test/fixtures/custom/layouts/default.haml",
|
58
|
+
"test/fixtures/custom/layouts/erbtest.erb",
|
59
|
+
"test/fixtures/custom/site/about/index.html",
|
60
|
+
"test/fixtures/custom/site/assets/common.css.less",
|
61
|
+
"test/fixtures/custom/site/assets/style.css.less",
|
62
|
+
"test/fixtures/custom/site/foo.html.haml",
|
63
|
+
"test/fixtures/custom/site/index.html.haml",
|
64
|
+
"test/fixtures/custom/site/layout_test.html.haml",
|
65
|
+
"test/fixtures/custom/site/lol.html.erb",
|
66
|
+
"test/fixtures/custom/site/markdown.html.md",
|
67
|
+
"test/fixtures/custom/site/yes.html",
|
68
|
+
"test/fixtures/custom/www_control/about/index.html",
|
69
|
+
"test/fixtures/custom/www_control/assets/common.css",
|
70
|
+
"test/fixtures/custom/www_control/assets/style.css",
|
71
|
+
"test/fixtures/custom/www_control/foo.html",
|
72
|
+
"test/fixtures/custom/www_control/index.html",
|
73
|
+
"test/fixtures/custom/www_control/layout_test.html",
|
74
|
+
"test/fixtures/custom/www_control/lol.html",
|
75
|
+
"test/fixtures/custom/www_control/markdown.html",
|
76
|
+
"test/fixtures/custom/www_control/yes.html",
|
77
|
+
"test/fixtures/default/_config.yml",
|
78
|
+
"test/fixtures/default/layouts/default.haml",
|
79
|
+
"test/fixtures/default/site/about/index.html",
|
80
|
+
"test/fixtures/default/site/foo.html.haml",
|
81
|
+
"test/fixtures/default/site/index.html.haml",
|
82
|
+
"test/fixtures/default/site/layout_test.html.haml",
|
83
|
+
"test/fixtures/default/site/yes.html",
|
84
|
+
"test/fixtures/default/www_control/about/index.html",
|
85
|
+
"test/fixtures/default/www_control/foo.html",
|
86
|
+
"test/fixtures/default/www_control/index.html",
|
87
|
+
"test/fixtures/default/www_control/layout_test.html",
|
88
|
+
"test/fixtures/default/www_control/yes.html",
|
89
|
+
"test/helper.rb",
|
90
|
+
"test/test_all_fixtures.rb",
|
91
|
+
"test/test_build.rb",
|
92
|
+
"test/test_hyde.rb",
|
93
|
+
"test/test_utils.rb"
|
94
|
+
]
|
95
|
+
s.homepage = %q{http://github.com/sinefunc/hyde}
|
96
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
97
|
+
s.require_paths = ["lib"]
|
98
|
+
s.rubygems_version = %q{1.3.6}
|
99
|
+
s.summary = %q{Website preprocessor}
|
100
|
+
s.test_files = [
|
101
|
+
"test/fixtures/custom/extensions/custom/custom.rb",
|
102
|
+
"test/helper.rb",
|
103
|
+
"test/test_all_fixtures.rb",
|
104
|
+
"test/test_build.rb",
|
105
|
+
"test/test_hyde.rb",
|
106
|
+
"test/test_utils.rb"
|
107
|
+
]
|
108
|
+
|
109
|
+
if s.respond_to? :specification_version then
|
110
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
111
|
+
s.specification_version = 3
|
112
|
+
|
113
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
114
|
+
s.add_runtime_dependency(%q<sinatra>, [">= 1.0.0"])
|
115
|
+
s.add_runtime_dependency(%q<less>, [">= 1.2.21"])
|
116
|
+
s.add_runtime_dependency(%q<haml>, [">= 2.2.20"])
|
117
|
+
else
|
118
|
+
s.add_dependency(%q<sinatra>, [">= 1.0.0"])
|
119
|
+
s.add_dependency(%q<less>, [">= 1.2.21"])
|
120
|
+
s.add_dependency(%q<haml>, [">= 2.2.20"])
|
121
|
+
end
|
122
|
+
else
|
123
|
+
s.add_dependency(%q<sinatra>, [">= 1.0.0"])
|
124
|
+
s.add_dependency(%q<less>, [">= 1.2.21"])
|
125
|
+
s.add_dependency(%q<haml>, [">= 2.2.20"])
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
data/lib/hyde/clicommand.rb
CHANGED
@@ -10,6 +10,10 @@ module Hyde
|
|
10
10
|
ostream << str << "\n"
|
11
11
|
end
|
12
12
|
|
13
|
+
def self.out(str)
|
14
|
+
puts str
|
15
|
+
end
|
16
|
+
|
13
17
|
def self.help
|
14
18
|
log "Usage: hyde #{self.to_s.downcase.split(':')[-1]}"
|
15
19
|
log "No help for this command."
|
@@ -28,6 +32,18 @@ module Hyde
|
|
28
32
|
$project
|
29
33
|
end
|
30
34
|
|
35
|
+
def self.hidden?
|
36
|
+
false
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.hidden(bool = true)
|
40
|
+
class_eval %{
|
41
|
+
def self.hidden?
|
42
|
+
#{bool.inspect}
|
43
|
+
end
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
31
47
|
def self.desc(str)
|
32
48
|
class_eval %{
|
33
49
|
def self.description
|
data/lib/hyde/clicommands.rb
CHANGED
@@ -3,19 +3,32 @@ module Hyde
|
|
3
3
|
extend self
|
4
4
|
|
5
5
|
def get_controller(str)
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
6
|
+
if ['-v', '--version'].include? str
|
7
|
+
controller = Hyde::CLICommands::Version
|
8
|
+
elsif ['-h', '-?', '--help'].include? str
|
9
|
+
controller = Hyde::CLICommands::Help
|
10
|
+
else
|
11
|
+
begin
|
12
|
+
class_name = str.downcase.capitalize.to_sym
|
13
|
+
controller = Hyde::CLICommands.const_get(class_name)
|
14
|
+
rescue NameError
|
15
|
+
STDERR << "Unknown command: #{str}\n"
|
16
|
+
STDERR << "Type `hyde` for a list of commands.\n"
|
17
|
+
exit
|
18
|
+
end
|
13
19
|
end
|
14
20
|
controller
|
15
21
|
end
|
16
22
|
|
23
|
+
class Version < CLICommand
|
24
|
+
hidden true
|
25
|
+
def self.run(*a)
|
26
|
+
out "Hyde version #{Hyde.version}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
17
30
|
class Help < CLICommand
|
18
|
-
|
31
|
+
hidden true
|
19
32
|
|
20
33
|
def self.run(*a)
|
21
34
|
if a.size == 0
|
@@ -31,14 +44,20 @@ module Hyde
|
|
31
44
|
log "Usage: hyde <command> [arguments]"
|
32
45
|
log ""
|
33
46
|
log "Commands:"
|
47
|
+
|
34
48
|
CLICommands.constants.each do |class_name|
|
35
49
|
klass = CLICommands.const_get(class_name)
|
36
50
|
name = class_name.to_s.downcase
|
37
|
-
|
51
|
+
unless klass.hidden?
|
52
|
+
puts " #{name}%s#{klass.description}" % [' ' * (20-name.size)]
|
53
|
+
end
|
38
54
|
end
|
39
55
|
|
40
56
|
log ""
|
41
|
-
log "
|
57
|
+
log " -h, --help Prints this help screen"
|
58
|
+
log " -v, --version Show version and exit"
|
59
|
+
log ""
|
60
|
+
log "For more info on a command, type `hyde --help <command>`."
|
42
61
|
end
|
43
62
|
end
|
44
63
|
|
@@ -50,11 +69,22 @@ module Hyde
|
|
50
69
|
end
|
51
70
|
|
52
71
|
class Start < CLICommand
|
53
|
-
desc "Starts the
|
72
|
+
desc "Starts the local webserver"
|
54
73
|
def self.run(*a)
|
55
74
|
project
|
56
75
|
system "ruby \"%s\"" % [File.join(lib_path, 'hyde', 'init.rb')]
|
57
76
|
end
|
77
|
+
|
78
|
+
def self.help
|
79
|
+
log "Usage: hyde start"
|
80
|
+
log ""
|
81
|
+
log "This command starts the local webserver. You may then be able to"
|
82
|
+
log "see your site locally by visiting the URL:"
|
83
|
+
log ""
|
84
|
+
log " http://127.0.0.1:4567"
|
85
|
+
log ""
|
86
|
+
log "You may shut the server down by pressing Ctrl-C."
|
87
|
+
end
|
58
88
|
end
|
59
89
|
|
60
90
|
class Create < CLICommand
|
data/lib/hyde/helpers.rb
ADDED
data/lib/hyde/page.rb
CHANGED
data/lib/hyde/project.rb
CHANGED
@@ -46,26 +46,6 @@ module Hyde
|
|
46
46
|
ret
|
47
47
|
end
|
48
48
|
|
49
|
-
def load_extensions
|
50
|
-
@config.gems.each do |gem|
|
51
|
-
require gem
|
52
|
-
end
|
53
|
-
|
54
|
-
ext_roots = Dir[root :extensions, '*'].select { |d| File.directory? d }
|
55
|
-
ext_roots.each do |dir|
|
56
|
-
ext = File.basename(dir)
|
57
|
-
|
58
|
-
# Try extensions/name/name.rb
|
59
|
-
# Try extensions/name/lib/name.rb
|
60
|
-
ext_files = [
|
61
|
-
File.join(dir, "#{ext}.rb"),
|
62
|
-
File.join(dir, 'lib', "#{ext}.rb")
|
63
|
-
]
|
64
|
-
ext_files.reject! { |f| not File.exists? f }
|
65
|
-
require ext_files[0] if ext_files[0]
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
49
|
def method_missing(meth, *args, &blk)
|
70
50
|
raise NoMethodError, "No method `#{meth}`" unless @config.include?(meth)
|
71
51
|
@config.send meth
|
@@ -149,6 +129,26 @@ module Hyde
|
|
149
129
|
end
|
150
130
|
|
151
131
|
protected
|
132
|
+
|
133
|
+
def load_extensions
|
134
|
+
@config.gems.each do |gem|
|
135
|
+
require gem
|
136
|
+
end
|
137
|
+
|
138
|
+
ext_roots = Dir[root :extensions, '*'].select { |d| File.directory? d }
|
139
|
+
ext_roots.each do |dir|
|
140
|
+
ext = File.basename(dir)
|
141
|
+
|
142
|
+
# Try extensions/name/name.rb
|
143
|
+
# Try extensions/name/lib/name.rb
|
144
|
+
ext_files = [
|
145
|
+
File.join(dir, "#{ext}.rb"),
|
146
|
+
File.join(dir, 'lib', "#{ext}.rb")
|
147
|
+
]
|
148
|
+
ext_files.reject! { |f| not File.exists? f }
|
149
|
+
require ext_files[0] if ext_files[0]
|
150
|
+
end
|
151
|
+
end
|
152
152
|
def defaults
|
153
153
|
{ 'layouts_path' => 'layouts',
|
154
154
|
'extensions_path' => 'extensions',
|
data/lib/hyde/renderer.rb
CHANGED
@@ -3,6 +3,8 @@ require "ostruct"
|
|
3
3
|
module Hyde
|
4
4
|
module Renderer
|
5
5
|
class Base
|
6
|
+
include Hyde::Utils
|
7
|
+
|
6
8
|
# Reference to {Page}
|
7
9
|
attr_reader :page
|
8
10
|
|
@@ -50,7 +52,7 @@ module Hyde
|
|
50
52
|
# This will let you eval something, and `yield` within that block.
|
51
53
|
eval src, &block
|
52
54
|
end
|
53
|
-
extend
|
55
|
+
get_helpers.each { |helper_class| extend helper_class }
|
54
56
|
end
|
55
57
|
|
56
58
|
scope
|
data/lib/hyde/utils.rb
CHANGED
@@ -15,5 +15,14 @@ module Hyde
|
|
15
15
|
FileUtils.mkdir_p File.dirname(filepath)
|
16
16
|
File.new filepath, 'w'
|
17
17
|
end
|
18
|
+
|
19
|
+
# Returns all helper classes under the Hyde::Helpers module.
|
20
|
+
def get_helpers
|
21
|
+
Hyde::Helpers.constants.inject([]) do |a, constant|
|
22
|
+
mod = Hyde::Helpers.const_get(constant)
|
23
|
+
a << mod if mod.is_a? Module
|
24
|
+
a
|
25
|
+
end
|
26
|
+
end
|
18
27
|
end
|
19
28
|
end
|
data/lib/hyde.rb
CHANGED
@@ -12,7 +12,7 @@ module Hyde
|
|
12
12
|
autoload :Scope, "#{prefix}/hyde/scope"
|
13
13
|
autoload :CLICommand, "#{prefix}/hyde/clicommand"
|
14
14
|
autoload :CLICommands,"#{prefix}/hyde/clicommands"
|
15
|
-
autoload :
|
15
|
+
autoload :Helpers, "#{prefix}/hyde/helpers"
|
16
16
|
|
17
17
|
Error = Class.new(::StandardError)
|
18
18
|
NoGemError = Class.new(Error)
|
@@ -35,4 +35,10 @@ module Hyde
|
|
35
35
|
"#{@message}"
|
36
36
|
end
|
37
37
|
end
|
38
|
+
|
39
|
+
extend self
|
40
|
+
|
41
|
+
def version
|
42
|
+
@version ||= File.open(File.join(File.dirname(__FILE__), '..', 'VERSION')) { |f| f.read.strip }
|
43
|
+
end
|
38
44
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
Hello
|
2
2
|
Hey there!
|
3
|
-
#<Hyde::Page:0x0000010126a930 @project=#<Hyde::Project:0x00000100b35058 @config=#<Hyde::OStruct layouts_path="layouts", extensions_path="extensions", site_path="site", output_path="www", ignore=["hyde", "_*"]>, @root="/Users/rsc/Workdesk/hyde/test/fixtures/custom", @config_file="/Users/rsc/Workdesk/hyde/test/fixtures/custom/_config.yml", @ignore_list=["/Users/rsc/Workdesk/hyde/test/fixtures/custom/layouts/**/*", "/Users/rsc/Workdesk/hyde/test/fixtures/custom/extensions/**/*", "/Users/rsc/Workdesk/hyde/test/fixtures/custom/www/**/*", "/Users/rsc/Workdesk/hyde/test/fixtures/custom/_config.yml"], @ignored_files=["/Users/rsc/Workdesk/hyde/test/fixtures/custom/layouts/default.haml", "/Users/rsc/Workdesk/hyde/test/fixtures/custom/layouts/erbtest.erb", "/Users/rsc/Workdesk/hyde/test/fixtures/custom/_config.yml"], @file_list=["about/index.html", "assets/common.css", "assets/style.css", "foo.html", "index.html", "layout_test.html", "lol.html", "markdown.html", "yes.html"]>, @name="lol.html", @meta={"yay"=>444, "layout"=>"erbtest", "title"=>"This is from lol.html"}, @filename="/Users/rsc/Workdesk/hyde/test/fixtures/custom/site/lol.html.erb", @renderer=#<Hyde::Renderers::Erb:0x0000010126a578 @page=#<Hyde::Page:0x0000010126a930 ...>, @filename="/Users/rsc/Workdesk/hyde/test/fixtures/custom/site/lol.html.erb", @markup="Hey there!\n<%= self.inspect %>\n<%= yay %>\n", @engine=#<ERB:0x0000010125ebc0 @safe_level=nil, @src="#coding:US-ASCII\n_erbout = ''; _erbout.concat \"Hey there!\\n\"\n; _erbout.concat(( self.inspect ).to_s); _erbout.concat \"\\n\"\n; _erbout.concat(( yay ).to_s); _erbout.concat \"\\n\"\n; _erbout.force_encoding(__ENCODING__)", @enc=#<Encoding:US-ASCII>, @filename=nil>>, @_locals={}, @layout=#<Hyde::Layout:0x000001012624a0 @project=#<Hyde::Project:0x00000100b35058 @config=#<Hyde::OStruct layouts_path="layouts", extensions_path="extensions", site_path="site", output_path="www", ignore=["hyde", "_*"]>, @root="/Users/rsc/Workdesk/hyde/test/fixtures/custom", @config_file="/Users/rsc/Workdesk/hyde/test/fixtures/custom/_config.yml", @ignore_list=["/Users/rsc/Workdesk/hyde/test/fixtures/custom/layouts/**/*", "/Users/rsc/Workdesk/hyde/test/fixtures/custom/extensions/**/*", "/Users/rsc/Workdesk/hyde/test/fixtures/custom/www/**/*", "/Users/rsc/Workdesk/hyde/test/fixtures/custom/_config.yml"], @ignored_files=["/Users/rsc/Workdesk/hyde/test/fixtures/custom/layouts/default.haml", "/Users/rsc/Workdesk/hyde/test/fixtures/custom/layouts/erbtest.erb", "/Users/rsc/Workdesk/hyde/test/fixtures/custom/_config.yml"], @file_list=["about/index.html", "assets/common.css", "assets/style.css", "foo.html", "index.html", "layout_test.html", "lol.html", "markdown.html", "yes.html"]>, @name="erbtest", @meta={}, @filename="/Users/rsc/Workdesk/hyde/test/fixtures/custom/layouts/erbtest.erb", @renderer=#<Hyde::Renderers::Erb:0x000001012623f8 @page=#<Hyde::Layout:0x000001012624a0 ...>, @filename="/Users/rsc/Workdesk/hyde/test/fixtures/custom/layouts/erbtest.erb", @markup="Hello\n<%= yield %>\n">>>
|
4
3
|
444
|
4
|
+
This is from the helper
|
5
5
|
|
metadata
CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 3
|
9
9
|
- pre
|
10
|
-
version: 0.0.
|
10
|
+
version: 0.0.3.pre
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Rico Sta. Cruz
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-05-
|
19
|
+
date: 2010-05-04 00:00:00 +08:00
|
20
20
|
default_executable: hyde
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -83,11 +83,19 @@ files:
|
|
83
83
|
- data/new_site/hyde.conf
|
84
84
|
- data/new_site/layouts/default.haml
|
85
85
|
- data/new_site/site/index.html.haml
|
86
|
-
- docs/ExtendingHyde.md
|
87
|
-
- docs/
|
86
|
+
- docs/Extending/ExtendingHyde.md
|
87
|
+
- docs/Hyde.md
|
88
|
+
- docs/Introduction/Configuration.md
|
89
|
+
- docs/Introduction/GettingStarted.md
|
90
|
+
- docs/Introduction/Installation.md
|
91
|
+
- docs/Introduction/Layouts.md
|
92
|
+
- docs/Introduction/Partials.md
|
93
|
+
- docs/Introduction/TemplateLanguages.md
|
94
|
+
- hydeweb.gemspec
|
88
95
|
- lib/hyde.rb
|
89
96
|
- lib/hyde/clicommand.rb
|
90
97
|
- lib/hyde/clicommands.rb
|
98
|
+
- lib/hyde/helpers.rb
|
91
99
|
- lib/hyde/init.rb
|
92
100
|
- lib/hyde/layout.rb
|
93
101
|
- lib/hyde/ostruct.rb
|
@@ -95,10 +103,9 @@ files:
|
|
95
103
|
- lib/hyde/project.rb
|
96
104
|
- lib/hyde/renderer.rb
|
97
105
|
- lib/hyde/renderers.rb
|
98
|
-
- lib/hyde/scope.rb
|
99
|
-
- lib/hyde/template_helpers.rb
|
100
106
|
- lib/hyde/utils.rb
|
101
107
|
- test/fixtures/custom/_config.yml
|
108
|
+
- test/fixtures/custom/extensions/custom/custom.rb
|
102
109
|
- test/fixtures/custom/layouts/default.haml
|
103
110
|
- test/fixtures/custom/layouts/erbtest.erb
|
104
111
|
- test/fixtures/custom/site/about/index.html
|
@@ -120,18 +127,17 @@ files:
|
|
120
127
|
- test/fixtures/custom/www_control/markdown.html
|
121
128
|
- test/fixtures/custom/www_control/yes.html
|
122
129
|
- test/fixtures/default/_config.yml
|
123
|
-
- test/fixtures/default/
|
124
|
-
- test/fixtures/default/about/index.html
|
125
|
-
- test/fixtures/default/foo.html.haml
|
126
|
-
- test/fixtures/default/index.html.haml
|
127
|
-
- test/fixtures/default/layout_test.html.haml
|
128
|
-
- test/fixtures/default/
|
130
|
+
- test/fixtures/default/layouts/default.haml
|
131
|
+
- test/fixtures/default/site/about/index.html
|
132
|
+
- test/fixtures/default/site/foo.html.haml
|
133
|
+
- test/fixtures/default/site/index.html.haml
|
134
|
+
- test/fixtures/default/site/layout_test.html.haml
|
135
|
+
- test/fixtures/default/site/yes.html
|
129
136
|
- test/fixtures/default/www_control/about/index.html
|
130
137
|
- test/fixtures/default/www_control/foo.html
|
131
138
|
- test/fixtures/default/www_control/index.html
|
132
139
|
- test/fixtures/default/www_control/layout_test.html
|
133
140
|
- test/fixtures/default/www_control/yes.html
|
134
|
-
- test/fixtures/default/yes.html
|
135
141
|
- test/helper.rb
|
136
142
|
- test/test_all_fixtures.rb
|
137
143
|
- test/test_build.rb
|
@@ -170,6 +176,7 @@ signing_key:
|
|
170
176
|
specification_version: 3
|
171
177
|
summary: Website preprocessor
|
172
178
|
test_files:
|
179
|
+
- test/fixtures/custom/extensions/custom/custom.rb
|
173
180
|
- test/helper.rb
|
174
181
|
- test/test_all_fixtures.rb
|
175
182
|
- test/test_build.rb
|
data/docs/ExtendingHyde.md
DELETED
data/docs/GettingStarted.md
DELETED
data/lib/hyde/scope.rb
DELETED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|