integritray 0.1.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,6 @@
1
+ = 0.2.2
2
+ Invoke authentication on private projects [Gabe Varela]
3
+ = 0.2.0
4
+ Updates for compatibility with latest Integrity [Smestad]
5
+ = 0.1.1
6
+ Fix build status when project is pending [Jonas Nicklas]
@@ -5,13 +5,15 @@ for use with CCMenu and other tray items.
5
5
 
6
6
  == Usage
7
7
  Install the integritray gem:
8
- gem install jfrench-integritray
8
+ gem install integritray
9
9
 
10
10
  Require in your Integrity application's config.ru:
11
11
  require 'integrity/integritray'
12
12
 
13
13
  Point CCMenu or your tray item of choice to the feed URL:
14
14
  http://my.integration.server/projects.xml
15
+ to view private projects
16
+ http://user:password@my.integration.server/projects.xml?private=true
15
17
 
16
18
  You may have to manually specify that this is a CruiseControl.rb-type server;
17
19
  CCMenu has trouble determining which type of server to treat this as.
data/Rakefile CHANGED
@@ -8,9 +8,11 @@ begin
8
8
  gem.summary = %Q{CCMenu support for Integrity}
9
9
  gem.email = "josh@digitalpulp.com"
10
10
  gem.homepage = "http://github.com/jfrench/integritray"
11
- gem.authors = ["Josh French"]
12
- end
11
+ gem.authors = ["Josh French", "Justin Smestad", "Gabe Varela"]
13
12
 
13
+ gem.add_dependency 'sinatra', '>= 0.9.4'
14
+ end
15
+ Jeweler::GemcutterTasks.new
14
16
  rescue LoadError
15
17
  puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
16
18
  end
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.2.2
@@ -1,12 +1,15 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
1
4
  # -*- encoding: utf-8 -*-
2
5
 
3
6
  Gem::Specification.new do |s|
4
7
  s.name = %q{integritray}
5
- s.version = "0.1.1"
8
+ s.version = "0.2.1"
6
9
 
7
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
- s.authors = ["Josh French"]
9
- s.date = %q{2009-07-08}
11
+ s.authors = ["Josh French", "Justin Smestad"]
12
+ s.date = %q{2010-01-06}
10
13
  s.email = %q{josh@digitalpulp.com}
11
14
  s.extra_rdoc_files = [
12
15
  "LICENSE",
@@ -15,6 +18,7 @@ Gem::Specification.new do |s|
15
18
  s.files = [
16
19
  ".document",
17
20
  ".gitignore",
21
+ "CHANGELOG",
18
22
  "LICENSE",
19
23
  "README.rdoc",
20
24
  "Rakefile",
@@ -27,7 +31,7 @@ Gem::Specification.new do |s|
27
31
  s.homepage = %q{http://github.com/jfrench/integritray}
28
32
  s.rdoc_options = ["--charset=UTF-8"]
29
33
  s.require_paths = ["lib"]
30
- s.rubygems_version = %q{1.3.4}
34
+ s.rubygems_version = %q{1.3.5}
31
35
  s.summary = %q{CCMenu support for Integrity}
32
36
  s.test_files = [
33
37
  "test/acceptance/acceptance_helper.rb",
@@ -39,8 +43,12 @@ Gem::Specification.new do |s|
39
43
  s.specification_version = 3
40
44
 
41
45
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
46
+ s.add_runtime_dependency(%q<sinatra>, [">= 0.9.4"])
42
47
  else
48
+ s.add_dependency(%q<sinatra>, [">= 0.9.4"])
43
49
  end
44
50
  else
51
+ s.add_dependency(%q<sinatra>, [">= 0.9.4"])
45
52
  end
46
53
  end
54
+
@@ -1,49 +1,58 @@
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)
1
+
2
+ module Integrity
3
+ module Integritray
4
+ module Helpers
5
+
6
+ def xml_opts_for_project(project)
7
+ opts = {}
8
+ opts['name'] = project.name
9
+ opts['category'] = project.branch
10
+ opts['activity'] = activity(project.last_build.status) if project.last_build
11
+ opts['webUrl'] = project_url(project)
12
+ if project.last_build
13
+ opts['lastBuildStatus'] = build_status(project.last_build.status)
14
+ opts['lastBuildLabel'] = project.last_build.commit.short_identifier
15
+ opts['lastBuildTime'] = project.last_build.completed_at
9
16
  end
17
+ opts
10
18
  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'] = activity(project.last_commit.status)
25
- opts['webUrl'] = project_url(project)
26
- if project.last_commit
27
- opts['lastBuildStatus'] = build_status(project.last_commit.status)
28
- opts['lastBuildLabel'] = project.last_commit.short_identifier
29
- opts['lastBuildTime'] = project.last_commit.build.completed_at if project.last_commit.build
19
+
20
+ def activity(status)
21
+ case status
22
+ when :success, :failed then 'Sleeping'
23
+ when :pending then 'Building'
24
+ else 'Sleeping'
25
+ end
30
26
  end
31
- opts
32
- end
33
-
34
- def activity(status)
35
- case status
36
- when :success, :failed then 'Sleeping'
37
- when :pending then 'Building'
38
- else 'Sleeping'
39
- end
27
+
28
+ def build_status(status)
29
+ case status
30
+ when :success, :pending then 'Success'
31
+ when :failed then 'Failure'
32
+ else 'Unknown'
33
+ end
34
+ end
35
+
40
36
  end
41
-
42
- def build_status(status)
43
- case status
44
- when :success, :pending then 'Success'
45
- when :failed then 'Failure'
46
- else 'Unknown'
37
+
38
+
39
+ def self.registered(app)
40
+ app.helpers Integritray::Helpers
41
+
42
+ app.get '/projects.xml' do
43
+ login_required if params["private"]
44
+ builder do |xml|
45
+ @projects = authorized? ? Project.all : Project.all(:public => true)
46
+ response["Content-Type"] = "application/xml; charset=utf-8"
47
+ xml.Projects do
48
+ @projects.each do |project|
49
+ xml.Project xml_opts_for_project(project)
50
+ end
51
+ end
52
+ end
47
53
  end
54
+
48
55
  end
49
- end
56
+
57
+ end # Integritray
58
+ end # Integrity
@@ -55,4 +55,18 @@ class IntegritrayTest < Test::Unit::AcceptanceTestCase
55
55
  assert_have_tag("projects/project[@activity='Sleeping']")
56
56
  assert_have_tag("projects/project[@lastbuildstatus='Failure']")
57
57
  end
58
+
59
+ scenario "projects.xml has a tag representing my unbuilt project" do
60
+ project = Project.gen(:integrity, :public => true)
61
+ commit = project.last_commit
62
+ puts commit.inspect
63
+ visit "/projects.xml"
64
+
65
+ assert_have_tag("projects")
66
+ assert_have_tag("projects/project[@name='Integrity']")
67
+ assert_have_tag("projects/project[@weburl='#{project_url(project)}']")
68
+ assert_have_tag("projects/project[@category='#{project.branch}']")
69
+ assert_have_no_tag("projects/project[@activity]")
70
+ assert_have_no_tag("projects/project[@lastbuildstatus]")
71
+ end
58
72
  end
metadata CHANGED
@@ -1,18 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: integritray
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh French
8
+ - Justin Smestad
9
+ - Gabe Varela
8
10
  autorequire:
9
11
  bindir: bin
10
12
  cert_chain: []
11
13
 
12
- date: 2009-07-08 00:00:00 -04:00
14
+ date: 2010-01-15 00:00:00 -05:00
13
15
  default_executable:
14
- dependencies: []
15
-
16
+ dependencies:
17
+ - !ruby/object:Gem::Dependency
18
+ name: sinatra
19
+ type: :runtime
20
+ version_requirement:
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: 0.9.4
26
+ version:
16
27
  description:
17
28
  email: josh@digitalpulp.com
18
29
  executables: []
@@ -25,6 +36,7 @@ extra_rdoc_files:
25
36
  files:
26
37
  - .document
27
38
  - .gitignore
39
+ - CHANGELOG
28
40
  - LICENSE
29
41
  - README.rdoc
30
42
  - Rakefile
@@ -57,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
57
69
  requirements: []
58
70
 
59
71
  rubyforge_project:
60
- rubygems_version: 1.3.4
72
+ rubygems_version: 1.3.5
61
73
  signing_key:
62
74
  specification_version: 3
63
75
  summary: CCMenu support for Integrity