Class: Dapp::CLI::Command::Update

Inherits:
Dapp::CLI
  • Object
show all
Defined in:
lib/dapp/cli/command/update.rb

Constant Summary

Constants inherited from Dapp::CLI

SUBCOMMANDS

Instance Method Summary collapse

Methods inherited from Dapp::CLI

#initialize

Methods included from Helper::Cli

#cli_wrapper, #composite_options, #in_validate!, #list_msg_format, #parse_options, #parse_subcommand, #prepare_subcommand, #required_argument, #run_subcommand

Methods included from Helper::Trivia

class_to_lowercase, #class_to_lowercase, #delete_file, #kwargs, #make_path, #search_file_upward

Constructor Details

This class inherits a constructor from Dapp::CLI

Instance Method Details

#approximate_recommendation(version) ⇒ Object

get latest beta-version



15
16
17
# File 'lib/dapp/cli/command/update.rb', line 15

def approximate_recommendation(version)
  [version.approximate_recommendation, 0].join('.')
end

#run(_argv) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/dapp/cli/command/update.rb', line 5

def run(_argv)
  spec = Gem::Specification.find do |s|
    File.fnmatch(File.join(s.full_gem_path, '*'), __FILE__)
  end
  Gem.install(spec.name, approximate_recommendation(spec.version))
rescue Gem::FilePermissionError => e
  raise Errno::EACCES, e.message
end