Sha256: 3fbb484a5226f761167de11edc53b1d80f24717ec9742412b408c8fabb1481b5
Contents?: true
Size: 1.33 KB
Versions: 2
Compression:
Stored size: 1.33 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) && 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cocoapods-stats-0.6.1 | lib/cocoapods_plugin.rb |
cocoapods-stats-0.6.0 | lib/cocoapods_plugin.rb |