Class: Homebrew::Cmd::Developer Private

Inherits:
AbstractCommand show all
Defined in:
cmd/developer.rb,
sorbet/rbi/dsl/homebrew/cmd/developer.rbi

This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.

Defined Under Namespace

Classes: Args

Instance Method Summary collapse

Methods inherited from AbstractCommand

command, command_name, dev_cmd?, #initialize, parser, ruby_cmd?

Constructor Details

This class inherits a constructor from Homebrew::AbstractCommand

Instance Method Details

#argsHomebrew::Cmd::Developer::Args

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.



10
# File 'sorbet/rbi/dsl/homebrew/cmd/developer.rbi', line 10

def args; end

#runvoid

This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

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
53
54
55
56
57
58
59
# File 'cmd/developer.rb', line 26

def run
  case args.named.first
  when nil, "state"
    if Homebrew::EnvConfig.developer?
      puts "Developer mode is enabled because #{Tty.bold}HOMEBREW_DEVELOPER#{Tty.reset} is set."
    elsif Homebrew::EnvConfig.devcmdrun?
      puts "Developer mode is enabled because a developer command or `brew developer on` was run."
    else
      puts "Developer mode is disabled."
    end
    if Homebrew::EnvConfig.developer? || Homebrew::EnvConfig.devcmdrun?
      if Homebrew::EnvConfig.update_to_tag?
        puts "However, `brew update` will update to the latest stable tag because " \
             "#{Tty.bold}HOMEBREW_UPDATE_TO_TAG#{Tty.reset} is set."
      else
        puts "`brew update` will update to the latest commit on the `master` branch."
      end
    else
      puts "`brew update` will update to the latest stable tag."
    end
  when "on"
    Homebrew::Settings.write "devcmdrun", true
    if Homebrew::EnvConfig.update_to_tag?
      puts "To fully enable developer mode, you must unset #{Tty.bold}HOMEBREW_UPDATE_TO_TAG#{Tty.reset}."
    end
  when "off"
    Homebrew::Settings.delete "devcmdrun"
    if Homebrew::EnvConfig.developer?
      puts "To fully disable developer mode, you must unset #{Tty.bold}HOMEBREW_DEVELOPER#{Tty.reset}."
    end
  else
    raise UsageError, "unknown subcommand: #{args.named.first}"
  end
end