Class: Homebrew::Cmd::Developer

Inherits:
AbstractCommand show all
Defined in:
cmd/developer.rb

Instance Attribute Summary

Attributes inherited from AbstractCommand

#args

Instance Method Summary collapse

Methods inherited from AbstractCommand

command, command_name, #initialize, parser

Constructor Details

This class inherits a constructor from Homebrew::AbstractCommand

Instance Method Details

#runvoid

This method returns an undefined value.



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'cmd/developer.rb', line 26

def run
  env_vars = []
  env_vars << "HOMEBREW_DEVELOPER" if Homebrew::EnvConfig.developer?
  env_vars << "HOMEBREW_UPDATE_TO_TAG" if Homebrew::EnvConfig.update_to_tag?
  env_vars.map! do |var|
    "#{Tty.bold}#{var}#{Tty.reset}"
  end

  case args.named.first
  when nil, "state"
    if env_vars.any?
      verb = (env_vars.count == 1) ? "is" : "are"
      puts "Developer mode is enabled because #{env_vars.to_sentence} #{verb} set."
    elsif Homebrew::Settings.read("devcmdrun") == "true"
      puts "Developer mode is enabled."
    else
      puts "Developer mode is disabled."
    end
  when "on"
    Homebrew::Settings.write "devcmdrun", true
  when "off"
    Homebrew::Settings.delete "devcmdrun"
    puts "To fully disable developer mode, you must unset #{env_vars.to_sentence}." if env_vars.any?
  else
    raise UsageError, "unknown subcommand: #{args.named.first}"
  end
end