Skip to content
This repository has been archived by the owner on Sep 25, 2020. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ocean90 committed Dec 4, 2016
0 parents commit 6463abf
Show file tree
Hide file tree
Showing 8 changed files with 120 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.gem
Gemfile.lock
4 changes: 4 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source "http://rubygems.org"

# Specify your gem's dependencies in capistrano-required_tools.gemspec
gemspec
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Capistrano::RequiredTools

A collection of tools for Capistrano.


## Installation

1. Add this line to your application's Gemfile:

```ruby
gem 'capistrano-required_tools', :git => 'git@github.com:wearerequired/capistrano-required_tools.git'
```

2. Execute:

```
$ bundle
```

3. Require the library in your application's Capfile:
```ruby
require 'capistrano/required_tools'
```
## Usage
### Colors for Slackistrano
The class `SlackistranoMessagingColors ` adds colors to the deploy messages posted to Slack.
```ruby
set :slackistrano, {
klass: Capistrano::RequiredTools::SlackistranoMessagingColors,
channel: '#your-channel',
webhook: 'your-incoming-webhook-url'
}
```

See [Customizing the Messaging](https://github.com/phallstrom/slackistrano/tree/v3.1.0#customizing-the-messaging) for more information.
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
require "bundler/gem_tasks"
23 changes: 23 additions & 0 deletions capistrano-required_tools.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

require 'capistrano/required_tools/version'

Gem::Specification.new do |spec|
spec.name = "capistrano-required_tools"
spec.version = Capistrano::RequiredTools::VERSION
spec.summary = %q{Tools for Capistrano used by required.}
spec.authors = ["required"]
spec.email = "info@required.ch"
spec.homepage = "https://required.com"
spec.license = "GPL-2.0+"

spec.files = `git ls-files -z`.split("\x0")
spec.require_paths = ["lib"]

spec.add_dependency "capistrano", "~> 3.6"
spec.add_dependency "slackistrano", "~> 3.1"

spec.add_development_dependency "bundler", "~> 1.13"
spec.add_development_dependency "rake", "~> 11.0"
end
8 changes: 8 additions & 0 deletions lib/capistrano/required_tools.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require "capistrano/required_tools/version"

module Capistrano
module RequiredTools
end
end

require "capistrano/required_tools/slackistrano_messaging_colors"
36 changes: 36 additions & 0 deletions lib/capistrano/required_tools/slackistrano_messaging_colors.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
require 'slackistrano/capistrano'

module Capistrano
module RequiredTools
class SlackistranoMessagingColors < Slackistrano::Messaging::Base

def payload_for_updating
make_message(super.merge(color: '#E7E7E7'))
end

def payload_for_reverting
make_message(super.merge(color: '#E7E7E7'))
end

def payload_for_updated
make_message(super.merge(color: 'good'))
end

def payload_for_reverted
make_message(super.merge(color: 'good'))
end

def payload_for_failed
make_message(super.merge(color: 'danger'))
end

private ##################################################

def make_message(options={})
attachment = options.reject{|k, v| v.nil? }
{attachments: [attachment]}
end

end
end
end
5 changes: 5 additions & 0 deletions lib/capistrano/required_tools/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module Capistrano
module RequiredTools
VERSION = "0.1.0"
end
end

0 comments on commit 6463abf

Please sign in to comment.