Class: Carta::CLI::Base
- Inherits:
-
Thor
- Object
- Thor
- Carta::CLI::Base
- Includes:
- Thor::Actions
- Defined in:
- lib/carta/cli.rb
Overview
The class from which it all begins
Instance Attribute Summary collapse
-
#ASSET_PATH ⇒ Object
readonly
Returns the value of attribute ASSET_PATH.
-
#BUILD_PATH ⇒ Object
readonly
Returns the value of attribute BUILD_PATH.
-
#LAYOUT_PATH ⇒ Object
readonly
Returns the value of attribute LAYOUT_PATH.
-
#MANU_PATH ⇒ Object
readonly
Returns the value of attribute MANU_PATH.
-
#meta ⇒ Object
readonly
Returns the value of attribute meta.
Class Method Summary collapse
-
.source_root ⇒ Object
def initialize(*args) @BUILD_PATH = ‘build’ @LAYOUT_PATH = ‘layouts’ @MANU_PATH = ‘manuscript’ @ASSET_PATH = ‘assets’ end.
Instance Method Summary collapse
Instance Attribute Details
#ASSET_PATH ⇒ Object (readonly)
Returns the value of attribute ASSET_PATH.
9 10 11 |
# File 'lib/carta/cli.rb', line 9 def ASSET_PATH @ASSET_PATH end |
#BUILD_PATH ⇒ Object (readonly)
Returns the value of attribute BUILD_PATH.
9 10 11 |
# File 'lib/carta/cli.rb', line 9 def BUILD_PATH @BUILD_PATH end |
#LAYOUT_PATH ⇒ Object (readonly)
Returns the value of attribute LAYOUT_PATH.
9 10 11 |
# File 'lib/carta/cli.rb', line 9 def LAYOUT_PATH @LAYOUT_PATH end |
#MANU_PATH ⇒ Object (readonly)
Returns the value of attribute MANU_PATH.
9 10 11 |
# File 'lib/carta/cli.rb', line 9 def MANU_PATH @MANU_PATH end |
#meta ⇒ Object (readonly)
Returns the value of attribute meta.
9 10 11 |
# File 'lib/carta/cli.rb', line 9 def @meta end |
Class Method Details
.source_root ⇒ Object
def initialize(*args)
@BUILD_PATH = 'build'
@LAYOUT_PATH = 'layouts'
@MANU_PATH = 'manuscript'
@ASSET_PATH = 'assets'
end
22 23 24 |
# File 'lib/carta/cli.rb', line 22 def self.source_root File.(File.join(File.dirname(__FILE__), 'templates')) end |
Instance Method Details
#book(*name) ⇒ Object
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 |
# File 'lib/carta/cli.rb', line 28 def book(*name) name = name.empty? ? '' : name.join(' ') say("\nThis utility will walk you through creating an ebook project.") say("\nPress ^C at any time to quit.") require 'carta/cli/book' default_name = name.empty? ? '' : "(#{name})" ask_title = ask "Title:#{default_name}" ask_license = ask 'License: (MIT)' ask_lang = ask 'Language: (en-US)' = ask 'Author(s): (Anonymous)' ask_uuid = ask 'uuid:' @meta = { title: ask_title.empty? ? name : ask_title, subtitle: ask('Subtitle: (blank)'), authors: .empty? ? 'Anonymous' : , language: ask_lang.empty? ? 'en-US' : ask_lang, license: ask_license.empty? ? 'MIT' : ask_license, uid: ask_uuid.empty? ? UUID.new.generate : ask_uuid } Carta::CLI::Book.new(self, ).run end |