hyla 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +8 -8
  2. data/.gitignore +30 -0
  3. data/LICENSE.txt +10 -19
  4. data/README.adoc +67 -6
  5. data/bin/hyla +22 -20
  6. data/documentation/introduction.adoc +57 -60
  7. data/documentation/scripts/create_adoc_from_toc.sh +20 -0
  8. data/documentation/scripts/create_adoc_from_toc_config.sh +24 -0
  9. data/documentation/scripts/create_myblankproject.sh +12 -0
  10. data/documentation/scripts/create_myblankproject_add_artefacts.sh +23 -0
  11. data/documentation/scripts/create_myblankproject_add_artefacts_config.sh +28 -0
  12. data/documentation/scripts/create_mytemplateproject.sh +10 -0
  13. data/documentation/scripts/create_mytrainingproject.sh +10 -0
  14. data/documentation/scripts/generate_content_myblankproject.sh +25 -0
  15. data/documentation/scripts/generate_content_myblankproject_config.sh +28 -0
  16. data/documentation/scripts/generate_content_myblankproject_other_style.sh +29 -0
  17. data/documentation/scripts/generate_pdf_from_html.sh +36 -0
  18. data/documentation/scripts/generate_slideshow_deckjs.sh +18 -0
  19. data/documentation/scripts/generate_slideshow_mytoc_all.sh +17 -0
  20. data/documentation/scripts/generate_slideshow_mytoc_module.sh +10 -0
  21. data/documentation/scripts/generate_slideshow_revealjs.sh +23 -0
  22. data/documentation/scripts/generate_watch_mytrainingproject.sh +19 -0
  23. data/documentation/scripts/remove_temp_directories.sh +16 -0
  24. data/documentation/scripts/sendmail.sh +19 -0
  25. data/hyla.gemspec +4 -4
  26. data/lib/hyla/commands/create.rb +4 -4
  27. data/lib/hyla/commands/generate.rb +38 -22
  28. data/lib/hyla/commands/new.rb +5 -2
  29. data/lib/hyla/commands/sendmail.rb +2 -1
  30. data/lib/hyla/commands/serve.rb +2 -2
  31. data/lib/hyla/commands/watch.rb +10 -64
  32. data/lib/hyla/configuration.rb +9 -5
  33. data/lib/hyla/project.rb +1 -1
  34. data/lib/resources/styles/liberation.css +1 -0
  35. data/lib/templates/_config.yaml +72 -0
  36. data/lib/templates/sample/asciidoc_report.adoc +10 -48
  37. data/lib/templates/sample/asciidoc_source.adoc +7 -0
  38. data/lib/templates/sample/source/HelloWorld.java +11 -0
  39. data/test/reports/test-1.0.x-11-12-2013.txt +2 -2
  40. data/todo.adoc +0 -28
  41. metadata +1286 -444
  42. data/data/chm-status-weeks-0601-1001.html +0 -913
  43. data/lib/templates/_config.yml +0 -27
@@ -0,0 +1,20 @@
1
+ #!/bin/sh
2
+
3
+ # ./create_adoc_from_toc.sh ~/MyProjects/hyla/data/toc.adoc MyTocProject
4
+
5
+ source remove_temp_directories.sh
6
+
7
+ if [ "$#" == "0" ]; then
8
+ echo "No arguments provided"
9
+ echo "Usage : ./create_adoc_from_toc.sh path_to_toc_file project_name"
10
+ exit 1
11
+ fi
12
+
13
+ echo "TOC file location : $1"
14
+ echo "Project Name : $2"
15
+
16
+ hyla generate -r toc2adoc -p my-project -d ~/hyla/$2/ --toc $1
17
+ hyla generate -r adoc2html -s ~/hyla/$2/ -d ~/hyla/$2/generated_content
18
+
19
+ echo "Project created"
20
+ ls -la ~/hyla/$2
@@ -0,0 +1,24 @@
1
+ #!/bin/sh
2
+
3
+ # ./create_adoc_from_toc.sh ~/MyProjects/hyla/data/toc.adoc MyTocProject
4
+
5
+ source remove_temp_directories.sh
6
+
7
+ if [ "$#" == "0" ]; then
8
+ echo "No arguments provided"
9
+ echo "Usage : ./create_adoc_from_toc.sh path_to_toc_file project_name"
10
+ exit 1
11
+ fi
12
+
13
+ echo "TOC file location : $1"
14
+ echo "Project Name : $2"
15
+
16
+ echo "Create a $2 using --force option"
17
+ cd ~/hyla
18
+ rm -rf $2/
19
+
20
+ hyla generate -r toc2adoc -p my-project -d ~/hyla/$2/ --toc $1
21
+ hyla generate -r adoc2html -s ~/hyla/$2/ -d ~/hyla/$2/generated_content
22
+
23
+ echo "Project created"
24
+ ls -la ~/hyla/$2
@@ -0,0 +1,12 @@
1
+ #!/bin/sh
2
+
3
+ source remove_temp_directories.sh
4
+
5
+ echo "Create a MyBlankProject"
6
+ hyla new --blank -d ~/hyla/MyBlankProject
7
+
8
+ echo "Create a MyBlankProject using --force option"
9
+ hyla new -b -d ~/hyla/MyBlankProject --force
10
+
11
+ echo "Project created"
12
+ ls -la ~/hyla/MyBlankProject
@@ -0,0 +1,23 @@
1
+ #!/bin/sh
2
+
3
+ source remove_temp_directories.sh
4
+
5
+ echo "Create a MyBlankProject and add artefacts"
6
+ cd ~/hyla
7
+
8
+ echo "Create a new Blank project"
9
+ hyla new -b -d MyBlankProject --force
10
+
11
+ echo "Add asciidoc files using artefacts and template"
12
+ hyla create --t asciidoc --a article --d ~/hyla/MyBlankProject
13
+ hyla create --t asciidoc --a book --d ~/hyla/MyBlankProject
14
+ hyla create --t asciidoc --a image --d ~/hyla/MyBlankProject
15
+ hyla create --t asciidoc --a audio --d ~/hyla/MyBlankProject
16
+ hyla create --t asciidoc --a video --d ~/hyla/MyBlankProject
17
+ hyla create --t asciidoc --a source --d ~/hyla/MyBlankProject
18
+ hyla create --t asciidoc --a table --d ~/hyla/MyBlankProject
19
+
20
+ echo "Project created"
21
+ ls -la ~/hyla/MyBlankProject
22
+
23
+
@@ -0,0 +1,28 @@
1
+ #!/bin/sh
2
+
3
+ source remove_temp_directories.sh
4
+
5
+ echo "Create a Blank project but containing the yaml config file"
6
+ cd ~/hyla
7
+ hyla new -b -d MyBlankProject --force
8
+ cd MyBlankProject
9
+
10
+ echo "Change destination parameter"
11
+ ruby -i.bak -pe 'sub(%r{destination: generated_content},"destination: .")' _config.yaml
12
+
13
+ hyla create --a article
14
+ hyla create --a book
15
+ hyla create --a image
16
+ hyla create --a audio
17
+ hyla create --a video
18
+ hyla create --a source
19
+ hyla create --a table
20
+
21
+ echo "Project created"
22
+ ls -la ~/hyla/MyBlankProject
23
+
24
+ echo "Revert destination parameter"
25
+ ruby -i.bak -pe 'sub(%r{destination: .},"destination: generated_content")' _config.yaml
26
+
27
+
28
+
@@ -0,0 +1,10 @@
1
+ #!/bin/sh
2
+
3
+ source remove_temp_directories.sh
4
+
5
+ echo "Create a MyBookProject using template book"
6
+ cd ~/hyla
7
+ hyla new --t book -d MyBookProject
8
+
9
+ echo "Project created"
10
+ ls -la ~/hyla/MyBookProject
@@ -0,0 +1,10 @@
1
+ #!/bin/sh
2
+
3
+ source remove_temp_directories.sh
4
+
5
+ echo "Create a MyTrainingProject using template book"
6
+ cd ~/hyla
7
+ hyla new --t training -d MyTrainingProject
8
+
9
+ echo "Project created"
10
+ ls -la ~/hyla/MyTrainingProject
@@ -0,0 +1,25 @@
1
+ #!/bin/sh
2
+
3
+ echo "Create Project"
4
+ rm -rf ~hyla/MyBlankProject
5
+ hyla new -b -d ~/hyla/MyBlankProject --force
6
+
7
+ echo "Generate HTML Content of MyBlank project"
8
+ cd ~/hyla/MyBlankProject
9
+
10
+ echo "Backup _config.yaml file as we don't use it here"
11
+ mv _config.yaml _config.yaml.bk
12
+
13
+ echo "Add asciidoc files"
14
+ hyla create --t asciidoc --a article --d ~/hyla/MyBlankProject
15
+ hyla create --t asciidoc --a book --d ~/hyla/MyBlankProject
16
+ hyla create --t asciidoc --a image --d ~/hyla/MyBlankProject
17
+ hyla create --t asciidoc --a audio --d ~/hyla/MyBlankProject
18
+ hyla create --t asciidoc --a video --d ~/hyla/MyBlankProject
19
+ hyla create --t asciidoc --a source --d ~/hyla/MyBlankProject
20
+ hyla create --t asciidoc --a table --d ~/hyla/MyBlankProject
21
+
22
+ hyla generate -r adoc2html -s ~/hyla/MyBlankProject/ -d ~/hyla/MyBlankProject/generated_content
23
+
24
+ echo "Revert _config.yaml file"
25
+ mv _config.yaml.bk _config.yaml
@@ -0,0 +1,28 @@
1
+ #!/bin/sh
2
+
3
+ echo "Generate HTML Content of MyBlank project"
4
+ echo "Styles availables : liberation, asciidoctor, colony, foundation, foundation-lime, foundation-potion, github, golo, iconic, maker, readthedocs, riak, rocket-panda, rubygems"
5
+
6
+ echo "Create Project"
7
+ rm -rf ~hyla/MyBlankProject
8
+ hyla new -b -d ~/hyla/MyBlankProject --force
9
+ cd ~/hyla/MyBlankProject
10
+
11
+ echo "Add asciidoc files"
12
+ hyla new -b -d MyBlankProject --force
13
+ hyla create --t asciidoc --a article --d ~/hyla/MyBlankProject
14
+ hyla create --t asciidoc --a book --d ~/hyla/MyBlankProject
15
+ hyla create --t asciidoc --a image --d ~/hyla/MyBlankProject
16
+ hyla create --t asciidoc --a audio --d ~/hyla/MyBlankProject
17
+ hyla create --t asciidoc --a video --d ~/hyla/MyBlankProject
18
+ hyla create --t asciidoc --a source --d ~/hyla/MyBlankProject
19
+ hyla create --t asciidoc --a table --d ~/hyla/MyBlankProject
20
+
21
+ echo "Change style in the _config.yaml file"
22
+ ruby -i.bak -pe 'sub(%r{style: liberation},"style: foundation")' _config.yaml
23
+
24
+ echo "Generate HTML content"
25
+ hyla generate
26
+
27
+ echo "Revert style"
28
+ ruby -i.bak -pe 'sub(%r{style: foundation},"style: liberation")' _config.yaml
@@ -0,0 +1,29 @@
1
+ #!/bin/sh
2
+
3
+ echo "Generate HTML Content of MyBlank project - Style Foundation"
4
+
5
+ echo "Create Project"
6
+ rm -rf ~hyla/MyBlankProject
7
+ hyla new -b -d ~/hyla/MyBlankProject --force
8
+
9
+ cd ~/hyla/MyBlankProject
10
+
11
+ echo "Add asciidoc files"
12
+ hyla new -b -d MyBlankProject --force
13
+ hyla create --t asciidoc --a article --d ~/hyla/MyBlankProject
14
+ hyla create --t asciidoc --a book --d ~/hyla/MyBlankProject
15
+ hyla create --t asciidoc --a image --d ~/hyla/MyBlankProject
16
+ hyla create --t asciidoc --a audio --d ~/hyla/MyBlankProject
17
+ hyla create --t asciidoc --a video --d ~/hyla/MyBlankProject
18
+ hyla create --t asciidoc --a source --d ~/hyla/MyBlankProject
19
+ hyla create --t asciidoc --a table --d ~/hyla/MyBlankProject
20
+
21
+ echo "Change style in the _config.yaml file"
22
+ ruby -i.bak -pe 'sub(%r{style: liberation},"style: foundation")' _config.yaml
23
+
24
+ #hyla generate -r adoc2html -s ~/hyla/MyBlankProject/ -d ~/hyla/MyBlankProject/generated_content --style liberation
25
+ #hyla generate -r adoc2html -s ~/hyla/MyBlankProject/ -d ~/hyla/MyBlankProject/generated_content --style github
26
+ hyla generate -r adoc2html -s ~/hyla/MyBlankProject/ -d ~/hyla/MyBlankProject/generated_content -y foundation
27
+
28
+ echo "Revert _config.yaml file"
29
+ mv _config.yaml.bk _config.yaml
@@ -0,0 +1,36 @@
1
+ #!/bin/sh
2
+
3
+ source remove_temp_directories.sh
4
+
5
+ echo "Create a MyPdfProject"
6
+ cd ~/hyla
7
+ hyla new --blank -d MyPdfProject --force
8
+ cd MyPdfProject
9
+
10
+ echo "Create one Asciidoc file from sample (book)"
11
+
12
+ hyla create -a book --t asciidoc -d .
13
+
14
+ echo "Generate HTML content using foundation stylesheet"
15
+
16
+ hyla generate --style foundation
17
+
18
+ echo "We change the rendering from adoc2html to html2pdf"
19
+
20
+ ruby -i.bak -pe 'sub(%r{rendering: adoc2html},"rendering: html2pdf")' _config.yaml
21
+
22
+ echo "Adapt source directory & destination directory"
23
+
24
+ ruby -i.bak -pe 'sub(%r{source: .},"source: ./generated_content")' _config.yaml
25
+ ruby -i.bak -pe 'sub(%r{destination: generated_content},"destination: ./generated_content/pdf")' _config.yaml
26
+
27
+ echo "Generate the PDF file for the image and book"
28
+
29
+ hyla generate -f asciidoc_book.html
30
+ #hyla generate -f asciidoc_image.html
31
+
32
+ echo "Result can be opened and viewed"
33
+
34
+ open generated_content/pdf/asciidoc_book.pdf
35
+ #open generated_content/pdf/asciidoc_image.pdf
36
+
@@ -0,0 +1,18 @@
1
+ #!/bin/sh
2
+
3
+ echo "Remove MyDeckSlideShow"
4
+ rm -rf ~/hyla/MyDeckSlideShow
5
+ cd ~/hyla
6
+
7
+ echo "Create a blank project"
8
+ hyla new -b -d MyDeckSlideShow
9
+
10
+ echo "Create from slideshow template a DeckJS file"
11
+ hyla create --t slideshow -a deckjs -d MyDeckSlideShow
12
+
13
+ echo "Generate HTML5 Slideshow content"
14
+ hyla generate --backend deckjs -s ~/hyla/MyDeckSlideShow -d ~/hyla/MyDeckSlideShow/generated_content -r adoc2htmlslide -a deckjs_theme=swiss,deckjs_transition=fade
15
+
16
+ # hyla generate --backend deckjs -s ~/hyla/MyDeckSlideShow -d ~/hyla/MyDeckSlideShow/generated_content -r adoc2htmlslide
17
+ # hyla generate --backend deckjs -s ~/hyla/MyDeckSlideShow -d ~/hyla/MyDeckSlideShow/generated_content -r adoc2htmlslide -a deckjs_theme=web-2.0,deckjs_transition=horizontal-slide
18
+
@@ -0,0 +1,17 @@
1
+ #!/bin/sh
2
+
3
+ #./generate_slideshow_mytoc_all.sh ~/MyProjects/hyla/data/toc.adoc MyTocProject
4
+ echo "Create MyToc Project"
5
+ echo "Using parameters"
6
+ source create_adoc_from_toc.sh $1 $2
7
+
8
+ cd ~/hyla/MyTocProject
9
+
10
+ # echo "Generate slideshow for a module using deckjs as backend"
11
+ hyla generate --backend deckjs -s . -d generated_content_deckjs -r index2htmlslide
12
+ open ~/hyla/MyTocProject/generated_content_deckjs/my-project_AllSlides.html
13
+
14
+ # echo "Generate slideshow for a module using revealjs as backend"
15
+ hyla generate --backend revealjs -s . -d generated_content_reveal -r index2htmlslide
16
+
17
+ open ~/hyla/MyTocProject/generated_content_reveal/my-project_AllSlides.html
@@ -0,0 +1,10 @@
1
+ #!/bin/sh
2
+
3
+ #./generate_slideshow_mytoc_module.sh ~/MyProjects/hyla/data/toc.adoc MyTocProject
4
+ echo "Create MyToc Project"
5
+ echo "Using parameters"
6
+ source create_adoc_from_toc.sh $1 $2
7
+
8
+ echo "Generate slideshow for a module using deckjs as backend"
9
+ cd ~/hyla/MyTocProject
10
+ hyla generate --backend deckjs -s A_Introduction_module/ -d A_Introduction_module/generated_content -r index2htmlslide
@@ -0,0 +1,23 @@
1
+ #!/bin/sh
2
+
3
+ echo "Remove MyRevealJS"
4
+ rm -rf ~/hyla/MyRevealSlideShow
5
+ cd ~/hyla
6
+
7
+ echo "Create a blank project"
8
+ hyla new --blank -d MyRevealSlideShow
9
+
10
+ echo "Create from slideshow template a RevealJS file"
11
+ hyla create --t slideshow -a revealjs -d MyRevealSlideShow
12
+
13
+ echo "Generate HTML5 Slideshow content"
14
+ cd MyRevealSlideShow
15
+
16
+ hyla generate --backend revealjs -s . -d generated_content -r adoc2htmlslide
17
+
18
+ echo "Open the slideshow using your web browser"
19
+ open http://localhost:4000/hyla/slideshow_revealjs.html &
20
+
21
+ echo "Start web server"
22
+ hyla serve -P 4000 -H localhost -b /hyla/ -d generated_content/
23
+
@@ -0,0 +1,19 @@
1
+ #!/bin/sh
2
+
3
+ source remove_temp_directories.sh
4
+
5
+ echo "Create a MyTrainingProject using template book"
6
+ cd ~/hyla
7
+ hyla new --t training -d MyTrainingProject
8
+
9
+ echo "Project created"
10
+ ls -la ~/hyla/MyTrainingProject
11
+
12
+ cd ~/hyla/MyTrainingProject
13
+ echo "Geerate content"
14
+ hyla generate
15
+
16
+ ls -la ~/hyla/MyTrainingProject/generate_content
17
+
18
+ echo "Watch content"
19
+ hyla watch -s ~/hyla/MyTrainingProject/ -d ~/hyla/MyTrainingProject/generated_content
@@ -0,0 +1,16 @@
1
+ #!/bin/sh
2
+
3
+ echo "Remove temp directories"
4
+ rm -rf ~/hyla/MyBlankProject/
5
+ rm -rf ~/hyla/MyBookProject
6
+ rm -rf ~/hyla/MyPdfProject/
7
+ rm -rf ~/hyla/MyTocProject/
8
+ rm -rf ~/hyla/MyTrainingProject/
9
+ rm -rf ~/hyla/MyTrainingExercisesProject/
10
+ rm -rf ~/hyla/MyDeckSlideShow/
11
+ rm -rf ~/hyla/MyRevealSlideShow/
12
+ rm -rf ~/hyla/MyEmailProject/
13
+
14
+ ls -la ~/hyla
15
+
16
+ echo "Temp directories removed"
@@ -0,0 +1,19 @@
1
+ #!/bin/sh
2
+
3
+ source remove_temp_directories.sh
4
+
5
+ echo "Create a MyEmailProject"
6
+ hyla new -b -d ~/hyla/MyEmailProject --force
7
+
8
+ cd ~/hyla/MyEmailProject
9
+
10
+ echo "Add an artefact - asciidoc with images"
11
+ hyla create --a image --d ~/hyla/MyEmailProject
12
+
13
+ echo "Generate HTML content"
14
+ hyla generate -r adoc2html -s ~/hyla/MyEmailProject/ -d ~/hyla/MyEmailProject/generated_content
15
+
16
+ # ?? Find a way to add SMTP Server, user, password ??
17
+ echo "Send email"
18
+ #hyla sendmail
19
+
data/hyla.gemspec CHANGED
@@ -26,10 +26,10 @@ Gem::Specification.new do |s|
26
26
  s.add_runtime_dependency 'commander', '~> 4.1', '>= 4.1.3'
27
27
  s.add_runtime_dependency 'asciidoctor', '~> 0.1', '>= 0.1.4'
28
28
  s.add_runtime_dependency 'em-websocket', '~> 0.5'
29
- s.add_runtime_dependency 'multi_json', '~> 1.8'
30
- s.add_runtime_dependency 'tilt'
31
- s.add_runtime_dependency 'haml'
32
- s.add_runtime_dependency 'slim'
29
+ s.add_runtime_dependency 'multi_json', '~> 1.8', '>= 1.8.4'
30
+ s.add_runtime_dependency 'tilt', '~> 1.4', '>= 1.4.1'
31
+ s.add_runtime_dependency 'haml', '~> 4.0', '>= 4.0.4'
32
+ s.add_runtime_dependency 'slim', '~> 2.0', '>= 2.0.2'
33
33
  s.add_runtime_dependency 'guard', '~> 1.8', '>= 1.8.3'
34
34
  s.add_runtime_dependency 'listen', '~> 1.3', '>= 1.3.1'
35
35
  s.add_runtime_dependency 'safe_yaml', '~> 1.0', '>= 1.0.0'
@@ -3,9 +3,9 @@ module Hyla
3
3
  class Create < Command
4
4
 
5
5
  def self.process(args, options)
6
- destination = options[:destination] if check_mandatory_option?('--d / --destination', options[:destination])
7
- artefact_type = options[:artefact_type] if check_mandatory_option?('--a / --artefact_type', options[:artefact_type])
8
- type = options[:type] if check_mandatory_option?('--t / --type', options[:type])
6
+ destination = options[:destination] if check_mandatory_option?('-d / --destination', options[:destination])
7
+ artefact_type = options[:artefact_type] if check_mandatory_option?('-a / --artefact_type', options[:artefact_type])
8
+ type = options[:type] if check_mandatory_option?('-t / --type', options[:type])
9
9
 
10
10
  copy_artefact(type, artefact_type, destination)
11
11
  end
@@ -23,7 +23,7 @@ module Hyla
23
23
  Hyla::logger.info ">> Artefact #{artefact_file_name} added to project #{destination}"
24
24
 
25
25
  case artefact_type
26
- when 'image','audio','video'
26
+ when 'image','audio','video','source'
27
27
  source_dir = [Configuration::samples, artefact_type] * '/'
28
28
  FileUtils.cp_r(source_dir,destination)
29
29
  end
@@ -4,7 +4,7 @@ module Hyla
4
4
 
5
5
  def self.process(args, options = {})
6
6
 
7
- rendering = options[:rendering] if self.check_mandatory_option?('--r / --rendering', options[:rendering])
7
+ rendering = options[:rendering] if self.check_mandatory_option?('-r / --rendering', options[:rendering])
8
8
 
9
9
  case rendering
10
10
 
@@ -21,7 +21,7 @@ module Hyla
21
21
  when 'toc2adoc'
22
22
 
23
23
  Hyla.logger.info "Rendering : Table of Content to Asciidoc"
24
- self.check_mandatory_option?('--t / --toc', options[:toc])
24
+ self.check_mandatory_option?('-t / --toc', options[:toc])
25
25
  @toc_file = options[:toc]
26
26
  @out_dir = options[:destination]
27
27
  @project_name = options[:project_name]
@@ -31,8 +31,8 @@ module Hyla
31
31
  when 'adoc2html'
32
32
 
33
33
  Hyla.logger.info "Rendering : Asciidoc to HTML"
34
- self.check_mandatory_option?('--s / --source', options[:source])
35
- self.check_mandatory_option?('--d / --destination', options[:destination])
34
+ self.check_mandatory_option?('-s / --source', options[:source])
35
+ self.check_mandatory_option?('-d / --destination', options[:destination])
36
36
 
37
37
  @destination = options[:destination]
38
38
  @source = options[:source]
@@ -50,10 +50,10 @@ module Hyla
50
50
 
51
51
  self.asciidoc_to_html(@source, @destination, extensions, merged_options)
52
52
 
53
- when 'index2slide'
53
+ when 'index2htmlslide'
54
54
  Hyla.logger.info "Rendering : Asciidoctor Indexed Files to SlideShow"
55
- self.check_mandatory_option?('--s / --source', options[:source])
56
- self.check_mandatory_option?('--d / --destination', options[:destination])
55
+ self.check_mandatory_option?('-s / --source', options[:source])
56
+ self.check_mandatory_option?('-d / --destination', options[:destination])
57
57
 
58
58
  @destination = options[:destination]
59
59
  @source = options[:source]
@@ -72,10 +72,10 @@ module Hyla
72
72
 
73
73
  self.asciidoc_to_html(@source, @destination, extensions, merged_options)
74
74
 
75
- when 'adoc2slide'
75
+ when 'adoc2htmlslide'
76
76
  Hyla.logger.info "Rendering : Asciidoc to SlideShow"
77
- self.check_mandatory_option?('--s / --source', options[:source])
78
- self.check_mandatory_option?('--d / --destination', options[:destination])
77
+ self.check_mandatory_option?('-s / --source', options[:source])
78
+ self.check_mandatory_option?('-d / --destination', options[:destination])
79
79
 
80
80
  @destination = options[:destination]
81
81
  @source = options[:source]
@@ -99,8 +99,10 @@ module Hyla
99
99
  end
100
100
  end
101
101
 
102
+ #
102
103
  # Return backend directory
103
104
  # containing templates (haml, slim)
105
+ #
104
106
  def self.backend_dir(backend)
105
107
  case backend
106
108
  when 'deckjs'
@@ -110,6 +112,9 @@ module Hyla
110
112
  end
111
113
  end
112
114
 
115
+ #
116
+ # Call Asciidoctor.render function
117
+ #
113
118
  def self.asciidoc_to_html(source, destination, extensions, options)
114
119
 
115
120
  # Move to Source directory & Retrieve Asciidoctor files to be processed
@@ -125,24 +130,31 @@ module Hyla
125
130
  exit(1)
126
131
  end
127
132
 
133
+ # Move to source directory
128
134
  Dir.chdir(source)
129
135
  current_dir = Dir.pwd
130
136
  Hyla.logger.info ">> Current dir: #{current_dir}"
131
137
 
132
- # Delete destination directory
133
- FileUtils.rm_rf(Dir.glob(@destination))
138
+ # Delete destination directory (generated_content, ...)
139
+ # FileUtils.rm_rf(Dir.glob(@destination))
134
140
 
135
141
  # Search for files using extensions parameter and do the rendering
136
142
  adoc_file_paths = []
137
- Find.find(current_dir) do |path|
138
- if path =~ /.*\.(?:#{extensions})$/
139
- path1 = Pathname.new(source)
140
- path2 = Pathname.new(path)
141
- relative_path = path2.relative_path_from(path1).to_s
143
+ Find.find(current_dir) do |f|
144
+ if f =~ /.*\.(?:#{extensions})$/
145
+
146
+ path_to_source = Pathname.new(source)
147
+ path_to_adoc_file = Pathname.new(f)
148
+ relative_path = path_to_adoc_file.relative_path_from(path_to_source).to_s
142
149
  Hyla.logger.debug ">> Relative path: #{relative_path}"
143
150
  adoc_file_paths << relative_path
144
151
 
145
- # Create dir
152
+ # Get asciidoc file name
153
+ file_name_processed = path_to_adoc_file.basename
154
+
155
+ #
156
+ # Create destination dir relative to the path calculated
157
+ #
146
158
  html_dir = @destination + '/' + File.dirname(relative_path)
147
159
  Hyla.logger.info ">> Dir of html: #{html_dir}"
148
160
  FileUtils.mkdir_p html_dir
@@ -157,9 +169,13 @@ module Hyla
157
169
  end
158
170
 
159
171
  # Render asciidoc to HTML
160
- Hyla.logger.info ">> File to be rendered : #{path}"
172
+ Hyla.logger.info ">> File to be rendered : #{f}"
173
+
174
+ # Convert asciidoc file name to html file name
175
+ html_file_name = file_name_processed.to_s.gsub(/.adoc$|.ad$|.asciidoc$|.index$|.txt$/, '.html')
161
176
  options[:to_dir] = html_dir
162
- Asciidoctor.render_file(path, options)
177
+ options[:to_file] = html_file_name
178
+ Asciidoctor.render_file(f, options)
163
179
 
164
180
  end
165
181
  end
@@ -219,7 +235,7 @@ module Hyla
219
235
  FileUtils.mkdir_p @out_dir
220
236
  end
221
237
 
222
- # Copy YAML Config file
238
+ # Copy YML Config file
223
239
  FileUtils.cp_r [Configuration::templates, Configuration::YAML_CONFIG_FILE_NAME] * '/', @out_dir
224
240
 
225
241
  # Copy styles
@@ -376,7 +392,7 @@ module Hyla
376
392
  # TODO - until now we cannot use level 0 for parent/children files
377
393
  # even if doctype: book
378
394
  # This is why the level for each index file title is '=='
379
- index_file.puts '==' + file_name
395
+ index_file.puts '== ' + file_name
380
396
  index_file.puts "\n"
381
397
 
382
398
  index_file