integritray 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -12,14 +12,14 @@ Require in your Integrity application's config.ru:
12
12
 
13
13
  Add rack end point in your config.ru
14
14
 
15
- map "/" do
15
+ map "/tray" do
16
16
  run Integrity::Integritray::App
17
17
  end
18
18
 
19
19
  Point CCMenu or your tray item of choice to the feed URL:
20
- http://my.integration.server/projects.xml
20
+ http://my.integration.server/tray/projects.xml
21
21
  to view private projects
22
- http://user:password@my.integration.server/projects.xml?private=true
22
+ http://user:password@my.integration.server/tray/projects.xml?private=true
23
23
 
24
24
  You may have to manually specify that this is a CruiseControl.rb-type server;
25
25
  CCMenu has trouble determining which type of server to treat this as.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.0
1
+ 0.3.1
data/integritray.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{integritray}
8
- s.version = "0.3.0"
8
+ s.version = "0.3.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Josh French", "Justin Smestad", "Gabe Varela"]
@@ -1,15 +1,19 @@
1
1
  require 'integrity'
2
+ require "integrity/helpers/urls"
3
+ require "integrity/helpers/authorization"
4
+ require "integrity/helpers/rendering"
2
5
 
3
6
  module Integrity
4
7
  module Integritray
5
8
  module Helpers
9
+ include Integrity::Helpers
6
10
 
7
11
  def xml_opts_for_project(project)
8
12
  opts = {}
9
13
  opts['name'] = project.name
10
14
  opts['category'] = project.branch
11
15
  opts['activity'] = activity(project.last_build.status) if project.last_build
12
- opts['webUrl'] = project_url(project)
16
+ opts['webUrl'] = project_url(project).to_s.gsub(request.script_name, '')
13
17
  if project.last_build
14
18
  opts['lastBuildStatus'] = build_status(project.last_build.status)
15
19
  opts['lastBuildLabel'] = project.last_build.commit.short_identifier
@@ -40,6 +44,15 @@ module Integrity
40
44
  end
41
45
  end
42
46
 
47
+ def authorize(user, password)
48
+ return true unless protect?
49
+ Integrity.app.user == user && Integrity.app.pass == password
50
+ end
51
+
52
+ def protect?
53
+ Integrity.app.respond_to?(:user) && Integrity.app.respond_to?(:pass)
54
+ end
55
+
43
56
  end
44
57
 
45
58
  class App < Sinatra::Base
@@ -47,7 +60,14 @@ module Integrity
47
60
  set :raise_errors, true
48
61
  enable :methodoverride, :static, :sessions
49
62
 
50
- helpers Sinatra::UrlForHelper, Integrity::Helpers, Integritray::Helpers
63
+ helpers Sinatra::UrlForHelper, Integritray::Helpers
64
+
65
+ before do
66
+ # The browser only sends http auth data for requests that are explicitly
67
+ # required to do so. This way we get the real values of +#logged_in?+ and
68
+ # +#current_user+
69
+ login_required if session[:user]
70
+ end
51
71
 
52
72
  get '/projects.xml' do
53
73
  login_required if params["private"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: integritray
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh French