genit 1.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS +7 -2
- data/README.markdown +0 -6
- data/TODO +9 -19
- data/VERSION +1 -1
- data/data/templates/html_5 +1 -2
- data/lib/genit/documents/document_writer.rb +2 -2
- data/lib/genit/project/compiler.rb +2 -1
- data/lib/genit/project/page_compiler.rb +1 -0
- data/spec/compiler_spec.rb +73 -28
- data/spec/helper.rb +0 -2
- metadata +21 -19
data/NEWS
CHANGED
@@ -1,14 +1,19 @@
|
|
1
|
+
v1.0.1 2013-03-13
|
2
|
+
|
3
|
+
* Fix a bug that creates a bad html5 doctype
|
4
|
+
|
5
|
+
|
1
6
|
v1.0 2011-10-02
|
2
7
|
|
3
8
|
* Genit creates a sitemap.xml
|
4
9
|
|
5
|
-
* Genit
|
10
|
+
* Genit puts an error message when:
|
6
11
|
- config file not present
|
7
12
|
- unknown tag
|
8
13
|
- bad or incomplete fragment tag
|
9
14
|
- syntax error in .config
|
10
15
|
|
11
|
-
* Genit
|
16
|
+
* Genit puts a warning message when a here tag is used without its counterpart
|
12
17
|
|
13
18
|
* Version is added to the .genit file
|
14
19
|
|
data/README.markdown
CHANGED
@@ -66,14 +66,8 @@ Dependencies
|
|
66
66
|
### Contributors dependencies
|
67
67
|
|
68
68
|
* rspec for tests
|
69
|
-
* [coco](https://github.com/lkdjiin/coco) (code coverage must be 90% minimum)
|
70
69
|
* [tomdoc](http://tomdoc.org/) to document your code
|
71
70
|
|
72
|
-
_recommended_
|
73
|
-
|
74
|
-
* reek, to check for code smells
|
75
|
-
* flay, to check for duplicated code
|
76
|
-
|
77
71
|
|
78
72
|
License
|
79
73
|
--------------------------
|
data/TODO
CHANGED
@@ -1,23 +1,15 @@
|
|
1
|
+
BUG
|
2
|
+
================
|
1
3
|
|
2
|
-
|
3
|
-
|
4
|
-
*trouver la liste des pages (et markdown ?))
|
5
|
-
*transformer liste page en liste url
|
6
|
-
*construire le sitemap
|
7
|
-
*tout ensemble
|
8
|
-
*la doc
|
4
|
+
Un site HTML5 compilé -> le résultat du doctype, head, etc. est un mélange
|
5
|
+
de html5 et xhtml.
|
9
6
|
|
7
|
+
Update docs to reflect the fact that all tags MUST be closed.
|
10
8
|
|
11
|
-
messages erreur
|
12
|
-
----------------
|
13
9
|
|
14
|
-
|
15
|
-
|
16
|
-
*<genit class="fragment"/> dans template ou page fait une erreur moche.
|
17
|
-
*<genit class="fragment" file="inconnu.html"/> fait une erreur moche.
|
18
|
-
*une erreur de syntaxe dans le .config fait une erreur moche.
|
10
|
+
messages warning
|
11
|
+
----------------
|
19
12
|
|
20
|
-
*<genit here="window_title"/> sans contrepartie ne fait rien, il faudrait un warning.
|
21
13
|
|
22
14
|
si j'écris <h1>news page (en oubliant le tag de fin) Genit ne dis
|
23
15
|
rien et ajoute silencieusement le </h1>. Voir si on peut lui faire
|
@@ -28,8 +20,6 @@ d'avoir un warning.
|
|
28
20
|
|
29
21
|
dans le dossier page on accepte uniquement .html et .markdown (warning)
|
30
22
|
|
31
|
-
|
32
|
-
|
33
|
-
*ajouter la version
|
34
|
-
|
23
|
+
si j'écris </br> (au lieu de <br/>) Genit ne dis rien, le tag est ignoré.
|
24
|
+
Voir si on peut lui faire cracher un warning (ou une erreur si pas possible warning).
|
35
25
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0
|
1
|
+
1.0.1
|
data/data/templates/html_5
CHANGED
@@ -9,7 +9,7 @@ module Genit
|
|
9
9
|
|
10
10
|
# Public: Constructor.
|
11
11
|
#
|
12
|
-
# working_dir -
|
12
|
+
# working_dir - the string working directory, where live the project.
|
13
13
|
def initialize working_dir
|
14
14
|
@working_dir = working_dir
|
15
15
|
end
|
@@ -21,7 +21,7 @@ module Genit
|
|
21
21
|
def save_as_xhtml document, filename
|
22
22
|
@document = document
|
23
23
|
remove_remaining_tags
|
24
|
-
FileWriter.write document.
|
24
|
+
FileWriter.write document.to_html, get_full_path(filename.force_html_extension)
|
25
25
|
end
|
26
26
|
|
27
27
|
private
|
@@ -73,7 +73,8 @@ module Genit
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def create_rss_feed
|
76
|
-
all_news_files =
|
76
|
+
all_news_files =
|
77
|
+
Dir.glob(File.join(@working_dir, 'news', '*')).sort.reverse
|
77
78
|
begin
|
78
79
|
config_file = YAML.load_file(File.join(@working_dir, '.config'))
|
79
80
|
rescue ArgumentError => msg
|
@@ -13,6 +13,7 @@ module Genit
|
|
13
13
|
@working_dir = working_dir
|
14
14
|
@filename = filename
|
15
15
|
@template = XmlDocument.open(File.join(@working_dir, 'templates/main.html'))
|
16
|
+
# @template = XmlDocument.open(File.join(@working_dir, 'templates/main.html'))
|
16
17
|
end
|
17
18
|
|
18
19
|
# Public: Compile the page.
|
data/spec/compiler_spec.rb
CHANGED
@@ -68,7 +68,9 @@ describe Compiler do
|
|
68
68
|
describe "Sitemap XML" do
|
69
69
|
it "should build the 'sitemap.xml'" do
|
70
70
|
a_news = %q{<h1>title</h1>}
|
71
|
-
File.open('spec/project-name/news/2011-10-01.html', "w")
|
71
|
+
File.open('spec/project-name/news/2011-10-01.html', "w") do |out|
|
72
|
+
out.puts a_news
|
73
|
+
end
|
72
74
|
@compiler.compile
|
73
75
|
File.exist?('spec/project-name/www/sitemap.xml').should be_true
|
74
76
|
end
|
@@ -85,10 +87,14 @@ describe Compiler do
|
|
85
87
|
</body>
|
86
88
|
</html>
|
87
89
|
}
|
88
|
-
File.open('spec/project-name/templates/main.html', "w")
|
90
|
+
File.open('spec/project-name/templates/main.html', "w") do |out|
|
91
|
+
out.puts main
|
92
|
+
end
|
89
93
|
|
90
94
|
$stdout.should_receive(:puts).with(/Unknown tag <genit class="foo"/i)
|
91
|
-
lambda
|
95
|
+
lambda do
|
96
|
+
Compiler.new(test_project_path).compile
|
97
|
+
end.should raise_error(SystemExit)
|
92
98
|
end
|
93
99
|
end
|
94
100
|
|
@@ -96,10 +102,14 @@ describe Compiler do
|
|
96
102
|
it "should exit" do
|
97
103
|
# replace index.html
|
98
104
|
index = %q{<genit class="foo"/>}
|
99
|
-
File.open('spec/project-name/pages/index.html', "w")
|
105
|
+
File.open('spec/project-name/pages/index.html', "w") do |out|
|
106
|
+
out.puts index
|
107
|
+
end
|
100
108
|
|
101
109
|
$stdout.should_receive(:puts).with(/Unknown tag <genit class="foo"/i)
|
102
|
-
lambda
|
110
|
+
lambda do
|
111
|
+
Compiler.new(test_project_path).compile
|
112
|
+
end.should raise_error(SystemExit)
|
103
113
|
end
|
104
114
|
end
|
105
115
|
|
@@ -113,10 +123,14 @@ describe Compiler do
|
|
113
123
|
</body>
|
114
124
|
</html>
|
115
125
|
}
|
116
|
-
File.open('spec/project-name/templates/main.html', "w")
|
126
|
+
File.open('spec/project-name/templates/main.html', "w") do |out|
|
127
|
+
out.puts main
|
128
|
+
end
|
117
129
|
|
118
130
|
$stdout.should_receive(:puts).with(/Incomplete <genit class="fragment"/i)
|
119
|
-
lambda
|
131
|
+
lambda do
|
132
|
+
Compiler.new(test_project_path).compile
|
133
|
+
end.should raise_error(SystemExit)
|
120
134
|
end
|
121
135
|
end
|
122
136
|
|
@@ -124,10 +138,14 @@ describe Compiler do
|
|
124
138
|
it "should exit" do
|
125
139
|
# replace index.html
|
126
140
|
index = %q{<genit class="fragment"/>}
|
127
|
-
File.open('spec/project-name/pages/index.html', "w")
|
141
|
+
File.open('spec/project-name/pages/index.html', "w") do |out|
|
142
|
+
out.puts index
|
143
|
+
end
|
128
144
|
|
129
145
|
$stdout.should_receive(:puts).with(/Incomplete <genit class="fragment"/i)
|
130
|
-
lambda
|
146
|
+
lambda do
|
147
|
+
Compiler.new(test_project_path).compile
|
148
|
+
end.should raise_error(SystemExit)
|
131
149
|
end
|
132
150
|
end
|
133
151
|
|
@@ -141,10 +159,15 @@ describe Compiler do
|
|
141
159
|
</body>
|
142
160
|
</html>
|
143
161
|
}
|
144
|
-
File.open('spec/project-name/templates/main.html', "w")
|
162
|
+
File.open('spec/project-name/templates/main.html', "w") do |out|
|
163
|
+
out.puts main
|
164
|
+
end
|
145
165
|
|
146
|
-
|
147
|
-
|
166
|
+
rx = /No such file <genit class="fragment" file=/i
|
167
|
+
$stdout.should_receive(:puts).with(rx)
|
168
|
+
lambda do
|
169
|
+
Compiler.new(test_project_path).compile
|
170
|
+
end.should raise_error(SystemExit)
|
148
171
|
end
|
149
172
|
end
|
150
173
|
|
@@ -152,10 +175,15 @@ describe Compiler do
|
|
152
175
|
it "should exit" do
|
153
176
|
# replace index.html
|
154
177
|
index = %q{<genit class="fragment" file="unknown.html"/>}
|
155
|
-
File.open('spec/project-name/pages/index.html', "w")
|
178
|
+
File.open('spec/project-name/pages/index.html', "w") do |out|
|
179
|
+
out.puts index
|
180
|
+
end
|
156
181
|
|
157
|
-
|
158
|
-
|
182
|
+
rx = /No such file <genit class="fragment" file=/i
|
183
|
+
$stdout.should_receive(:puts).with(rx)
|
184
|
+
lambda do
|
185
|
+
Compiler.new(test_project_path).compile
|
186
|
+
end.should raise_error(SystemExit)
|
159
187
|
end
|
160
188
|
end
|
161
189
|
|
@@ -171,17 +199,14 @@ describe Compiler do
|
|
171
199
|
</body>
|
172
200
|
</html>
|
173
201
|
}
|
174
|
-
File.open('spec/project-name/templates/main.html', "w")
|
202
|
+
File.open('spec/project-name/templates/main.html', "w") do |out|
|
203
|
+
out.puts main
|
204
|
+
end
|
175
205
|
$stdout.should_receive(:puts).with(/here without what/i)
|
176
|
-
#~ lambda{Compiler.new(test_project_path).compile}.should_not raise_error
|
177
206
|
Compiler.new(test_project_path).compile
|
178
207
|
end
|
179
208
|
end
|
180
209
|
|
181
|
-
context "with what tag without here tag" do
|
182
|
-
it "should warn"
|
183
|
-
end
|
184
|
-
|
185
210
|
end
|
186
211
|
|
187
212
|
context "with bad '.config' syntax" do
|
@@ -197,26 +222,44 @@ describe Compiler do
|
|
197
222
|
File.open('spec/project-name/.config', "w") {|out| out.puts main }
|
198
223
|
|
199
224
|
$stdout.should_receive(:puts).with(/in .config file/i)
|
200
|
-
lambda
|
225
|
+
lambda do
|
226
|
+
Compiler.new(test_project_path).compile
|
227
|
+
end.should raise_error(SystemExit)
|
201
228
|
end
|
202
229
|
end
|
203
230
|
|
204
231
|
describe "BUGS" do
|
232
|
+
|
233
|
+
it "should compile to valid HTML5" do
|
234
|
+
@compiler.compile
|
235
|
+
file = File.open("spec/project-name/www/index.html", "r")
|
236
|
+
contents = file.read
|
237
|
+
puts "*************"
|
238
|
+
puts contents
|
239
|
+
expected = '<!DOCTYPE html>'
|
240
|
+
contents.start_with?(expected).should be_true
|
241
|
+
end
|
205
242
|
|
206
243
|
it "should allow template to include a fragment (Bug#37)" do
|
207
244
|
# add a fragment
|
208
|
-
File.open('spec/project-name/fragments/footer.html', "w")
|
245
|
+
File.open('spec/project-name/fragments/footer.html', "w") do |out|
|
246
|
+
out.puts '<p>footer</p>'
|
247
|
+
end
|
209
248
|
# replace main.html
|
210
249
|
main = %q{
|
211
250
|
<?xml version="1.0" encoding="UTF-8"?>
|
212
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
251
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
252
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
213
253
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
214
254
|
<head>
|
215
255
|
<title>Genit - Static web site framework</title>
|
216
256
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
217
|
-
<link rel="stylesheet" type="text/css" media="all"
|
218
|
-
|
219
|
-
<link rel="stylesheet" type="text/css" media="
|
257
|
+
<link rel="stylesheet" type="text/css" media="all"
|
258
|
+
href="styles/alsa/all.css" />
|
259
|
+
<link rel="stylesheet" type="text/css" media="screen"
|
260
|
+
href="styles/screen.css" />
|
261
|
+
<link rel="stylesheet" type="text/css" media="print"
|
262
|
+
href="styles/print.css" />
|
220
263
|
</head>
|
221
264
|
<body>
|
222
265
|
<genit class="menu" />
|
@@ -224,7 +267,9 @@ describe Compiler do
|
|
224
267
|
<genit class="fragment" file="footer.html"/>
|
225
268
|
</body>
|
226
269
|
</html>}
|
227
|
-
File.open('spec/project-name/templates/main.html', "w")
|
270
|
+
File.open('spec/project-name/templates/main.html', "w") do |out|
|
271
|
+
out.puts main
|
272
|
+
end
|
228
273
|
lambda {@compiler.compile}.should_not raise_error
|
229
274
|
end
|
230
275
|
|
data/spec/helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: genit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,34 +9,27 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
default_executable:
|
12
|
+
date: 2013-03-14 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
|
-
name:
|
17
|
-
requirement:
|
15
|
+
name: nokogiri
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
18
17
|
none: false
|
19
18
|
requirements:
|
20
19
|
- - ! '>='
|
21
20
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
21
|
+
version: 1.4.6
|
23
22
|
type: :runtime
|
24
23
|
prerelease: false
|
25
|
-
version_requirements:
|
26
|
-
- !ruby/object:Gem::Dependency
|
27
|
-
name: nokogiri
|
28
|
-
requirement: &72352350 !ruby/object:Gem::Requirement
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
29
25
|
none: false
|
30
26
|
requirements:
|
31
27
|
- - ! '>='
|
32
28
|
- !ruby/object:Gem::Version
|
33
29
|
version: 1.4.6
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: *72352350
|
37
30
|
- !ruby/object:Gem::Dependency
|
38
31
|
name: bluecloth
|
39
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
40
33
|
none: false
|
41
34
|
requirements:
|
42
35
|
- - ! '>='
|
@@ -44,10 +37,15 @@ dependencies:
|
|
44
37
|
version: 2.1.0
|
45
38
|
type: :runtime
|
46
39
|
prerelease: false
|
47
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 2.1.0
|
48
46
|
- !ruby/object:Gem::Dependency
|
49
47
|
name: clamp
|
50
|
-
requirement:
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
51
49
|
none: false
|
52
50
|
requirements:
|
53
51
|
- - ! '>='
|
@@ -55,7 +53,12 @@ dependencies:
|
|
55
53
|
version: 0.2.2
|
56
54
|
type: :runtime
|
57
55
|
prerelease: false
|
58
|
-
version_requirements:
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.2.2
|
59
62
|
description: ! "Genit builds a **static web site**, that is a web site without server
|
60
63
|
side \nprograming language and database. The site consists only of xhtml code (+
|
61
64
|
css and medias) and \neventually of javascript. It is a command line framework,
|
@@ -157,7 +160,6 @@ files:
|
|
157
160
|
- README.markdown
|
158
161
|
- Rakefile
|
159
162
|
- TODO
|
160
|
-
has_rdoc: true
|
161
163
|
homepage: https://github.com/lkdjiin/genit
|
162
164
|
licenses:
|
163
165
|
- Expat (also known as MIT)
|
@@ -179,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
179
181
|
version: '0'
|
180
182
|
requirements: []
|
181
183
|
rubyforge_project:
|
182
|
-
rubygems_version: 1.
|
184
|
+
rubygems_version: 1.8.25
|
183
185
|
signing_key:
|
184
186
|
specification_version: 3
|
185
187
|
summary: Static web site framework
|