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 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 put an error message when:
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 put a warning message when a here tag is used without its counterpart
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
 
@@ -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
- sitemap
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
- *Les deux fichiers cachés doivent être présent à la compil
15
- *<genit class="foo" /> dans le template fait un RuntimeError. Idem dans une page.
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
- fichier .genit
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
@@ -1,5 +1,4 @@
1
1
  <!DOCTYPE html>
2
-
3
2
  <html lang="en">
4
3
  <head>
5
- <meta charset="UTF-8">
4
+ <meta charset="UTF-8"/>
@@ -9,7 +9,7 @@ module Genit
9
9
 
10
10
  # Public: Constructor.
11
11
  #
12
- # working_dir - The String working directory, where live the project.
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.to_xhtml, get_full_path(filename.force_html_extension)
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 = Dir.glob(File.join(@working_dir, 'news', '*')).sort.reverse
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.
@@ -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") {|out| out.puts a_news }
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") {|out| out.puts main }
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{Compiler.new(test_project_path).compile}.should raise_error(SystemExit)
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") {|out| out.puts index }
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{Compiler.new(test_project_path).compile}.should raise_error(SystemExit)
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") {|out| out.puts main }
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{Compiler.new(test_project_path).compile}.should raise_error(SystemExit)
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") {|out| out.puts index }
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{Compiler.new(test_project_path).compile}.should raise_error(SystemExit)
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") {|out| out.puts main }
162
+ File.open('spec/project-name/templates/main.html', "w") do |out|
163
+ out.puts main
164
+ end
145
165
 
146
- $stdout.should_receive(:puts).with(/No such file <genit class="fragment" file=/i)
147
- lambda{Compiler.new(test_project_path).compile}.should raise_error(SystemExit)
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") {|out| out.puts index }
178
+ File.open('spec/project-name/pages/index.html', "w") do |out|
179
+ out.puts index
180
+ end
156
181
 
157
- $stdout.should_receive(:puts).with(/No such file <genit class="fragment" file=/i)
158
- lambda{Compiler.new(test_project_path).compile}.should raise_error(SystemExit)
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") {|out| out.puts main }
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{Compiler.new(test_project_path).compile}.should raise_error(SystemExit)
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") {|out| out.puts '<p>footer</p>' }
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" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
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" href="styles/alsa/all.css" />
218
- <link rel="stylesheet" type="text/css" media="screen" href="styles/screen.css" />
219
- <link rel="stylesheet" type="text/css" media="print" href="styles/print.css" />
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") {|out| out.puts main }
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
 
@@ -1,7 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
2
 
3
- require 'coco'
4
-
5
3
  $GENIT_PATH = File.expand_path(File.join(File.expand_path(File.dirname(__FILE__)), '..'))
6
4
 
7
5
  require './lib/genit'
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: '1.0'
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: 2011-10-02 00:00:00.000000000 +02:00
13
- default_executable:
12
+ date: 2013-03-14 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
- name: coco
17
- requirement: &72352700 !ruby/object:Gem::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: 0.4.2
21
+ version: 1.4.6
23
22
  type: :runtime
24
23
  prerelease: false
25
- version_requirements: *72352700
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: &72351960 !ruby/object:Gem::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: *72351960
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: &72351550 !ruby/object:Gem::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: *72351550
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.6.2
184
+ rubygems_version: 1.8.25
183
185
  signing_key:
184
186
  specification_version: 3
185
187
  summary: Static web site framework