Sha256: 217dbb31f8dcef7bba14c85d92667700a6984e08d7bd37af4ea9b65538f5fb48
Contents?: true
Size: 1.27 KB
Versions: 2
Compression:
Stored size: 1.27 KB
Contents
module CocoaPodsStats class SpecsRepoValidator def validates?(source) source && 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? master_source = Pod::SourcesManager.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) && context.sandbox_root.start_with?(Pod::Command::Try::TRY_TMP_DIR.to_s) # Send the analytics stuff up Sender.new.send(targets, :pod_try => is_pod_try) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cocoapods-stats-0.5.3 | lib/cocoapods_plugin.rb |
cocoapods-stats-0.5.2 | lib/cocoapods_plugin.rb |