genit 0.3 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
data/NEWS CHANGED
@@ -1,4 +1,15 @@
1
- v0.3 2001-07-23
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
 
@@ -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
- There is no needs to know the Ruby language.
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
- Take a look at the [tutorial](https://github.com/lkdjiin/genit/blob/master/documentation/tutorial.markdown)
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
- release v0.4
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.3
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
- def usage
32
- puts %q{usage: genit command
32
+ module Genit
33
33
 
34
- where command is:
35
- create project-name
36
- compile | cc}
37
- end
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
- case ARGV[0]
40
- when "create"
41
- case ARGV[1]
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
- when "compile", "cc"
49
- compiler = Compiler.new Dir.getwd
50
- compiler.compile
51
- else
52
- usage
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
@@ -1,6 +1,28 @@
1
1
  <h1>Welcome to Genit !</h1>
2
2
 
3
3
  <p>
4
- This is a generated index page. Change it as you want
5
- to suit your needs.
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>
@@ -1 +1,26 @@
1
- /* Write your rules */
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
+ }
@@ -1,5 +1,4 @@
1
1
  <ul id="menu">
2
2
  <li><a href="index.html">home</a></li>
3
- <li><a href="help.html">help</a></li>
4
3
  </ul>
5
4
 
@@ -16,12 +16,24 @@ module Genit
16
16
 
17
17
  # Public: Compile the web site.
18
18
  def compile
19
- compile_pages
20
- FileUtils.cp_r File.join(@working_dir, 'styles'), File.join(@working_dir, 'www')
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
- FileUtils.makedirs @name
24
- create_dirs ['fragments', 'news', 'pages', 'scripts', 'styles', 'templates', 'www']
25
- create_dirs ['styles/alsa', 'styles/yui', 'styles/images']
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
- rescue SystemCallError
31
- puts "Cannot create project..."
32
- end
30
+ FileUtils.touch "#{@name}/.genit"
31
+ rescue SystemCallError
32
+ puts "Cannot create project..."
33
+ end
33
34
  end
34
35
 
35
36
  private
@@ -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 "Folder structure" do
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.3'
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-23 00:00:00.000000000 +02:00
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: &75668220 !ruby/object:Gem::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: *75668220
25
+ version_requirements: *80775510
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: nokogiri
28
- requirement: &75643120 !ruby/object:Gem::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: *75643120
36
+ version_requirements: *80775070
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: bluecloth
39
- requirement: &75642670 !ruby/object:Gem::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: *75642670
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,