integrity-yammer 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +62 -0
- data/Rakefile +15 -0
- data/integrity-yammer.gemspec +22 -0
- data/lib/notifier/config.haml +3 -0
- data/lib/notifier/yammer.rb +29 -0
- data/spec/integrity_yammer_spec.rb +43 -0
- data/spec/spec_helper.rb +5 -0
- metadata +82 -0
data/README.markdown
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
Integrity Yammer Notifier
|
2
|
+
===========================
|
3
|
+
|
4
|
+
Post a message to a Yammer feed after each build
|
5
|
+
|
6
|
+
Setup
|
7
|
+
==================
|
8
|
+
|
9
|
+
Step 1. **Install Required Gems**
|
10
|
+
|
11
|
+
*oauth* (gem install oauth)
|
12
|
+
*yammer4r* (gem install -s http://gems.github.com jstewart-yammer4r)
|
13
|
+
*integrity-yammer* (gem install -s http://gems.github.com jstewart-integrity-yammer)
|
14
|
+
|
15
|
+
|
16
|
+
Step 2. **Add this to config.ru file:**
|
17
|
+
|
18
|
+
require "rubygems"
|
19
|
+
require "notifier/yammer"
|
20
|
+
Integrity::Notifier.register(Integrity::Notifier::Yammer)
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
Step 3. **Create a yammer oauth yml file with the following information (or use the yammer\_create\_oauth\_yml script in yammer4r):**
|
25
|
+
|
26
|
+
consumer:
|
27
|
+
key: YOUR_KEY_HERE
|
28
|
+
secret: YOUR_KEY_HERE
|
29
|
+
|
30
|
+
access:
|
31
|
+
token: YOUR_KEY_HERE
|
32
|
+
secret: YOUR_KEY_HERE
|
33
|
+
|
34
|
+
|
35
|
+
Step 4. **Edit your project and enter the location of your yammer oauth file.**
|
36
|
+
|
37
|
+
|
38
|
+
License
|
39
|
+
=======
|
40
|
+
|
41
|
+
(The MIT License)
|
42
|
+
|
43
|
+
Copyright (c) 2009 Jason Stewart
|
44
|
+
|
45
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
46
|
+
a copy of this software and associated documentation files (the
|
47
|
+
'Software'), to deal in the Software without restriction, including
|
48
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
49
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
50
|
+
permit persons to whom the Software is furnished to do so, subject to
|
51
|
+
the following conditions:
|
52
|
+
|
53
|
+
The above copyright notice and this permission notice shall be
|
54
|
+
included in all copies or substantial portions of the Software.
|
55
|
+
|
56
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
57
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
58
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
59
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
60
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
61
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
62
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
Dir["#{File.dirname(__FILE__)}/tasks/*.rake"].sort.each { |ext| load ext }
|
5
|
+
|
6
|
+
require 'spec/rake/spectask'
|
7
|
+
|
8
|
+
Spec::Rake::SpecTask.new(:spec) do |t|
|
9
|
+
t.spec_opts = ["--color", "--format", "progress"]
|
10
|
+
t.spec_files = Dir['spec/**/*_spec.rb'].sort
|
11
|
+
t.libs = ['lib']
|
12
|
+
t.rcov = false
|
13
|
+
end
|
14
|
+
|
15
|
+
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{integrity-yammer}
|
5
|
+
s.version = "1.0.2"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Jason Stewart"]
|
9
|
+
s.date = %q{2009-03-09}
|
10
|
+
s.description = %q{Post a short message to a Yammer feed after each build}
|
11
|
+
s.email = %q{jason.m.stewart@gmail.com}
|
12
|
+
s.extra_rdoc_files = ["lib/notifier/config.haml", "lib/notifier/yammer.rb", "README.markdown"]
|
13
|
+
s.files = ["integrity-yammer.gemspec", "lib/notifier/config.haml", "lib/notifier/yammer.rb", "Rakefile", "README.markdown", "spec/integrity_yammer_spec.rb", "spec/spec_helper.rb"]
|
14
|
+
s.homepage = %q{http://integrityapp.com}
|
15
|
+
s.has_rdoc = false
|
16
|
+
s.require_paths = ["lib"]
|
17
|
+
s.rubygems_version = %q{1.3.1}
|
18
|
+
s.summary = %q{Yammer notifier for Integrity ci server}
|
19
|
+
|
20
|
+
s.add_dependency 'integrity'
|
21
|
+
s.add_dependency 'jstewart-yammer4r'
|
22
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'integrity'
|
3
|
+
require 'yammer4r'
|
4
|
+
|
5
|
+
module Integrity
|
6
|
+
class Notifier
|
7
|
+
class Yammer < Notifier::Base
|
8
|
+
|
9
|
+
attr_reader :config
|
10
|
+
|
11
|
+
def initialize(build, config = {})
|
12
|
+
@yammer_client = ::Yammer::Client.new(:config => config['oauth_yml'])
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.to_haml
|
17
|
+
File.read File.dirname(__FILE__) / "config.haml"
|
18
|
+
end
|
19
|
+
|
20
|
+
def deliver!
|
21
|
+
@yammer_client.message(:post, :body => message)
|
22
|
+
end
|
23
|
+
|
24
|
+
def message
|
25
|
+
@message ||= "#{build.project.name} #{short_message}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/spec_helper"
|
2
|
+
|
3
|
+
describe Integrity::Notifier::Yammer do
|
4
|
+
include AppSpecHelper
|
5
|
+
include NotifierSpecHelper
|
6
|
+
|
7
|
+
it_should_behave_like "A notifier"
|
8
|
+
|
9
|
+
def klass
|
10
|
+
Integrity::Notifier::Yammer
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "notifying the world of a build" do
|
14
|
+
before { klass.stub!(:new).and_return(notifier) }
|
15
|
+
|
16
|
+
it "should instantiate a notifier with the given build and config" do
|
17
|
+
klass.should_receive(:new).with(mock_build, anything).and_return(notifier)
|
18
|
+
klass.notify_of_build(mock_build, notifier_config)
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should pass the notifier options to the notifier" do
|
22
|
+
klass.should_receive(:new).with(anything, notifier_config).and_return(notifier)
|
23
|
+
klass.notify_of_build(mock_build, notifier_config)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should deliver the notification" do
|
27
|
+
notifier.should_receive(:deliver!)
|
28
|
+
klass.notify_of_build(mock_build, notifier_config)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "generating a form for configuration" do
|
33
|
+
describe "with a field for the oauth yaml file" do
|
34
|
+
it "should have the proper name, id and label" do
|
35
|
+
the_form.should have_textfield("integrity_yammer_notify_oauth_yml").named("notifiers[Yammer][oauth_yml]").with_label("Oauth Yaml File").with_value("yammer_oauth.yml")
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should use the config's 'oauth_yml' value if available" do
|
39
|
+
the_form(:config => { 'oauth_yml' => 'oauth.yml' }).should have_textfield("integrity_yammer_notifier_oauth_yml").with_value("oauth.yml")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: integrity-yammer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jason Stewart
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-03-09 00:00:00 -04:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: integrity
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: "0"
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: jstewart-yammer4r
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: "0"
|
34
|
+
version:
|
35
|
+
description: Post a short message to a Yammer feed after each build
|
36
|
+
email: jason.m.stewart@gmail.com
|
37
|
+
executables: []
|
38
|
+
|
39
|
+
extensions: []
|
40
|
+
|
41
|
+
extra_rdoc_files:
|
42
|
+
- lib/notifier/config.haml
|
43
|
+
- lib/notifier/yammer.rb
|
44
|
+
- README.markdown
|
45
|
+
files:
|
46
|
+
- integrity-yammer.gemspec
|
47
|
+
- lib/notifier/config.haml
|
48
|
+
- lib/notifier/yammer.rb
|
49
|
+
- Rakefile
|
50
|
+
- README.markdown
|
51
|
+
- spec/integrity_yammer_spec.rb
|
52
|
+
- spec/spec_helper.rb
|
53
|
+
has_rdoc: true
|
54
|
+
homepage: http://integrityapp.com
|
55
|
+
licenses: []
|
56
|
+
|
57
|
+
post_install_message:
|
58
|
+
rdoc_options: []
|
59
|
+
|
60
|
+
require_paths:
|
61
|
+
- lib
|
62
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: "0"
|
67
|
+
version:
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
requirements:
|
70
|
+
- - ">="
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: "1.2"
|
73
|
+
version:
|
74
|
+
requirements: []
|
75
|
+
|
76
|
+
rubyforge_project:
|
77
|
+
rubygems_version: 1.3.5
|
78
|
+
signing_key:
|
79
|
+
specification_version: 3
|
80
|
+
summary: Yammer notifier for Integrity ci server
|
81
|
+
test_files: []
|
82
|
+
|