Skip to content

Commit

Permalink
basic functionality,
Browse files Browse the repository at this point in the history
      still missing: get config from master branch use for new branch
  • Loading branch information
pxlpnk committed Jul 8, 2012
1 parent 95209ef commit c63884e
Showing 1 changed file with 50 additions and 3 deletions.
53 changes: 50 additions & 3 deletions lib/kraken-build.rb
Expand Up @@ -7,8 +7,55 @@



module Kraken
module Build
# Your code goes here...
module KrakenBuild

def self.set_config(options = {})
@config = options
@repository = options[:repository]
@github = GithubApi.new(@config)
@jenkins = JenkinsApi.new(@config)
@jobs = []
@branches = []

@config
end

def self.get_jenkins_branches
@jenkins.get_jobs.map{ |job| job =~ /^#{@repository}\.(.*)$/ && $1 }.compact
end

def self.get_github_branches
@github.get_branches
end

def self.run
@jobs = get_jenkins_branches
@branches = get_github_branches

create = compute_jobs_to_create
create.map do |job|
job_name = "#{@repository}.#{job}"
puts "creating => #{job_name}"
# @jenkins.create_job(job_name,"")
# @jenkins.build_job(job_name)
end


remove = compute_jobs_to_remove
remove.map do |job|
job_name = "#{@repository}.#{job}"
puts "removing => #{job_name}"
@jenkins.remove_job(job_name)
end

end

def self.compute_jobs_to_create
@branches - @jobs
end

def self.compute_jobs_to_remove
@jobs - @branches
end

end

0 comments on commit c63884e

Please sign in to comment.