Class: Airbrussh::Configuration
- Inherits:
-
Object
- Object
- Airbrussh::Configuration
- Defined in:
- lib/airbrussh/configuration.rb
Instance Attribute Summary collapse
-
#banner ⇒ Object
Returns the value of attribute banner.
-
#color ⇒ Object
Returns the value of attribute color.
-
#command_output ⇒ Object
Returns the value of attribute command_output.
-
#context ⇒ Object
Returns the value of attribute context.
-
#log_file ⇒ Object
Returns the value of attribute log_file.
-
#monkey_patch_rake ⇒ Object
Returns the value of attribute monkey_patch_rake.
-
#task_prefix ⇒ Object
Returns the value of attribute task_prefix.
-
#truncate ⇒ Object
Returns the value of attribute truncate.
Instance Method Summary collapse
- #apply_options(options) ⇒ Object
- #banner_message ⇒ Object
-
#formatters(io) ⇒ Object
This returns an array of formatters appropriate for the configuration.
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #show_command_output?(sym) ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/airbrussh/configuration.rb', line 10 def initialize self.log_file = nil self.monkey_patch_rake = false self.color = :auto self.truncate = :auto self. = :auto self.command_output = false self.task_prefix = nil self.context = Airbrussh::Rake::Context end |
Instance Attribute Details
#banner ⇒ Object
Returns the value of attribute banner.
7 8 9 |
# File 'lib/airbrussh/configuration.rb', line 7 def @banner end |
#color ⇒ Object
Returns the value of attribute color.
7 8 9 |
# File 'lib/airbrussh/configuration.rb', line 7 def color @color end |
#command_output ⇒ Object
Returns the value of attribute command_output.
7 8 9 |
# File 'lib/airbrussh/configuration.rb', line 7 def command_output @command_output end |
#context ⇒ Object
Returns the value of attribute context.
7 8 9 |
# File 'lib/airbrussh/configuration.rb', line 7 def context @context end |
#log_file ⇒ Object
Returns the value of attribute log_file.
7 8 9 |
# File 'lib/airbrussh/configuration.rb', line 7 def log_file @log_file end |
#monkey_patch_rake ⇒ Object
Returns the value of attribute monkey_patch_rake.
7 8 9 |
# File 'lib/airbrussh/configuration.rb', line 7 def monkey_patch_rake @monkey_patch_rake end |
#task_prefix ⇒ Object
Returns the value of attribute task_prefix.
7 8 9 |
# File 'lib/airbrussh/configuration.rb', line 7 def task_prefix @task_prefix end |
#truncate ⇒ Object
Returns the value of attribute truncate.
7 8 9 |
# File 'lib/airbrussh/configuration.rb', line 7 def truncate @truncate end |
Instance Method Details
#apply_options(options) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/airbrussh/configuration.rb', line 21 def () return self if .nil? .each do |key, value| if respond_to?(writer = "#{key}=") public_send(writer, value) else warn_unrecognized_key(key) end end self end |
#banner_message ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/airbrussh/configuration.rb', line 34 def return nil unless return unless == :auto msg = "Using airbrussh format." if log_file msg << "\n" msg << "Verbose output is being written to #{Colors.blue(log_file)}." end msg end |
#formatters(io) ⇒ Object
This returns an array of formatters appropriate for the configuration. Depending on whether a log file is configured, this could be just the Airbrussh:ConsoleFormatter, or that plus the LogFileFormatter.
48 49 50 51 52 |
# File 'lib/airbrussh/configuration.rb', line 48 def formatters(io) fmts = [Airbrussh::ConsoleFormatter.new(io, self)] fmts.unshift(Airbrussh::LogFileFormatter.new(log_file)) if log_file fmts end |
#show_command_output?(sym) ⇒ Boolean
54 55 56 |
# File 'lib/airbrussh/configuration.rb', line 54 def show_command_output?(sym) command_output == true || Array(command_output).include?(sym) end |