Skip to content
This repository has been archived by the owner on May 10, 2021. It is now read-only.

Commit

Permalink
Adding more control over debug output
Browse files Browse the repository at this point in the history
  • Loading branch information
igormoochnick committed May 1, 2014
1 parent f1e1c69 commit ffeb903
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lib/jenkins_pipeline_builder/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class Generator
def initialize(args, client)
@client = client
@logger = @client.logger
#@logger.level = (@debug) ? Logger::DEBUG : Logger::INFO;
@job_templates = {}
@job_collection = {}

Expand Down Expand Up @@ -95,7 +96,14 @@ def initialize(args, client)
end

attr_accessor :client
attr_accessor :debug
#attr_accessor :debug
def debug=(value)
@debug = value
@logger.level = (value) ? Logger::DEBUG : Logger::INFO;
end
def debug
@debug
end
# TODO: WTF?
attr_accessor :no_files
attr_accessor :job_collection
Expand All @@ -109,6 +117,7 @@ def view
end

def load_collection_from_path(path, recursively = false)
path = File.expand_path(path, relative_to=Dir.getwd)
if File.directory?(path)
@logger.info "Generating from folder #{path}"
Dir[File.join(path, '/*.yaml'), File.join(path, '/*.yml')].each do |file|
Expand Down Expand Up @@ -183,6 +192,7 @@ def resolve_job_by_name(name, settings = {})
job = get_item(name)
raise "Failed to locate job by name '#{name}'" if job.nil?
job_value = job[:value]
@logger.debug "Compiling job #{name}"
compiled_job = Compiler.compile(job_value, settings)
return compiled_job
end
Expand Down

0 comments on commit ffeb903

Please sign in to comment.