Class: Bundler::InstallDashDocs::Dash

Inherits:
Object
  • Object
show all
Defined in:
lib/bundler/install_dash_docs/dash.rb

Overview

Methods for interacting with Dash.app

Class Method Summary collapse

Class Method Details

.install(gem_name, version, quiet: false, trace: false, dry_run: false) ⇒ Object

Installs the provided gem documentation into Dash.app

Parameters:

  • gem_name (String)

    the name of the gem

  • version (String)

    the specific version of the gem

  • quiet (Boolean) (defaults to: false)

    if set to true, informative log messages are suppressed

  • trace (Boolean) (defaults to: false)

    if set to true, the ‘open` command that’s executed is logged

  • dry_run (Boolean) (defaults to: false)

    if set to true, ‘open` command is not executed (but might be printed if trace == true)



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/bundler/install_dash_docs/dash.rb', line 14

def self.install(gem_name, version, quiet: false, trace: false, dry_run: false)
  puts "Installing docs for #{gem_name} #{version}" unless quiet
  url = DashInstallUrl.new(gem_name, version)
  command = [
    "open",
    "-g",
    url.to_str
  ]
  puts("+ " + command.join(" ")) if trace
  unless dry_run
    system(*command)
    sleep 2
  end
end