Class: Fvm::CLI::Installer

Inherits:
Object
  • Object
show all
Defined in:
lib/fvm/cli/installer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dir, executables) ⇒ Installer

Returns a new instance of Installer.



10
11
12
13
# File 'lib/fvm/cli/installer.rb', line 10

def initialize( dir, executables )
  @dir = Pathname.new( dir ).expand_path
  @executables = executables
end

Instance Attribute Details

#dirObject (readonly)

Returns the value of attribute dir.



9
10
11
# File 'lib/fvm/cli/installer.rb', line 9

def dir
  @dir
end

#executablesObject (readonly)

Returns the value of attribute executables.



9
10
11
# File 'lib/fvm/cli/installer.rb', line 9

def executables
  @executables
end

Instance Method Details

#install(zip_url, version) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/fvm/cli/installer.rb', line 15

def install( zip_url, version )
  # download the zip and unzip it
  temp = download zip_url
  # create the destination directory name for this sdk version
  dest = File.join( dir, "flex_sdk_#{version}" )
  # move the unzipped directory to the destination
  move = FileUtils.mv temp, dest
  # make all executables in bin actually executable
  make_executables_executable! dest
  # return the destination
  dest
end

#installationsObject



28
29
30
# File 'lib/fvm/cli/installer.rb', line 28

def installations
  Dir[ File.join( dir, 'flex_sdk_*' ) ].map { |d| Installation.new( d ) }
end