Class: ZAssets::CLI
- Inherits:
-
Object
- Object
- ZAssets::CLI
- Defined in:
- lib/zassets/cli.rb
Constant Summary collapse
- ACTIONS =
%w[build serve].freeze
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #builder ⇒ Object
- #config ⇒ Object
-
#initialize(args, stdout = $stdout) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
- #server ⇒ Object
Constructor Details
#initialize(args, stdout = $stdout) ⇒ CLI
Returns a new instance of CLI.
9 10 11 12 13 |
# File 'lib/zassets/cli.rb', line 9 def initialize args, stdout = $stdout @stdout = stdout @action = :build args_parse! args end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action.
7 8 9 |
# File 'lib/zassets/cli.rb', line 7 def action @action end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
7 8 9 |
# File 'lib/zassets/cli.rb', line 7 def end |
Instance Method Details
#builder ⇒ Object
26 27 28 |
# File 'lib/zassets/cli.rb', line 26 def builder @builder ||= Builder.new(config) end |
#config ⇒ Object
15 16 17 |
# File 'lib/zassets/cli.rb', line 15 def config @config ||= Config.new() end |
#run ⇒ Object
19 20 21 22 23 24 |
# File 'lib/zassets/cli.rb', line 19 def run case @action when :serve then server.run when :build then builder.build end end |
#server ⇒ Object
30 31 32 |
# File 'lib/zassets/cli.rb', line 30 def server @server ||= Server.new(config) end |