Class: Fontist::FontInstaller

Inherits:
Object
  • Object
show all
Defined in:
lib/fontist/font_installer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(formula, font_name: nil, no_progress: false, location: nil, format_spec: nil, confirmation: "no") ⇒ FontInstaller

Returns a new instance of FontInstaller.



8
9
10
11
12
13
14
15
16
# File 'lib/fontist/font_installer.rb', line 8

def initialize(formula, font_name: nil, no_progress: false, location: nil,
               format_spec: nil, confirmation: "no")
  @formula = formula
  @font_name = font_name
  @no_progress = no_progress
  @location = InstallLocation.create(formula, location_type: location)
  @format_spec = format_spec
  @confirmation = confirmation
end

Instance Attribute Details

#locationObject (readonly)

Returns the value of attribute location.



6
7
8
# File 'lib/fontist/font_installer.rb', line 6

def location
  @location
end

Instance Method Details

#install(confirmation:) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/fontist/font_installer.rb', line 18

def install(confirmation:)
  raise_platform_error unless platform_compatible?
  raise_fontist_version_error unless supported_version?
  raise_licensing_error unless license_is_accepted?(confirmation)

  install_font
end