Class: Spriteful::CLI
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- Spriteful::CLI
- Includes:
- Thor::Actions
- Defined in:
- lib/spriteful/cli.rb
Class Method Summary collapse
-
.banner ⇒ Object
Public: Gets the CLI banner for the Thor help message.
Instance Method Summary collapse
-
#execute ⇒ Object
Public: executes the CLI processing of the sprite sources into combined images and stylesheets.
-
#initialize ⇒ CLI
constructor
Public: Initializes the CLI object and replaces the frozen ‘options’ object with an unfrozen one that we can mutate.
- #template ⇒ Object
Constructor Details
#initialize ⇒ CLI
Public: Initializes the CLI object and replaces the frozen ‘options’ object with an unfrozen one that we can mutate.
38 39 40 41 |
# File 'lib/spriteful/cli.rb', line 38 def initialize(*) super self. = .dup end |
Class Method Details
.banner ⇒ Object
Public: Gets the CLI banner for the Thor help message.
Returns a String.
32 33 34 |
# File 'lib/spriteful/cli.rb', line 32 def self. 'spriteful sources [options]' end |
Instance Method Details
#execute ⇒ Object
Public: executes the CLI processing of the sprite sources into combined images and stylesheets. Returns nothing.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/spriteful/cli.rb', line 46 def execute if .version? say "Spriteful #{Spriteful::VERSION}" exit(0) end if sources.empty? self.class.help(shell) exit(1) end sources.uniq! sources.each do |source| create_sprite(source) end end |
#template ⇒ Object
67 68 69 |
# File 'lib/spriteful/cli.rb', line 67 def template create_file "spriteful.#{.format}", Spriteful::Stylesheet.read_template(.format) end |