Module: Slidr
- Includes:
- Commands
- Defined in:
- lib/slidr/configurators/base.rb,
lib/slidr.rb,
lib/slidr/html.rb,
lib/slidr/config.rb,
lib/slidr/version.rb,
lib/slidr/defaults.rb,
lib/slidr/configurator.rb,
lib/slidr/slide_filter.rb,
lib/slidr/configurators/slide.rb,
lib/slidr/configurators/layout.rb,
lib/slidr/configurators/output.rb,
lib/slidr/commands/base_command.rb,
lib/slidr/commands/base_executor.rb,
lib/slidr/commands/slide_command.rb,
lib/slidr/commands/void_executor.rb,
lib/slidr/commands/insert_command.rb,
lib/slidr/commands/return_executor.rb,
lib/slidr/commands/copy_dir_command.rb,
lib/slidr/commands/copy_file_command.rb,
lib/slidr/commands/create_dir_command.rb,
lib/slidr/commands/save_to_file_command.rb
Overview
require ‘slidr/helpers/path_unpacker’ require ‘slidr/helpers/script_unpacker’
Defined Under Namespace
Modules: Commands, Configurators, Defaults Classes: Config, Configurator, Html, SlideFilter
Constant Summary collapse
- VERSION =
"0.2.0"
Class Method Summary collapse
Class Method Details
.config {|Configurator.new(@@config)| ... } ⇒ Object
15 16 17 18 19 |
# File 'lib/slidr.rb', line 15 def self.config @@config = Config.new yield Configurator.new(@@config) self end |
.start ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/slidr.rb', line 21 def self.start @@config.outputs.each do |out| content = File.read(@@config.base.html) VoidExecutor.new .add(CreateDirCommand.new(out.path)) .add(CopyFileCommand.new(@@config.base.remark, out.path)) .add(CopyFileCommand.new(@@config.base.structure, out.path)) .add(CopyDirCommand.new(@@config.layouts[out.layout.to_sym], out.path)) .go remark = @@config.base.remark[@@config.base.remark.rindex('/')+1..-1] structure = @@config.base.structure[@@config.base.structure.rindex('/')+1..-1] = [] @@config..each do |path| File.read(path).split(/(?=^---$)/).each do || << .strip end end ReturnExecutor.new(content) .add(InsertCommand.new('{{TITLE}}', out.title)) .add(InsertCommand.new('{{REMARK_PATH}}', remark)) .add(InsertCommand.new('{{STRUCTURE_PATH}}', structure)) .add(InsertCommand.new('{{SCRIPT_INIT}}', @@config.base.script)) .add(SlideCommand.new('{{MARKDOWN}}', , { publish: out.publish, draft: out.draft })) .add(SaveToFileCommand.new("#{ out.path }/#{ out.name }")) .go end end |