module Source2Epub
Constants
- CustomError
- TMP_DIR
- VERSION
Attributes
configuration[RW]
Public Class Methods
clone_repository(url, name, path)
click to toggle source
Clone the given repository from github
@param [String] url the github repository url like 'github.com/schacon/ruby-git.git' @param [String] name the output name to be used @param [String] path the output directory
# File lib/source2epub/source2epub.rb, line 10 def clone_repository(url, name, path) puts "git clone #{url} #{File.expand_path(path)}/#{name}" Git.clone url, name, path: File.expand_path(path) end
configure() { |configuration| ... }
click to toggle source
# File lib/source2epub/configuration.rb, line 29 def configure yield(configuration) end
files_to_htmls(opts)
click to toggle source
# File lib/source2epub/source2epub.rb, line 26 def files_to_htmls(opts) base_dir = base_dir(opts[:base_dir]) unless File.exist?(base_dir) && File.directory?(base_dir) fail "Starting directory must be valid, and exist" end exts = opts[:exts] || [] non_exts = opts[:non_exts] || [] theme = opts.fetch(:theme, "default") command = opts[:command] if command args = [ "print", "--base-dir", base_dir, "--command", command, "--theme", theme ] else args = [ "print", "--base-dir", base_dir, "--exts", exts, "--theme", theme, "--recursive" ] args.concat(["--non-exts"]).concat(non_exts) unless non_exts.empty? end VimPrinter::CLI.start(args) end
list_extensions(base_dir = ".")
click to toggle source
# File lib/source2epub/source2epub.rb, line 15 def list_extensions(base_dir = ".") extensions = Dir.glob(File.join(File.expand_path(base_dir), "**/*")).reduce([]) do |exts, file| exts << File.extname(file) end extensions.sort.uniq.delete_if { |e| e == "" } end
list_files(options = {})
click to toggle source
# File lib/source2epub/source2epub.rb, line 22 def list_files(options = {}) CodeLister.files(options) end
update_config()
click to toggle source
# File lib/config/source2epub.rb, line 3 def update_config Source2Epub.configure do |config| config.creator = "Burin C" config.publisher = "Burin C" config.published_date = "2014-06-23" # TODO: get the current date config.identifier = "https://agilecreativity.com/" end end
Private Class Methods
base_dir(dir_name)
click to toggle source
Always expand the directory name so that '~' or '.' is expanded correctly
# File lib/source2epub/source2epub.rb, line 66 def base_dir(dir_name) File.expand_path(dir_name) end