Class: Esbuild::BinaryInstaller
- Inherits:
-
Object
- Object
- Esbuild::BinaryInstaller
- Defined in:
- lib/esbuild/binary_installer.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#platform ⇒ Object
readonly
Returns the value of attribute platform.
Instance Method Summary collapse
-
#initialize(platform, path) ⇒ BinaryInstaller
constructor
A new instance of BinaryInstaller.
- #install ⇒ Object
Constructor Details
#initialize(platform, path) ⇒ BinaryInstaller
Returns a new instance of BinaryInstaller.
9 10 11 12 13 14 |
# File 'lib/esbuild/binary_installer.rb', line 9 def initialize(platform, path) package = package_from_platform(platform) raise ArgumentError, "Unknown platform #{platform}" unless package @package = package @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
8 9 10 |
# File 'lib/esbuild/binary_installer.rb', line 8 def path @path end |
#platform ⇒ Object (readonly)
Returns the value of attribute platform.
8 9 10 |
# File 'lib/esbuild/binary_installer.rb', line 8 def platform @platform end |
Instance Method Details
#install ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/esbuild/binary_installer.rb', line 16 def install tempfile = "#{@path}__" if ENV["ESBUILD_BINARY_PATH"] FileUtils.cp(ENV["ESBUILD_BINARY_PATH"], tempfile) else # TODO: use cache download(tempfile) end validate_binary_version!(tempfile) FileUtils.mv(tempfile, @path) end |