jstewart-integrity-yammer 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown ADDED
@@ -0,0 +1,60 @@
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
+
21
+
22
+ Step 3. **Create a yammer oauth yml file with the following information (or use the yammer\_create\_oauth\_yml script in yammer4r):**
23
+
24
+ consumer:
25
+ key: YOUR_KEY_HERE
26
+ secret: YOUR_KEY_HERE
27
+
28
+ access:
29
+ token: YOUR_KEY_HERE
30
+ secret: YOUR_KEY_HERE
31
+
32
+
33
+ Step 4. **Edit your project and enter the location of your yammer oauth file.**
34
+
35
+
36
+ License
37
+ =======
38
+
39
+ (The MIT License)
40
+
41
+ Copyright (c) 2009 Jason Stewart
42
+
43
+ Permission is hereby granted, free of charge, to any person obtaining
44
+ a copy of this software and associated documentation files (the
45
+ 'Software'), to deal in the Software without restriction, including
46
+ without limitation the rights to use, copy, modify, merge, publish,
47
+ distribute, sublicense, and/or sell copies of the Software, and to
48
+ permit persons to whom the Software is furnished to do so, subject to
49
+ the following conditions:
50
+
51
+ The above copyright notice and this permission notice shall be
52
+ included in all copies or substantial portions of the Software.
53
+
54
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
55
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
56
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
57
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
58
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
59
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
60
+ 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,35 @@
1
+ # -*- encoding: utf-8 -*-
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = %q{integrity-yammer}
5
+ s.version = "1.0.0"
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
+ if s.respond_to? :specification_version then
21
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
22
+ s.specification_version = 2
23
+
24
+ if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
25
+ s.add_runtime_dependency(%q<foca-integrity>, [">= 0"])
26
+ s.add_runtime_dependency(%q<jstewart-yammer4r>, [">= 0"])
27
+ else
28
+ s.add_dependency(%q<foca-integrity>, [">= 0"])
29
+ s.add_dependency(%q<jstewart-yammer4r>, [">= 0"])
30
+ end
31
+ else
32
+ s.add_dependency(%q<foca-integrity>, [">= 0"])
33
+ s.add_dependency(%q<jstewart-yammer4r>, [">= 0"])
34
+ end
35
+ end
@@ -0,0 +1,3 @@
1
+ %p.normal
2
+ %label{ :for => "integrity_yammer_notify_oauth_yml" } Consumer Key
3
+ %input.text#integrity_yammer_notify_oauth_yml{ :name => "notifiers[Yammer][oauth_yml]", :value => config["oauth_yml"] || "yammer_oauth.yml", :type => "text" }
@@ -0,0 +1,35 @@
1
+ require 'rubygems'
2
+ require 'integrity'
3
+ require 'oauth/consumer'
4
+ require 'yammer4r'
5
+
6
+ module Integrity
7
+ class Notifier
8
+ class Yammer < Notifier::Base
9
+
10
+ attr_reader :config
11
+
12
+ def initialize(build, config = {})
13
+ @yammer_client = ::Yammer::Client.new(:config => config['oauth_yml'])
14
+ super
15
+ end
16
+
17
+ def self.to_haml
18
+ File.read File.dirname(__FILE__) / "config.haml"
19
+ end
20
+
21
+ def deliver!
22
+ @yammer_client.message(:post, :body => message)
23
+ end
24
+
25
+ def message
26
+ @message ||= <<-content
27
+ #{build.project.name}: #{short_message} (at #{build.commited_at} by #{build.commit_author.name})
28
+ Commit Message: '#{build.commit_message}'
29
+ Link: #{build_url}
30
+ content
31
+ end
32
+
33
+ end
34
+ end
35
+ 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 consumer key" 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
@@ -0,0 +1,5 @@
1
+ require "rubygems"
2
+ require "integrity"
3
+ require File.dirname(__FILE__) / ".." / "lib" / "notifier" / "yammer"
4
+
5
+ require Integrity.root / "spec" / "spec_helper"
metadata ADDED
@@ -0,0 +1,80 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: jstewart-integrity-yammer
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
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 -07:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: foca-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: false
54
+ homepage: http://integrityapp.com
55
+ post_install_message:
56
+ rdoc_options: []
57
+
58
+ require_paths:
59
+ - lib
60
+ required_ruby_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: "0"
65
+ version:
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: "1.2"
71
+ version:
72
+ requirements: []
73
+
74
+ rubyforge_project:
75
+ rubygems_version: 1.2.0
76
+ signing_key:
77
+ specification_version: 2
78
+ summary: Yammer notifier for Integrity ci server
79
+ test_files: []
80
+