Class: Pod::Command::Thumbs
- Inherits:
-
Pod::Command
- Object
- Pod::Command
- Pod::Command::Thumbs
- Defined in:
- lib/cocoapods-thumbs/command/thumbs.rb,
lib/cocoapods-thumbs/command/thumbs/server.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Server
Constant Summary collapse
- THUMBS_TMP_DIR =
Pathname.new('/tmp/CocoaPods/Thumbs')
- DEFAULT_PLATFORM_VERSIONS =
{ :ios => '8.3', :osx => '10.10' }
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#platform ⇒ Object
Returns the value of attribute platform.
-
#platform_version ⇒ Object
Returns the value of attribute platform_version.
-
#requirement ⇒ Object
Returns the value of attribute requirement.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ Thumbs
constructor
A new instance of Thumbs.
- #run ⇒ Object
- #validate! ⇒ Object
Constructor Details
#initialize(argv) ⇒ Thumbs
Returns a new instance of Thumbs.
38 39 40 41 42 43 44 45 |
# File 'lib/cocoapods-thumbs/command/thumbs.rb', line 38 def initialize(argv) @comments = argv.flag?('comments') @platform = argv.option('platform', 'ios').to_sym @platform_version = argv.option('version', DEFAULT_PLATFORM_VERSIONS[@platform]) @name, @requirement = argv.shift_argument, argv.shift_argument @requirement ||= Pod::Requirement.default.to_s super end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
36 37 38 |
# File 'lib/cocoapods-thumbs/command/thumbs.rb', line 36 def name @name end |
#platform ⇒ Object
Returns the value of attribute platform.
36 37 38 |
# File 'lib/cocoapods-thumbs/command/thumbs.rb', line 36 def platform @platform end |
#platform_version ⇒ Object
Returns the value of attribute platform_version.
36 37 38 |
# File 'lib/cocoapods-thumbs/command/thumbs.rb', line 36 def platform_version @platform_version end |
#requirement ⇒ Object
Returns the value of attribute requirement.
36 37 38 |
# File 'lib/cocoapods-thumbs/command/thumbs.rb', line 36 def requirement @requirement end |
Class Method Details
.options ⇒ Object
47 48 49 50 51 52 53 |
# File 'lib/cocoapods-thumbs/command/thumbs.rb', line 47 def self. [ ['--comments', 'Display user comments alongside votes.'], ['--platform', 'When specifying a Podname the platform to use for calculating dependencies. Valid values: ios / osx. Defaults to ios.'], ['--version', 'When specifying a platform, use this option to set a version different than the default (iOS 8.3 and OS X 10.10)'] ].concat(super) end |
Instance Method Details
#run ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/cocoapods-thumbs/command/thumbs.rb', line 62 def run @configuration = Pod::Thumbs::Configuration.load @votes_list = Pod::Thumbs::VotesList.new(RestClient.get(@configuration[:url]).body) configure_sandbox_and_podfile sandbox = @sandbox podfile = @podfile analyzer = Installer::Analyzer.new( sandbox, podfile, nil ) specs = analyzer.analyze(false).specs_by_target.values.flatten(1) specs.each do |spec| voted_dependencies = @votes_list.find(spec.name, spec.version) if ! voted_dependencies.empty? then UI.section "#{spec.name} #{spec.version}" do voted_dependencies.each do |voted_dependency| UI.marked_labeled "", voted_dependency.dependency.requirement, voted_dependency.votes_summary_string if @comments then UI.indented_block do voted_dependency.votes.select {|v| v.comment != nil }.each do |vote| UI.marked_labeled vote.type_string, vote.voter, vote.comment, 15 end end end end end end end end |
#validate! ⇒ Object
55 56 57 58 59 60 |
# File 'lib/cocoapods-thumbs/command/thumbs.rb', line 55 def validate! super verify_config_exists! verify_podfile_exists! if @name.nil? verify_valid_platform! unless @name.nil? end |