https://github.com/sue445/capistrano-around_chatwork
post to ChatWork before and after the specified task
https://github.com/sue445/capistrano-around_chatwork
capistrano chatwork
Last synced: 20 days ago
JSON representation
post to ChatWork before and after the specified task
- Host: GitHub
- URL: https://github.com/sue445/capistrano-around_chatwork
- Owner: sue445
- License: mit
- Created: 2015-06-03T11:48:59.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2021-11-20T11:58:59.000Z (over 3 years ago)
- Last Synced: 2025-03-27T16:56:04.505Z (about 1 month ago)
- Topics: capistrano, chatwork
- Language: Ruby
- Size: 36.1 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Capistrano::AroundChatwork
[](http://badge.fury.io/rb/capistrano-around_chatwork)
[](https://codeclimate.com/github/sue445/capistrano-around_chatwork)post to [ChatWork](http://www.chatwork.com/) before and after the specified task

## Installation
Add this line to your application's Gemfile:
```ruby
group :development do
gem 'capistrano-around_chatwork', require: false
end
```## Usage
Capfile
```ruby
require "capistrano/around_chatwork"
```config/deploy.rb
```ruby
set :chatwork_api_token, "YOUR_API_TOKEN"
set :chatwork_room_id, 00000000around_chatwork "deploy"
```## Customize
If you want to customize messages, set `starting_message`, `ending_message` and `failure_message`### Example
```ruby
set :starting_message, -> {
"[info][title][#{fetch(:stage)}] :task_name: @#{fetch(:user)}[/title]started[/info]"
}set :ending_message, -> {
"[info][title][#{fetch(:stage)}] :task_name: @#{fetch(:user)}[/title]done (:elapsed_time: sec)[/info]"
}set :failure_message, -> {
<<-MSG
[info][title][#{fetch(:stage)}] :task_name: @#{fetch(:user)}[/title]failed (:elapsed_time: sec)
:error_inspect:
:error_backtrace:[/info]
MSG
}
```When these are falsy (e.g. `nil` or `false`) or empty string (e.g. `""`), notification is skipped.
e.g.
```ruby
set :starting_message, nil
set :ending_message, ""
```### Variables
* `:task_name:` is replaced to current task name (e.g. `deploy`)
* `:elapsed_time:` is replaced to elapsed time of task (e.g. `1.234`)
* `:error_message:` is replaced to error message (i.e. `Exception#message`) if task is failed
* `:error_inspect:` is replaced to error inspected message (i.e. `Exception#inspect`) if task is failed
* `:error_backtrace:` is replaced to error backtrace (i.e. `Exception#backtrace`) if task is failed## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
## Contributing
1. Fork it ( https://github.com/sue445/capistrano-around_chatwork/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