lib/xcprofiler/plugin.rb in danger-xcprofiler-0.3.1 vs lib/xcprofiler/plugin.rb in danger-xcprofiler-0.4.0
- old
+ new
@@ -10,10 +10,14 @@
# @example Define thresholds (ms)
#
# xcprofiler.thresholds = { warn: 100, fail: 500 }
# xcprofiler.report 'MyApp'
#
+ # @example Specify a custom DerivedData directory
+ #
+ # xcprofiler.report 'MyApp' './DerivedData'
+ #
# @see giginet/danger-xcprofiler
# @tags xcode, ios, danger
class DangerXcprofiler < Plugin
# Defines path for working directory
# Default value is `Dir.pwd`
@@ -31,17 +35,26 @@
# Default value is `true`
# @param [Boolean] value
# @return [Boolean]
attr_accessor :inline_mode
+ # A globbed string or array of strings which should match the files
+ # that you want to ignore warnings on. Defaults to nil.
+ # An example would be `'**/Pods/**'` to ignore warnings in Pods that your project uses.
+ #
+ # @param [String or [String]] value
+ # @return [[String]]
+ attr_accessor :ignored_files
+
# Search the latest .xcactivitylog by the passing product_name and profile compilation time
# @param [String] product_name Product name for the target project.
+ # @param [String] derived_data_path Path to the directory containing the DerivedData.
# @return [void]
- def report(product_name)
- profiler = Xcprofiler::Profiler.by_product_name(product_name)
+ def report(product_name, derived_data_path = nil)
+ profiler = Xcprofiler::Profiler.by_product_name(product_name, derived_data_path)
profiler.reporters = [
- DangerReporter.new(@dangerfile, thresholds, inline_mode, working_dir)
+ DangerReporter.new(@dangerfile, thresholds, inline_mode, working_dir, ignored_files)
]
profiler.report!
rescue Xcprofiler::DerivedDataNotFound, Xcprofiler::BuildFlagIsNotEnabled => e
warn(e.message)
end
@@ -56,9 +69,10 @@
@thresholds || { warn: 50, fail: 100 }
end
def inline_mode
return true if @inline_mode.nil?
+
!!@inline_mode
end
end
end