class CocoaPodsStats::Stats

Public Instance Methods

fork_available?() click to toggle source
# File lib/cocoapods_plugin.rb, line 25
def fork_available?
  !Gem.win_platform?
end
send_stats(master_source, context) click to toggle source
# File lib/cocoapods_plugin.rb, line 15
def send_stats(master_source, context)
  if fork_available?
    Process.fork do
      compute_and_send_stats(master_source, context)
    end
  else
    compute_and_send_stats(master_source, context)
  end
end

Private Instance Methods

compute_and_send_stats(master_source, context) click to toggle source
# File lib/cocoapods_plugin.rb, line 31
def compute_and_send_stats(master_source, context)
  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