diff options
| author | Mike McQuaid | 2017-01-09 21:07:55 +0000 |
|---|---|---|
| committer | Mike McQuaid | 2017-01-18 11:23:21 +0000 |
| commit | 16293c0a68622dee1497b36be8aef9d8a6dc064f (patch) | |
| tree | 2cd0084ad28eab3ac4b0f96e8a4ae49ba8b55018 /Library | |
| parent | 44f1c9752a1f55f09475cab79ab85fdaf39cef84 (diff) | |
| download | brew-16293c0a68622dee1497b36be8aef9d8a6dc064f.tar.bz2 | |
formula_installer: use installed_* variables.
Also, report formulae installed on request. This is useful in
differentiating between those formulae that are popular because they
are widely requested and those that are popular because they are widely
depended on.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/formula_installer.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index 55e983264..d9127f654 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -36,6 +36,7 @@ class FormulaInstaller mode_attr_accessor :build_from_source, :force_bottle mode_attr_accessor :ignore_deps, :only_deps, :interactive, :git mode_attr_accessor :verbose, :debug, :quieter + mode_attr_accessor :installed_as_dependency, :installed_on_request def initialize(formula) @formula = formula @@ -50,6 +51,8 @@ class FormulaInstaller @verbose = false @quieter = false @debug = false + @installed_as_dependency = false + @installed_on_request = true @options = Options.new @invalid_option_names = [] @requirement_messages = [] @@ -250,6 +253,12 @@ class FormulaInstaller category = "install" action = ([formula.full_name] + options).join(" ") Utils::Analytics.report_event(category, action) + + if installed_on_request + category = "install_on_request" + action = ([formula.full_name] + options).join(" ") + Utils::Analytics.report_event(category, action) + end end @@attempted << formula @@ -287,6 +296,12 @@ class FormulaInstaller brew_prefix = formula.prefix/".brew" brew_prefix.mkdir Pathname(brew_prefix/"#{formula.name}.rb").atomic_write(s) + + keg = Keg.new(formula.prefix) + tab = Tab.for_keg(keg) + tab.installed_as_dependency = installed_as_dependency + tab.installed_on_request = installed_on_request + tab.write end build_bottle_postinstall if build_bottle? @@ -483,6 +498,8 @@ class FormulaInstaller fi.build_from_source = ARGV.build_formula_from_source?(df) fi.verbose = verbose? && !quieter? fi.debug = debug? + fi.installed_as_dependency = true + fi.installed_on_request = false fi.prelude oh1 "Installing #{formula.full_name} dependency: #{Formatter.identifier(dep.name)}" fi.install @@ -809,6 +826,8 @@ class FormulaInstaller tab.time = Time.now.to_i tab.head = HOMEBREW_REPOSITORY.git_head tab.source["path"] = formula.specified_path.to_s + tab.installed_as_dependency = installed_as_dependency + tab.installed_on_request = installed_on_request tab.write end |
