Class: Teapot::Command::Top
- Inherits:
-
Samovar::Command
- Object
- Samovar::Command
- Teapot::Command::Top
- Defined in:
- lib/teapot/command.rb
Instance Method Summary collapse
- #configuration ⇒ Object
- #context(root = self.root) ⇒ Object
- #invoke ⇒ Object
- #logger ⇒ Object
- #quiet? ⇒ Boolean
- #root ⇒ Object
- #verbose? ⇒ Boolean
Instance Method Details
#configuration ⇒ Object
92 93 94 |
# File 'lib/teapot/command.rb', line 92 def configuration @options[:configuration] end |
#context(root = self.root) ⇒ Object
96 97 98 |
# File 'lib/teapot/command.rb', line 96 def context(root = self.root) Context.new(root, configuration: configuration) end |
#invoke ⇒ Object
100 101 102 103 104 105 106 107 108 |
# File 'lib/teapot/command.rb', line 100 def invoke if @options[:version] puts "teapot v#{Teapot::VERSION}" elsif @options[:help] print_usage(output: $stdout) else @command.invoke end end |
#logger ⇒ Object
80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/teapot/command.rb', line 80 def logger @logger ||= Console::Logger.new(Console.logger, verbose: self.verbose?).tap do |logger| if verbose? logger.debug! elsif quiet? logger.warn! else logger.info! end end end |
#quiet? ⇒ Boolean
76 77 78 |
# File 'lib/teapot/command.rb', line 76 def quiet? @options[:logging] == :quiet end |
#root ⇒ Object
68 69 70 |
# File 'lib/teapot/command.rb', line 68 def root ::Build::Files::Path.(@options[:root] || Dir.getwd) end |
#verbose? ⇒ Boolean
72 73 74 |
# File 'lib/teapot/command.rb', line 72 def verbose? @options[:logging] == :verbose end |