hipchat 0.0.1 → 0.0.2

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/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 david
1
+ Copyright (c) 2009 Mojo Tech
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
@@ -0,0 +1,36 @@
1
+ h1. HipChat Wrapper
2
+
3
+ A very basic wrapper for the HipChat HTTP API.
4
+
5
+ h2. Usage
6
+
7
+ bc.. client = HipChat::Client.new(api_token)
8
+ notify_users = false
9
+ client['my room'].send('username', 'A message!', notify_users)
10
+
11
+ h2. Capistrano
12
+
13
+ bc.. require 'hipchat/capistrano'
14
+
15
+ set :hipchat_token, "<your token>"
16
+ set :hipchat_room_name, "Your room"
17
+ set :hipchat_announce, false # notify users
18
+
19
+ h3. Who did it?
20
+
21
+ To determine the user that is currently running the deploy, the capistrano tasks will look for the following:
22
+
23
+ # The $HIPCHAT_USER environment variable
24
+ # The hipchat_human capistrano var.
25
+ # The $USER environment variable.
26
+
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
+ h2. Copyright
35
+
36
+ Copyright (c) 2010 Mojo Tech. See LICENSE for details.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.1
1
+ 0.0.2
@@ -5,22 +5,22 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{hipchat}
8
- s.version = "0.0.1"
8
+ s.version = "0.0.2"
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-25}
12
+ s.date = %q{2010-10-26}
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 = [
16
16
  "LICENSE",
17
- "README.rdoc"
17
+ "README.textile"
18
18
  ]
19
19
  s.files = [
20
20
  ".document",
21
21
  ".gitignore",
22
22
  "LICENSE",
23
- "README.rdoc",
23
+ "README.textile",
24
24
  "Rakefile",
25
25
  "VERSION",
26
26
  "hipchat.gemspec",
@@ -2,24 +2,40 @@ require 'hipchat'
2
2
 
3
3
  Capistrano::Configuration.instance(:must_exist).load do
4
4
  namespace :hipchat do
5
- task :set_hipchat_client do
5
+ task :set_client do
6
6
  set :hipchat_client, HipChat::Client.new(hipchat_token)
7
7
  end
8
8
 
9
9
  task :notify_deploy_started do
10
- rails_env = fetch(:hipchat_env, fetch(:rails_env, "production"))
11
-
12
10
  hipchat_client[hipchat_room_name].
13
- send(hipchat_user, "Started deploying #{application} (#{rails_env}).", hipchat_announce)
11
+ send(deploy_user, "#{human} is deploying #{application} to #{rails_env}.", hipchat_announce)
14
12
  end
15
13
 
16
14
  task :notify_deploy_finished do
17
15
  hipchat_client[hipchat_room_name].
18
- send(hipchat_user, "Finished deploying #{application}.", hipchat_announce)
16
+ send(deploy_user, "#{human} finished deploying #{application} to #{rails_env}.", hipchat_announce)
17
+ end
18
+
19
+ def deploy_user
20
+ fetch(:hipchat_deploy_user, "Deploy")
21
+ end
22
+
23
+ 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
31
+ end
32
+
33
+ def rails_env
34
+ fetch(:hipchat_env, fetch(:rails_env, "production"))
19
35
  end
20
36
  end
21
37
 
22
- before "hipchat:notify_deploy_started", "hipchat:set_hipchat_client"
38
+ before "hipchat:notify_deploy_started", "hipchat:set_client"
23
39
  before "deploy", "hipchat:notify_deploy_started"
24
40
  after "deploy", "hipchat:notify_deploy_finished"
25
41
  end
metadata CHANGED
@@ -1,13 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hipchat
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 0
9
- - 1
10
- version: 0.0.1
8
+ - 2
9
+ version: 0.0.2
11
10
  platform: ruby
12
11
  authors:
13
12
  - david
@@ -15,7 +14,7 @@ autorequire:
15
14
  bindir: bin
16
15
  cert_chain: []
17
16
 
18
- date: 2010-10-25 00:00:00 +01:00
17
+ date: 2010-10-26 00:00:00 +01:00
19
18
  default_executable:
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
@@ -26,7 +25,6 @@ dependencies:
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
29
- hash: 3
30
28
  segments:
31
29
  - 0
32
30
  version: "0"
@@ -40,7 +38,6 @@ dependencies:
40
38
  requirements:
41
39
  - - ">="
42
40
  - !ruby/object:Gem::Version
43
- hash: 13
44
41
  segments:
45
42
  - 1
46
43
  - 2
@@ -56,12 +53,12 @@ extensions: []
56
53
 
57
54
  extra_rdoc_files:
58
55
  - LICENSE
59
- - README.rdoc
56
+ - README.textile
60
57
  files:
61
58
  - .document
62
59
  - .gitignore
63
60
  - LICENSE
64
- - README.rdoc
61
+ - README.textile
65
62
  - Rakefile
66
63
  - VERSION
67
64
  - hipchat.gemspec
@@ -84,7 +81,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
84
81
  requirements:
85
82
  - - ">="
86
83
  - !ruby/object:Gem::Version
87
- hash: 3
88
84
  segments:
89
85
  - 0
90
86
  version: "0"
@@ -93,7 +89,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
89
  requirements:
94
90
  - - ">="
95
91
  - !ruby/object:Gem::Version
96
- hash: 3
97
92
  segments:
98
93
  - 0
99
94
  version: "0"
@@ -1,17 +0,0 @@
1
- = hipchat
2
-
3
- Description goes here.
4
-
5
- == Note on Patches/Pull Requests
6
-
7
- * Fork the project.
8
- * Make your feature addition or bug fix.
9
- * Add tests for it. This is important so I don't break it in a
10
- future version unintentionally.
11
- * Commit, do not mess with rakefile, version, or history.
12
- (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
13
- * Send me a pull request. Bonus points for topic branches.
14
-
15
- == Copyright
16
-
17
- Copyright (c) 2010 david. See LICENSE for details.