Permalink
Browse files

Merge pull request #2 from citizen428/master

Improve the Kraken!
  • Loading branch information...
2 parents b7bf609 + 07037ac commit e6c78f30002ccf101fb30e498412db689b2e66eb @pxlpnk committed Jul 12, 2012
Showing with 8 additions and 19 deletions.
  1. +1 −3 kraken-build.gemspec
  2. +2 −7 lib/kraken-build.rb
  3. +5 −9 spec/lib/jenkins_api_spec.rb
View
@@ -17,9 +17,7 @@ Gem::Specification.new do |gem|
gem.add_development_dependency "rspec"
- gem.add_dependency "rake"
+ gem.add_development_dependency "rake"
gem.add_dependency "httparty"
- gem.add_dependency "nokogiri"
# Other attributes omitted
-
end
View
@@ -6,13 +6,10 @@
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 = []
@@ -22,7 +19,7 @@ def self.set_config(options = {})
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
@@ -41,14 +38,12 @@ def self.run
@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
@@ -4,24 +4,20 @@
context "configurations" do
before(:each) do
- api = JenkinsApi.new
+ JenkinsApi.instance_variable_set(:@default_options, {})
end
- it "uses no basic_auth when username and password are not prived" do
- pending("flapping")
- asd = {:user_name => nil, :password =>"nil"}
- api = asd
- api = JenkinsApi.new(asd)
-
+ it "uses no basic_auth when username and password are not prived" do
+ api = JenkinsApi.new
api.class.default_options[:basic_auth].should be(nil)
end
it "uses basic_auth when username and password prived" do
options = {:username => 'user', :password => 'password'}
api = JenkinsApi.new(options)
- api.class.default_options[:basic_auth][:username] == options[:username].should
- api.class.default_options[:basic_auth][:password] == options[:password].should
+ api.class.default_options[:basic_auth][:username].should == options[:username]
+ api.class.default_options[:basic_auth][:password].should == options[:password]
end
it "uses a port when provided" do

0 comments on commit e6c78f3

Please sign in to comment.