lib/kraken-build.rb in kraken-build-0.0.2 vs lib/kraken-build.rb in kraken-build-0.0.3
- old
+ new
@@ -4,27 +4,24 @@
require "kraken-build/version"
require "kraken-build/jenkins-api.rb"
require "kraken-build/github-api.rb"
-
-
module KrakenBuild
-
def self.set_config(options = {})
@config = options
- @repository = options[:repository]
+ @repository = @config[: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
+ @jenkins.get_jobs.map { |job| job =~ /^#{@repository}\.(.*)$/ && $1 }.compact
end
def self.get_github_branches
@github.get_branches
end
@@ -39,17 +36,15 @@
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