Class: Dply::Cli::InstallPkgs

Inherits:
Object
  • Object
show all
Includes:
Helper
Defined in:
lib/dply/cli/install_pkgs.rb

Instance Method Summary collapse

Methods included from Helper

#cmd, #error, #git, #logger, #sh, #symlink

Constructor Details

#initialize(argv) ⇒ InstallPkgs

Returns a new instance of InstallPkgs.



10
11
12
13
# File 'lib/dply/cli/install_pkgs.rb', line 10

def initialize(argv)
  @argv = argv
  @options = {}
end

Instance Method Details

#optsObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/dply/cli/install_pkgs.rb', line 23

def opts
  OptionParser.new do |opts|

    opts.banner = "Usage: drake install-pkgs [options] [target]"

    opts.on("-b" , "Build mode") do |b|
      @options[:build_mode] = true
    end

    opts.on("-h", "--help", "Help") do
      puts opts
      exit
    end
  end
end

#runObject



15
16
17
18
19
20
21
# File 'lib/dply/cli/install_pkgs.rb', line 15

def run
  opts.parse!(@argv)
  error "pkgs.yml cannot be a symlink" if File.symlink? "pkgs.yml"
  pkgs = Pkgs.new("pkgs.yml")
  pkgs.install(build_mode: @options[:build_mode])
  puts "installed"
end