genit 0.3 → 0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/NEWS +12 -1
- data/README.markdown +3 -3
- data/TODO +3 -10
- data/VERSION +1 -1
- data/bin/genit +39 -19
- data/data/pages/index.html +24 -2
- data/data/styles/screen.css +26 -1
- data/data/templates/menu.html +0 -1
- data/lib/genit/compiler.rb +14 -2
- data/lib/genit/project_creator.rb +7 -6
- data/spec/compiler_spec.rb +8 -2
- data/spec/project_creator_spec.rb +10 -2
- metadata +19 -8
data/NEWS
CHANGED
@@ -1,4 +1,15 @@
|
|
1
|
-
v0.
|
1
|
+
v0.4 2011-07-25
|
2
|
+
|
3
|
+
* better smoke test
|
4
|
+
|
5
|
+
* basic user documentation
|
6
|
+
|
7
|
+
* genit use a simple project file
|
8
|
+
|
9
|
+
* use clamp as a command line framework
|
10
|
+
|
11
|
+
|
12
|
+
v0.3 2011-07-23
|
2
13
|
|
3
14
|
* You can split a page in a multitude of fragments.
|
4
15
|
|
data/README.markdown
CHANGED
@@ -4,7 +4,7 @@ Genit
|
|
4
4
|
Genit builds a **static web site**, that is a web site without server side programing language
|
5
5
|
and database. A genit site consists only of xhtml code (+ css, medias and eventually javascript).
|
6
6
|
|
7
|
-
|
7
|
+
Genit is written in Ruby but there is no needs to know the Ruby language.
|
8
8
|
|
9
9
|
The project is in early development stage, see
|
10
10
|
[project guidelines](https://github.com/lkdjiin/genit/blob/master/project_guidelines.markdown).
|
@@ -50,8 +50,7 @@ Usage
|
|
50
50
|
|
51
51
|
genit compile
|
52
52
|
|
53
|
-
|
54
|
-
for more information.
|
53
|
+
See the wiki for user documentation and a tutorial.
|
55
54
|
|
56
55
|
|
57
56
|
Dependencies
|
@@ -62,6 +61,7 @@ Dependencies
|
|
62
61
|
* ruby >= 1.9.2
|
63
62
|
* nokogiri (xml parser)
|
64
63
|
* bluecloth (markdown parser)
|
64
|
+
* clamp (command line utility)
|
65
65
|
|
66
66
|
### Contributors dependencies
|
67
67
|
|
data/TODO
CHANGED
@@ -1,23 +1,16 @@
|
|
1
|
-
release v0.3
|
2
1
|
|
2
|
+
release v0.4
|
3
3
|
|
4
4
|
|
5
|
-
smoke test
|
6
|
-
|
7
|
-
mettre un fichier caché pour savoir qu'on a affaire à un projet Genit.
|
8
|
-
|
9
|
-
option --version et --help (utiliser un framework cli)
|
10
5
|
|
11
|
-
commencer documentation
|
12
6
|
|
13
|
-
|
7
|
+
web site for genit
|
14
8
|
|
9
|
+
announce site (freshmeat et blog)
|
15
10
|
|
16
11
|
|
17
12
|
|
18
|
-
web site for genit
|
19
13
|
|
20
|
-
announce site (freshmeat et blog)
|
21
14
|
|
22
15
|
news
|
23
16
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4
|
data/bin/genit
CHANGED
@@ -26,28 +26,48 @@ $LOAD_PATH.unshift File.dirname(__FILE__) + '/../lib'
|
|
26
26
|
$GENIT_PATH = File.expand_path(File.dirname(__FILE__)) + '/..'
|
27
27
|
|
28
28
|
require 'genit'
|
29
|
+
require 'clamp'
|
29
30
|
include Genit
|
30
31
|
|
31
|
-
|
32
|
-
puts %q{usage: genit command
|
32
|
+
module Genit
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
class AbstractCommand < Clamp::Command
|
35
|
+
|
36
|
+
option ['-v', '--version'], :flag, "print version" do
|
37
|
+
puts "genit #{File.read('VERSION').strip}"
|
38
|
+
exit 0
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
|
43
|
+
class CreateCommand < AbstractCommand
|
44
|
+
|
45
|
+
parameter "NAME", "the name of the project", :attribute_name => :project_name
|
46
|
+
|
47
|
+
def execute
|
48
|
+
project = ProjectCreator.new project_name
|
49
|
+
project.create
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
54
|
+
class CompileCommand < AbstractCommand
|
38
55
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
when /\w/
|
43
|
-
project = ProjectCreator.new ARGV[1]
|
44
|
-
project.create
|
45
|
-
else
|
46
|
-
usage
|
56
|
+
def execute
|
57
|
+
compiler = Compiler.new Dir.getwd
|
58
|
+
compiler.compile
|
47
59
|
end
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
60
|
+
|
61
|
+
end
|
62
|
+
|
63
|
+
class MainCommand < AbstractCommand
|
64
|
+
|
65
|
+
subcommand "create", "Create a project.", CreateCommand
|
66
|
+
subcommand "compile", "Compile the web site.", CompileCommand
|
67
|
+
subcommand "cc", "Compile the web site.", CompileCommand
|
68
|
+
|
69
|
+
end
|
70
|
+
|
53
71
|
end
|
72
|
+
|
73
|
+
Genit::MainCommand.run
|
data/data/pages/index.html
CHANGED
@@ -1,6 +1,28 @@
|
|
1
1
|
<h1>Welcome to Genit !</h1>
|
2
2
|
|
3
3
|
<p>
|
4
|
-
|
5
|
-
|
4
|
+
Genit is a framework to build a <strong>static web site</strong>, that is a web site without server
|
5
|
+
side programing language and database. A genit site consists only of xhtml code (+ css, medias and
|
6
|
+
eventually javascript).
|
7
|
+
</p>
|
8
|
+
|
9
|
+
<p>
|
10
|
+
<em>Genit is written in Ruby but there is no needs to know the Ruby language.</em>
|
11
|
+
</p>
|
12
|
+
|
13
|
+
<p>
|
14
|
+
The Genit project is hosted on
|
15
|
+
<a href="https://github.com/lkdjiin/genit" title="Source code of Genit">GitHub</a> under the terms
|
16
|
+
of the MIT license. Feel free to fork it. Each new release will be announced on the
|
17
|
+
<a href="http://freshmeat.net/projects/genit" title="Genit project on freshmeat">freshmeat</a> site.
|
18
|
+
The development progress will be announced on Twitter:<br/>
|
19
|
+
<a href="http://twitter.com/lkdjiin" class="twitter-follow-button" data-show-count="false">Follow @lkdjiin</a>
|
20
|
+
<script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>
|
21
|
+
</p>
|
22
|
+
|
23
|
+
<h1>Get started</h1>
|
24
|
+
|
25
|
+
<p>
|
26
|
+
Read the <a href="https://github.com/lkdjiin/genit/blob/master/documentation/tutorial.markdown"
|
27
|
+
"A short get started tutorial for Genit">tutorial</a> and make your site !
|
6
28
|
</p>
|
data/data/styles/screen.css
CHANGED
@@ -1 +1,26 @@
|
|
1
|
-
/*
|
1
|
+
/* Delete this content and write your own rules */
|
2
|
+
|
3
|
+
body {
|
4
|
+
width:600px;
|
5
|
+
margin:0 auto;
|
6
|
+
font-family: Arial, Helvetica, FreeSans, sans-serif;
|
7
|
+
}
|
8
|
+
|
9
|
+
#menu { display:none;}
|
10
|
+
|
11
|
+
p {
|
12
|
+
font-size:1.2em;
|
13
|
+
color:#555;
|
14
|
+
}
|
15
|
+
|
16
|
+
p:hover {color:#001;}
|
17
|
+
|
18
|
+
p:hover a {
|
19
|
+
background-color:#001 !important;
|
20
|
+
color:white !important;
|
21
|
+
text-decoration:none !important;
|
22
|
+
}
|
23
|
+
|
24
|
+
a {
|
25
|
+
color:#334 !important;
|
26
|
+
}
|
data/data/templates/menu.html
CHANGED
data/lib/genit/compiler.rb
CHANGED
@@ -16,12 +16,24 @@ module Genit
|
|
16
16
|
|
17
17
|
# Public: Compile the web site.
|
18
18
|
def compile
|
19
|
-
|
20
|
-
|
19
|
+
if genit_project_folder?
|
20
|
+
compile_site
|
21
|
+
else
|
22
|
+
puts 'Not a genit project folder'
|
23
|
+
end
|
21
24
|
end
|
22
25
|
|
23
26
|
private
|
24
27
|
|
28
|
+
def genit_project_folder?
|
29
|
+
File.exist?(File.join(@working_dir, '.genit'))
|
30
|
+
end
|
31
|
+
|
32
|
+
def compile_site
|
33
|
+
compile_pages
|
34
|
+
FileUtils.cp_r File.join(@working_dir, 'styles'), File.join(@working_dir, 'www')
|
35
|
+
end
|
36
|
+
|
25
37
|
def compile_pages
|
26
38
|
Dir.foreach(File.join(@working_dir, 'pages')) do |file|
|
27
39
|
next if (file == ".") or (file == "..")
|
@@ -20,16 +20,17 @@ module Genit
|
|
20
20
|
# Returns nothing.
|
21
21
|
def create
|
22
22
|
begin
|
23
|
-
|
24
|
-
create_dirs ['fragments', 'news', 'pages', 'scripts', 'styles', 'templates', 'www'
|
25
|
-
|
23
|
+
FileUtils.makedirs @name
|
24
|
+
create_dirs ['fragments', 'news', 'pages', 'scripts', 'styles', 'templates', 'www',
|
25
|
+
'styles/alsa', 'styles/yui', 'styles/images']
|
26
26
|
copy_files ['templates/main.html', 'templates/menu.html',
|
27
27
|
'pages/index.html', 'styles/handheld.css', 'styles/print.css',
|
28
28
|
'styles/screen.css', 'styles/alsa/all.css', 'styles/yui/all.css', 'styles/yui/base.css',
|
29
29
|
'styles/yui/fonts.css', 'styles/yui/reset.css']
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
FileUtils.touch "#{@name}/.genit"
|
31
|
+
rescue SystemCallError
|
32
|
+
puts "Cannot create project..."
|
33
|
+
end
|
33
34
|
end
|
34
35
|
|
35
36
|
private
|
data/spec/compiler_spec.rb
CHANGED
@@ -19,7 +19,7 @@ describe Compiler do
|
|
19
19
|
file.puts content
|
20
20
|
end
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
it "should build an index.html page in www" do
|
24
24
|
@compiler.compile
|
25
25
|
File.exist?('spec/project-name/www/index.html').should == true
|
@@ -31,7 +31,7 @@ describe Compiler do
|
|
31
31
|
File.exist?('spec/project-name/www/index.html').should == true
|
32
32
|
File.exist?('spec/project-name/www/doc.html').should == true
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
it "should copy the styles/ into www/" do
|
36
36
|
File.exist?('spec/project-name/www/styles/screen.css').should be_true
|
37
37
|
end
|
@@ -42,4 +42,10 @@ describe Compiler do
|
|
42
42
|
doc.at_css("ul#menu a#selected")['href'].should == 'index.html'
|
43
43
|
end
|
44
44
|
|
45
|
+
it "should take care of the hidden project file" do
|
46
|
+
compiler = Compiler.new File.expand_path('.')
|
47
|
+
$stdout.should_receive(:puts).with("Not a genit project folder")
|
48
|
+
compiler.compile
|
49
|
+
end
|
50
|
+
|
45
51
|
end
|
@@ -13,8 +13,8 @@ describe ProjectCreator do
|
|
13
13
|
clean_test_repository
|
14
14
|
end
|
15
15
|
|
16
|
-
describe "
|
17
|
-
|
16
|
+
describe "Project folder" do
|
17
|
+
|
18
18
|
it "should create a project folder" do
|
19
19
|
File.exist?('spec/project-name').should == true
|
20
20
|
end
|
@@ -24,6 +24,14 @@ describe ProjectCreator do
|
|
24
24
|
$stdout.should_receive(:puts).with("Cannot create project...")
|
25
25
|
project.create
|
26
26
|
end
|
27
|
+
|
28
|
+
it "should create a project file" do
|
29
|
+
File.exist?('spec/project-name/.genit').should == true
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
describe "Folder structure" do
|
27
35
|
|
28
36
|
it "should create a news folder" do
|
29
37
|
File.exist?('spec/project-name/news').should == true
|
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: '0.
|
4
|
+
version: '0.4'
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,12 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-07-
|
12
|
+
date: 2011-07-25 00:00:00.000000000 +02:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: coco
|
17
|
-
requirement: &
|
17
|
+
requirement: &80775510 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 0.4.2
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *80775510
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: nokogiri
|
28
|
-
requirement: &
|
28
|
+
requirement: &80775070 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: 1.4.6
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *80775070
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: bluecloth
|
39
|
-
requirement: &
|
39
|
+
requirement: &80774600 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,7 +44,18 @@ dependencies:
|
|
44
44
|
version: 2.1.0
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *80774600
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: clamp
|
50
|
+
requirement: &80774180 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 0.2.2
|
56
|
+
type: :runtime
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: *80774180
|
48
59
|
description: ! "Genit builds a **static web site**, that is a web site without server
|
49
60
|
side \nprograming language and database. The site consists only of xhtml code (+
|
50
61
|
css and medias) and \neventually of javascript. It is a command line framework,
|