Class: Cask::Cmd::Home Private

Inherits:
AbstractCommand show all
Defined in:
Library/Homebrew/cask/cmd/home.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Implementation of the brew cask home command.

Constant Summary

Constants inherited from AbstractCommand

AbstractCommand::OPTIONS

Instance Attribute Summary

Attributes inherited from AbstractCommand

#args

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AbstractCommand

abstract?, banner_args, banner_headline, command_name, help, #initialize, max_named, min_named, parser, run, short_description, visible?

Methods included from Homebrew::Search

#query_regexp, #search_casks, #search_descriptions, #search_formulae, #search_taps

Constructor Details

This class inherits a constructor from Cask::Cmd::AbstractCommand

Class Method Details

.descriptionObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


10
11
12
# File 'Library/Homebrew/cask/cmd/home.rb', line 10

def self.description
  "Opens the homepage of the given <cask>. If no cask is given, opens the Homebrew homepage."
end

.open_url(url) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


26
27
28
# File 'Library/Homebrew/cask/cmd/home.rb', line 26

def self.open_url(url)
  SystemCommand.run!(OS::PATH_OPEN, args: ["--", url])
end

Instance Method Details

#runObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.


14
15
16
17
18
19
20
21
22
23
24
# File 'Library/Homebrew/cask/cmd/home.rb', line 14

def run
  if casks.none?
    odebug "Opening project homepage"
    self.class.open_url "https://brew.sh/"
  else
    casks.each do |cask|
      odebug "Opening homepage for Cask #{cask}"
      self.class.open_url cask.homepage
    end
  end
end