Class: Source2Epub::Exporter
- Inherits:
-
Object
- Object
- Source2Epub::Exporter
- Defined in:
- lib/source2epub/exporter.rb
Instance Attribute Summary collapse
-
#base_dir ⇒ Object
readonly
Returns the value of attribute base_dir.
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#epub_title ⇒ Object
readonly
Returns the value of attribute epub_title.
-
#exts ⇒ Object
readonly
Returns the value of attribute exts.
-
#non_exts ⇒ Object
readonly
Returns the value of attribute non_exts.
-
#output_path ⇒ Object
readonly
Returns the value of attribute output_path.
-
#repo_name ⇒ Object
readonly
Returns the value of attribute repo_name.
-
#theme ⇒ Object
readonly
Returns the value of attribute theme.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#export ⇒ Object
Print and export the source from a given URL to an epub file.
-
#initialize(url, opts = {}) ⇒ Exporter
constructor
Constructor for Executor.
Constructor Details
#initialize(url, opts = {}) ⇒ Exporter
Constructor for Executor
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/source2epub/exporter.rb', line 29 def initialize(url, opts = {}) @url = url @base_dir = Dir.pwd @exts = opts[:exts] || [] @non_exts = opts[:non_exts] || [] @theme = opts[:theme] || "default" @command = opts[:command] @repo_name = project_name(url) @epub_title = opts[:epub_title] || @repo_name @output_path = File.([base_dir, repo_name].join(File::SEPARATOR)) end |
Instance Attribute Details
#base_dir ⇒ Object (readonly)
Returns the value of attribute base_dir.
16 17 18 |
# File 'lib/source2epub/exporter.rb', line 16 def base_dir @base_dir end |
#command ⇒ Object (readonly)
Returns the value of attribute command.
9 10 11 |
# File 'lib/source2epub/exporter.rb', line 9 def command @command end |
#epub_title ⇒ Object (readonly)
Returns the value of attribute epub_title.
9 10 11 |
# File 'lib/source2epub/exporter.rb', line 9 def epub_title @epub_title end |
#exts ⇒ Object (readonly)
Returns the value of attribute exts.
9 10 11 |
# File 'lib/source2epub/exporter.rb', line 9 def exts @exts end |
#non_exts ⇒ Object (readonly)
Returns the value of attribute non_exts.
9 10 11 |
# File 'lib/source2epub/exporter.rb', line 9 def non_exts @non_exts end |
#output_path ⇒ Object (readonly)
Returns the value of attribute output_path.
16 17 18 |
# File 'lib/source2epub/exporter.rb', line 16 def output_path @output_path end |
#repo_name ⇒ Object (readonly)
Returns the value of attribute repo_name.
16 17 18 |
# File 'lib/source2epub/exporter.rb', line 16 def repo_name @repo_name end |
#theme ⇒ Object (readonly)
Returns the value of attribute theme.
9 10 11 |
# File 'lib/source2epub/exporter.rb', line 9 def theme @theme end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
9 10 11 |
# File 'lib/source2epub/exporter.rb', line 9 def url @url end |
Instance Method Details
#export ⇒ Object
Print and export the source from a given URL to an epub file
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/source2epub/exporter.rb', line 42 def export clone puts "FYI: list of extensions: #{all_extensions}" # Note: if we are using the '--command', it will be empty list by default puts "FYI: list of all files : #{all_files}" unless all_files.empty? files2htmls htmls2epub copy_output cleanup end |