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.
39 40 41 42 |
# File 'lib/spriteful/cli.rb', line 39 def initialize(*) super self. = .dup end |
Class Method Details
.banner ⇒ Object
Public: Gets the CLI banner for the Thor help message.
Returns a String.
33 34 35 |
# File 'lib/spriteful/cli.rb', line 33 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.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/spriteful/cli.rb', line 47 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
68 69 70 |
# File 'lib/spriteful/cli.rb', line 68 def template create_file "spriteful.#{.format}", Spriteful::Stylesheet.read_template(.format) end |