capistrano-skype 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 970544581c5d44938aa72ca32444197e74dae36b
4
+ data.tar.gz: ffcc803d4537e77160ee44bd946230cf7eb7a4b6
5
+ SHA512:
6
+ metadata.gz: d5fa17c94844a69eb56a25edfc7cbcbc25e7fd8ee1c6684ee8f4127c264500f473864581c196ee23efd5b2cea3010b6845c28ca90474052dbf51c6cd09105c74
7
+ data.tar.gz: dec8972582111514eaff7b321709b0f639c7709d65d371401c06e55619da374c3508d0789867758fdfe3d8ebb8a9e8e2a32c8097494cf538716e74cfcb5b3502
data/.gitignore ADDED
@@ -0,0 +1,14 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in capistrano-skype.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 Eduard Litau
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.
data/README.md ADDED
@@ -0,0 +1,41 @@
1
+ # Capistrano::Skype
2
+
3
+ Capistrano 3 tasks to notify deployments via skype. Currently works only on MacOS X.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```ruby
10
+ gem 'capistrano-skype'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ Or install it yourself as:
18
+
19
+ $ gem install capistrano-skype
20
+
21
+ ## Usage
22
+
23
+ Set ```skype_chat_name``` in your deploy.rb to define in which chat the notifications should be posted. If have a hosted repository like github, also set ```project_url``` to have links to the commit page in the notification.
24
+
25
+ ### Example
26
+
27
+ ```ruby
28
+ set :skype_chat_name, "Project X"
29
+ ```
30
+
31
+ ```ruby
32
+ set :project_url, "https://github.com/company/project_x"
33
+ ```
34
+
35
+ ## Contributing
36
+
37
+ 1. Fork it ( https://github.com/[my-github-username]/capistrano-skype/fork )
38
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
39
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
40
+ 4. Push to the branch (`git push origin my-new-feature`)
41
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,3 @@
1
+ tell application "Skype"
2
+ send command "SEARCH RECENTCHATS" script name "capistrano-skype"
3
+ end tell
@@ -0,0 +1,5 @@
1
+ on run argv
2
+ tell application "Skype"
3
+ send command "CHATMESSAGE " & item 1 of argv & " " & item 2 of argv script name "capistrano-skype"
4
+ end tell
5
+ end run
@@ -0,0 +1,5 @@
1
+ on run argv
2
+ tell application "Skype"
3
+ send command "GET CHAT " & item 1 of argv & " TOPIC" script name "capistrano-skype"
4
+ end tell
5
+ end run
@@ -0,0 +1,26 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'capistrano/skype/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "capistrano-skype"
8
+ spec.version = Capistrano::Skype::VERSION
9
+ spec.authors = ["Eduard Litau"]
10
+ spec.email = ["eduard.litau@gmail.com"]
11
+ spec.summary = %q{Capistrano 3 tasks to notify deployments via skype.}
12
+ spec.description = "Theses recipies allow to send deploy notifications to "\
13
+ "a named skype chat"
14
+ spec.homepage = "https://github.com/elitau/capistrano-skype"
15
+ spec.license = "MIT"
16
+
17
+ spec.files = `git ls-files -z`.split("\x0")
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
20
+ spec.require_paths = ["lib"]
21
+
22
+ spec.add_dependency "capistrano", "~> 3.2"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.7"
25
+ spec.add_development_dependency "rake", "~> 10.0"
26
+ end
@@ -0,0 +1,5 @@
1
+ module Capistrano
2
+ module Skype
3
+ VERSION = "1.0.0"
4
+ end
5
+ end
@@ -0,0 +1,96 @@
1
+ require "capistrano/skype/version"
2
+ require "capistrano"
3
+
4
+ module Capistrano
5
+ module Skype
6
+ class MacOSSkypeInterface
7
+ attr_accessor :target_chat_id
8
+
9
+ SCRIPT_PATH = File.join(File.dirname(__FILE__), "../../applescripts/")
10
+
11
+ def initialize(chat_topic)
12
+ @target_chat_id = get_chat_id_for_topic(chat_topic)
13
+ end
14
+
15
+ def chats
16
+ @chats ||= `osascript #{SCRIPT_PATH}chats.applescript`
17
+ end
18
+
19
+ def get_topic_for_chat(chat_id)
20
+ `osascript #{SCRIPT_PATH}topic_for_chat.applescript '#{chat_id}'`
21
+ end
22
+
23
+ def get_chat_id_for_topic(target_topic = "dummy_stuff")
24
+ found_chat_id = nil
25
+
26
+ chats.gsub("CHATS ", "").split(",").each do |chat_id|
27
+ details = (get_topic_for_chat chat_id).chomp.split("TOPIC ")
28
+ topic = details[1].chomp if details.size > 1
29
+ found_chat_id = chat_id if topic == target_topic
30
+ end
31
+
32
+ found_chat_id
33
+ end
34
+
35
+ def send_message(message)
36
+ `osascript #{SCRIPT_PATH}send_message.applescript '#{@target_chat_id}' '#{message}'` unless target_chat_id.nil?
37
+ end
38
+ end
39
+ end
40
+ end
41
+
42
+ namespace :deploy do
43
+ namespace :skype do
44
+ def send_message(message)
45
+ if fetch(:skype_chat_name).to_s.empty?
46
+ warn("Could not notify skype chat: please set `skype_chat_name`.")
47
+ else
48
+ Capistrano::Skype::MacOSSkypeInterface.new(fetch(:skype_chat_name)).send_message(message)
49
+ end
50
+ end
51
+
52
+ desc 'Send deploy started'
53
+ task :started do
54
+ on roles(:all) do
55
+ message = "[#{fetch(:application)}]" \
56
+ "(#{fetch(:stage).upcase})" \
57
+ " Deploy started" \
58
+ " (F)"
59
+
60
+ send_message(message)
61
+ end
62
+ end
63
+
64
+ desc 'Send deploy finished'
65
+ task :finished do
66
+ def commit_url(revision)
67
+ if !fetch(:project_url).to_s.empty?
68
+ "#{fetch(:project_url)}/commit/#{revision}"
69
+ else
70
+ "Revision #{revision}"
71
+ end
72
+ end
73
+
74
+ on roles(:all) do
75
+ message = "Finished deploy of " \
76
+ " #{commit_url(fetch(:current_revision))}" \
77
+ " (#{fetch(:branch)})" \
78
+ " (sun)"
79
+
80
+ send_message(message)
81
+ end
82
+ end
83
+
84
+ desc 'Send deploy rollback'
85
+ task :rollback do
86
+ on roles(:all) do
87
+ message = "(doh) Deployment failed. Rolled back (doh)"
88
+ send_message(message)
89
+ end
90
+ end
91
+ end
92
+
93
+ after 'deploy:started', 'deploy:skype:started'
94
+ after 'deploy:finished', 'deploy:skype:finished'
95
+ after 'deploy:finishing_rollback', 'deploy:skype:rollback'
96
+ end
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: capistrano-skype
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Eduard Litau
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-09-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: capistrano
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bundler
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.7'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '10.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ description: Theses recipies allow to send deploy notifications to a named skype chat
56
+ email:
57
+ - eduard.litau@gmail.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - LICENSE.txt
65
+ - README.md
66
+ - Rakefile
67
+ - applescripts/chats.applescript
68
+ - applescripts/send_message.applescript
69
+ - applescripts/topic_for_chat.applescript
70
+ - capistrano-skype.gemspec
71
+ - lib/capistrano/skype.rb
72
+ - lib/capistrano/skype/version.rb
73
+ homepage: https://github.com/elitau/capistrano-skype
74
+ licenses:
75
+ - MIT
76
+ metadata: {}
77
+ post_install_message:
78
+ rdoc_options: []
79
+ require_paths:
80
+ - lib
81
+ required_ruby_version: !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ requirements: []
92
+ rubyforge_project:
93
+ rubygems_version: 2.4.1
94
+ signing_key:
95
+ specification_version: 4
96
+ summary: Capistrano 3 tasks to notify deployments via skype.
97
+ test_files: []