fingercap 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/fingercap/recipes/notify.rb +29 -2
- metadata +4 -4
@@ -9,6 +9,34 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
9
9
|
puts "[!] Please `gem install broach' to post deployment messages to Campfire."
|
10
10
|
end
|
11
11
|
else
|
12
|
+
def uses_instances?
|
13
|
+
!variables[:instances].nil? and !variables[:instances].empty?
|
14
|
+
end
|
15
|
+
|
16
|
+
def instances_as_sentence
|
17
|
+
case instances.length
|
18
|
+
when 0
|
19
|
+
''
|
20
|
+
when 1
|
21
|
+
instances.first
|
22
|
+
when 2
|
23
|
+
instances.join(' and ')
|
24
|
+
else
|
25
|
+
message = instances[0..-2].join(', ')
|
26
|
+
message << ", and #{instances.last}"
|
27
|
+
message
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def message(action)
|
32
|
+
message = "#{ENV['USER']} just #{action} #{application}"
|
33
|
+
message << " (#{variables[:url]})" if variables[:url]
|
34
|
+
if uses_instances?
|
35
|
+
message << " to instances: #{instances_as_sentence}"
|
36
|
+
end
|
37
|
+
message
|
38
|
+
end
|
39
|
+
|
12
40
|
def notify(action)
|
13
41
|
begin
|
14
42
|
Broach.settings = YAML.load_file(File.expand_path('~/.fingercap.yml'))['campfire']
|
@@ -17,8 +45,7 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
17
45
|
puts File.read(File.expand_path('../../../../examples/fingercap.yml', __FILE__))
|
18
46
|
exit -1
|
19
47
|
end
|
20
|
-
|
21
|
-
Broach.speak(Broach.session.room, "#{ENV['USER']} just #{action} #{application}: #{variables[:url] || variables[:repository]}")
|
48
|
+
Broach.speak(Broach.session.room, message(action))
|
22
49
|
end
|
23
50
|
end
|
24
51
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fingercap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 4
|
10
|
+
version: 0.3.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Manfred Stienstra
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-08-25 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|