hipchat 0.3.0 → 0.4.0

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/README.textile CHANGED
@@ -25,6 +25,37 @@ To determine the user that is currently running the deploy, the capistrano tasks
25
25
  # The git user.name var.
26
26
  # The $USER environment variable.
27
27
 
28
+ h2. Rails 3 Rake Task
29
+
30
+ Send a message using a rake task:
31
+
32
+ bc.. rake hipchat:send["hello world"]
33
+
34
+ Options like the room, API token, user name and notification flag can be set in YAML.
35
+
36
+ RAILS_ROOT/config/hipchat.yml:
37
+
38
+ bc.. token: "<your token>"
39
+ room: "Your room"
40
+ user: "Your name" # Default to `whoami`
41
+ notify: true # Defaults to false
42
+
43
+ h2. Engine Yard
44
+
45
+ Use a "deploy hook":http://bit.ly/qnbIkP to send messages from Engine Yard's Cloud platform.
46
+
47
+ RAILS_ROOT/deploy/after_restart.rb:
48
+
49
+ bc.. on_app_master do
50
+ message = "Deploying revision #{@configuration[:revision]}"
51
+ message += " to #{@configuration[:environment]}"
52
+ message += " (with migrations)" if migrate?
53
+ message += "."
54
+
55
+ # Send a message via rake task assuming a hipchat.yml in your config like above
56
+ run "cd #{release_path} && rake hipchat:send MESSAGE=#{message}"
57
+ end
58
+
28
59
  h2. Copyright
29
60
 
30
61
  Copyright (c) 2010 Mojo Tech. See LICENSE for details.
data/Rakefile CHANGED
@@ -7,33 +7,18 @@ begin
7
7
  gem.name = "hipchat"
8
8
  gem.summary = %Q{Ruby library to interact with HipChat}
9
9
  gem.description = %Q{Ruby library to interact with HipChat}
10
- gem.email = "dgleal@gmail.com"
11
- gem.homepage = "http://github.com/david/hipchat"
12
- gem.authors = ["david"]
10
+ gem.email = "gems@mojotech.com"
11
+ gem.homepage = "http://github.com/mojotech/hipchat"
12
+ gem.authors = ["MojoTech"]
13
13
  gem.add_dependency "httparty"
14
14
  gem.add_development_dependency "rspec", "~> 2.0"
15
15
  gem.add_development_dependency "rr", "~> 1.0"
16
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
17
16
  end
18
17
  Jeweler::GemcutterTasks.new
19
18
  rescue LoadError
20
19
  puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
21
20
  end
22
21
 
23
- require 'spec/rake/spectask'
24
- Spec::Rake::SpecTask.new(:spec) do |spec|
25
- spec.libs << 'lib' << 'spec'
26
- spec.spec_files = FileList['spec/**/*_spec.rb']
27
- end
28
-
29
- Spec::Rake::SpecTask.new(:rcov) do |spec|
30
- spec.libs << 'lib' << 'spec'
31
- spec.pattern = 'spec/**/*_spec.rb'
32
- spec.rcov = true
33
- end
34
-
35
- task :spec => :check_dependencies
36
-
37
22
  task :default => :spec
38
23
 
39
24
  require 'rake/rdoctask'
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.4.0
data/hipchat.gemspec CHANGED
@@ -4,14 +4,14 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{hipchat}
8
- s.version = "0.3.0"
7
+ s.name = "hipchat"
8
+ s.version = "0.4.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["david"]
12
- s.date = %q{2011-07-06}
13
- s.description = %q{Ruby library to interact with HipChat}
14
- s.email = %q{dgleal@gmail.com}
11
+ s.authors = ["MojoTech"]
12
+ s.date = "2011-10-07"
13
+ s.description = "Ruby library to interact with HipChat"
14
+ s.email = "gems@mojotech.com"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
17
  "README.textile"
@@ -26,17 +26,18 @@ Gem::Specification.new do |s|
26
26
  "lib/hipchat.rb",
27
27
  "lib/hipchat/capistrano.rb",
28
28
  "lib/hipchat/chef.rb",
29
+ "lib/hipchat/rails3_tasks.rb",
30
+ "lib/hipchat/railtie.rb",
29
31
  "spec/hipchat_spec.rb",
30
32
  "spec/spec.opts",
31
33
  "spec/spec_helper.rb"
32
34
  ]
33
- s.homepage = %q{http://github.com/david/hipchat}
35
+ s.homepage = "http://github.com/mojotech/hipchat"
34
36
  s.require_paths = ["lib"]
35
- s.rubygems_version = %q{1.3.7}
36
- s.summary = %q{Ruby library to interact with HipChat}
37
+ s.rubygems_version = "1.8.10"
38
+ s.summary = "Ruby library to interact with HipChat"
37
39
 
38
40
  if s.respond_to? :specification_version then
39
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
40
41
  s.specification_version = 3
41
42
 
42
43
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
data/lib/hipchat.rb CHANGED
@@ -1,6 +1,8 @@
1
1
  require 'httparty'
2
2
  require 'ostruct'
3
3
 
4
+ require 'hipchat/railtie' if defined?(Rails::Railtie)
5
+
4
6
  module HipChat
5
7
  class UnknownRoom < StandardError; end
6
8
  class Unauthorized < StandardError; end
@@ -0,0 +1,32 @@
1
+ require 'hipchat'
2
+
3
+ namespace :hipchat do
4
+ desc "Sends a HipChat message as a particular user"
5
+ task :send do
6
+ required_options = [:message, :room, :token, :user]
7
+ config_file = Rails.root.join 'config', 'hipchat.yml'
8
+
9
+ options = {
10
+ :message => ENV['MESSAGE'],
11
+ :user => ENV['USER'],
12
+ :notify => ENV['NOTIFY'],
13
+ :room => ENV['ROOM'],
14
+ :token => ENV['TOKEN']
15
+ }.reject { |k, v| v.blank? }
16
+
17
+ if File.exists? config_file
18
+ options.reverse_merge! YAML.load_file(config_file).symbolize_keys
19
+ end
20
+
21
+ options[:notify] = options[:notify].to_s != 'false'
22
+
23
+ if (missing_options = required_options - options.keys).size > 0
24
+ puts "HipChat needs #{missing_options.to_sentence} to send!"
25
+ exit
26
+ end
27
+
28
+ client = HipChat::Client.new(options[:token])
29
+
30
+ client[options[:room]].send(options[:user], options[:message], options[:notify])
31
+ end
32
+ end
@@ -0,0 +1,9 @@
1
+ require 'hipchat'
2
+
3
+ module HipChat
4
+ class Railtie < Rails::Railtie
5
+ rake_tasks do
6
+ require 'hipchat/rails3_tasks'
7
+ end
8
+ end
9
+ end
metadata CHANGED
@@ -1,77 +1,57 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: hipchat
3
- version: !ruby/object:Gem::Version
4
- hash: 19
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 3
9
- - 0
10
- version: 0.3.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.0
5
+ prerelease:
11
6
  platform: ruby
12
- authors:
13
- - david
7
+ authors:
8
+ - MojoTech
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-07-06 00:00:00 +01:00
19
- default_executable:
20
- dependencies:
21
- - !ruby/object:Gem::Dependency
12
+ date: 2011-10-07 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
22
15
  name: httparty
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70192945036400 !ruby/object:Gem::Requirement
25
17
  none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
33
22
  type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: rspec
37
23
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70192945036400
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ requirement: &70192945035200 !ruby/object:Gem::Requirement
39
28
  none: false
40
- requirements:
29
+ requirements:
41
30
  - - ~>
42
- - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 2
46
- - 0
47
- version: "2.0"
31
+ - !ruby/object:Gem::Version
32
+ version: '2.0'
48
33
  type: :development
49
- version_requirements: *id002
50
- - !ruby/object:Gem::Dependency
51
- name: rr
52
34
  prerelease: false
53
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *70192945035200
36
+ - !ruby/object:Gem::Dependency
37
+ name: rr
38
+ requirement: &70192945034300 !ruby/object:Gem::Requirement
54
39
  none: false
55
- requirements:
40
+ requirements:
56
41
  - - ~>
57
- - !ruby/object:Gem::Version
58
- hash: 15
59
- segments:
60
- - 1
61
- - 0
62
- version: "1.0"
42
+ - !ruby/object:Gem::Version
43
+ version: '1.0'
63
44
  type: :development
64
- version_requirements: *id003
45
+ prerelease: false
46
+ version_requirements: *70192945034300
65
47
  description: Ruby library to interact with HipChat
66
- email: dgleal@gmail.com
48
+ email: gems@mojotech.com
67
49
  executables: []
68
-
69
50
  extensions: []
70
-
71
- extra_rdoc_files:
51
+ extra_rdoc_files:
72
52
  - LICENSE
73
53
  - README.textile
74
- files:
54
+ files:
75
55
  - .document
76
56
  - LICENSE
77
57
  - README.textile
@@ -81,42 +61,33 @@ files:
81
61
  - lib/hipchat.rb
82
62
  - lib/hipchat/capistrano.rb
83
63
  - lib/hipchat/chef.rb
64
+ - lib/hipchat/rails3_tasks.rb
65
+ - lib/hipchat/railtie.rb
84
66
  - spec/hipchat_spec.rb
85
67
  - spec/spec.opts
86
68
  - spec/spec_helper.rb
87
- has_rdoc: true
88
- homepage: http://github.com/david/hipchat
69
+ homepage: http://github.com/mojotech/hipchat
89
70
  licenses: []
90
-
91
71
  post_install_message:
92
72
  rdoc_options: []
93
-
94
- require_paths:
73
+ require_paths:
95
74
  - lib
96
- required_ruby_version: !ruby/object:Gem::Requirement
75
+ required_ruby_version: !ruby/object:Gem::Requirement
97
76
  none: false
98
- requirements:
99
- - - ">="
100
- - !ruby/object:Gem::Version
101
- hash: 3
102
- segments:
103
- - 0
104
- version: "0"
105
- required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ! '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ required_rubygems_version: !ruby/object:Gem::Requirement
106
82
  none: false
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- hash: 3
111
- segments:
112
- - 0
113
- version: "0"
83
+ requirements:
84
+ - - ! '>='
85
+ - !ruby/object:Gem::Version
86
+ version: '0'
114
87
  requirements: []
115
-
116
88
  rubyforge_project:
117
- rubygems_version: 1.3.7
89
+ rubygems_version: 1.8.10
118
90
  signing_key:
119
91
  specification_version: 3
120
92
  summary: Ruby library to interact with HipChat
121
93
  test_files: []
122
-