bin/hyla in hyla-1.0 vs bin/hyla in hyla-1.0.1

- old
+ new

@@ -24,23 +24,23 @@ c.option '--config CONFIG_FILE[,CONFIG_FILE2,...]', Array, 'Custom configuration file' c.option '-V', '--verbose', 'Print verbose output.' end def add_common_options(c) - c.option '-s', '--source [DIR]', 'Source directory (defaults to ./)' - c.option '-d', '--destination [DIR]', 'Destination directory (defaults to ./generated_content)' + c.option '--s', '--source [DIR]', 'Source directory (defaults to ./)' + c.option '--d', '--destination [DIR]', 'Destination directory (defaults to ./generated_content)' end # # Creates a new Hyla project using a template or blank to the PATH specified # command :new do |c| c.syntax = 'hyla new PATH' c.description = 'Creates a new Hyla project using a template or blank to the PATH specified' c.option '--f','--force', 'Force creation even if PATH already exists' c.option '--b','--blank', 'Creates project but with empty files' - c.option '--t','--template_type TEMPLATE_TYPE', String, 'Template Type to be used (documentation, training, training-exercises, blog, web, ...)' + c.option '--t','--template_type TEMPLATE_TYPE', String, 'Template Type to be used (documentation, book, training, training-exercises, blog, web, ...)' c.action do |args, options| Hyla::Commands::New.process(args, options.__hash__) end end @@ -48,50 +48,53 @@ # # Creates a new file from an artefact within an existing project # command :create do |c| c.syntax = 'hyla create ARTEFACT TYPE' - c.description = 'Creates a new file from asciidoc artefacts for an existing project' + c.description = 'Creates a new file from asciidoc artefact for an existing project' c.option '--a', '--artefact_type [ARTEFACT_TYPE]', String, 'Artefact Type : article, audio, video, blog entry ...' - c.option '--d', '--destination [DIR]', String, 'Destination directory' c.option '--t', '--type [TYPE]', String, 'Type : asciidoc, slideshow' + add_common_options(c) + c.action do |args, options| - Hyla::Commands::Create.process(args, options.__hash__) + config = Hyla::Configuration.parse(options.__hash__) + Hyla::Commands::Create.process(args, config) end end # # Generate from asciidoc files content according to rendering/transformation requested # command :generate do |c| c.syntax = 'hyla generate [OPTIONS]' c.description = 'Generate content from asciidoc files (Table Of Content, modules, ...) to HTML, Slideshow' - c.option '--s', '--source [DIR]', String, 'Directory to be watched' - c.option '--d', '--destination [DIR]', String, 'Destination directory' + c.option '--b', '--backend [BACKEND]', String, 'Backend to be used : HTML5, deckjs, revealjs, ...' c.option '--p', '--project_name [PROJECT_NAME]', String, 'Project Name' c.option '--r', '--rendering [RENDERING]', String, 'Code of the rendering : toc2html, adoc2html' c.option '--t', '--toc [PATH]', String, 'File Path of the asciidoc file containing the Table of Content' + c.option '--st', '--style [STYLE]', String, 'Stylesheet theme to be applied : asciidoctor, redhat, github, colony, foundation, ...' + c.option '--a', '--attributes [KEY=VALUE,KEY=VALUE]', String, 'Asciidoctor attributes' - c.action do |args, options| + add_common_options(c) - Hyla::Commands::Generate.process(args, options.__hash__) + c.action do |args, options| + config = Hyla::Configuration.parse(options.__hash__) + Hyla::Commands::Generate.process(args, config) end end # Watch command :watch do |c| c.syntax = 'hyla watch [options]' c.description = 'Watch directories for any change, add or file deleted and render document (HTML5)' - c.option '--d', '--destination DIR', String, 'Output directory where content must be generated' - c.option '--s', '--source DIR', String, 'Directory to be watched' add_common_options(c) c.action do |args, options| options.default :serving => true - # TODO Find if it is possible to watch files, generate HTML content - asciidoctor, expose content using HTTPServe and expose WebSocket - LiveReload + # TODO Find if it is possible to watch files, generate HTML content - asciidoctor, expose content using HTTPServer and expose WebSocket - LiveReload # as they are started in 2 different threads, this is not possible with existing code # Hyla::Commands::Serve.process(args,options.__hash__) Hyla::Commands::Watch.process(args, options.__hash__) end end