lib/ronin/ui/command_line/commands/install.rb in ronin-0.2.0 vs lib/ronin/ui/command_line/commands/install.rb in ronin-0.2.1

- old
+ new

@@ -25,54 +25,54 @@ require 'ronin/platform/overlay' module Ronin module UI module CommandLine - class InstallCommand < Command + module Commands + class Install < Command - command :install + def defaults + @cache = nil + @media = nil + end - def initialize - @cache = nil - @media = nil + def define_options(opts) + opts.usage = 'URI [options]' - super - end + opts.options do + opts.on('-C','--cache DIR','Specify an alternate overlay cache') do |dir| + @cache = dir + end - def define_options(opts) - opts.usage = 'URI [options]' - - opts.options do - opts.on('-C','--cache DIR','Specify an alternate overlay cache') do |dir| - @cache = dir + opts.on('-m','--media [MEDIA]','Spedify the media-type of the overlay') do |media| + @media = media + end end - opts.on('-m','--media [MEDIA]','Spedify the media-type of the overlay') do |media| - @media = media - end - end + opts.arguments( + 'URI' => 'The URI of the overlay to install' + ) - opts.arguments( - 'URI' => 'The URI of the overlay to install' - ) - - opts.summary('Installs the overlay located at the specified URI') - end - - def arguments(args) - unless args.length == 1 - fail('only one overlay URI maybe specified') + opts.summary %{ + Installs the overlay located at the specified URI + } end - uri = args.first + def arguments(args) + unless args.length == 1 + fail('only one overlay URI maybe specified') + end - Platform.load_overlays(@cache) if @cache + uri = args.first - Platform.install(:uri => uri, :media => @media) do |overlay| - puts "Overlay #{overlay.name.dump} has been installed." + Platform.load_overlays(@cache) if @cache + + Platform.install(:uri => uri, :media => @media) do |overlay| + puts "Overlay #{overlay.name.dump} has been installed." + end end - end + end end end end end