Skip to content

Commit 6bd66f3

Browse files
author
Glyn Normington
committed
Merge 55005634-public-API-check to master
[Completes #55005634]
2 parents 7b40cd9 + 19fd3f6 commit 6bd66f3

5 files changed

Lines changed: 49 additions & 3 deletions

File tree

Rakefile

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,27 @@ require 'rspec/core/rake_task'
1717
RSpec::Core::RakeTask.new
1818

1919
require 'yard'
20-
YARD::Rake::YardocTask.new
20+
YARD::Rake::YardocTask.new do |t|
21+
t.options = ['--no-stats']
22+
end
2123

2224
require 'rubocop/rake_task'
2325
Rubocop::RakeTask.new
2426

27+
require 'open3'
28+
task :check_api_doc do
29+
puts "\nChecking API documentation..."
30+
output = Open3.capture3("yard stats --list-undoc")[0]
31+
if output !~ /100.00% documented/
32+
puts "\nFailed due to undocumented public API:\n\n#{output}"
33+
exit 1
34+
else
35+
puts "\n#{output}\n"
36+
end
37+
end
38+
2539
require 'rake/clean'
2640
CLEAN.include %w(.yardoc coverage)
2741
CLOBBER.include %w(doc pkg)
2842

29-
task :default => [ :rubocop, :yard, :spec ]
43+
task :default => [ :rubocop, :check_api_doc, :yard, :spec ]

lib/java_buildpack/diagnostics/common.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,18 @@ module JavaBuildpack::Diagnostics
2424
# The name of the buildpack diagnostic log file.
2525
LOG_FILE_NAME = 'buildpack.log'.freeze
2626

27+
# Returns the full path of the buildpack diagnostics directory.
28+
#
29+
# @param [String] app_dir the application root directory
30+
# @return [String] the full path of the buildpack diagnostics directory
2731
def self.get_diagnostic_directory(app_dir)
2832
File.join(app_dir, DIAGNOSTICS_DIRECTORY)
2933
end
3034

35+
# Returns the full path of the buildpack log file.
36+
#
37+
# @param [String] app_dir the application root directory
38+
# @return [String] the full path of the buildpack log file
3139
def self.get_buildpack_log(app_dir)
3240
File.join(get_diagnostic_directory(app_dir), LOG_FILE_NAME)
3341
end

lib/java_buildpack/diagnostics/logger_factory.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
module JavaBuildpack::Diagnostics
2525

26+
# Factory for the buildpack diagnostic logger.
2627
class LoggerFactory
2728
# Create a Logger for the given application directory.
2829
#
@@ -116,18 +117,25 @@ def self.close
116117
end
117118
end
118119

120+
# A +Logger+ destination which delegates to multiple underlying destinations.
119121
class LogSplitter
122+
# Initializes a +LogSplitter+ with a given array of destinations.
123+
# @param [Array] destinations an array of destinations
120124
def initialize(*destinations)
121125
@destinations = destinations
122126
end
123127

128+
# Writes to the underlying destinations.
129+
#
130+
# @param [Array] args the arguments for the delegated call
124131
def write(*args)
125132
@destinations.each do |destination|
126133
destination.write(*args)
127134
destination.flush
128135
end
129136
end
130137

138+
# Closes the underlying destinations.
131139
def close
132140
@destinations.each do |destination|
133141
destination.close
@@ -136,11 +144,19 @@ def close
136144

137145
end
138146

147+
# A subclass of the standard +Logger+ which determines the caller from the stack.
139148
class Logger < ::Logger
149+
# Initializes a Logger.
150+
# @param [Object] log_dev the destination 'device' to log to
140151
def initialize(log_dev)
141152
super
142153
end
143154

155+
# Logs a message with a given severity.
156+
#
157+
# @param [String] severity the severity of the log message
158+
# @param [Object, nil] message the message to be logged
159+
# @param [String, nil] progname the name of the program logging the message
144160
def add(severity, message = nil, progname = nil, &block)
145161

146162
if message || block_given?
@@ -158,6 +174,7 @@ def add(severity, message = nil, progname = nil, &block)
158174
super(severity, message_text, program_name, &block)
159175
end
160176

177+
# Closes the logger.
161178
def close
162179
warn(caller[0]) { 'logger is being closed' }
163180
super

lib/java_buildpack/repository/configured_item.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ class ConfiguredItem
2929
# @option configuration [String] :repository_root the root directory of the repository
3030
# @option configuration [String] :version the version of the file to resolve
3131
# @param [Block, nil] version_validator an optional version validation block
32-
# @return [JavaBuildpack::Util::TokenizedVersion] the chosen version of the file
3332
# @return [String] the URI of the chosen version of the file
33+
# @return [JavaBuildpack::Util::TokenizedVersion] the chosen version of the file
3434
def self.find_item(configuration, &version_validator)
3535
repository_root = ConfiguredItem.repository_root(configuration)
3636
version = ConfiguredItem.version(configuration)

lib/java_buildpack/util/download.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@
2020

2121
module JavaBuildpack::Util
2222

23+
# Downloads a given item using the application cache.
24+
#
25+
# @param [JavaBuildpack::Util::TokenizedVersion] version the version of the item
26+
# @param [String] uri the URI of the item
27+
# @param [String] description a description of the item
28+
# @param [String] jar_name the filename of the item
29+
# @param [String] target_directory the path of the directory into which to download the item
2330
def self.download(version, uri, description, jar_name, target_directory)
2431

2532
download_start_time = Time.now

0 commit comments

Comments
 (0)