Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/greenscreen/app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class App < Sinatra::Base
private

def load_source(source)
jobs = load_cc_xml(source.url)
jobs = load_cc_xml(source)
if included_jobs = source.jobs
jobs = jobs.select { |j| included_jobs.member?(j.name) }
end
Expand All @@ -39,8 +39,10 @@ def load_source(source)
$stderr.puts "ERROR loading #{source.url.inspect}: #{e}"
end

def load_cc_xml(url)
xml = REXML::Document.new(open(url))
def load_cc_xml(source)
opts = {}
opts[:http_basic_authentication] = [source.username, source.password] if source.respond_to?(:username)
xml = REXML::Document.new(open(source.url, opts))
xml.elements["//Projects"].map do |project_element|
data = project_element.attributes
Job.new.tap do |job|
Expand Down
7 changes: 7 additions & 0 deletions sample/greenscreen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,10 @@ sources:
jobs:
- roodi
- runway

-
url: http://yet.another.build.server:8080/cc.xml
username: 'batman'
password: 'wayne'
jobs:
- batmobile