Module: Source2Epub
- Defined in:
- lib/source2epub/cli.rb,
lib/config/source2epub.rb,
lib/source2epub/version.rb,
lib/source2epub/exporter.rb,
lib/source2epub/source2epub.rb,
lib/source2epub/configuration.rb
Defined Under Namespace
Classes: CLI, Configuration, Exporter
Constant Summary collapse
- VERSION =
"0.2.8"- TMP_DIR =
"source2epub_tmp"- CustomError =
Class.new(StandardError)
Class Attribute Summary collapse
-
.configuration ⇒ Object
Configure Source2Epub someplace sensible, like.
Class Method Summary collapse
-
.clone_repository(url, name, path) ⇒ Object
Clone the given repository from github.
- .configure {|configuration| ... } ⇒ Object
- .files_to_htmls(opts) ⇒ Object
- .list_extensions(base_dir = ".") ⇒ Object
- .list_files(options = {}) ⇒ Object
- .update_config ⇒ Object
Class Attribute Details
.configuration ⇒ Object
Configure Source2Epub someplace sensible, like
‘config/initializers/source2epub.rb’
Source2Epub.configure do |config|
config.creator = ".."
end
25 26 27 |
# File 'lib/source2epub/configuration.rb', line 25 def configuration @configuration end |
Class Method Details
.clone_repository(url, name, path) ⇒ Object
Clone the given repository from github
10 11 12 13 |
# File 'lib/source2epub/source2epub.rb', line 10 def clone_repository(url, name, path) puts "git clone #{url} #{File.(path)}/#{name}" Git.clone url, name, path: File.(path) end |
.configure {|configuration| ... } ⇒ Object
29 30 31 |
# File 'lib/source2epub/configuration.rb', line 29 def configure yield(configuration) end |
.files_to_htmls(opts) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# 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 = ".") ⇒ Object
15 16 17 18 19 20 |
# File 'lib/source2epub/source2epub.rb', line 15 def list_extensions(base_dir = ".") extensions = Dir.glob(File.join(File.(base_dir), "**/*")).reduce([]) do |exts, file| exts << File.extname(file) end extensions.sort.uniq.delete_if { |e| e == "" } end |
.list_files(options = {}) ⇒ Object
22 23 24 |
# File 'lib/source2epub/source2epub.rb', line 22 def list_files( = {}) CodeLister.files() end |
.update_config ⇒ Object
3 4 5 6 7 8 9 10 |
# 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 |