Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #2 from citizen428/master

Improve the Kraken!
  • Loading branch information...
commit e6c78f30002ccf101fb30e498412db689b2e66eb 2 parents b7bf609 + 07037ac
@pxlpnk authored
View
4 kraken-build.gemspec
@@ -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
9 lib/kraken-build.rb
@@ -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
View
14 spec/lib/jenkins_api_spec.rb
@@ -4,15 +4,11 @@
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
@@ -20,8 +16,8 @@
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
Please sign in to comment.
Something went wrong with that request. Please try again.