airbrussh 0.8.0 → 1.0.0.beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 83498b571567499f13ecb5a978e2b8e1f8cdfaef
4
- data.tar.gz: 1e7f3fe9e08f71b5e2a32ba2cb3a2801d8b70a88
3
+ metadata.gz: f88b5b67607156fb5e37627a35a23339f674090d
4
+ data.tar.gz: 221fc6a9042cf7cc2249246ef5d2efa7bbee4463
5
5
  SHA512:
6
- metadata.gz: c9c0da68ef33be91854762fda31c785deb5e1b1ac55baabaa6784feecd391667077ac1407eeeb81c2f5cbbc5d9612b00f183fa1a55682877346fc9c1fd015760
7
- data.tar.gz: 964c8a4e8ea43062932220f25c0cdf491e76e8cc9941633de90e81578bd15de577a39ebe6d70bfc9043be6fe2103b10ec210a18274b740891a33e2672ddb1531
6
+ metadata.gz: d447630e02fea68846d1430314f515e42ababbd83ccb35bbc08400269d2c6181c93cd2efc7a41ecfe489a6cce4f09dd46deeb97769ad51f4d3f5b8440dce834f
7
+ data.tar.gz: 1477b51b5db6c879015d1334efb8b5d10a0f9bd80515cef749803ceeb615474dbf8532dbb08124fbbb043d9242c7f4b7769ef7fae0c66bd4052d1551bae0ba72
data/.rubocop.yml CHANGED
@@ -1,5 +1,3 @@
1
- inherit_from: .rubocop_todo.yml
2
-
3
1
  AllCops:
4
2
  DisplayCopNames: true
5
3
  DisplayStyleGuide: true
data/CHANGELOG.md CHANGED
@@ -8,6 +8,13 @@ Airbrussh is in a pre-1.0 state. This means that its APIs and behavior are subje
8
8
 
9
9
  * Your contribution here!
10
10
 
11
+ ## [1.0.0.beta1][] (2015-12-27)
12
+
13
+ * Airbrussh can now be configured with an options Hash passed to the
14
+ `Airbrussh::Formatter` constructor. This is in order to standardize how all
15
+ SSHKit formatters are configured
16
+ (see [SSHKit #308](https://github.com/capistrano/sshkit/pull/308)).
17
+
11
18
  ## [0.8.0][] (2015-11-20)
12
19
 
13
20
  * Airbrussh now displays the correct user@host output in the following edge-cases:
@@ -80,7 +87,8 @@ There are, however, many behind-the-scenes changes and improvements to overall c
80
87
  * Initial release
81
88
 
82
89
  [Semver]: http://semver.org
83
- [Unreleased]: https://github.com/mattbrictson/airbrussh/compare/v0.8.0...HEAD
90
+ [Unreleased]: https://github.com/mattbrictson/airbrussh/compare/v1.0.0.beta1...HEAD
91
+ [1.0.0.beta1]: https://github.com/mattbrictson/airbrussh/compare/v0.8.0...v1.0.0.beta1
84
92
  [0.8.0]: https://github.com/mattbrictson/airbrussh/compare/v0.7.0...v0.8.0
85
93
  [0.7.0]: https://github.com/mattbrictson/airbrussh/compare/v0.6.0...v0.7.0
86
94
  [0.6.0]: https://github.com/mattbrictson/airbrussh/compare/v0.5.1...v0.6.0
data/lib/airbrussh.rb CHANGED
@@ -3,8 +3,10 @@ require "airbrussh/formatter"
3
3
  require "airbrussh/version"
4
4
 
5
5
  module Airbrussh
6
- def self.configuration
6
+ def self.configuration(options={})
7
+ return options if options.is_a?(::Airbrussh::Configuration)
7
8
  @configuration ||= Configuration.new
9
+ @configuration.apply_options(options)
8
10
  end
9
11
 
10
12
  def self.configure
@@ -14,7 +14,7 @@ module Airbrussh
14
14
  #
15
15
  class Tasks
16
16
  extend Forwardable
17
- def_delegators :dsl, :set
17
+ def_delegators :dsl, :set, :env
18
18
  def_delegators :config, :log_file
19
19
 
20
20
  include Airbrussh::Colors
@@ -36,6 +36,7 @@ module Airbrussh
36
36
 
37
37
  # Behavior for the rake deploy:failed task.
38
38
  def deploy_failed
39
+ return unless airbrussh_is_being_used?
39
40
  return if log_file.nil?
40
41
 
41
42
  error_line
@@ -85,6 +86,12 @@ module Airbrussh
85
86
  file.readlines.last(20).join
86
87
  end
87
88
  end
89
+
90
+ def airbrussh_is_being_used?
91
+ # Obtain the current formatter from the SSHKit backend
92
+ output = env.backend.config.output
93
+ output.is_a?(Airbrussh::Formatter)
94
+ end
88
95
  end
89
96
  end
90
97
  end
@@ -16,6 +16,19 @@ module Airbrussh
16
16
  self.command_output = false
17
17
  end
18
18
 
19
+ def apply_options(options)
20
+ return self if options.nil?
21
+
22
+ options.each do |key, value|
23
+ if respond_to?(writer = "#{key}=")
24
+ public_send(writer, value)
25
+ else
26
+ warn_unrecognized_key(key)
27
+ end
28
+ end
29
+ self
30
+ end
31
+
19
32
  def banner_message
20
33
  return nil unless banner
21
34
  return banner unless banner == :auto
@@ -39,5 +52,11 @@ module Airbrussh
39
52
  def show_command_output?(sym)
40
53
  command_output == true || Array(command_output).include?(sym)
41
54
  end
55
+
56
+ private
57
+
58
+ def warn_unrecognized_key(key)
59
+ $stderr.puts("Ignoring unrecognized Airbrussh option: #{key}")
60
+ end
42
61
  end
43
62
  end
@@ -8,7 +8,8 @@ require "airbrussh/delegating_formatter"
8
8
  #
9
9
  module Airbrussh
10
10
  class Formatter < Airbrussh::DelegatingFormatter
11
- def initialize(io, config=::Airbrussh.configuration)
11
+ def initialize(io, options_or_config_object={})
12
+ config = ::Airbrussh.configuration(options_or_config_object)
12
13
  # Delegate to ConsoleFormatter and (optionally) LogFileFormatter,
13
14
  # based on the configuration.
14
15
  super(config.formatters(io))
@@ -1,3 +1,3 @@
1
1
  module Airbrussh
2
- VERSION = "0.8.0"
2
+ VERSION = "1.0.0.beta1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: airbrussh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 1.0.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Brictson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-20 00:00:00.000000000 Z
11
+ date: 2015-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sshkit
@@ -139,7 +139,6 @@ extra_rdoc_files: []
139
139
  files:
140
140
  - ".gitignore"
141
141
  - ".rubocop.yml"
142
- - ".rubocop_todo.yml"
143
142
  - ".travis.yml"
144
143
  - CHANGELOG.md
145
144
  - CODE_OF_CONDUCT.md
@@ -184,12 +183,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
184
183
  version: '0'
185
184
  required_rubygems_version: !ruby/object:Gem::Requirement
186
185
  requirements:
187
- - - ">="
186
+ - - ">"
188
187
  - !ruby/object:Gem::Version
189
- version: '0'
188
+ version: 1.3.1
190
189
  requirements: []
191
190
  rubyforge_project:
192
- rubygems_version: 2.4.8
191
+ rubygems_version: 2.5.1
193
192
  signing_key:
194
193
  specification_version: 4
195
194
  summary: Airbrussh pretties up your SSHKit and Capistrano output
data/.rubocop_todo.yml DELETED
@@ -1,21 +0,0 @@
1
- # This configuration was generated by `rubocop --auto-gen-config`
2
- # on 2015-05-10 16:52:41 -0700 using RuboCop version 0.31.0.
3
- # The point is for the user to remove these configuration records
4
- # one by one as the offenses are removed from the code base.
5
- # Note that changes in the inspected code, or installation of new
6
- # versions of RuboCop, may require this file to be generated again.
7
-
8
- # Offense count: 1
9
- # Configuration parameters: CountComments.
10
- Metrics/ClassLength:
11
- Max: 168
12
-
13
- # Offense count: 5
14
- # Configuration parameters: CountComments.
15
- Metrics/MethodLength:
16
- Max: 15
17
-
18
- # Offense count: 1
19
- # Configuration parameters: MinBodyLength.
20
- Style/GuardClause:
21
- Enabled: false