class Spectacle::DSL
Public Class Methods
arguments()
click to toggle source
Generate Spectacle
command line arguments
@return string
# File lib/spectacle/dsl.rb, line 36 def arguments s = '' #'-C ' s += '-e ' if Config.embedded_mode s += "-l #{Config.logo_file} " if Config.logo_file s += Config.spec_file end
copy_static()
click to toggle source
Copy generated static documentation HTML into the public folder
@return success
# File lib/spectacle/dsl.rb, line 63 def copy_static build_dir = "#{Config.spectacle_lib_dir}/public" # Prepare the target folder FileUtils.rm_rf Config.target_dir if File.exist?(Config.target_dir) FileUtils.mkdir_p Config.target_dir # Copy the SCSS files from the spectacle source tree to the # assets folder puts "Copying HTML from #{build_dir}/* to #{Config.target_dir}" FileUtils.copy_entry build_dir, Config.target_dir replace_static_asset_paths end
generate()
click to toggle source
Generate Spectacle
documentation
@return success
# File lib/spectacle/dsl.rb, line 17 def generate spectacle arguments end
install()
click to toggle source
Install Spectacle
using `npm`
@return success
# File lib/spectacle/dsl.rb, line 9 def install system 'npm install -g spectacle-docs' end
replace_static_asset_paths()
click to toggle source
Replace paths in generated static documentation HTML
@return success
# File lib/spectacle/dsl.rb, line 47 def replace_static_asset_paths if Config.target_dir.include?('/public/') base_dir = Config.target_dir.match('/public(.*)')[1] html_path = "#{Config.target_dir}/index.html" contents = File.open(html_path, &:read) contents.gsub!('/images', base_dir + '/images') contents.gsub!('/stylesheets', base_dir + '/stylesheets') contents.gsub!('/javascripts', base_dir + '/javascripts') File.write(html_path, contents) end end
spectacle(args)
click to toggle source
Run the Spectacle
shell command
@param args the command line arguments to pass to spectacle
@return success
# File lib/spectacle/dsl.rb, line 27 def spectacle args # system "spectacle #{args}" system "cd #{Config.spectacle_lib_dir} && node bin/spectacle-cli #{args}" end