capistrano-skype 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f518ea0d54bd7028a1da6e51b8e993e3977b4278
4
- data.tar.gz: 960911437fd7fe1a6528a6be8b71cfe3f861c3a2
3
+ metadata.gz: a9180bfd188658f319dc8eb18f4f266674cddd4b
4
+ data.tar.gz: 119aa44868e42bfb27153a10f8dabcdf27cac773
5
5
  SHA512:
6
- metadata.gz: f034c1fc3052349de29a3990ccc2938eca4a22e5ce150ebdb23c2f3995098feea63d0723d807a97367711fd8b890b9aed3b7cdd92a8d3a074b09a8b7d8f36552
7
- data.tar.gz: 6f0539e72b8601bb2dce28913702f1c7d3e96100b8dd1fef2875702599bca6f3f6fc6a65ade2c1099500b5a51c2824869b074ff092eae5b248022f034e466424
6
+ metadata.gz: 43440b1ac8a9b94e70ae887e856c76fb906bc6bbbaad6d71404e171218302a0393d978e924781bc29c3d87d738256ea6680a90a9e53ef027192943f115e1b605
7
+ data.tar.gz: 8857eda75e2a4fa8dcc1e017c51bbdc8607dbfbb650a6aa329b3f829b4c968c635245619fc2739498428cabc1ffa9aa3acecc1a64eb490a9e05895a67d0e69fe
File without changes
@@ -1,97 +1 @@
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
- info("Sending started notification to skype")
56
- message = "[#{fetch(:application)}]" \
57
- "(#{fetch(:stage).upcase})" \
58
- " Deploy started"
59
-
60
- send_message(fetch(:started_notification) || 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
- info("Sending finished notification to skype")
76
- message = "Finished deploy of " \
77
- " #{commit_url(fetch(:current_revision))}" \
78
- " (#{fetch(:branch)})"
79
-
80
- send_message(fetch(:finished_notification) || message)
81
- end
82
- end
83
-
84
- desc 'Send deploy rollback'
85
- task :rollback do
86
- on roles(:all) do
87
- info("Sending rollback notification to skype")
88
- message = "(doh) Deployment failed. Rolled back (doh)"
89
- send_message(fetch(:rollback_notification) || message)
90
- end
91
- end
92
- end
93
-
94
- after 'deploy:started', 'deploy:skype:started'
95
- after 'deploy:finished', 'deploy:skype:finished'
96
- after 'deploy:finishing_rollback', 'deploy:skype:rollback'
97
- end
1
+ load File.expand_path("../tasks/skype.cap", __FILE__)
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Skype
3
- VERSION = "1.0.2"
3
+ VERSION = "1.0.3"
4
4
  end
5
5
  end
@@ -0,0 +1,94 @@
1
+ module Capistrano
2
+ module Skype
3
+ class MacOSSkypeInterface
4
+ attr_accessor :target_chat_id
5
+
6
+ SCRIPT_PATH = File.join(File.dirname(__FILE__), "../../../applescripts/")
7
+
8
+ def initialize(chat_topic)
9
+ @target_chat_id = get_chat_id_for_topic(chat_topic)
10
+ end
11
+
12
+ def chats
13
+ @chats ||= `osascript #{SCRIPT_PATH}chats.applescript`
14
+ end
15
+
16
+ def get_topic_for_chat(chat_id)
17
+ `osascript #{SCRIPT_PATH}topic_for_chat.applescript '#{chat_id}'`
18
+ end
19
+
20
+ def get_chat_id_for_topic(target_topic = "dummy_stuff")
21
+ found_chat_id = nil
22
+
23
+ chats.gsub("CHATS ", "").split(",").each do |chat_id|
24
+ details = (get_topic_for_chat chat_id).chomp.split("TOPIC ")
25
+ topic = details[1].chomp if details.size > 1
26
+ found_chat_id = chat_id if topic == target_topic
27
+ end
28
+
29
+ found_chat_id
30
+ end
31
+
32
+ def send_message(message)
33
+ `osascript #{SCRIPT_PATH}send_message.applescript '#{@target_chat_id}' '#{message}'` unless target_chat_id.nil?
34
+ end
35
+ end
36
+ end
37
+ end
38
+
39
+ namespace :deploy do
40
+ namespace :skype do
41
+ def send_message(message)
42
+ if fetch(:skype_chat_name).to_s.empty?
43
+ warn("Could not notify skype chat: please set `skype_chat_name`.")
44
+ else
45
+ Capistrano::Skype::MacOSSkypeInterface.new(fetch(:skype_chat_name)).send_message(message)
46
+ end
47
+ end
48
+
49
+ desc 'Send deploy started'
50
+ task :started do
51
+ on roles(:all) do
52
+ info("Sending started notification to skype")
53
+ message = "[#{fetch(:application)}]" \
54
+ "(#{fetch(:stage).upcase})" \
55
+ " Deploy started"
56
+
57
+ send_message(fetch(:started_notification) || message)
58
+ end
59
+ end
60
+
61
+ desc 'Send deploy finished'
62
+ task :finished do
63
+ def commit_url(revision)
64
+ if !fetch(:project_url).to_s.empty?
65
+ "#{fetch(:project_url)}/commit/#{revision}"
66
+ else
67
+ "Revision #{revision}"
68
+ end
69
+ end
70
+
71
+ on roles(:all) do
72
+ info("Sending finished notification to skype")
73
+ message = "Finished deploy of " \
74
+ " #{commit_url(fetch(:current_revision))}" \
75
+ " (#{fetch(:branch)})"
76
+
77
+ send_message(fetch(:finished_notification) || message)
78
+ end
79
+ end
80
+
81
+ desc 'Send deploy rollback'
82
+ task :rollback do
83
+ on roles(:all) do
84
+ info("Sending rollback notification to skype")
85
+ message = "(doh) Deployment failed. Rolled back (doh)"
86
+ send_message(fetch(:rollback_notification) || message)
87
+ end
88
+ end
89
+ end
90
+
91
+ after 'deploy:started', 'deploy:skype:started'
92
+ after 'deploy:finished', 'deploy:skype:finished'
93
+ after 'deploy:finishing_rollback', 'deploy:skype:rollback'
94
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-skype
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eduard Litau
@@ -68,8 +68,10 @@ files:
68
68
  - applescripts/send_message.applescript
69
69
  - applescripts/topic_for_chat.applescript
70
70
  - capistrano-skype.gemspec
71
+ - lib/capistrano-skype.rb
71
72
  - lib/capistrano/skype.rb
72
73
  - lib/capistrano/skype/version.rb
74
+ - lib/capistrano/tasks/skype.cap
73
75
  homepage: https://github.com/elitau/capistrano-skype
74
76
  licenses:
75
77
  - MIT