hipchat 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.textile CHANGED
@@ -22,15 +22,9 @@ To determine the user that is currently running the deploy, the capistrano tasks
22
22
 
23
23
  # The $HIPCHAT_USER environment variable
24
24
  # The hipchat_human capistrano var.
25
+ # The git user.name var.
25
26
  # The $USER environment variable.
26
27
 
27
- If you set
28
-
29
- bc. set :hipchat_human, :from_git
30
-
31
- the user name will be taken from your git config (user.name). Note that whatever you put in
32
- @hipchat_human@, @$HIPCHAT_USER@ always prevails.
33
-
34
28
  h2. Copyright
35
29
 
36
30
  Copyright (c) 2010 Mojo Tech. See LICENSE for details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.2
1
+ 0.0.3
data/hipchat.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{hipchat}
8
- s.version = "0.0.2"
8
+ s.version = "0.0.3"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["david"]
12
- s.date = %q{2010-10-26}
12
+ s.date = %q{2010-10-27}
13
13
  s.description = %q{Ruby library to interact with HipChat}
14
14
  s.email = %q{dgleal@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -1,14 +1,36 @@
1
1
  require 'hipchat'
2
2
 
3
3
  Capistrano::Configuration.instance(:must_exist).load do
4
+ set :hipchat_send_notification, false
5
+ set :hipchat_with_migrations, false
6
+
4
7
  namespace :hipchat do
5
8
  task :set_client do
6
9
  set :hipchat_client, HipChat::Client.new(hipchat_token)
7
10
  end
8
11
 
12
+ task :trigger_notification do
13
+ set :hipchat_send_notification, true
14
+ end
15
+
16
+ task :configure_for_migrations do
17
+ set :hipchat_with_migrations, true
18
+ end
19
+
9
20
  task :notify_deploy_started do
10
- hipchat_client[hipchat_room_name].
11
- send(deploy_user, "#{human} is deploying #{application} to #{rails_env}.", hipchat_announce)
21
+ if hipchat_send_notification
22
+ on_rollback do
23
+ hipchat_client[hipchat_room_name].
24
+ send(deploy_user, "#{human} cancelled deployment of #{application} to #{rails_env}.", hipchat_announce)
25
+ end
26
+
27
+ message = "#{human} is deploying #{application} to #{rails_env}"
28
+ message << " (with migrations)" if hipchat_with_migrations
29
+ message << "."
30
+
31
+ hipchat_client[hipchat_room_name].
32
+ send(deploy_user, message, hipchat_announce)
33
+ end
12
34
  end
13
35
 
14
36
  task :notify_deploy_finished do
@@ -21,13 +43,15 @@ Capistrano::Configuration.instance(:must_exist).load do
21
43
  end
22
44
 
23
45
  def human
24
- user = ENV['HIPCHAT_USER'] || fetch(:hipchat_human, ENV['USER'])
25
-
26
- if user == :from_git
27
- %x{git config user.name}.strip
28
- else
29
- user
30
- end
46
+ ENV['HIPCHAT_USER'] ||
47
+ fetch(:hipchat_human,
48
+ if (u = %x{git config user.name}.strip) != ""
49
+ u
50
+ elsif (u = ENV['USER']) != ""
51
+ u
52
+ else
53
+ "Someone"
54
+ end)
31
55
  end
32
56
 
33
57
  def rails_env
@@ -36,6 +60,8 @@ Capistrano::Configuration.instance(:must_exist).load do
36
60
  end
37
61
 
38
62
  before "hipchat:notify_deploy_started", "hipchat:set_client"
39
- before "deploy", "hipchat:notify_deploy_started"
63
+ before "deploy", "hipchat:trigger_notification"
64
+ before "deploy:migrations", "hipchat:trigger_notification", "hipchat:configure_for_migrations"
65
+ before "deploy:update_code", "hipchat:notify_deploy_started"
40
66
  after "deploy", "hipchat:notify_deploy_finished"
41
67
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 2
9
- version: 0.0.2
8
+ - 3
9
+ version: 0.0.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - david
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-26 00:00:00 +01:00
17
+ date: 2010-10-27 00:00:00 +01:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency