This repository has been archived by the owner on Sep 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6463abf
Showing
8 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
*.gem | ||
Gemfile.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require "bundler/gem_tasks" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
36
lib/capistrano/required_tools/slackistrano_messaging_colors.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module Capistrano | ||
module RequiredTools | ||
VERSION = "0.1.0" | ||
end | ||
end |