Sha256: 9d169df894fb933692c42669d310f4aeeb298bc270bcd8e0dd8bc9b5d0a2ef50
Contents?: true
Size: 1.54 KB
Versions: 3
Compression:
Stored size: 1.54 KB
Contents
module CocoaPodsStats class SpecsRepoValidator def validates?(source) source && source.url && source.url.end_with?('CocoaPods/Specs.git') end end class OptOutValidator def validates? ENV['COCOAPODS_DISABLE_STATS'].nil? end end Pod::HooksManager.register('cocoapods-stats', :post_install) do |context, _| require 'set' require 'cocoapods' require 'cocoapods_stats/target_mapper' require 'cocoapods_stats/sender' validator = OptOutValidator.new next unless validator.validates? sources_manager = if defined?(Pod::SourcesManager) Pod::SourcesManager else Pod::Config.instance.sources_manager end master_source = sources_manager.master.first validator = SpecsRepoValidator.new next unless validator.validates?(master_source) Pod::UI.titled_section 'Sending stats' do master_pods = Set.new(master_source.pods) mapper = TargetMapper.new targets = mapper.pods_from_project(context, master_pods) # Logs out for now: targets.flat_map { |t| t[:pods] }.uniq.sort_by { |p| p[:name] }.each do |pod| Pod::UI.message "#{pod[:name]}, #{pod[:version]}", '- ' end is_pod_try = defined?(Pod::Command::Try::TRY_TMP_DIR) && Pod::Command::Try::TRY_TMP_DIR.exist? && context.sandbox_root.start_with?(Pod::Command::Try::TRY_TMP_DIR.realpath.to_s) # Send the analytics stuff up Sender.new.send(targets, :pod_try => is_pod_try) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
cocoapods-stats-1.0.0 | lib/cocoapods_plugin.rb |
cocoapods-stats-1.0.0.rc.1 | lib/cocoapods_plugin.rb |
cocoapods-stats-1.0.0.beta.4 | lib/cocoapods_plugin.rb |