Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mattbrictson committed Feb 20, 2015
0 parents commit 6b6a031
Show file tree
Hide file tree
Showing 11 changed files with 207 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/.bundle/
/.yardoc
/Gemfile.lock
/_yardoc/
/coverage/
/doc/
/pkg/
/spec/reports/
/tmp/
*.bundle
*.so
*.o
*.a
mkmf.log
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
language: ruby
rvm:
- 2.2.0
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source "https://rubygems.org"

# Specify your gem's dependencies in airbrussh.gemspec
gemspec
22 changes: 22 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Copyright (c) 2015 Matt Brictson

MIT License

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
98 changes: 98 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Airbrussh

**Airbrussh is a replacement log formatter for SSHKit that makes your Capistrano output much easier on the eyes.** Just add it to your Capfile and enjoy concise, useful log output that is easy to read.

And don't worry: airbrussh saves Capistrano's default verbose output to a separate log file just in case you still need it for troubleshooting.

*TODO: animated GIF of airbrusshed output goes here!*

## Installation

Add this line to your application's Gemfile:

```ruby
gem "airbrussh", :require => false
```

And then execute:

$ bundle

Finally, add this line to your application's Capfile:

```ruby
require "airbrussh/capistrano"
```

## Usage

Airbrussh automatically replaces the default Capistrano log formatter, so there is nothing more you have to do. Just run `cap` as normal and enjoy the prettier output!

**Advanced:** Airbrussh can be configured by calling `Airbrussh.configure` in your `deploy.rb` file. You can do stage-specific configuration in e.g. `deploy/production.rb` as well. Here are the available options:

```ruby
Airbrussh.configure do |config|
# Capistrano's default, un-airbrusshed output is saved to a file to
# facilitate debugging. To disable this entirely:
# config.log_file = nil
# You can also provide an IO object:
# config.log_file = $stderr
# Default:
config.log_file = "log/capistrano.log"

# Airbrussh patches Rake so it can access the name of the currently executing
# task. Set this to false if monkey patching is causing issues.
# Default:
config.monkey_patch_rake = true

# Ansi colors will be used in the output automatically based on whether the
# output is a TTY, or if the SSHKIT_COLOR environment variable is set.
# To disable color always:
# config.color = false
# Default:
config.color = :auto

# Output is automatically truncated to the width of the terminal window, if
# possible. If the width of the terminal can't be determined, no truncation
# is performed. To truncate to a fixed with:
# config.truncate = 80
# Or to disable truncation entirely:
# config.truncate = false
# Default:
config.truncate = :auto
end
```

## Usage outside of Capistrano

If you are using SSHKit directly, you can use Airbrussh without the Capistrano magic:

```ruby
require "airbrussh"
SSHKit.config.output = Airbrussh::Formatter.new
```

When Capistrano is not present, Airbrussh uses a slightly different default configuration:

```ruby
Airbrussh.configure do |config|
config.log_file = nil
config.monkey_patch_rake = false
config.color = :auto
config.truncate = :auto
end
```

## History

Airbrussh started life as custom logging code within the [capistrano-fiftyfive][] collection of opinionated Capistrano recipes. In February 2015, the logging code was refactored into a standalone gem with its own configuration and documentation, and renamed `airbrussh`. Now anyone can using SSHKit or Capistrano can safely plug it into their projects!

## Contributing

1. Fork it ( https://github.com/[my-github-username]/airbrussh/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request

[capistrano-fiftyfive]: https://github.com/mattbrictson/capistrano-fiftyfive
8 changes: 8 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require "bundler/gem_tasks"
require "rake/testtask"

Rake::TestTask.new(:test) do |t|
t.libs << "test"
end

task :default => :test
28 changes: 28 additions & 0 deletions airbrussh.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# coding: utf-8
lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "airbrussh/version"

Gem::Specification.new do |spec|
spec.name = "airbrussh"
spec.version = Airbrussh::VERSION
spec.authors = ["Matt Brictson"]
spec.email = ["[email protected]"]
spec.summary = "Airbrussh pretties up your SSHKit and Capistrano output"
spec.description = "Airbrussh is a replacement log formatter for SSHKit "\
"that makes your Capistrano output much easier on the "\
"eyes. Just add it to your Capfile and enjoy concise, "\
"useful log output that is easy to read."
spec.homepage = "https://github.com/mattbrictson/airbrussh"
spec.license = "MIT"

spec.files = `git ls-files -z`.split("\x0")
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]

spec.add_development_dependency "bundler", "~> 1.7"
spec.add_development_dependency "rake", "~> 10.0"
spec.add_development_dependency "minitest"
spec.add_development_dependency "minitest-reporters"
end
5 changes: 5 additions & 0 deletions lib/airbrussh.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require "airbrussh/version"

module Airbrussh
# Your code goes here...
end
3 changes: 3 additions & 0 deletions lib/airbrussh/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module Airbrussh
VERSION = "0.0.1"
end
11 changes: 11 additions & 0 deletions test/minitest_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__)
require "airbrussh"

require "minitest/autorun"
require "minitest/reporters"

Minitest::Reporters.use!(
Minitest::Reporters::ProgressReporter.new,
ENV,
Minitest.backtrace_filter
)
11 changes: 11 additions & 0 deletions test/test_airbrussh.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require "minitest_helper"

class TestAirbrussh < MiniTest::Unit::TestCase
def test_that_it_has_a_version_number
refute_nil ::Airbrussh::VERSION
end

def test_it_does_something_useful
assert false
end
end

0 comments on commit 6b6a031

Please sign in to comment.