cinch-deploy 1.0.5 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cinch/plugins/deploy.rb +30 -12
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71d6e5426915fbf6bab8a3bd8059733da00c8c15
|
4
|
+
data.tar.gz: ebc5ca49e1f3cafcff25f9cd4d2e99810e07d23d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b9c630db5be4a171b947bf42cbd0b689819eb94e0d5297da33aee3bf34fd791235f69508a8247174fdddaf7b5752a167b7e7a01d7e94c6211445d4bdcdd1d55
|
7
|
+
data.tar.gz: 10794d420d1309d15e7958775dddc6a07aec4b87eae762d5c7a914d552fbfd0c472bb87b65408eabed6737f8829d5b42a53d0175f31fc737c1839b81a22522ec
|
data/lib/cinch/plugins/deploy.rb
CHANGED
@@ -3,25 +3,43 @@ module Cinch
|
|
3
3
|
class Deploy
|
4
4
|
include Cinch::Plugin
|
5
5
|
|
6
|
+
def initialize
|
7
|
+
@running = {}
|
8
|
+
end
|
9
|
+
|
6
10
|
listen_to :message
|
7
11
|
|
8
12
|
def listen(m)
|
9
|
-
return if @running
|
10
|
-
@running = true
|
11
13
|
config[:configurations].each do |config|
|
12
|
-
|
13
|
-
IO.popen("#{config[:command]} 2>&1") do |handle|
|
14
|
-
while line = handle.gets
|
15
|
-
m.reply "#{config[:command]} > #{line}", true
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
14
|
+
deploy(m) if can_deploy?(m)
|
19
15
|
end
|
20
16
|
rescue Exception => e
|
21
|
-
m.reply "
|
22
|
-
|
17
|
+
m.reply "exception - #{e.message}", true
|
18
|
+
exception(e)
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def can_deploy?(m)
|
24
|
+
config[:channels].include?(m.channel.to_s) &&
|
25
|
+
config[:users].include?(m.user.nick) &&
|
26
|
+
m.message =~ Regexp.new(config[:trigger])
|
27
|
+
end
|
28
|
+
|
29
|
+
def deploy(m)
|
30
|
+
return if @running[command]
|
31
|
+
@running[command] = true
|
32
|
+
IO.popen("#{command} 2>&1") do |handle|
|
33
|
+
while line = handle.gets
|
34
|
+
m.reply "#{command} > #{line}", true
|
35
|
+
end
|
36
|
+
end
|
23
37
|
ensure
|
24
|
-
@running
|
38
|
+
@running.delete(command)
|
39
|
+
end
|
40
|
+
|
41
|
+
def command
|
42
|
+
config[:command]
|
25
43
|
end
|
26
44
|
|
27
45
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cinch-deploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michal Papis
|
@@ -54,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
54
|
version: '0'
|
55
55
|
requirements: []
|
56
56
|
rubyforge_project:
|
57
|
-
rubygems_version: 2.
|
57
|
+
rubygems_version: 2.2.0
|
58
58
|
signing_key:
|
59
59
|
specification_version: 4
|
60
60
|
summary: A Cinch plugin to start deploy process via irc messages.
|