Skip to content

Commit

Permalink
Removes excessive logging using 'puts'. Will be improved in #323
Browse files Browse the repository at this point in the history
  • Loading branch information
bartoszmajsak committed Jul 25, 2016
1 parent 7a38885 commit 9141e23
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions _ext/arquillian.rb
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,15 @@ def visit(repository, site)
clone_dir = File.join(repos_dir, repository.path)
rc = nil
if !File.directory? clone_dir
puts "Cloning repository #{repository.clone_url} -> #{clone_dir}"
# puts "Cloning repository #{repository.clone_url} -> #{clone_dir}"
rc = Git.clone(repository.clone_url, clone_dir)
if repository.master_branch.nil?
rc.checkout(repository.master_branch)
else
repository.master_branch = rc.current_branch
end
else
puts "Using cloned repository #{clone_dir}"
# puts "Using cloned repository #{clone_dir}"
rc = Git.open(clone_dir)
master_branch = repository.master_branch
if master_branch.nil?
Expand Down
7 changes: 4 additions & 3 deletions _ext/common.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# -*- encoding : utf-8 -*-

def getOrCache(tmp_file, url)
response_body = ""
if !File.exist?tmp_file
puts url
# puts url
response_body = RestClient.get(url, :cache => false) { |response, request, result, &block|
case response.code
when 404
Expand All @@ -23,7 +24,7 @@ def getOrCache(tmp_file, url)
def getOrCacheJSON(tmp_file, json_url)
json = {}
if !File.exist?tmp_file
puts 'Grabbing ' + json_url
# puts 'Grabbing ' + json_url
response_body = RestClient.get(json_url, :cache => false, :accept => 'application/json') { |response, request, result, &block|
case response.code
when 404
Expand All @@ -42,7 +43,7 @@ def getOrCacheJSON(tmp_file, json_url)
begin
json = JSON.parse File.read(tmp_file)
rescue => e
puts 'Could not parse JSON file ' + tmp_file + '; ' + e
# puts 'Could not parse JSON file ' + tmp_file + '; ' + e
json = {}
end
end
Expand Down
2 changes: 1 addition & 1 deletion _ext/guide.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def transform(site, page, rendered)

# Wrap <div class="header"> around the h2 section
# If you can do this more efficiently, feel free to improve it
puts page_content
# puts page_content
guide_content = guide_root.search('.titlebar').first.parent
indent = get_indent(get_depth(guide_content) + 2)
in_header = true
Expand Down
4 changes: 2 additions & 2 deletions _ext/identities.rb
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def lookup_by_contributor(contributor)
# identity = lookup_by_name(contributor.name) if identity.nil?
if identity.nil?
# Indication that we have a mismatched account
puts "Could not find contributor with e-mail " + contributor.email
# puts "Could not find contributor with e-mail " + contributor.email
end
identity
end
Expand All @@ -91,7 +91,7 @@ def lookup_by_contributor_email(email)
identity = self.find {|e| e.contributor and e.contributor.emails and e.contributor.emails.include? email }
if identity.nil?
# Indication that we have a mismatched account
puts "Could not find contributor with e-mail " + email
# puts "Could not find contributor with e-mail " + email
end
identity
end
Expand Down
1 change: 1 addition & 0 deletions _ext/lanyrd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def execute(site)
begin
page1 = Nokogiri::HTML(getOrCache(File.join(@lanyrd_tmp, "search-#{@term}-1.html"), search_url))
rescue => e
# In case lanyrd is down... which is not that rare
puts e
site.sessions = []
return
Expand Down
4 changes: 2 additions & 2 deletions _ext/restclient_extensions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def execute(&block)
end

if response.nil?
puts 'Fetching ' + self.url
# puts 'Fetching ' + self.url
response = _execute &block
instances.each do |instance|
instance.cache_miss(response) if instance.respond_to? 'cache_miss'
Expand Down Expand Up @@ -150,7 +150,7 @@ class << cachedResponse
def cache_miss(response)
if response.code == 200 and @cache and @request.method.eql? 'get' and
@redirects.eql? @request.headers[:redirects] and !response.body.empty?
puts "Cache miss because #{@cache_file} is missing or expired"
# puts "Cache miss because #{@cache_file} is missing or expired"
FileUtils.mkdir_p(File.dirname @cache_file)
begin
File.open(@cache_file, 'w:UTF-8') do |out|
Expand Down

0 comments on commit 9141e23

Please sign in to comment.