Class: Albacore::Cli

Inherits:
Object
  • Object
show all
Includes:
CliDSL
Defined in:
lib/albacore/cli.rb

Instance Method Summary collapse

Methods included from CliDSL

included

Constructor Details

#initialize(args) ⇒ Cli

Returns a new instance of Cli.



10
11
12
13
14
15
# File 'lib/albacore/cli.rb', line 10

def initialize args
  # Run a semver command. Raise a CommandError if the command does not exist.
  # Expects an array of commands, such as ARGV.
  @args = args
  run_command(@args.shift || :help)
end

Instance Method Details

#download_paketObject



198
199
200
# File 'lib/albacore/cli.rb', line 198

def download_paket
  download_tool 'https://github.com/fsprojects/Paket/releases/download/0.16.2/paket.bootstrapper.exe', 'paket.bootstrapper.exe' unless File.exists? './tools/paket.bootstrapper.exe'
end

#download_tool(uri, file_name) ⇒ Object



202
203
204
205
206
207
208
209
210
211
# File 'lib/albacore/cli.rb', line 202

def download_tool uri, file_name
  target = "./tools/#{file_name}"

  Dir.mkdir './tools' unless Dir.exists? './tools'
  File.open(target, "wb") do |saved_file|
    open(uri, "rb") do |read_file|
      saved_file.write(read_file.read)
    end
  end
end