Class: ADLicenseLint::Runner
- Inherits:
-
Object
- Object
- ADLicenseLint::Runner
- Defined in:
- lib/ad_licenselint/runner.rb
Constant Summary collapse
- POD_SOURCES =
["trunk", "master"] .map { |source| File.join(ENV["HOME"], ".cocoapods/repos", source) } .select { |path| File.exist? path } .map { |path| Pod::Source.new path }
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #create_report ⇒ Object
- #format(report) ⇒ Object
-
#initialize(options = nil) ⇒ Runner
constructor
A new instance of Runner.
- #run ⇒ Object
Constructor Details
#initialize(options = nil) ⇒ Runner
Returns a new instance of Runner.
13 14 15 16 17 18 19 20 |
# File 'lib/ad_licenselint/runner.rb', line 13 def initialize( = nil) if .nil? @options = OptionHandler.parse else @options = ADLicenseLint::Constant::DEFAULT_OPTIONS.merge() end @path = File.(@options[:path]) end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
6 7 8 |
# File 'lib/ad_licenselint/runner.rb', line 6 def @options end |
#path ⇒ Object
Returns the value of attribute path.
6 7 8 |
# File 'lib/ad_licenselint/runner.rb', line 6 def path @path end |
Instance Method Details
#create_report ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ad_licenselint/runner.rb', line 22 def create_report raise "Folder #{target_support_path} does not exist" if Dir[target_support_path].empty? plist_files = Dir[acknowledgements_plist_path] # one plist for each target json_contents = plist_files.map { |plist_file| acknowledgement_json(plist_file) } entries = all_entries(json_contents) warning_entries = entries.reject { |entry| accepted? entry } displayed_entries = [:all] ? entries : warning_entries Report.new(displayed_entries) end |
#format(report) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/ad_licenselint/runner.rb', line 34 def format(report) if report.empty? LOGGER.log(:info, :green, "No warnings found.") return "" end case [:format] when ADLicenseLint::Constant::MARKDOWN_FORMAT_OPTION MarkdownFormatter.new(report).formatted_content when ADLicenseLint::Constant::TERMINAL_FORMAT_OPTION TerminalFormatter.new(report).formatted_content end end |
#run ⇒ Object
48 49 50 |
# File 'lib/ad_licenselint/runner.rb', line 48 def run format create_report end |