jfrench-integritray 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +5 -0
- data/LICENSE +20 -0
- data/README.rdoc +21 -0
- data/Rakefile +55 -0
- data/VERSION +1 -0
- data/lib/integrity/integritray.rb +33 -0
- data/test/acceptance/integritray_test.rb +30 -0
- metadata +61 -0
data/.document
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Josh French
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
= integritray
|
2
|
+
|
3
|
+
Adds a CruiseControl.rb-style XML feed to Integrity (http://integrityapp.com)
|
4
|
+
for use with CCMenu and other tray items.
|
5
|
+
|
6
|
+
== Usage
|
7
|
+
Install the integritray gem:
|
8
|
+
gem install jfrench-integritray
|
9
|
+
|
10
|
+
Require in your Integrity application's config.ru:
|
11
|
+
require 'integrity/integritray'
|
12
|
+
|
13
|
+
Point CCMenu or your tray item of choice to the feed URL:
|
14
|
+
http://my.integration.server/projects.xml
|
15
|
+
|
16
|
+
You may have to manually specify that this is a CruiseControl.rb-type server;
|
17
|
+
CCMenu has trouble determining which type of server to treat this as.
|
18
|
+
|
19
|
+
== Copyright
|
20
|
+
|
21
|
+
Copyright (c) 2009 Josh French. See LICENSE for details.
|
data/Rakefile
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "integritray"
|
8
|
+
gem.summary = %Q{CCMenu support for Integrity}
|
9
|
+
gem.email = "josh@digitalpulp.com"
|
10
|
+
gem.homepage = "http://github.com/jfrench/integritray"
|
11
|
+
gem.authors = ["Josh French"]
|
12
|
+
end
|
13
|
+
|
14
|
+
rescue LoadError
|
15
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
16
|
+
end
|
17
|
+
|
18
|
+
require 'rake/testtask'
|
19
|
+
Rake::TestTask.new(:test) do |test|
|
20
|
+
test.libs << 'lib' << 'test'
|
21
|
+
test.pattern = 'test/**/*_test.rb'
|
22
|
+
test.verbose = true
|
23
|
+
end
|
24
|
+
|
25
|
+
begin
|
26
|
+
require 'rcov/rcovtask'
|
27
|
+
Rcov::RcovTask.new do |test|
|
28
|
+
test.libs << 'test'
|
29
|
+
test.pattern = 'test/**/*_test.rb'
|
30
|
+
test.verbose = true
|
31
|
+
end
|
32
|
+
rescue LoadError
|
33
|
+
task :rcov do
|
34
|
+
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
task :default => :test
|
40
|
+
|
41
|
+
require 'rake/rdoctask'
|
42
|
+
Rake::RDocTask.new do |rdoc|
|
43
|
+
if File.exist?('VERSION.yml')
|
44
|
+
config = YAML.load(File.read('VERSION.yml'))
|
45
|
+
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
46
|
+
else
|
47
|
+
version = ""
|
48
|
+
end
|
49
|
+
|
50
|
+
rdoc.rdoc_dir = 'rdoc'
|
51
|
+
rdoc.title = "integritray #{version}"
|
52
|
+
rdoc.rdoc_files.include('README*')
|
53
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
54
|
+
end
|
55
|
+
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class Integrity::App < Sinatra::Default
|
2
|
+
get '/projects.xml' do
|
3
|
+
builder do |xml|
|
4
|
+
@projects = authorized? ? Project.all : Project.all(:public => true)
|
5
|
+
response["Content-Type"] = "application/xml; charset=utf-8"
|
6
|
+
xml.Projects do
|
7
|
+
@projects.each do |project|
|
8
|
+
xml.Project xml_opts_for_project(project)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
# Move route definition with the literal routes where it won't be hidden behind any general matchers
|
15
|
+
xml_route = routes['GET'].pop
|
16
|
+
first_literal_route = routes['GET'].find { |route| route.first.inspect.include? 'integrity' }
|
17
|
+
routes['GET'].insert(routes['GET'].index(first_literal_route), xml_route)
|
18
|
+
|
19
|
+
private
|
20
|
+
def xml_opts_for_project(project)
|
21
|
+
opts = {}
|
22
|
+
opts['name'] = project.name
|
23
|
+
opts['category'] = project.branch
|
24
|
+
opts['activity'] = project.building? ? 'Building' : 'Sleeping'
|
25
|
+
opts['webUrl'] = project_url(project)
|
26
|
+
if project.last_commit
|
27
|
+
opts['lastBuildStatus'] = project.last_commit.status.to_s.capitalize
|
28
|
+
opts['lastBuildLabel'] = project.last_commit.short_identifier
|
29
|
+
opts['lastBuildTime'] = project.last_commit.build.completed_at if project.last_commit.build
|
30
|
+
end
|
31
|
+
opts
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# Unclear how to get ahold of Integrity's test helpers externally. For now,
|
2
|
+
# I've been copying this into an unpacked version of Integrity and running it
|
3
|
+
# there.
|
4
|
+
|
5
|
+
require File.dirname(__FILE__) + "/../helpers/acceptance"
|
6
|
+
require 'integrity/integritray'
|
7
|
+
|
8
|
+
class IntegritrayTest < Test::Unit::AcceptanceTestCase
|
9
|
+
include Integrity::Helpers::Urls
|
10
|
+
|
11
|
+
story <<-EOS
|
12
|
+
As a user,
|
13
|
+
I want an XML representation of my projects
|
14
|
+
So I can use CCMenu with Integrity
|
15
|
+
EOS
|
16
|
+
|
17
|
+
scenario "projects.xml has a tag representing my project" do
|
18
|
+
project = Project.gen(:integrity, :public => true, :commits => 2.of { Commit.gen(:successful)})
|
19
|
+
commit = project.last_commit
|
20
|
+
visit "/projects.xml"
|
21
|
+
|
22
|
+
assert_have_tag("projects")
|
23
|
+
assert_have_tag("projects/project[@name='Integrity']")
|
24
|
+
assert_have_tag("projects/project[@lastbuildlabel='#{commit.short_identifier}']")
|
25
|
+
assert_have_tag("projects/project[@weburl='#{project_url(project)}']")
|
26
|
+
assert_have_tag("projects/project[@category='#{project.branch}']")
|
27
|
+
assert_have_tag("projects/project[@activity='Sleeping']")
|
28
|
+
assert_have_tag("projects/project[@lastbuildstatus='#{commit.status}']")
|
29
|
+
end
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jfrench-integritray
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Josh French
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-05-29 00:00:00 -07:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description:
|
17
|
+
email: josh@digitalpulp.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- LICENSE
|
24
|
+
- README.rdoc
|
25
|
+
files:
|
26
|
+
- .document
|
27
|
+
- .gitignore
|
28
|
+
- LICENSE
|
29
|
+
- README.rdoc
|
30
|
+
- Rakefile
|
31
|
+
- VERSION
|
32
|
+
- lib/integrity/integritray.rb
|
33
|
+
- test/acceptance/integritray_test.rb
|
34
|
+
has_rdoc: false
|
35
|
+
homepage: http://github.com/jfrench/integritray
|
36
|
+
post_install_message:
|
37
|
+
rdoc_options:
|
38
|
+
- --charset=UTF-8
|
39
|
+
require_paths:
|
40
|
+
- lib
|
41
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
42
|
+
requirements:
|
43
|
+
- - ">="
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: "0"
|
46
|
+
version:
|
47
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
|
+
requirements:
|
49
|
+
- - ">="
|
50
|
+
- !ruby/object:Gem::Version
|
51
|
+
version: "0"
|
52
|
+
version:
|
53
|
+
requirements: []
|
54
|
+
|
55
|
+
rubyforge_project:
|
56
|
+
rubygems_version: 1.2.0
|
57
|
+
signing_key:
|
58
|
+
specification_version: 3
|
59
|
+
summary: CCMenu support for Integrity
|
60
|
+
test_files:
|
61
|
+
- test/acceptance/integritray_test.rb
|