| 
									
										
										
										
											2019-04-19 15:38:03 +09:00
										 |  |  | # frozen_string_literal: true | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-03-18 17:02:08 +02:00
										 |  |  | require "missing_formula" | 
					
						
							| 
									
										
										
										
											2014-06-19 17:52:42 -05:00
										 |  |  | require "caveats" | 
					
						
							| 
									
										
										
										
											2019-04-17 18:25:08 +09:00
										 |  |  | require "cli/parser" | 
					
						
							| 
									
										
										
										
											2015-12-27 19:12:27 +01:00
										 |  |  | require "options" | 
					
						
							| 
									
										
										
										
											2014-06-19 17:52:42 -05:00
										 |  |  | require "formula" | 
					
						
							|  |  |  | require "keg" | 
					
						
							|  |  |  | require "tab" | 
					
						
							| 
									
										
										
										
											2016-11-20 13:00:01 -05:00
										 |  |  | require "json" | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-18 22:41:47 -05:00
										 |  |  | module Homebrew | 
					
						
							| 
									
										
										
										
											2016-09-26 01:44:51 +02:00
										 |  |  |   module_function | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-07 19:31:20 +05:30
										 |  |  |   def info_args | 
					
						
							|  |  |  |     Homebrew::CLI::Parser.new do | 
					
						
							|  |  |  |       usage_banner <<~EOS | 
					
						
							| 
									
										
										
										
											2019-03-11 12:59:39 -04:00
										 |  |  |         `info` [<options>] [<formula>] | 
					
						
							| 
									
										
										
										
											2018-11-07 19:31:20 +05:30
										 |  |  | 
 | 
					
						
							|  |  |  |         Display brief statistics for your Homebrew installation. | 
					
						
							| 
									
										
										
										
											2019-03-11 12:59:39 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-20 00:04:14 -04:00
										 |  |  |         If <formula> is provided, show summary of information about <formula>. | 
					
						
							| 
									
										
										
										
											2018-11-07 19:31:20 +05:30
										 |  |  |       EOS | 
					
						
							|  |  |  |       switch "--analytics", | 
					
						
							| 
									
										
										
										
											2019-08-20 00:04:14 -04:00
										 |  |  |              description: "List global Homebrew analytics data or, if specified, installation and "\ | 
					
						
							| 
									
										
										
										
											2019-04-30 08:44:35 +01:00
										 |  |  |                           "build error data for <formula> (provided neither `HOMEBREW_NO_ANALYTICS` "\ | 
					
						
							|  |  |  |                           "nor `HOMEBREW_NO_GITHUB_API` are set)." | 
					
						
							| 
									
										
										
										
											2018-11-07 19:31:20 +05:30
										 |  |  |       flag   "--days", | 
					
						
							| 
									
										
										
										
											2019-04-30 08:44:35 +01:00
										 |  |  |              depends_on:  "--analytics", | 
					
						
							|  |  |  |              description: "How many days of global analytics data to retrieve. "\ | 
					
						
							|  |  |  |                           "The value for <days> must be `30`, `90` or `365`. The default is `30`." | 
					
						
							| 
									
										
										
										
											2018-11-07 19:31:20 +05:30
										 |  |  |       flag   "--category", | 
					
						
							| 
									
										
										
										
											2019-04-30 08:44:35 +01:00
										 |  |  |              depends_on:  "--analytics", | 
					
						
							|  |  |  |              description: "Which type of global analytics data to retrieve. "\ | 
					
						
							|  |  |  |                           "The value for <category> must be `install`, `install-on-request`, "\ | 
					
						
							|  |  |  |                           "`cask-install`, `build-error` or `os-version`. The default is `install`." | 
					
						
							| 
									
										
										
										
											2018-11-07 19:31:20 +05:30
										 |  |  |       switch "--github", | 
					
						
							| 
									
										
										
										
											2019-08-20 00:04:14 -04:00
										 |  |  |              description: "Open the GitHub source page for <formula> in a browser. "\ | 
					
						
							| 
									
										
										
										
											2019-04-30 08:44:35 +01:00
										 |  |  |                           "To view formula history locally: `brew log -p` <formula>" | 
					
						
							| 
									
										
										
										
											2019-08-06 13:23:19 -04:00
										 |  |  |       flag   "--json", | 
					
						
							|  |  |  |              description: "Print a JSON representation of <formula>. Currently the default and only accepted "\ | 
					
						
							|  |  |  |                           "value for <version> is `v1`. See the docs for examples of using the JSON "\ | 
					
						
							|  |  |  |                           "output: <https://docs.brew.sh/Querying-Brew>" | 
					
						
							| 
									
										
										
										
											2018-11-07 19:31:20 +05:30
										 |  |  |       switch "--installed", | 
					
						
							| 
									
										
										
										
											2019-04-30 08:44:35 +01:00
										 |  |  |              depends_on:  "--json", | 
					
						
							|  |  |  |              description: "Print JSON of formulae that are currently installed." | 
					
						
							| 
									
										
										
										
											2019-03-11 12:59:39 -04:00
										 |  |  |       switch "--all", | 
					
						
							| 
									
										
										
										
											2019-04-30 08:44:35 +01:00
										 |  |  |              depends_on:  "--json", | 
					
						
							|  |  |  |              description: "Print JSON of all available formulae." | 
					
						
							| 
									
										
										
										
											2018-11-07 19:31:20 +05:30
										 |  |  |       switch :verbose, | 
					
						
							| 
									
										
										
										
											2019-04-30 08:44:35 +01:00
										 |  |  |              description: "Show more verbose analytics data for <formula>." | 
					
						
							| 
									
										
										
										
											2018-11-07 19:31:20 +05:30
										 |  |  |       switch :debug | 
					
						
							| 
									
										
										
										
											2019-03-11 12:59:39 -04:00
										 |  |  |       conflicts "--installed", "--all" | 
					
						
							| 
									
										
										
										
											2018-11-07 19:31:20 +05:30
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  |   def info | 
					
						
							| 
									
										
										
										
											2018-11-07 19:31:20 +05:30
										 |  |  |     info_args.parse | 
					
						
							| 
									
										
										
										
											2019-01-04 13:26:16 +00:00
										 |  |  |     if args.json | 
					
						
							| 
									
										
										
										
											2019-01-04 09:43:51 -08:00
										 |  |  |       raise UsageError, "invalid JSON version: #{args.json}" unless ["v1", true].include? args.json | 
					
						
							| 
									
										
										
										
											2019-02-19 13:12:52 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-01-04 09:43:51 -08:00
										 |  |  |       print_json | 
					
						
							| 
									
										
										
										
											2018-11-07 19:31:20 +05:30
										 |  |  |     elsif args.github? | 
					
						
							| 
									
										
										
										
											2013-03-28 17:37:29 -05:00
										 |  |  |       exec_browser(*ARGV.formulae.map { |f| github_info(f) }) | 
					
						
							| 
									
										
										
										
											2012-08-15 22:08:40 -05:00
										 |  |  |     else | 
					
						
							|  |  |  |       print_info | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def print_info | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  |     if ARGV.named.empty? | 
					
						
							| 
									
										
										
										
											2018-11-07 19:31:20 +05:30
										 |  |  |       if args.analytics? | 
					
						
							| 
									
										
										
										
											2018-10-20 12:06:24 +01:00
										 |  |  |         output_analytics | 
					
						
							|  |  |  |       elsif HOMEBREW_CELLAR.exist? | 
					
						
							| 
									
										
										
										
											2015-08-13 20:35:22 +08:00
										 |  |  |         count = Formula.racks.length | 
					
						
							| 
									
										
										
										
											2019-04-24 14:17:04 -07:00
										 |  |  |         puts "#{count} #{"keg".pluralize(count)}, #{HOMEBREW_CELLAR.dup.abv}" | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  |       end | 
					
						
							|  |  |  |     else | 
					
						
							| 
									
										
										
										
											2015-08-03 13:09:07 +01:00
										 |  |  |       ARGV.named.each_with_index do |f, i| | 
					
						
							| 
									
										
										
										
											2016-09-10 10:24:56 +01:00
										 |  |  |         puts unless i.zero? | 
					
						
							| 
									
										
										
										
											2013-04-29 10:12:40 -07:00
										 |  |  |         begin | 
					
						
							| 
									
										
										
										
											2018-10-21 13:07:08 +01:00
										 |  |  |           formula = if f.include?("/") || File.exist?(f) | 
					
						
							|  |  |  |             Formulary.factory(f) | 
					
						
							|  |  |  |           else | 
					
						
							|  |  |  |             Formulary.find_with_priority(f) | 
					
						
							|  |  |  |           end | 
					
						
							| 
									
										
										
										
											2018-11-07 19:31:20 +05:30
										 |  |  |           if args.analytics? | 
					
						
							| 
									
										
										
										
											2018-10-21 13:07:08 +01:00
										 |  |  |             output_formula_analytics(formula) | 
					
						
							| 
									
										
										
										
											2015-08-09 22:43:01 +08:00
										 |  |  |           else | 
					
						
							| 
									
										
										
										
											2018-10-21 13:07:08 +01:00
										 |  |  |             info_formula(formula) | 
					
						
							| 
									
										
										
										
											2015-08-09 22:43:01 +08:00
										 |  |  |           end | 
					
						
							| 
									
										
										
										
											2016-12-25 18:54:08 -05:00
										 |  |  |         rescue FormulaUnavailableError => e | 
					
						
							| 
									
										
										
										
											2018-11-07 19:31:20 +05:30
										 |  |  |           if args.analytics? | 
					
						
							| 
									
										
										
										
											2018-10-21 13:07:08 +01:00
										 |  |  |             output_analytics(filter: f) | 
					
						
							|  |  |  |             next | 
					
						
							|  |  |  |           end | 
					
						
							| 
									
										
										
										
											2017-03-22 21:55:22 +00:00
										 |  |  |           ofail e.message | 
					
						
							| 
									
										
										
										
											2017-03-18 17:02:08 +02:00
										 |  |  |           # No formula with this name, try a missing formula lookup | 
					
						
							| 
									
										
										
										
											2019-03-24 15:28:34 -04:00
										 |  |  |           if (reason = MissingFormula.reason(f, show_info: true)) | 
					
						
							| 
									
										
										
										
											2017-03-22 21:55:22 +00:00
										 |  |  |             $stderr.puts reason | 
					
						
							| 
									
										
										
										
											2016-12-25 18:54:08 -05:00
										 |  |  |           end | 
					
						
							| 
									
										
										
										
											2013-04-29 10:12:40 -07:00
										 |  |  |         end | 
					
						
							|  |  |  |       end | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-08-15 22:08:40 -05:00
										 |  |  |   def print_json | 
					
						
							| 
									
										
										
										
											2018-11-07 19:31:20 +05:30
										 |  |  |     ff = if args.all? | 
					
						
							| 
									
										
										
										
											2017-10-14 06:44:30 +01:00
										 |  |  |       Formula.sort | 
					
						
							| 
									
										
										
										
											2018-11-07 19:31:20 +05:30
										 |  |  |     elsif args.installed? | 
					
						
							| 
									
										
										
										
											2017-10-14 06:44:30 +01:00
										 |  |  |       Formula.installed.sort | 
					
						
							| 
									
										
										
										
											2015-08-03 13:09:07 +01:00
										 |  |  |     else | 
					
						
							|  |  |  |       ARGV.formulae | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |     json = ff.map(&:to_hash) | 
					
						
							| 
									
										
										
										
											2016-11-20 13:00:01 -05:00
										 |  |  |     puts JSON.generate(json) | 
					
						
							| 
									
										
										
										
											2012-08-15 22:08:40 -05:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-09-08 15:57:48 +08:00
										 |  |  |   def github_remote_path(remote, path) | 
					
						
							|  |  |  |     if remote =~ %r{^(?:https?://|git(?:@|://))github\.com[:/](.+)/(.+?)(?:\.git)?$} | 
					
						
							| 
									
										
										
										
											2017-06-10 20:23:20 +03:00
										 |  |  |       "https://github.com/#{Regexp.last_match(1)}/#{Regexp.last_match(2)}/blob/master/#{path}" | 
					
						
							| 
									
										
										
										
											2015-09-08 15:57:48 +08:00
										 |  |  |     else | 
					
						
							|  |  |  |       "#{remote}/#{path}" | 
					
						
							| 
									
										
										
										
											2012-03-06 17:35:10 +00:00
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-03 13:09:07 +01:00
										 |  |  |   def github_info(f) | 
					
						
							| 
									
										
										
										
											2015-12-06 22:24:46 +08:00
										 |  |  |     if f.tap | 
					
						
							|  |  |  |       if remote = f.tap.remote | 
					
						
							|  |  |  |         path = f.path.relative_path_from(f.tap.path) | 
					
						
							| 
									
										
										
										
											2015-09-08 15:57:48 +08:00
										 |  |  |         github_remote_path(remote, path) | 
					
						
							|  |  |  |       else | 
					
						
							|  |  |  |         f.path | 
					
						
							|  |  |  |       end | 
					
						
							| 
									
										
										
										
											2015-11-02 19:11:17 +08:00
										 |  |  |     else | 
					
						
							|  |  |  |       f.path | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  |     end | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-03 13:09:07 +01:00
										 |  |  |   def info_formula(f) | 
					
						
							| 
									
										
										
										
											2012-04-05 21:11:49 -05:00
										 |  |  |     specs = [] | 
					
						
							| 
									
										
										
										
											2014-03-10 14:56:02 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  |     if stable = f.stable | 
					
						
							|  |  |  |       s = "stable #{stable.version}" | 
					
						
							|  |  |  |       s += " (bottled)" if stable.bottled? | 
					
						
							|  |  |  |       specs << s | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if devel = f.devel | 
					
						
							| 
									
										
										
										
											2019-01-14 16:47:07 +00:00
										 |  |  |       specs << "devel #{devel.version}" | 
					
						
							| 
									
										
										
										
											2014-03-10 14:56:02 -05:00
										 |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-05 21:11:49 -05:00
										 |  |  |     specs << "HEAD" if f.head | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-11-16 20:10:25 +08:00
										 |  |  |     attrs = [] | 
					
						
							|  |  |  |     attrs << "pinned at #{f.pinned_version}" if f.pinned? | 
					
						
							|  |  |  |     attrs << "keg-only" if f.keg_only? | 
					
						
							| 
									
										
										
										
											2012-04-05 21:11:49 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-05 22:01:32 +08:00
										 |  |  |     puts "#{f.full_name}: #{specs * ", "}#{" [#{attrs * ", "}]" unless attrs.empty?}" | 
					
						
							| 
									
										
										
										
											2015-05-19 13:05:42 -04:00
										 |  |  |     puts f.desc if f.desc | 
					
						
							| 
									
										
										
										
											2016-08-30 21:38:13 +02:00
										 |  |  |     puts Formatter.url(f.homepage) if f.homepage | 
					
						
							| 
									
										
										
										
											2011-06-21 13:57:09 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-09 17:14:09 -04:00
										 |  |  |     conflicts = f.conflicts.map do |c| | 
					
						
							| 
									
										
										
										
											2017-05-14 15:09:01 -04:00
										 |  |  |       reason = " (because #{c.reason})" if c.reason | 
					
						
							|  |  |  |       "#{c.name}#{reason}" | 
					
						
							| 
									
										
										
										
											2017-04-09 17:14:09 -04:00
										 |  |  |     end.sort! | 
					
						
							| 
									
										
										
										
											2017-05-15 10:40:07 +01:00
										 |  |  |     unless conflicts.empty? | 
					
						
							| 
									
										
										
										
											2017-10-15 02:28:32 +02:00
										 |  |  |       puts <<~EOS | 
					
						
							| 
									
										
										
										
											2017-05-15 10:40:07 +01:00
										 |  |  |         Conflicts with: | 
					
						
							| 
									
										
										
										
											2017-05-16 10:04:15 +01:00
										 |  |  |           #{conflicts.join("\n  ")} | 
					
						
							| 
									
										
										
										
											2017-05-15 10:40:07 +01:00
										 |  |  |       EOS | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-26 09:21:38 +00:00
										 |  |  |     kegs = f.installed_kegs | 
					
						
							|  |  |  |     heads, versioned = kegs.partition { |k| k.version.head? } | 
					
						
							|  |  |  |     kegs = [ | 
					
						
							|  |  |  |       *heads.sort_by { |k| -Tab.for_keg(k).time.to_i }, | 
					
						
							|  |  |  |       *versioned.sort_by(&:version), | 
					
						
							|  |  |  |     ] | 
					
						
							| 
									
										
										
										
											2016-08-05 22:01:32 +08:00
										 |  |  |     if kegs.empty? | 
					
						
							|  |  |  |       puts "Not installed" | 
					
						
							|  |  |  |     else | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  |       kegs.each do |keg| | 
					
						
							| 
									
										
										
										
											2015-08-03 13:09:07 +01:00
										 |  |  |         puts "#{keg} (#{keg.abv})#{" *" if keg.linked?}" | 
					
						
							| 
									
										
										
										
											2013-03-27 23:07:33 -05:00
										 |  |  |         tab = Tab.for_keg(keg).to_s | 
					
						
							|  |  |  |         puts "  #{tab}" unless tab.empty? | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  |       end | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-30 21:38:13 +02:00
										 |  |  |     puts "From: #{Formatter.url(github_info(f))}" | 
					
						
							| 
									
										
										
										
											2012-03-06 17:35:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-10 23:45:06 -05:00
										 |  |  |     unless f.deps.empty? | 
					
						
							|  |  |  |       ohai "Dependencies" | 
					
						
							| 
									
										
										
										
											2015-08-03 13:09:07 +01:00
										 |  |  |       %w[build required recommended optional].map do |type| | 
					
						
							| 
									
										
										
											
												cmd/info: prevent duplicate dependency display.
Before:
    $ brew info llvm
    ==> Dependencies
    Build: xz ✔, xz ✔, xz ✔, xz ✔, xz ✔, xz ✔
    $ brew info --json=v1 llvm
    ... "dependencies":["xz","xz","xz","xz","xz","xz"], ...
After
    $ brew info llvm
    ==> Dependencies
    Build: xz ✔
    $ brew info --json=v1 llvm
    ... "dependencies":["xz"], ...
Closes Homebrew/homebrew#36653.
Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
											
										 
											2015-02-08 23:20:45 +08:00
										 |  |  |         deps = f.deps.send(type).uniq | 
					
						
							| 
									
										
										
										
											2013-11-11 14:15:46 +00:00
										 |  |  |         puts "#{type.capitalize}: #{decorate_dependencies deps}" unless deps.empty? | 
					
						
							| 
									
										
										
										
											2013-05-10 23:45:06 -05:00
										 |  |  |       end | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-18 00:12:49 -04:00
										 |  |  |     unless f.requirements.to_a.empty? | 
					
						
							|  |  |  |       ohai "Requirements" | 
					
						
							|  |  |  |       %w[build required recommended optional].map do |type| | 
					
						
							|  |  |  |         reqs = f.requirements.select(&:"#{type}?") | 
					
						
							| 
									
										
										
										
											2016-09-18 00:37:02 -04:00
										 |  |  |         next if reqs.to_a.empty? | 
					
						
							| 
									
										
										
										
											2018-09-17 02:45:00 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-09-18 00:37:02 -04:00
										 |  |  |         puts "#{type.capitalize}: #{decorate_requirements(reqs)}" | 
					
						
							| 
									
										
										
										
											2016-09-18 00:12:49 -04:00
										 |  |  |       end | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-18 00:03:10 -08:00
										 |  |  |     if !f.options.empty? || f.head || f.devel | 
					
						
							| 
									
										
										
										
											2012-08-04 15:40:36 -04:00
										 |  |  |       ohai "Options" | 
					
						
							|  |  |  |       Homebrew.dump_options_for_formula f | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-26 07:30:28 +02:00
										 |  |  |     caveats = Caveats.new(f) | 
					
						
							|  |  |  |     ohai "Caveats", caveats.to_s unless caveats.empty? | 
					
						
							| 
									
										
											  
											
												cmd/info: display analytics data.
When users don't have `HOMEBREW_NO_ANALYTICS` or
`HOMEBREW_NO_GITHUB_API` set let's display some analytics data in
`brew info`. This should be useful for both maintainers and for users of
Homebrew.
Note this by default combines all installs across options for a single
number; for formulae with lots of options it's a bit overwhelming to
print the installs per-option. However, for `HOMEBREW_DEVELOPER`s print
the full output.
Sample non-developer output:
```console
$ brew info wget
wget: stable 1.19.5 (bottled), HEAD
Internet file retriever
https://www.gnu.org/software/wget/
/usr/local/Cellar/wget/1.19.5 (49 files, 3.7MB) *
  Built from source on 2018-09-03 at 20:46:32
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/wget.rb
==> Dependencies
Build: pkg-config ✔
Required: libidn2 ✔, openssl ✔
Optional: pcre ✔, libmetalink ✘, gpgme ✘
==> Options
--with-debug
	Build with debug support
--with-gpgme
	Build with gpgme support
--with-libmetalink
	Build with libmetalink support
--with-pcre
	Build with pcre support
--HEAD
	Install HEAD version
==> Analytics
install: 84638 (30d), 353800 (90d), 1372775 (365d)
install_on_request: 77926 (30d), 291305 (90d), 1044898 (365d)
build_error: 11 (30d)
```
Sample developer output:
```console
$ brew info wget
wget: stable 1.19.5 (bottled), HEAD
Internet file retriever
https://www.gnu.org/software/wget/
/usr/local/Cellar/wget/1.19.5 (49 files, 3.7MB) *
  Built from source on 2018-09-03 at 20:46:32
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/wget.rb
==> Dependencies
Build: pkg-config ✔
Required: libidn2 ✔, openssl ✔
Optional: pcre ✔, libmetalink ✘, gpgme ✘
==> Options
--with-debug
	Build with debug support
--with-gpgme
	Build with gpgme support
--with-libmetalink
	Build with libmetalink support
--with-pcre
	Build with pcre support
--HEAD
	Install HEAD version
==> Analytics
==> install (30d)
wget: 84516
wget --with-debug: 51
wget --with-libressl: 16
wget --with-pcre: 14
wget --with-pcre --with-libmetalink --with-gpgme: 12
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 8
wget --HEAD: 3
wget --HEAD --with-debug --with-libmetalink --with-gpgme: 3
wget --with-gpgme: 3
wget --with-libmetalink: 3
wget --with-pcre --with-libmetalink: 3
wget --with-debug --with-pcre: 2
wget --with-libmetalink --with-gpgme: 2
wget --with-pcre --with-gpgme: 2
==> install (90d)
wget: 353131
wget --with-debug: 188
wget --with-pcre: 138
wget --with-pcre --with-libmetalink --with-gpgme: 118
wget --with-libressl: 81
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 47
wget --with-pcre --with-libmetalink: 31
wget --HEAD: 13
wget --with-pcre --with-gpgme: 12
wget --with-gpgme: 11
wget --with-debug --with-pcre: 10
wget --with-libmetalink: 8
wget --HEAD --with-pcre --with-libmetalink --with-gpgme: 4
wget --with-debug --with-pcre --with-libmetalink: 4
wget --with-libmetalink --with-gpgme: 4
==> install (365d)
wget: 1369530
wget --with-pcre: 810
wget --with-debug: 649
wget --with-pcre --with-libmetalink --with-gpgme: 554
wget --with-libressl: 479
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 235
wget --with-pcre --with-libmetalink: 184
wget --with-gpgme: 67
wget --with-pcre --with-gpgme: 67
wget --with-debug --with-pcre: 65
wget --HEAD: 54
wget --with-libmetalink: 30
wget --with-libmetalink --with-gpgme: 27
wget --with-debug --with-pcre --with-libmetalink: 24
==> install_on_request (30d)
wget: 77827
wget --with-debug: 48
wget --with-pcre: 12
wget --with-pcre --with-libmetalink --with-gpgme: 11
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 8
wget --HEAD: 3
wget --HEAD --with-debug --with-libmetalink --with-gpgme: 3
wget --with-gpgme: 3
wget --with-libmetalink: 3
wget --with-debug --with-pcre: 2
wget --with-libmetalink --with-gpgme: 2
wget --with-pcre --with-gpgme: 2
wget --with-pcre --with-libmetalink: 2
==> install_on_request (90d)
wget: 290818
wget --with-debug: 157
wget --with-pcre --with-libmetalink --with-gpgme: 101
wget --with-pcre: 100
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 42
wget --with-pcre --with-libmetalink: 30
wget --HEAD: 13
wget --with-pcre --with-gpgme: 11
wget --with-gpgme: 10
wget --with-debug --with-pcre: 8
wget --with-libmetalink: 7
wget --HEAD --with-pcre --with-libmetalink --with-gpgme: 4
wget --with-debug --with-pcre --with-libmetalink: 4
==> install_on_request (365d)
wget: 1042845
wget --with-pcre: 504
wget --with-debug: 458
wget --with-pcre --with-libmetalink --with-gpgme: 432
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 201
wget --with-pcre --with-libmetalink: 158
wget --with-gpgme: 61
wget --HEAD: 54
wget --with-pcre --with-gpgme: 49
wget --with-debug --with-pcre: 47
wget --with-debug --with-pcre --with-libmetalink: 24
wget --with-libressl: 23
wget --with-libmetalink: 22
wget --with-libmetalink --with-gpgme: 20
==> build_error (30d)
wget: 9
wget --HEAD: 1
wget --with-debug: 1
```
											
										 
											2018-09-06 14:18:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-20 12:06:24 +01:00
										 |  |  |     output_formula_analytics(f) | 
					
						
							| 
									
										
											  
											
												cmd/info: display analytics data.
When users don't have `HOMEBREW_NO_ANALYTICS` or
`HOMEBREW_NO_GITHUB_API` set let's display some analytics data in
`brew info`. This should be useful for both maintainers and for users of
Homebrew.
Note this by default combines all installs across options for a single
number; for formulae with lots of options it's a bit overwhelming to
print the installs per-option. However, for `HOMEBREW_DEVELOPER`s print
the full output.
Sample non-developer output:
```console
$ brew info wget
wget: stable 1.19.5 (bottled), HEAD
Internet file retriever
https://www.gnu.org/software/wget/
/usr/local/Cellar/wget/1.19.5 (49 files, 3.7MB) *
  Built from source on 2018-09-03 at 20:46:32
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/wget.rb
==> Dependencies
Build: pkg-config ✔
Required: libidn2 ✔, openssl ✔
Optional: pcre ✔, libmetalink ✘, gpgme ✘
==> Options
--with-debug
	Build with debug support
--with-gpgme
	Build with gpgme support
--with-libmetalink
	Build with libmetalink support
--with-pcre
	Build with pcre support
--HEAD
	Install HEAD version
==> Analytics
install: 84638 (30d), 353800 (90d), 1372775 (365d)
install_on_request: 77926 (30d), 291305 (90d), 1044898 (365d)
build_error: 11 (30d)
```
Sample developer output:
```console
$ brew info wget
wget: stable 1.19.5 (bottled), HEAD
Internet file retriever
https://www.gnu.org/software/wget/
/usr/local/Cellar/wget/1.19.5 (49 files, 3.7MB) *
  Built from source on 2018-09-03 at 20:46:32
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/wget.rb
==> Dependencies
Build: pkg-config ✔
Required: libidn2 ✔, openssl ✔
Optional: pcre ✔, libmetalink ✘, gpgme ✘
==> Options
--with-debug
	Build with debug support
--with-gpgme
	Build with gpgme support
--with-libmetalink
	Build with libmetalink support
--with-pcre
	Build with pcre support
--HEAD
	Install HEAD version
==> Analytics
==> install (30d)
wget: 84516
wget --with-debug: 51
wget --with-libressl: 16
wget --with-pcre: 14
wget --with-pcre --with-libmetalink --with-gpgme: 12
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 8
wget --HEAD: 3
wget --HEAD --with-debug --with-libmetalink --with-gpgme: 3
wget --with-gpgme: 3
wget --with-libmetalink: 3
wget --with-pcre --with-libmetalink: 3
wget --with-debug --with-pcre: 2
wget --with-libmetalink --with-gpgme: 2
wget --with-pcre --with-gpgme: 2
==> install (90d)
wget: 353131
wget --with-debug: 188
wget --with-pcre: 138
wget --with-pcre --with-libmetalink --with-gpgme: 118
wget --with-libressl: 81
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 47
wget --with-pcre --with-libmetalink: 31
wget --HEAD: 13
wget --with-pcre --with-gpgme: 12
wget --with-gpgme: 11
wget --with-debug --with-pcre: 10
wget --with-libmetalink: 8
wget --HEAD --with-pcre --with-libmetalink --with-gpgme: 4
wget --with-debug --with-pcre --with-libmetalink: 4
wget --with-libmetalink --with-gpgme: 4
==> install (365d)
wget: 1369530
wget --with-pcre: 810
wget --with-debug: 649
wget --with-pcre --with-libmetalink --with-gpgme: 554
wget --with-libressl: 479
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 235
wget --with-pcre --with-libmetalink: 184
wget --with-gpgme: 67
wget --with-pcre --with-gpgme: 67
wget --with-debug --with-pcre: 65
wget --HEAD: 54
wget --with-libmetalink: 30
wget --with-libmetalink --with-gpgme: 27
wget --with-debug --with-pcre --with-libmetalink: 24
==> install_on_request (30d)
wget: 77827
wget --with-debug: 48
wget --with-pcre: 12
wget --with-pcre --with-libmetalink --with-gpgme: 11
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 8
wget --HEAD: 3
wget --HEAD --with-debug --with-libmetalink --with-gpgme: 3
wget --with-gpgme: 3
wget --with-libmetalink: 3
wget --with-debug --with-pcre: 2
wget --with-libmetalink --with-gpgme: 2
wget --with-pcre --with-gpgme: 2
wget --with-pcre --with-libmetalink: 2
==> install_on_request (90d)
wget: 290818
wget --with-debug: 157
wget --with-pcre --with-libmetalink --with-gpgme: 101
wget --with-pcre: 100
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 42
wget --with-pcre --with-libmetalink: 30
wget --HEAD: 13
wget --with-pcre --with-gpgme: 11
wget --with-gpgme: 10
wget --with-debug --with-pcre: 8
wget --with-libmetalink: 7
wget --HEAD --with-pcre --with-libmetalink --with-gpgme: 4
wget --with-debug --with-pcre --with-libmetalink: 4
==> install_on_request (365d)
wget: 1042845
wget --with-pcre: 504
wget --with-debug: 458
wget --with-pcre --with-libmetalink --with-gpgme: 432
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 201
wget --with-pcre --with-libmetalink: 158
wget --with-gpgme: 61
wget --HEAD: 54
wget --with-pcre --with-gpgme: 49
wget --with-debug --with-pcre: 47
wget --with-debug --with-pcre --with-libmetalink: 24
wget --with-libressl: 23
wget --with-libmetalink: 22
wget --with-libmetalink --with-gpgme: 20
==> build_error (30d)
wget: 9
wget --HEAD: 1
wget --with-debug: 1
```
											
										 
											2018-09-06 14:18:30 +01:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-20 12:06:24 +01:00
										 |  |  |   def formulae_api_json(endpoint) | 
					
						
							|  |  |  |     return if ENV["HOMEBREW_NO_ANALYTICS"] || ENV["HOMEBREW_NO_GITHUB_API"] | 
					
						
							| 
									
										
											  
											
												cmd/info: display analytics data.
When users don't have `HOMEBREW_NO_ANALYTICS` or
`HOMEBREW_NO_GITHUB_API` set let's display some analytics data in
`brew info`. This should be useful for both maintainers and for users of
Homebrew.
Note this by default combines all installs across options for a single
number; for formulae with lots of options it's a bit overwhelming to
print the installs per-option. However, for `HOMEBREW_DEVELOPER`s print
the full output.
Sample non-developer output:
```console
$ brew info wget
wget: stable 1.19.5 (bottled), HEAD
Internet file retriever
https://www.gnu.org/software/wget/
/usr/local/Cellar/wget/1.19.5 (49 files, 3.7MB) *
  Built from source on 2018-09-03 at 20:46:32
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/wget.rb
==> Dependencies
Build: pkg-config ✔
Required: libidn2 ✔, openssl ✔
Optional: pcre ✔, libmetalink ✘, gpgme ✘
==> Options
--with-debug
	Build with debug support
--with-gpgme
	Build with gpgme support
--with-libmetalink
	Build with libmetalink support
--with-pcre
	Build with pcre support
--HEAD
	Install HEAD version
==> Analytics
install: 84638 (30d), 353800 (90d), 1372775 (365d)
install_on_request: 77926 (30d), 291305 (90d), 1044898 (365d)
build_error: 11 (30d)
```
Sample developer output:
```console
$ brew info wget
wget: stable 1.19.5 (bottled), HEAD
Internet file retriever
https://www.gnu.org/software/wget/
/usr/local/Cellar/wget/1.19.5 (49 files, 3.7MB) *
  Built from source on 2018-09-03 at 20:46:32
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/wget.rb
==> Dependencies
Build: pkg-config ✔
Required: libidn2 ✔, openssl ✔
Optional: pcre ✔, libmetalink ✘, gpgme ✘
==> Options
--with-debug
	Build with debug support
--with-gpgme
	Build with gpgme support
--with-libmetalink
	Build with libmetalink support
--with-pcre
	Build with pcre support
--HEAD
	Install HEAD version
==> Analytics
==> install (30d)
wget: 84516
wget --with-debug: 51
wget --with-libressl: 16
wget --with-pcre: 14
wget --with-pcre --with-libmetalink --with-gpgme: 12
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 8
wget --HEAD: 3
wget --HEAD --with-debug --with-libmetalink --with-gpgme: 3
wget --with-gpgme: 3
wget --with-libmetalink: 3
wget --with-pcre --with-libmetalink: 3
wget --with-debug --with-pcre: 2
wget --with-libmetalink --with-gpgme: 2
wget --with-pcre --with-gpgme: 2
==> install (90d)
wget: 353131
wget --with-debug: 188
wget --with-pcre: 138
wget --with-pcre --with-libmetalink --with-gpgme: 118
wget --with-libressl: 81
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 47
wget --with-pcre --with-libmetalink: 31
wget --HEAD: 13
wget --with-pcre --with-gpgme: 12
wget --with-gpgme: 11
wget --with-debug --with-pcre: 10
wget --with-libmetalink: 8
wget --HEAD --with-pcre --with-libmetalink --with-gpgme: 4
wget --with-debug --with-pcre --with-libmetalink: 4
wget --with-libmetalink --with-gpgme: 4
==> install (365d)
wget: 1369530
wget --with-pcre: 810
wget --with-debug: 649
wget --with-pcre --with-libmetalink --with-gpgme: 554
wget --with-libressl: 479
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 235
wget --with-pcre --with-libmetalink: 184
wget --with-gpgme: 67
wget --with-pcre --with-gpgme: 67
wget --with-debug --with-pcre: 65
wget --HEAD: 54
wget --with-libmetalink: 30
wget --with-libmetalink --with-gpgme: 27
wget --with-debug --with-pcre --with-libmetalink: 24
==> install_on_request (30d)
wget: 77827
wget --with-debug: 48
wget --with-pcre: 12
wget --with-pcre --with-libmetalink --with-gpgme: 11
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 8
wget --HEAD: 3
wget --HEAD --with-debug --with-libmetalink --with-gpgme: 3
wget --with-gpgme: 3
wget --with-libmetalink: 3
wget --with-debug --with-pcre: 2
wget --with-libmetalink --with-gpgme: 2
wget --with-pcre --with-gpgme: 2
wget --with-pcre --with-libmetalink: 2
==> install_on_request (90d)
wget: 290818
wget --with-debug: 157
wget --with-pcre --with-libmetalink --with-gpgme: 101
wget --with-pcre: 100
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 42
wget --with-pcre --with-libmetalink: 30
wget --HEAD: 13
wget --with-pcre --with-gpgme: 11
wget --with-gpgme: 10
wget --with-debug --with-pcre: 8
wget --with-libmetalink: 7
wget --HEAD --with-pcre --with-libmetalink --with-gpgme: 4
wget --with-debug --with-pcre --with-libmetalink: 4
==> install_on_request (365d)
wget: 1042845
wget --with-pcre: 504
wget --with-debug: 458
wget --with-pcre --with-libmetalink --with-gpgme: 432
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 201
wget --with-pcre --with-libmetalink: 158
wget --with-gpgme: 61
wget --HEAD: 54
wget --with-pcre --with-gpgme: 49
wget --with-debug --with-pcre: 47
wget --with-debug --with-pcre --with-libmetalink: 24
wget --with-libressl: 23
wget --with-libmetalink: 22
wget --with-libmetalink --with-gpgme: 20
==> build_error (30d)
wget: 9
wget --HEAD: 1
wget --with-debug: 1
```
											
										 
											2018-09-06 14:18:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-03-10 16:10:45 -04:00
										 |  |  |     output, = curl_output("--max-time", "5", | 
					
						
							| 
									
										
										
										
											2019-04-30 08:44:35 +01:00
										 |  |  |                           "https://formulae.brew.sh/api/#{endpoint}") | 
					
						
							| 
									
										
										
										
											2018-10-20 12:06:24 +01:00
										 |  |  |     return if output.blank? | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     JSON.parse(output) | 
					
						
							|  |  |  |   rescue JSON::ParserError | 
					
						
							|  |  |  |     nil | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
											  
											
												cmd/info: display analytics data.
When users don't have `HOMEBREW_NO_ANALYTICS` or
`HOMEBREW_NO_GITHUB_API` set let's display some analytics data in
`brew info`. This should be useful for both maintainers and for users of
Homebrew.
Note this by default combines all installs across options for a single
number; for formulae with lots of options it's a bit overwhelming to
print the installs per-option. However, for `HOMEBREW_DEVELOPER`s print
the full output.
Sample non-developer output:
```console
$ brew info wget
wget: stable 1.19.5 (bottled), HEAD
Internet file retriever
https://www.gnu.org/software/wget/
/usr/local/Cellar/wget/1.19.5 (49 files, 3.7MB) *
  Built from source on 2018-09-03 at 20:46:32
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/wget.rb
==> Dependencies
Build: pkg-config ✔
Required: libidn2 ✔, openssl ✔
Optional: pcre ✔, libmetalink ✘, gpgme ✘
==> Options
--with-debug
	Build with debug support
--with-gpgme
	Build with gpgme support
--with-libmetalink
	Build with libmetalink support
--with-pcre
	Build with pcre support
--HEAD
	Install HEAD version
==> Analytics
install: 84638 (30d), 353800 (90d), 1372775 (365d)
install_on_request: 77926 (30d), 291305 (90d), 1044898 (365d)
build_error: 11 (30d)
```
Sample developer output:
```console
$ brew info wget
wget: stable 1.19.5 (bottled), HEAD
Internet file retriever
https://www.gnu.org/software/wget/
/usr/local/Cellar/wget/1.19.5 (49 files, 3.7MB) *
  Built from source on 2018-09-03 at 20:46:32
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/wget.rb
==> Dependencies
Build: pkg-config ✔
Required: libidn2 ✔, openssl ✔
Optional: pcre ✔, libmetalink ✘, gpgme ✘
==> Options
--with-debug
	Build with debug support
--with-gpgme
	Build with gpgme support
--with-libmetalink
	Build with libmetalink support
--with-pcre
	Build with pcre support
--HEAD
	Install HEAD version
==> Analytics
==> install (30d)
wget: 84516
wget --with-debug: 51
wget --with-libressl: 16
wget --with-pcre: 14
wget --with-pcre --with-libmetalink --with-gpgme: 12
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 8
wget --HEAD: 3
wget --HEAD --with-debug --with-libmetalink --with-gpgme: 3
wget --with-gpgme: 3
wget --with-libmetalink: 3
wget --with-pcre --with-libmetalink: 3
wget --with-debug --with-pcre: 2
wget --with-libmetalink --with-gpgme: 2
wget --with-pcre --with-gpgme: 2
==> install (90d)
wget: 353131
wget --with-debug: 188
wget --with-pcre: 138
wget --with-pcre --with-libmetalink --with-gpgme: 118
wget --with-libressl: 81
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 47
wget --with-pcre --with-libmetalink: 31
wget --HEAD: 13
wget --with-pcre --with-gpgme: 12
wget --with-gpgme: 11
wget --with-debug --with-pcre: 10
wget --with-libmetalink: 8
wget --HEAD --with-pcre --with-libmetalink --with-gpgme: 4
wget --with-debug --with-pcre --with-libmetalink: 4
wget --with-libmetalink --with-gpgme: 4
==> install (365d)
wget: 1369530
wget --with-pcre: 810
wget --with-debug: 649
wget --with-pcre --with-libmetalink --with-gpgme: 554
wget --with-libressl: 479
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 235
wget --with-pcre --with-libmetalink: 184
wget --with-gpgme: 67
wget --with-pcre --with-gpgme: 67
wget --with-debug --with-pcre: 65
wget --HEAD: 54
wget --with-libmetalink: 30
wget --with-libmetalink --with-gpgme: 27
wget --with-debug --with-pcre --with-libmetalink: 24
==> install_on_request (30d)
wget: 77827
wget --with-debug: 48
wget --with-pcre: 12
wget --with-pcre --with-libmetalink --with-gpgme: 11
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 8
wget --HEAD: 3
wget --HEAD --with-debug --with-libmetalink --with-gpgme: 3
wget --with-gpgme: 3
wget --with-libmetalink: 3
wget --with-debug --with-pcre: 2
wget --with-libmetalink --with-gpgme: 2
wget --with-pcre --with-gpgme: 2
wget --with-pcre --with-libmetalink: 2
==> install_on_request (90d)
wget: 290818
wget --with-debug: 157
wget --with-pcre --with-libmetalink --with-gpgme: 101
wget --with-pcre: 100
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 42
wget --with-pcre --with-libmetalink: 30
wget --HEAD: 13
wget --with-pcre --with-gpgme: 11
wget --with-gpgme: 10
wget --with-debug --with-pcre: 8
wget --with-libmetalink: 7
wget --HEAD --with-pcre --with-libmetalink --with-gpgme: 4
wget --with-debug --with-pcre --with-libmetalink: 4
==> install_on_request (365d)
wget: 1042845
wget --with-pcre: 504
wget --with-debug: 458
wget --with-pcre --with-libmetalink --with-gpgme: 432
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 201
wget --with-pcre --with-libmetalink: 158
wget --with-gpgme: 61
wget --HEAD: 54
wget --with-pcre --with-gpgme: 49
wget --with-debug --with-pcre: 47
wget --with-debug --with-pcre --with-libmetalink: 24
wget --with-libressl: 23
wget --with-libmetalink: 22
wget --with-libmetalink --with-gpgme: 20
==> build_error (30d)
wget: 9
wget --HEAD: 1
wget --with-debug: 1
```
											
										 
											2018-09-06 14:18:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-03-10 16:11:15 -04:00
										 |  |  |   def analytics_table(category, days, results, os_version: false, cask_install: false) | 
					
						
							| 
									
										
										
										
											2018-10-20 12:06:24 +01:00
										 |  |  |     oh1 "#{category} (#{days} days)" | 
					
						
							|  |  |  |     total_count = results.values.inject("+") | 
					
						
							|  |  |  |     formatted_total_count = format_count(total_count) | 
					
						
							|  |  |  |     formatted_total_percent = format_percent(100) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     index_header = "Index" | 
					
						
							|  |  |  |     count_header = "Count" | 
					
						
							|  |  |  |     percent_header = "Percent" | 
					
						
							|  |  |  |     name_with_options_header = if os_version | 
					
						
							|  |  |  |       "macOS Version" | 
					
						
							| 
									
										
										
										
											2019-03-10 16:11:15 -04:00
										 |  |  |     elsif cask_install | 
					
						
							|  |  |  |       "Token" | 
					
						
							| 
									
										
										
										
											2018-10-20 12:06:24 +01:00
										 |  |  |     else | 
					
						
							|  |  |  |       "Name (with options)" | 
					
						
							| 
									
										
											  
											
												cmd/info: display analytics data.
When users don't have `HOMEBREW_NO_ANALYTICS` or
`HOMEBREW_NO_GITHUB_API` set let's display some analytics data in
`brew info`. This should be useful for both maintainers and for users of
Homebrew.
Note this by default combines all installs across options for a single
number; for formulae with lots of options it's a bit overwhelming to
print the installs per-option. However, for `HOMEBREW_DEVELOPER`s print
the full output.
Sample non-developer output:
```console
$ brew info wget
wget: stable 1.19.5 (bottled), HEAD
Internet file retriever
https://www.gnu.org/software/wget/
/usr/local/Cellar/wget/1.19.5 (49 files, 3.7MB) *
  Built from source on 2018-09-03 at 20:46:32
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/wget.rb
==> Dependencies
Build: pkg-config ✔
Required: libidn2 ✔, openssl ✔
Optional: pcre ✔, libmetalink ✘, gpgme ✘
==> Options
--with-debug
	Build with debug support
--with-gpgme
	Build with gpgme support
--with-libmetalink
	Build with libmetalink support
--with-pcre
	Build with pcre support
--HEAD
	Install HEAD version
==> Analytics
install: 84638 (30d), 353800 (90d), 1372775 (365d)
install_on_request: 77926 (30d), 291305 (90d), 1044898 (365d)
build_error: 11 (30d)
```
Sample developer output:
```console
$ brew info wget
wget: stable 1.19.5 (bottled), HEAD
Internet file retriever
https://www.gnu.org/software/wget/
/usr/local/Cellar/wget/1.19.5 (49 files, 3.7MB) *
  Built from source on 2018-09-03 at 20:46:32
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/wget.rb
==> Dependencies
Build: pkg-config ✔
Required: libidn2 ✔, openssl ✔
Optional: pcre ✔, libmetalink ✘, gpgme ✘
==> Options
--with-debug
	Build with debug support
--with-gpgme
	Build with gpgme support
--with-libmetalink
	Build with libmetalink support
--with-pcre
	Build with pcre support
--HEAD
	Install HEAD version
==> Analytics
==> install (30d)
wget: 84516
wget --with-debug: 51
wget --with-libressl: 16
wget --with-pcre: 14
wget --with-pcre --with-libmetalink --with-gpgme: 12
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 8
wget --HEAD: 3
wget --HEAD --with-debug --with-libmetalink --with-gpgme: 3
wget --with-gpgme: 3
wget --with-libmetalink: 3
wget --with-pcre --with-libmetalink: 3
wget --with-debug --with-pcre: 2
wget --with-libmetalink --with-gpgme: 2
wget --with-pcre --with-gpgme: 2
==> install (90d)
wget: 353131
wget --with-debug: 188
wget --with-pcre: 138
wget --with-pcre --with-libmetalink --with-gpgme: 118
wget --with-libressl: 81
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 47
wget --with-pcre --with-libmetalink: 31
wget --HEAD: 13
wget --with-pcre --with-gpgme: 12
wget --with-gpgme: 11
wget --with-debug --with-pcre: 10
wget --with-libmetalink: 8
wget --HEAD --with-pcre --with-libmetalink --with-gpgme: 4
wget --with-debug --with-pcre --with-libmetalink: 4
wget --with-libmetalink --with-gpgme: 4
==> install (365d)
wget: 1369530
wget --with-pcre: 810
wget --with-debug: 649
wget --with-pcre --with-libmetalink --with-gpgme: 554
wget --with-libressl: 479
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 235
wget --with-pcre --with-libmetalink: 184
wget --with-gpgme: 67
wget --with-pcre --with-gpgme: 67
wget --with-debug --with-pcre: 65
wget --HEAD: 54
wget --with-libmetalink: 30
wget --with-libmetalink --with-gpgme: 27
wget --with-debug --with-pcre --with-libmetalink: 24
==> install_on_request (30d)
wget: 77827
wget --with-debug: 48
wget --with-pcre: 12
wget --with-pcre --with-libmetalink --with-gpgme: 11
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 8
wget --HEAD: 3
wget --HEAD --with-debug --with-libmetalink --with-gpgme: 3
wget --with-gpgme: 3
wget --with-libmetalink: 3
wget --with-debug --with-pcre: 2
wget --with-libmetalink --with-gpgme: 2
wget --with-pcre --with-gpgme: 2
wget --with-pcre --with-libmetalink: 2
==> install_on_request (90d)
wget: 290818
wget --with-debug: 157
wget --with-pcre --with-libmetalink --with-gpgme: 101
wget --with-pcre: 100
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 42
wget --with-pcre --with-libmetalink: 30
wget --HEAD: 13
wget --with-pcre --with-gpgme: 11
wget --with-gpgme: 10
wget --with-debug --with-pcre: 8
wget --with-libmetalink: 7
wget --HEAD --with-pcre --with-libmetalink --with-gpgme: 4
wget --with-debug --with-pcre --with-libmetalink: 4
==> install_on_request (365d)
wget: 1042845
wget --with-pcre: 504
wget --with-debug: 458
wget --with-pcre --with-libmetalink --with-gpgme: 432
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 201
wget --with-pcre --with-libmetalink: 158
wget --with-gpgme: 61
wget --HEAD: 54
wget --with-pcre --with-gpgme: 49
wget --with-debug --with-pcre: 47
wget --with-debug --with-pcre --with-libmetalink: 24
wget --with-libressl: 23
wget --with-libmetalink: 22
wget --with-libmetalink --with-gpgme: 20
==> build_error (30d)
wget: 9
wget --HEAD: 1
wget --with-debug: 1
```
											
										 
											2018-09-06 14:18:30 +01:00
										 |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-20 12:06:24 +01:00
										 |  |  |     total_index_footer = "Total" | 
					
						
							|  |  |  |     max_index_width = results.length.to_s.length | 
					
						
							|  |  |  |     index_width = [ | 
					
						
							|  |  |  |       index_header.length, | 
					
						
							|  |  |  |       total_index_footer.length, | 
					
						
							|  |  |  |       max_index_width, | 
					
						
							|  |  |  |     ].max | 
					
						
							|  |  |  |     count_width = [ | 
					
						
							|  |  |  |       count_header.length, | 
					
						
							|  |  |  |       formatted_total_count.length, | 
					
						
							|  |  |  |     ].max | 
					
						
							|  |  |  |     percent_width = [ | 
					
						
							|  |  |  |       percent_header.length, | 
					
						
							|  |  |  |       formatted_total_percent.length, | 
					
						
							|  |  |  |     ].max | 
					
						
							|  |  |  |     name_with_options_width = Tty.width - | 
					
						
							|  |  |  |                               index_width - | 
					
						
							|  |  |  |                               count_width - | 
					
						
							|  |  |  |                               percent_width - | 
					
						
							|  |  |  |                               10 # spacing and lines | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     formatted_index_header = | 
					
						
							|  |  |  |       format "%#{index_width}s", index_header | 
					
						
							|  |  |  |     formatted_name_with_options_header = | 
					
						
							|  |  |  |       format "%-#{name_with_options_width}s", | 
					
						
							|  |  |  |              name_with_options_header[0..name_with_options_width-1] | 
					
						
							|  |  |  |     formatted_count_header = | 
					
						
							|  |  |  |       format "%#{count_width}s", count_header | 
					
						
							|  |  |  |     formatted_percent_header = | 
					
						
							|  |  |  |       format "%#{percent_width}s", percent_header | 
					
						
							|  |  |  |     puts "#{formatted_index_header} | #{formatted_name_with_options_header} | "\ | 
					
						
							|  |  |  |          "#{formatted_count_header} |  #{formatted_percent_header}" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     columns_line = "#{"-"*index_width}:|-#{"-"*name_with_options_width}-|-"\ | 
					
						
							|  |  |  |                    "#{"-"*count_width}:|-#{"-"*percent_width}:" | 
					
						
							|  |  |  |     puts columns_line | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     index = 0
 | 
					
						
							|  |  |  |     results.each do |name_with_options, count| | 
					
						
							|  |  |  |       index += 1
 | 
					
						
							|  |  |  |       formatted_index = format "%0#{max_index_width}d", index | 
					
						
							|  |  |  |       formatted_index = format "%-#{index_width}s", formatted_index | 
					
						
							|  |  |  |       formatted_name_with_options = | 
					
						
							|  |  |  |         format "%-#{name_with_options_width}s", | 
					
						
							|  |  |  |                name_with_options[0..name_with_options_width-1] | 
					
						
							|  |  |  |       formatted_count = format "%#{count_width}s", format_count(count) | 
					
						
							|  |  |  |       formatted_percent = if total_count.zero? | 
					
						
							|  |  |  |         format "%#{percent_width}s", format_percent(0) | 
					
						
							|  |  |  |       else | 
					
						
							|  |  |  |         format "%#{percent_width}s", | 
					
						
							|  |  |  |                format_percent((count.to_i * 100) / total_count.to_f) | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  |       puts "#{formatted_index} | #{formatted_name_with_options} | " \ | 
					
						
							|  |  |  |            "#{formatted_count} | #{formatted_percent}%" | 
					
						
							|  |  |  |       next if index > 10
 | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  |     return unless results.length > 1
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     formatted_total_footer = | 
					
						
							|  |  |  |       format "%-#{index_width}s", total_index_footer | 
					
						
							|  |  |  |     formatted_blank_footer = | 
					
						
							|  |  |  |       format "%-#{name_with_options_width}s", "" | 
					
						
							|  |  |  |     formatted_total_count_footer = | 
					
						
							|  |  |  |       format "%#{count_width}s", formatted_total_count | 
					
						
							|  |  |  |     formatted_total_percent_footer = | 
					
						
							|  |  |  |       format "%#{percent_width}s", formatted_total_percent | 
					
						
							|  |  |  |     puts "#{formatted_total_footer} | #{formatted_blank_footer} | "\ | 
					
						
							|  |  |  |          "#{formatted_total_count_footer} | #{formatted_total_percent_footer}%" | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-21 13:07:08 +01:00
										 |  |  |   def output_analytics(filter: nil) | 
					
						
							| 
									
										
										
										
											2018-11-07 19:31:20 +05:30
										 |  |  |     days = args.days || "30" | 
					
						
							| 
									
										
										
										
											2018-10-20 12:06:24 +01:00
										 |  |  |     valid_days = %w[30 90 365] | 
					
						
							| 
									
										
										
										
											2019-03-10 16:10:45 -04:00
										 |  |  |     raise UsageError, "days must be one of #{valid_days.join(", ")}" unless valid_days.include?(days) | 
					
						
							| 
									
										
										
										
											2018-10-20 12:06:24 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-07 19:31:20 +05:30
										 |  |  |     category = args.category || "install" | 
					
						
							| 
									
										
										
										
											2019-03-10 16:11:15 -04:00
										 |  |  |     valid_categories = %w[install install-on-request cask-install build-error os-version] | 
					
						
							| 
									
										
										
										
											2018-10-20 12:06:24 +01:00
										 |  |  |     unless valid_categories.include?(category) | 
					
						
							| 
									
										
										
										
											2019-03-10 16:10:45 -04:00
										 |  |  |       raise UsageError, "category must be one of #{valid_categories.join(", ")}" | 
					
						
							| 
									
										
										
										
											2018-10-20 12:06:24 +01:00
										 |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     json = formulae_api_json("analytics/#{category}/#{days}d.json") | 
					
						
							|  |  |  |     return if json.blank? || json["items"].blank? | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     os_version = category == "os-version" | 
					
						
							| 
									
										
										
										
											2019-03-10 16:11:15 -04:00
										 |  |  |     cask_install = category == "cask-install" | 
					
						
							| 
									
										
										
										
											2018-10-20 12:06:24 +01:00
										 |  |  |     results = {} | 
					
						
							|  |  |  |     json["items"].each do |item| | 
					
						
							|  |  |  |       key = if os_version | 
					
						
							|  |  |  |         item["os_version"] | 
					
						
							| 
									
										
										
										
											2019-03-10 16:11:15 -04:00
										 |  |  |       elsif cask_install | 
					
						
							|  |  |  |         item["cask"] | 
					
						
							| 
									
										
										
										
											2018-10-20 12:06:24 +01:00
										 |  |  |       else | 
					
						
							|  |  |  |         item["formula"] | 
					
						
							| 
									
										
											  
											
												cmd/info: display analytics data.
When users don't have `HOMEBREW_NO_ANALYTICS` or
`HOMEBREW_NO_GITHUB_API` set let's display some analytics data in
`brew info`. This should be useful for both maintainers and for users of
Homebrew.
Note this by default combines all installs across options for a single
number; for formulae with lots of options it's a bit overwhelming to
print the installs per-option. However, for `HOMEBREW_DEVELOPER`s print
the full output.
Sample non-developer output:
```console
$ brew info wget
wget: stable 1.19.5 (bottled), HEAD
Internet file retriever
https://www.gnu.org/software/wget/
/usr/local/Cellar/wget/1.19.5 (49 files, 3.7MB) *
  Built from source on 2018-09-03 at 20:46:32
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/wget.rb
==> Dependencies
Build: pkg-config ✔
Required: libidn2 ✔, openssl ✔
Optional: pcre ✔, libmetalink ✘, gpgme ✘
==> Options
--with-debug
	Build with debug support
--with-gpgme
	Build with gpgme support
--with-libmetalink
	Build with libmetalink support
--with-pcre
	Build with pcre support
--HEAD
	Install HEAD version
==> Analytics
install: 84638 (30d), 353800 (90d), 1372775 (365d)
install_on_request: 77926 (30d), 291305 (90d), 1044898 (365d)
build_error: 11 (30d)
```
Sample developer output:
```console
$ brew info wget
wget: stable 1.19.5 (bottled), HEAD
Internet file retriever
https://www.gnu.org/software/wget/
/usr/local/Cellar/wget/1.19.5 (49 files, 3.7MB) *
  Built from source on 2018-09-03 at 20:46:32
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/wget.rb
==> Dependencies
Build: pkg-config ✔
Required: libidn2 ✔, openssl ✔
Optional: pcre ✔, libmetalink ✘, gpgme ✘
==> Options
--with-debug
	Build with debug support
--with-gpgme
	Build with gpgme support
--with-libmetalink
	Build with libmetalink support
--with-pcre
	Build with pcre support
--HEAD
	Install HEAD version
==> Analytics
==> install (30d)
wget: 84516
wget --with-debug: 51
wget --with-libressl: 16
wget --with-pcre: 14
wget --with-pcre --with-libmetalink --with-gpgme: 12
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 8
wget --HEAD: 3
wget --HEAD --with-debug --with-libmetalink --with-gpgme: 3
wget --with-gpgme: 3
wget --with-libmetalink: 3
wget --with-pcre --with-libmetalink: 3
wget --with-debug --with-pcre: 2
wget --with-libmetalink --with-gpgme: 2
wget --with-pcre --with-gpgme: 2
==> install (90d)
wget: 353131
wget --with-debug: 188
wget --with-pcre: 138
wget --with-pcre --with-libmetalink --with-gpgme: 118
wget --with-libressl: 81
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 47
wget --with-pcre --with-libmetalink: 31
wget --HEAD: 13
wget --with-pcre --with-gpgme: 12
wget --with-gpgme: 11
wget --with-debug --with-pcre: 10
wget --with-libmetalink: 8
wget --HEAD --with-pcre --with-libmetalink --with-gpgme: 4
wget --with-debug --with-pcre --with-libmetalink: 4
wget --with-libmetalink --with-gpgme: 4
==> install (365d)
wget: 1369530
wget --with-pcre: 810
wget --with-debug: 649
wget --with-pcre --with-libmetalink --with-gpgme: 554
wget --with-libressl: 479
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 235
wget --with-pcre --with-libmetalink: 184
wget --with-gpgme: 67
wget --with-pcre --with-gpgme: 67
wget --with-debug --with-pcre: 65
wget --HEAD: 54
wget --with-libmetalink: 30
wget --with-libmetalink --with-gpgme: 27
wget --with-debug --with-pcre --with-libmetalink: 24
==> install_on_request (30d)
wget: 77827
wget --with-debug: 48
wget --with-pcre: 12
wget --with-pcre --with-libmetalink --with-gpgme: 11
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 8
wget --HEAD: 3
wget --HEAD --with-debug --with-libmetalink --with-gpgme: 3
wget --with-gpgme: 3
wget --with-libmetalink: 3
wget --with-debug --with-pcre: 2
wget --with-libmetalink --with-gpgme: 2
wget --with-pcre --with-gpgme: 2
wget --with-pcre --with-libmetalink: 2
==> install_on_request (90d)
wget: 290818
wget --with-debug: 157
wget --with-pcre --with-libmetalink --with-gpgme: 101
wget --with-pcre: 100
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 42
wget --with-pcre --with-libmetalink: 30
wget --HEAD: 13
wget --with-pcre --with-gpgme: 11
wget --with-gpgme: 10
wget --with-debug --with-pcre: 8
wget --with-libmetalink: 7
wget --HEAD --with-pcre --with-libmetalink --with-gpgme: 4
wget --with-debug --with-pcre --with-libmetalink: 4
==> install_on_request (365d)
wget: 1042845
wget --with-pcre: 504
wget --with-debug: 458
wget --with-pcre --with-libmetalink --with-gpgme: 432
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 201
wget --with-pcre --with-libmetalink: 158
wget --with-gpgme: 61
wget --HEAD: 54
wget --with-pcre --with-gpgme: 49
wget --with-debug --with-pcre: 47
wget --with-debug --with-pcre --with-libmetalink: 24
wget --with-libressl: 23
wget --with-libmetalink: 22
wget --with-libmetalink --with-gpgme: 20
==> build_error (30d)
wget: 9
wget --HEAD: 1
wget --with-debug: 1
```
											
										 
											2018-09-06 14:18:30 +01:00
										 |  |  |       end | 
					
						
							| 
									
										
										
										
											2018-10-21 13:07:08 +01:00
										 |  |  |       if filter.present? | 
					
						
							|  |  |  |         next if key != filter && !key.start_with?("#{filter} ") | 
					
						
							|  |  |  |       end | 
					
						
							| 
									
										
										
										
											2018-10-20 12:06:24 +01:00
										 |  |  |       results[key] = item["count"].tr(",", "").to_i | 
					
						
							| 
									
										
											  
											
												cmd/info: display analytics data.
When users don't have `HOMEBREW_NO_ANALYTICS` or
`HOMEBREW_NO_GITHUB_API` set let's display some analytics data in
`brew info`. This should be useful for both maintainers and for users of
Homebrew.
Note this by default combines all installs across options for a single
number; for formulae with lots of options it's a bit overwhelming to
print the installs per-option. However, for `HOMEBREW_DEVELOPER`s print
the full output.
Sample non-developer output:
```console
$ brew info wget
wget: stable 1.19.5 (bottled), HEAD
Internet file retriever
https://www.gnu.org/software/wget/
/usr/local/Cellar/wget/1.19.5 (49 files, 3.7MB) *
  Built from source on 2018-09-03 at 20:46:32
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/wget.rb
==> Dependencies
Build: pkg-config ✔
Required: libidn2 ✔, openssl ✔
Optional: pcre ✔, libmetalink ✘, gpgme ✘
==> Options
--with-debug
	Build with debug support
--with-gpgme
	Build with gpgme support
--with-libmetalink
	Build with libmetalink support
--with-pcre
	Build with pcre support
--HEAD
	Install HEAD version
==> Analytics
install: 84638 (30d), 353800 (90d), 1372775 (365d)
install_on_request: 77926 (30d), 291305 (90d), 1044898 (365d)
build_error: 11 (30d)
```
Sample developer output:
```console
$ brew info wget
wget: stable 1.19.5 (bottled), HEAD
Internet file retriever
https://www.gnu.org/software/wget/
/usr/local/Cellar/wget/1.19.5 (49 files, 3.7MB) *
  Built from source on 2018-09-03 at 20:46:32
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/wget.rb
==> Dependencies
Build: pkg-config ✔
Required: libidn2 ✔, openssl ✔
Optional: pcre ✔, libmetalink ✘, gpgme ✘
==> Options
--with-debug
	Build with debug support
--with-gpgme
	Build with gpgme support
--with-libmetalink
	Build with libmetalink support
--with-pcre
	Build with pcre support
--HEAD
	Install HEAD version
==> Analytics
==> install (30d)
wget: 84516
wget --with-debug: 51
wget --with-libressl: 16
wget --with-pcre: 14
wget --with-pcre --with-libmetalink --with-gpgme: 12
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 8
wget --HEAD: 3
wget --HEAD --with-debug --with-libmetalink --with-gpgme: 3
wget --with-gpgme: 3
wget --with-libmetalink: 3
wget --with-pcre --with-libmetalink: 3
wget --with-debug --with-pcre: 2
wget --with-libmetalink --with-gpgme: 2
wget --with-pcre --with-gpgme: 2
==> install (90d)
wget: 353131
wget --with-debug: 188
wget --with-pcre: 138
wget --with-pcre --with-libmetalink --with-gpgme: 118
wget --with-libressl: 81
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 47
wget --with-pcre --with-libmetalink: 31
wget --HEAD: 13
wget --with-pcre --with-gpgme: 12
wget --with-gpgme: 11
wget --with-debug --with-pcre: 10
wget --with-libmetalink: 8
wget --HEAD --with-pcre --with-libmetalink --with-gpgme: 4
wget --with-debug --with-pcre --with-libmetalink: 4
wget --with-libmetalink --with-gpgme: 4
==> install (365d)
wget: 1369530
wget --with-pcre: 810
wget --with-debug: 649
wget --with-pcre --with-libmetalink --with-gpgme: 554
wget --with-libressl: 479
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 235
wget --with-pcre --with-libmetalink: 184
wget --with-gpgme: 67
wget --with-pcre --with-gpgme: 67
wget --with-debug --with-pcre: 65
wget --HEAD: 54
wget --with-libmetalink: 30
wget --with-libmetalink --with-gpgme: 27
wget --with-debug --with-pcre --with-libmetalink: 24
==> install_on_request (30d)
wget: 77827
wget --with-debug: 48
wget --with-pcre: 12
wget --with-pcre --with-libmetalink --with-gpgme: 11
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 8
wget --HEAD: 3
wget --HEAD --with-debug --with-libmetalink --with-gpgme: 3
wget --with-gpgme: 3
wget --with-libmetalink: 3
wget --with-debug --with-pcre: 2
wget --with-libmetalink --with-gpgme: 2
wget --with-pcre --with-gpgme: 2
wget --with-pcre --with-libmetalink: 2
==> install_on_request (90d)
wget: 290818
wget --with-debug: 157
wget --with-pcre --with-libmetalink --with-gpgme: 101
wget --with-pcre: 100
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 42
wget --with-pcre --with-libmetalink: 30
wget --HEAD: 13
wget --with-pcre --with-gpgme: 11
wget --with-gpgme: 10
wget --with-debug --with-pcre: 8
wget --with-libmetalink: 7
wget --HEAD --with-pcre --with-libmetalink --with-gpgme: 4
wget --with-debug --with-pcre --with-libmetalink: 4
==> install_on_request (365d)
wget: 1042845
wget --with-pcre: 504
wget --with-debug: 458
wget --with-pcre --with-libmetalink --with-gpgme: 432
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 201
wget --with-pcre --with-libmetalink: 158
wget --with-gpgme: 61
wget --HEAD: 54
wget --with-pcre --with-gpgme: 49
wget --with-debug --with-pcre: 47
wget --with-debug --with-pcre --with-libmetalink: 24
wget --with-libressl: 23
wget --with-libmetalink: 22
wget --with-libmetalink --with-gpgme: 20
==> build_error (30d)
wget: 9
wget --HEAD: 1
wget --with-debug: 1
```
											
										 
											2018-09-06 14:18:30 +01:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2018-10-21 13:07:08 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     if filter.present? && results.blank? | 
					
						
							|  |  |  |       onoe "No results matching `#{filter}` found!" | 
					
						
							|  |  |  |       return | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-03-10 16:11:15 -04:00
										 |  |  |     analytics_table(category, days, results, os_version: os_version, cask_install: cask_install) | 
					
						
							| 
									
										
										
										
											2018-10-20 12:06:24 +01:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def output_formula_analytics(f) | 
					
						
							|  |  |  |     json = formulae_api_json("formula/#{f}.json") | 
					
						
							|  |  |  |     return if json.blank? || json["analytics"].blank? | 
					
						
							| 
									
										
											  
											
												cmd/info: display analytics data.
When users don't have `HOMEBREW_NO_ANALYTICS` or
`HOMEBREW_NO_GITHUB_API` set let's display some analytics data in
`brew info`. This should be useful for both maintainers and for users of
Homebrew.
Note this by default combines all installs across options for a single
number; for formulae with lots of options it's a bit overwhelming to
print the installs per-option. However, for `HOMEBREW_DEVELOPER`s print
the full output.
Sample non-developer output:
```console
$ brew info wget
wget: stable 1.19.5 (bottled), HEAD
Internet file retriever
https://www.gnu.org/software/wget/
/usr/local/Cellar/wget/1.19.5 (49 files, 3.7MB) *
  Built from source on 2018-09-03 at 20:46:32
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/wget.rb
==> Dependencies
Build: pkg-config ✔
Required: libidn2 ✔, openssl ✔
Optional: pcre ✔, libmetalink ✘, gpgme ✘
==> Options
--with-debug
	Build with debug support
--with-gpgme
	Build with gpgme support
--with-libmetalink
	Build with libmetalink support
--with-pcre
	Build with pcre support
--HEAD
	Install HEAD version
==> Analytics
install: 84638 (30d), 353800 (90d), 1372775 (365d)
install_on_request: 77926 (30d), 291305 (90d), 1044898 (365d)
build_error: 11 (30d)
```
Sample developer output:
```console
$ brew info wget
wget: stable 1.19.5 (bottled), HEAD
Internet file retriever
https://www.gnu.org/software/wget/
/usr/local/Cellar/wget/1.19.5 (49 files, 3.7MB) *
  Built from source on 2018-09-03 at 20:46:32
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/wget.rb
==> Dependencies
Build: pkg-config ✔
Required: libidn2 ✔, openssl ✔
Optional: pcre ✔, libmetalink ✘, gpgme ✘
==> Options
--with-debug
	Build with debug support
--with-gpgme
	Build with gpgme support
--with-libmetalink
	Build with libmetalink support
--with-pcre
	Build with pcre support
--HEAD
	Install HEAD version
==> Analytics
==> install (30d)
wget: 84516
wget --with-debug: 51
wget --with-libressl: 16
wget --with-pcre: 14
wget --with-pcre --with-libmetalink --with-gpgme: 12
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 8
wget --HEAD: 3
wget --HEAD --with-debug --with-libmetalink --with-gpgme: 3
wget --with-gpgme: 3
wget --with-libmetalink: 3
wget --with-pcre --with-libmetalink: 3
wget --with-debug --with-pcre: 2
wget --with-libmetalink --with-gpgme: 2
wget --with-pcre --with-gpgme: 2
==> install (90d)
wget: 353131
wget --with-debug: 188
wget --with-pcre: 138
wget --with-pcre --with-libmetalink --with-gpgme: 118
wget --with-libressl: 81
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 47
wget --with-pcre --with-libmetalink: 31
wget --HEAD: 13
wget --with-pcre --with-gpgme: 12
wget --with-gpgme: 11
wget --with-debug --with-pcre: 10
wget --with-libmetalink: 8
wget --HEAD --with-pcre --with-libmetalink --with-gpgme: 4
wget --with-debug --with-pcre --with-libmetalink: 4
wget --with-libmetalink --with-gpgme: 4
==> install (365d)
wget: 1369530
wget --with-pcre: 810
wget --with-debug: 649
wget --with-pcre --with-libmetalink --with-gpgme: 554
wget --with-libressl: 479
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 235
wget --with-pcre --with-libmetalink: 184
wget --with-gpgme: 67
wget --with-pcre --with-gpgme: 67
wget --with-debug --with-pcre: 65
wget --HEAD: 54
wget --with-libmetalink: 30
wget --with-libmetalink --with-gpgme: 27
wget --with-debug --with-pcre --with-libmetalink: 24
==> install_on_request (30d)
wget: 77827
wget --with-debug: 48
wget --with-pcre: 12
wget --with-pcre --with-libmetalink --with-gpgme: 11
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 8
wget --HEAD: 3
wget --HEAD --with-debug --with-libmetalink --with-gpgme: 3
wget --with-gpgme: 3
wget --with-libmetalink: 3
wget --with-debug --with-pcre: 2
wget --with-libmetalink --with-gpgme: 2
wget --with-pcre --with-gpgme: 2
wget --with-pcre --with-libmetalink: 2
==> install_on_request (90d)
wget: 290818
wget --with-debug: 157
wget --with-pcre --with-libmetalink --with-gpgme: 101
wget --with-pcre: 100
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 42
wget --with-pcre --with-libmetalink: 30
wget --HEAD: 13
wget --with-pcre --with-gpgme: 11
wget --with-gpgme: 10
wget --with-debug --with-pcre: 8
wget --with-libmetalink: 7
wget --HEAD --with-pcre --with-libmetalink --with-gpgme: 4
wget --with-debug --with-pcre --with-libmetalink: 4
==> install_on_request (365d)
wget: 1042845
wget --with-pcre: 504
wget --with-debug: 458
wget --with-pcre --with-libmetalink --with-gpgme: 432
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 201
wget --with-pcre --with-libmetalink: 158
wget --with-gpgme: 61
wget --HEAD: 54
wget --with-pcre --with-gpgme: 49
wget --with-debug --with-pcre: 47
wget --with-debug --with-pcre --with-libmetalink: 24
wget --with-libressl: 23
wget --with-libmetalink: 22
wget --with-libmetalink --with-gpgme: 20
==> build_error (30d)
wget: 9
wget --HEAD: 1
wget --with-debug: 1
```
											
										 
											2018-09-06 14:18:30 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-07 19:31:20 +05:30
										 |  |  |     full_analytics = args.analytics? || args.verbose? | 
					
						
							| 
									
										
										
										
											2018-10-20 12:06:24 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ohai "Analytics" | 
					
						
							| 
									
										
											  
											
												cmd/info: display analytics data.
When users don't have `HOMEBREW_NO_ANALYTICS` or
`HOMEBREW_NO_GITHUB_API` set let's display some analytics data in
`brew info`. This should be useful for both maintainers and for users of
Homebrew.
Note this by default combines all installs across options for a single
number; for formulae with lots of options it's a bit overwhelming to
print the installs per-option. However, for `HOMEBREW_DEVELOPER`s print
the full output.
Sample non-developer output:
```console
$ brew info wget
wget: stable 1.19.5 (bottled), HEAD
Internet file retriever
https://www.gnu.org/software/wget/
/usr/local/Cellar/wget/1.19.5 (49 files, 3.7MB) *
  Built from source on 2018-09-03 at 20:46:32
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/wget.rb
==> Dependencies
Build: pkg-config ✔
Required: libidn2 ✔, openssl ✔
Optional: pcre ✔, libmetalink ✘, gpgme ✘
==> Options
--with-debug
	Build with debug support
--with-gpgme
	Build with gpgme support
--with-libmetalink
	Build with libmetalink support
--with-pcre
	Build with pcre support
--HEAD
	Install HEAD version
==> Analytics
install: 84638 (30d), 353800 (90d), 1372775 (365d)
install_on_request: 77926 (30d), 291305 (90d), 1044898 (365d)
build_error: 11 (30d)
```
Sample developer output:
```console
$ brew info wget
wget: stable 1.19.5 (bottled), HEAD
Internet file retriever
https://www.gnu.org/software/wget/
/usr/local/Cellar/wget/1.19.5 (49 files, 3.7MB) *
  Built from source on 2018-09-03 at 20:46:32
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/wget.rb
==> Dependencies
Build: pkg-config ✔
Required: libidn2 ✔, openssl ✔
Optional: pcre ✔, libmetalink ✘, gpgme ✘
==> Options
--with-debug
	Build with debug support
--with-gpgme
	Build with gpgme support
--with-libmetalink
	Build with libmetalink support
--with-pcre
	Build with pcre support
--HEAD
	Install HEAD version
==> Analytics
==> install (30d)
wget: 84516
wget --with-debug: 51
wget --with-libressl: 16
wget --with-pcre: 14
wget --with-pcre --with-libmetalink --with-gpgme: 12
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 8
wget --HEAD: 3
wget --HEAD --with-debug --with-libmetalink --with-gpgme: 3
wget --with-gpgme: 3
wget --with-libmetalink: 3
wget --with-pcre --with-libmetalink: 3
wget --with-debug --with-pcre: 2
wget --with-libmetalink --with-gpgme: 2
wget --with-pcre --with-gpgme: 2
==> install (90d)
wget: 353131
wget --with-debug: 188
wget --with-pcre: 138
wget --with-pcre --with-libmetalink --with-gpgme: 118
wget --with-libressl: 81
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 47
wget --with-pcre --with-libmetalink: 31
wget --HEAD: 13
wget --with-pcre --with-gpgme: 12
wget --with-gpgme: 11
wget --with-debug --with-pcre: 10
wget --with-libmetalink: 8
wget --HEAD --with-pcre --with-libmetalink --with-gpgme: 4
wget --with-debug --with-pcre --with-libmetalink: 4
wget --with-libmetalink --with-gpgme: 4
==> install (365d)
wget: 1369530
wget --with-pcre: 810
wget --with-debug: 649
wget --with-pcre --with-libmetalink --with-gpgme: 554
wget --with-libressl: 479
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 235
wget --with-pcre --with-libmetalink: 184
wget --with-gpgme: 67
wget --with-pcre --with-gpgme: 67
wget --with-debug --with-pcre: 65
wget --HEAD: 54
wget --with-libmetalink: 30
wget --with-libmetalink --with-gpgme: 27
wget --with-debug --with-pcre --with-libmetalink: 24
==> install_on_request (30d)
wget: 77827
wget --with-debug: 48
wget --with-pcre: 12
wget --with-pcre --with-libmetalink --with-gpgme: 11
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 8
wget --HEAD: 3
wget --HEAD --with-debug --with-libmetalink --with-gpgme: 3
wget --with-gpgme: 3
wget --with-libmetalink: 3
wget --with-debug --with-pcre: 2
wget --with-libmetalink --with-gpgme: 2
wget --with-pcre --with-gpgme: 2
wget --with-pcre --with-libmetalink: 2
==> install_on_request (90d)
wget: 290818
wget --with-debug: 157
wget --with-pcre --with-libmetalink --with-gpgme: 101
wget --with-pcre: 100
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 42
wget --with-pcre --with-libmetalink: 30
wget --HEAD: 13
wget --with-pcre --with-gpgme: 11
wget --with-gpgme: 10
wget --with-debug --with-pcre: 8
wget --with-libmetalink: 7
wget --HEAD --with-pcre --with-libmetalink --with-gpgme: 4
wget --with-debug --with-pcre --with-libmetalink: 4
==> install_on_request (365d)
wget: 1042845
wget --with-pcre: 504
wget --with-debug: 458
wget --with-pcre --with-libmetalink --with-gpgme: 432
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 201
wget --with-pcre --with-libmetalink: 158
wget --with-gpgme: 61
wget --HEAD: 54
wget --with-pcre --with-gpgme: 49
wget --with-debug --with-pcre: 47
wget --with-debug --with-pcre --with-libmetalink: 24
wget --with-libressl: 23
wget --with-libmetalink: 22
wget --with-libmetalink --with-gpgme: 20
==> build_error (30d)
wget: 9
wget --HEAD: 1
wget --with-debug: 1
```
											
										 
											2018-09-06 14:18:30 +01:00
										 |  |  |     json["analytics"].each do |category, value| | 
					
						
							| 
									
										
										
										
											2018-10-20 12:06:24 +01:00
										 |  |  |       analytics = [] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       value.each do |days, results| | 
					
						
							|  |  |  |         days = days.to_i | 
					
						
							|  |  |  |         if full_analytics | 
					
						
							|  |  |  |           analytics_table(category, days, results) | 
					
						
							|  |  |  |         else | 
					
						
							|  |  |  |           total_count = results.values.inject("+") | 
					
						
							|  |  |  |           analytics << "#{number_readable(total_count)} (#{days} days)" | 
					
						
							|  |  |  |         end | 
					
						
							| 
									
										
											  
											
												cmd/info: display analytics data.
When users don't have `HOMEBREW_NO_ANALYTICS` or
`HOMEBREW_NO_GITHUB_API` set let's display some analytics data in
`brew info`. This should be useful for both maintainers and for users of
Homebrew.
Note this by default combines all installs across options for a single
number; for formulae with lots of options it's a bit overwhelming to
print the installs per-option. However, for `HOMEBREW_DEVELOPER`s print
the full output.
Sample non-developer output:
```console
$ brew info wget
wget: stable 1.19.5 (bottled), HEAD
Internet file retriever
https://www.gnu.org/software/wget/
/usr/local/Cellar/wget/1.19.5 (49 files, 3.7MB) *
  Built from source on 2018-09-03 at 20:46:32
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/wget.rb
==> Dependencies
Build: pkg-config ✔
Required: libidn2 ✔, openssl ✔
Optional: pcre ✔, libmetalink ✘, gpgme ✘
==> Options
--with-debug
	Build with debug support
--with-gpgme
	Build with gpgme support
--with-libmetalink
	Build with libmetalink support
--with-pcre
	Build with pcre support
--HEAD
	Install HEAD version
==> Analytics
install: 84638 (30d), 353800 (90d), 1372775 (365d)
install_on_request: 77926 (30d), 291305 (90d), 1044898 (365d)
build_error: 11 (30d)
```
Sample developer output:
```console
$ brew info wget
wget: stable 1.19.5 (bottled), HEAD
Internet file retriever
https://www.gnu.org/software/wget/
/usr/local/Cellar/wget/1.19.5 (49 files, 3.7MB) *
  Built from source on 2018-09-03 at 20:46:32
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/wget.rb
==> Dependencies
Build: pkg-config ✔
Required: libidn2 ✔, openssl ✔
Optional: pcre ✔, libmetalink ✘, gpgme ✘
==> Options
--with-debug
	Build with debug support
--with-gpgme
	Build with gpgme support
--with-libmetalink
	Build with libmetalink support
--with-pcre
	Build with pcre support
--HEAD
	Install HEAD version
==> Analytics
==> install (30d)
wget: 84516
wget --with-debug: 51
wget --with-libressl: 16
wget --with-pcre: 14
wget --with-pcre --with-libmetalink --with-gpgme: 12
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 8
wget --HEAD: 3
wget --HEAD --with-debug --with-libmetalink --with-gpgme: 3
wget --with-gpgme: 3
wget --with-libmetalink: 3
wget --with-pcre --with-libmetalink: 3
wget --with-debug --with-pcre: 2
wget --with-libmetalink --with-gpgme: 2
wget --with-pcre --with-gpgme: 2
==> install (90d)
wget: 353131
wget --with-debug: 188
wget --with-pcre: 138
wget --with-pcre --with-libmetalink --with-gpgme: 118
wget --with-libressl: 81
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 47
wget --with-pcre --with-libmetalink: 31
wget --HEAD: 13
wget --with-pcre --with-gpgme: 12
wget --with-gpgme: 11
wget --with-debug --with-pcre: 10
wget --with-libmetalink: 8
wget --HEAD --with-pcre --with-libmetalink --with-gpgme: 4
wget --with-debug --with-pcre --with-libmetalink: 4
wget --with-libmetalink --with-gpgme: 4
==> install (365d)
wget: 1369530
wget --with-pcre: 810
wget --with-debug: 649
wget --with-pcre --with-libmetalink --with-gpgme: 554
wget --with-libressl: 479
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 235
wget --with-pcre --with-libmetalink: 184
wget --with-gpgme: 67
wget --with-pcre --with-gpgme: 67
wget --with-debug --with-pcre: 65
wget --HEAD: 54
wget --with-libmetalink: 30
wget --with-libmetalink --with-gpgme: 27
wget --with-debug --with-pcre --with-libmetalink: 24
==> install_on_request (30d)
wget: 77827
wget --with-debug: 48
wget --with-pcre: 12
wget --with-pcre --with-libmetalink --with-gpgme: 11
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 8
wget --HEAD: 3
wget --HEAD --with-debug --with-libmetalink --with-gpgme: 3
wget --with-gpgme: 3
wget --with-libmetalink: 3
wget --with-debug --with-pcre: 2
wget --with-libmetalink --with-gpgme: 2
wget --with-pcre --with-gpgme: 2
wget --with-pcre --with-libmetalink: 2
==> install_on_request (90d)
wget: 290818
wget --with-debug: 157
wget --with-pcre --with-libmetalink --with-gpgme: 101
wget --with-pcre: 100
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 42
wget --with-pcre --with-libmetalink: 30
wget --HEAD: 13
wget --with-pcre --with-gpgme: 11
wget --with-gpgme: 10
wget --with-debug --with-pcre: 8
wget --with-libmetalink: 7
wget --HEAD --with-pcre --with-libmetalink --with-gpgme: 4
wget --with-debug --with-pcre --with-libmetalink: 4
==> install_on_request (365d)
wget: 1042845
wget --with-pcre: 504
wget --with-debug: 458
wget --with-pcre --with-libmetalink --with-gpgme: 432
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 201
wget --with-pcre --with-libmetalink: 158
wget --with-gpgme: 61
wget --HEAD: 54
wget --with-pcre --with-gpgme: 49
wget --with-debug --with-pcre: 47
wget --with-debug --with-pcre --with-libmetalink: 24
wget --with-libressl: 23
wget --with-libmetalink: 22
wget --with-libmetalink --with-gpgme: 20
==> build_error (30d)
wget: 9
wget --HEAD: 1
wget --with-debug: 1
```
											
										 
											2018-09-06 14:18:30 +01:00
										 |  |  |       end | 
					
						
							| 
									
										
										
										
											2018-10-20 12:06:24 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |       puts "#{category}: #{analytics.join(", ")}" unless full_analytics | 
					
						
							| 
									
										
											  
											
												cmd/info: display analytics data.
When users don't have `HOMEBREW_NO_ANALYTICS` or
`HOMEBREW_NO_GITHUB_API` set let's display some analytics data in
`brew info`. This should be useful for both maintainers and for users of
Homebrew.
Note this by default combines all installs across options for a single
number; for formulae with lots of options it's a bit overwhelming to
print the installs per-option. However, for `HOMEBREW_DEVELOPER`s print
the full output.
Sample non-developer output:
```console
$ brew info wget
wget: stable 1.19.5 (bottled), HEAD
Internet file retriever
https://www.gnu.org/software/wget/
/usr/local/Cellar/wget/1.19.5 (49 files, 3.7MB) *
  Built from source on 2018-09-03 at 20:46:32
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/wget.rb
==> Dependencies
Build: pkg-config ✔
Required: libidn2 ✔, openssl ✔
Optional: pcre ✔, libmetalink ✘, gpgme ✘
==> Options
--with-debug
	Build with debug support
--with-gpgme
	Build with gpgme support
--with-libmetalink
	Build with libmetalink support
--with-pcre
	Build with pcre support
--HEAD
	Install HEAD version
==> Analytics
install: 84638 (30d), 353800 (90d), 1372775 (365d)
install_on_request: 77926 (30d), 291305 (90d), 1044898 (365d)
build_error: 11 (30d)
```
Sample developer output:
```console
$ brew info wget
wget: stable 1.19.5 (bottled), HEAD
Internet file retriever
https://www.gnu.org/software/wget/
/usr/local/Cellar/wget/1.19.5 (49 files, 3.7MB) *
  Built from source on 2018-09-03 at 20:46:32
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/wget.rb
==> Dependencies
Build: pkg-config ✔
Required: libidn2 ✔, openssl ✔
Optional: pcre ✔, libmetalink ✘, gpgme ✘
==> Options
--with-debug
	Build with debug support
--with-gpgme
	Build with gpgme support
--with-libmetalink
	Build with libmetalink support
--with-pcre
	Build with pcre support
--HEAD
	Install HEAD version
==> Analytics
==> install (30d)
wget: 84516
wget --with-debug: 51
wget --with-libressl: 16
wget --with-pcre: 14
wget --with-pcre --with-libmetalink --with-gpgme: 12
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 8
wget --HEAD: 3
wget --HEAD --with-debug --with-libmetalink --with-gpgme: 3
wget --with-gpgme: 3
wget --with-libmetalink: 3
wget --with-pcre --with-libmetalink: 3
wget --with-debug --with-pcre: 2
wget --with-libmetalink --with-gpgme: 2
wget --with-pcre --with-gpgme: 2
==> install (90d)
wget: 353131
wget --with-debug: 188
wget --with-pcre: 138
wget --with-pcre --with-libmetalink --with-gpgme: 118
wget --with-libressl: 81
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 47
wget --with-pcre --with-libmetalink: 31
wget --HEAD: 13
wget --with-pcre --with-gpgme: 12
wget --with-gpgme: 11
wget --with-debug --with-pcre: 10
wget --with-libmetalink: 8
wget --HEAD --with-pcre --with-libmetalink --with-gpgme: 4
wget --with-debug --with-pcre --with-libmetalink: 4
wget --with-libmetalink --with-gpgme: 4
==> install (365d)
wget: 1369530
wget --with-pcre: 810
wget --with-debug: 649
wget --with-pcre --with-libmetalink --with-gpgme: 554
wget --with-libressl: 479
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 235
wget --with-pcre --with-libmetalink: 184
wget --with-gpgme: 67
wget --with-pcre --with-gpgme: 67
wget --with-debug --with-pcre: 65
wget --HEAD: 54
wget --with-libmetalink: 30
wget --with-libmetalink --with-gpgme: 27
wget --with-debug --with-pcre --with-libmetalink: 24
==> install_on_request (30d)
wget: 77827
wget --with-debug: 48
wget --with-pcre: 12
wget --with-pcre --with-libmetalink --with-gpgme: 11
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 8
wget --HEAD: 3
wget --HEAD --with-debug --with-libmetalink --with-gpgme: 3
wget --with-gpgme: 3
wget --with-libmetalink: 3
wget --with-debug --with-pcre: 2
wget --with-libmetalink --with-gpgme: 2
wget --with-pcre --with-gpgme: 2
wget --with-pcre --with-libmetalink: 2
==> install_on_request (90d)
wget: 290818
wget --with-debug: 157
wget --with-pcre --with-libmetalink --with-gpgme: 101
wget --with-pcre: 100
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 42
wget --with-pcre --with-libmetalink: 30
wget --HEAD: 13
wget --with-pcre --with-gpgme: 11
wget --with-gpgme: 10
wget --with-debug --with-pcre: 8
wget --with-libmetalink: 7
wget --HEAD --with-pcre --with-libmetalink --with-gpgme: 4
wget --with-debug --with-pcre --with-libmetalink: 4
==> install_on_request (365d)
wget: 1042845
wget --with-pcre: 504
wget --with-debug: 458
wget --with-pcre --with-libmetalink --with-gpgme: 432
wget --with-debug --with-pcre --with-libmetalink --with-gpgme: 201
wget --with-pcre --with-libmetalink: 158
wget --with-gpgme: 61
wget --HEAD: 54
wget --with-pcre --with-gpgme: 49
wget --with-debug --with-pcre: 47
wget --with-debug --with-pcre --with-libmetalink: 24
wget --with-libressl: 23
wget --with-libmetalink: 22
wget --with-libmetalink --with-gpgme: 20
==> build_error (30d)
wget: 9
wget --HEAD: 1
wget --with-debug: 1
```
											
										 
											2018-09-06 14:18:30 +01:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-03 13:09:07 +01:00
										 |  |  |   def decorate_dependencies(dependencies) | 
					
						
							| 
									
										
										
										
											2018-09-02 20:14:54 +01:00
										 |  |  |     deps_status = dependencies.map do |dep| | 
					
						
							| 
									
										
										
										
											2016-10-17 04:13:48 -04:00
										 |  |  |       if dep.satisfied?([]) | 
					
						
							|  |  |  |         pretty_installed(dep_display_s(dep)) | 
					
						
							|  |  |  |       else | 
					
						
							|  |  |  |         pretty_uninstalled(dep_display_s(dep)) | 
					
						
							|  |  |  |       end | 
					
						
							| 
									
										
										
										
											2013-11-11 14:15:46 +00:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2016-10-17 04:13:48 -04:00
										 |  |  |     deps_status.join(", ") | 
					
						
							| 
									
										
										
										
											2013-11-11 14:15:46 +00:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2016-09-18 00:12:49 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |   def decorate_requirements(requirements) | 
					
						
							| 
									
										
										
										
											2018-09-02 20:14:54 +01:00
										 |  |  |     req_status = requirements.map do |req| | 
					
						
							| 
									
										
										
										
											2016-09-18 00:37:02 -04:00
										 |  |  |       req_s = req.display_s | 
					
						
							|  |  |  |       req.satisfied? ? pretty_installed(req_s) : pretty_uninstalled(req_s) | 
					
						
							| 
									
										
										
										
											2016-09-18 00:12:49 -04:00
										 |  |  |     end | 
					
						
							| 
									
										
										
										
											2016-09-18 00:37:02 -04:00
										 |  |  |     req_status.join(", ") | 
					
						
							| 
									
										
										
										
											2016-09-18 00:12:49 -04:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2016-10-17 04:13:48 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  |   def dep_display_s(dep) | 
					
						
							|  |  |  |     return dep.name if dep.option_tags.empty? | 
					
						
							| 
									
										
										
										
											2018-09-17 02:45:00 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-10-17 04:13:48 -04:00
										 |  |  |     "#{dep.name} #{dep.option_tags.map { |o| "--#{o}" }.join(" ")}" | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2018-10-20 12:06:24 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |   def format_count(count) | 
					
						
							|  |  |  |     count.to_s.reverse.gsub(/(\d{3})(?=\d)/, '\\1,').reverse | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def format_percent(percent) | 
					
						
							| 
									
										
										
										
											2019-10-03 08:50:45 +02:00
										 |  |  |     format("%<percent>.2f", percent: percent) | 
					
						
							| 
									
										
										
										
											2018-10-20 12:06:24 +01:00
										 |  |  |   end | 
					
						
							| 
									
										
										
										
											2010-09-11 20:22:54 +01:00
										 |  |  | end |