├── lib ├── capistrano-nc.rb └── capistrano-nc │ ├── nc.rb │ └── tasks │ └── nc.rake ├── .gitignore ├── Gemfile ├── Rakefile ├── capistrano-nc.gemspec ├── CHANGELOG.md ├── LICENSE └── README.md /lib/capistrano-nc.rb: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Gemfile.lock 2 | pkg 3 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source "https://rubygems.org" 2 | 3 | gemspec 4 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env rake 2 | 3 | require 'bundler/gem_tasks' 4 | -------------------------------------------------------------------------------- /lib/capistrano-nc/nc.rb: -------------------------------------------------------------------------------- 1 | load File.expand_path("../tasks/nc.rake", __FILE__) -------------------------------------------------------------------------------- /capistrano-nc.gemspec: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | Gem::Specification.new do |gem| 3 | gem.name = 'capistrano-nc' 4 | gem.version = '0.1.4' 5 | gem.authors = ['Kir Shatrov'] 6 | gem.email = ['shatrov@me.com'] 7 | gem.summary = "Capistrano 3 integration with Mountain Lion's Notification Center" 8 | gem.description = 'https://github.com/capistrano/notification-center' 9 | gem.homepage = 'https://github.com/capistrano/notification-center' 10 | 11 | gem.licenses = %w(MIT) 12 | 13 | gem.add_dependency 'terminal-notifier', '~> 1.6' 14 | gem.add_dependency 'capistrano', '~> 3.0' 15 | 16 | gem.files = `git ls-files`.split($\) 17 | gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } 18 | gem.test_files = gem.files.grep(%r{^(spec)/}) 19 | gem.require_paths = ['lib'] 20 | end 21 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## master 2 | 3 | https://github.com/capistrano/notification-center/compare/v0.1.4...HEAD 4 | 5 | * Your contribution here! 6 | 7 | ## 0.1.4 8 | 9 | https://github.com/capistrano/notification-center/compare/v0.1.3...v0.1.4 10 | 11 | * [#6](https://github.com/capistrano/notification-center/pull/6): Update terminal-notifier dependency (adds Yosemite compatibility) - [@rjocoleman](https://github.com/rjocoleman) 12 | 13 | ## 0.1.3 14 | 15 | https://github.com/capistrano/notification-center/compare/v0.1.2...v0.1.3 16 | 17 | * Added support for "activate" and "sender" terminal-notifier options (#5) 18 | 19 | ## 0.1.2 20 | 21 | https://github.com/capistrano/notification-center/compare/v0.1.1...v0.1.2 22 | 23 | * Fixed dependency on Capistrano core 24 | * Updated terminal-notifier dependency 25 | 26 | ## 0.1.1 27 | 28 | Fixed bug with `Don't know how to build task 'nc:finished'` in Capistrano 3 29 | 30 | ## 0.1.0 31 | 32 | Support for Capistrano 3. 33 | 34 | ## 0.0.2 35 | 36 | Initial release for Capistrano 2. 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 Kir Shatrov 2 | 3 | MIT License 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining 6 | a copy of this software and associated documentation files (the 7 | "Software"), to deal in the Software without restriction, including 8 | without limitation the rights to use, copy, modify, merge, publish, 9 | distribute, sublicense, and/or sell copies of the Software, and to 10 | permit persons to whom the Software is furnished to do so, subject to 11 | the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be 14 | included in all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /lib/capistrano-nc/tasks/nc.rake: -------------------------------------------------------------------------------- 1 | require 'terminal-notifier' 2 | 3 | module CapistranoNc 4 | def self.nc_supported? 5 | `uname`.strip == 'Darwin' && os_x_version >= Gem::Version.new('10.8') 6 | end 7 | 8 | def self.os_x_version 9 | Gem::Version.new(`sw_vers -productVersion`.strip) 10 | end 11 | end 12 | 13 | namespace :nc do 14 | task :finished do 15 | if CapistranoNc.nc_supported? 16 | announced_stage = fetch(:stage, 'production') 17 | application = fetch(:application) 18 | announcement = "\u2705 Successfully deployed " 19 | announcement += if fetch(:branch, nil) 20 | "#{application}'s #{fetch(:branch)} to #{announced_stage}" 21 | else 22 | "#{application} to #{announced_stage}" 23 | end 24 | 25 | terminal = fetch(:nc_terminal, 'com.apple.Terminal') 26 | TerminalNotifier.notify(announcement, title: "Capistrano", sender: terminal, activate: terminal) 27 | end 28 | end 29 | end 30 | 31 | after 'deploy:finished', 'nc:finished' 32 | 33 | namespace :load do 34 | task :defaults do 35 | 36 | set :nc_terminal, 'com.apple.Terminal' 37 | 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Capistrano + Notification Center 2 | 3 | capistrano-nc integrates Capistrano and OS X Notification Center. 4 | 5 | ![Screenshot](http://f.cl.ly/items/1k253H0o350m1F0L371j/Screen%20Shot%202012-09-29%20at%2012.57.34%20PM.png) 6 | 7 | ## Installation 8 | 9 | ### for Capistrano 3.x 10 | 11 | ```ruby 12 | # Gemfile 13 | gem 'capistrano-nc', '~> 0.1' 14 | ``` 15 | 16 | ```ruby 17 | # Capfile 18 | require 'capistrano-nc/nc' 19 | ``` 20 | 21 | ### for Capistrano 2.x 22 | 23 | ```ruby 24 | # Gemfile 25 | gem "capistrano-nc", "0.0.2" 26 | ``` 27 | 28 | ```ruby 29 | # config/deploy.rb 30 | require "capistrano-nc" 31 | ``` 32 | 33 | By default it will run the `nc:finished` task after your `deploy` or `deploy:migrations`. If this behavior doesn't suit you, you can hook `nc:finished` to any custom task by editing `deploy.rb`: 34 | 35 | ``` 36 | after `your:task`, `nc:finished` 37 | ``` 38 | 39 | Terminal.app is opened when the notification is clicked. To use an alternative terminal set `:nc_terminal` to the bundle identifier e.g. `set :nc_terminal, 'com.googlecode.iterm2'` for iTerm2. 40 | 41 | ## Contributors 42 | 43 | - [Kir Shatrov](https://github.com/kirs/) 44 | 45 | ## Feel free to pull request! 46 | --------------------------------------------------------------------------------