Class: Pod::Command::Spec::Lint
- Inherits:
-
Pod::Command::Spec
- Object
- CLAide::Command
- Pod::Command
- Pod::Command::Spec
- Pod::Command::Spec::Lint
- Defined in:
- lib/cocoapods/command/spec/lint.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Lint
constructor
A new instance of Lint.
- #run ⇒ Object
Methods inherited from Pod::Command
#ensure_master_spec_repo_exists!, report_error, run
Methods included from Pod::Config::Mixin
Constructor Details
#initialize(argv) ⇒ Lint
Returns a new instance of Lint.
30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/cocoapods/command/spec/lint.rb', line 30 def initialize(argv) @quick = argv.flag?('quick') @allow_warnings = argv.flag?('allow-warnings') @clean = argv.flag?('clean', true) @fail_fast = argv.flag?('fail-fast', false) @subspecs = argv.flag?('subspecs', true) @only_subspec = argv.option('subspec') @use_frameworks = !argv.flag?('use-libraries') @source_urls = argv.option('sources', 'https://github.com/CocoaPods/Specs.git').split(',') @podspecs_paths = argv.arguments! super end |
Class Method Details
.options ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/cocoapods/command/spec/lint.rb', line 17 def self. [['--quick', 'Lint skips checks that would require to download and build the spec'], ['--allow-warnings', 'Lint validates even if warnings are present'], ['--subspec=NAME', 'Lint validates only the given subspec'], ['--no-subspecs', 'Lint skips validation of subspecs'], ['--no-clean', 'Lint leaves the build directory intact for inspection'], ['--fail-fast', 'Lint stops on the first failing platform or subspec'], ['--use-libraries', 'Lint uses static libraries to install the spec'], ['--sources=https://github.com/artsy/Specs,master', 'The sources from which to pull dependant pods ' \ '(defaults to https://github.com/CocoaPods/Specs.git). '\ 'Multiple sources must be comma-delimited.']].concat(super) end |
Instance Method Details
#run ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/cocoapods/command/spec/lint.rb', line 43 def run UI.puts failure_reasons = [] podspecs_to_lint.each do |podspec| validator = Validator.new(podspec, @source_urls) validator.quick = @quick validator.no_clean = !@clean validator.fail_fast = @fail_fast validator.allow_warnings = @allow_warnings validator.no_subspecs = !@subspecs || @only_subspec validator.only_subspec = @only_subspec validator.use_frameworks = @use_frameworks validator.validate failure_reasons << validator.failure_reason unless @clean UI.puts "Pods project available at `#{validator.validation_dir}/Pods/Pods.xcodeproj` for inspection." UI.puts end end count = podspecs_to_lint.count UI.puts "Analyzed #{count} #{'podspec'.pluralize(count)}.\n\n" failure_reasons.compact! if failure_reasons.empty? = count == 1 ? "#{podspecs_to_lint.first.basename} passed validation." : 'All the specs passed validation.' UI.puts .green << "\n\n" else raise Informative, if count == 1 "The spec did not pass validation, due to #{failure_reasons.first}." else "#{invalid_count} out of #{count} specs failed validation." end end podspecs_tmp_dir.rmtree if podspecs_tmp_dir.exist? end |