Class: Ploy::Command::Install

Inherits:
Base
  • Object
show all
Defined in:
lib/ploy/command/install.rb

Instance Method Summary collapse

Instance Method Details

#helpObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/ploy/command/install.rb', line 26

def help
  return <<helptext
usage: ploy install -b $bucket -d $deployment -B $branch -v $version [-r $variant]

#{optparser}

Examples:
  $ ploy install -b deploybucket -d someproject # default to master branch and current version
  $ ploy install -b deploybucket -d someproject -B master -v current
  $ ploy install -b deploybucket -d someproject -B master -v 6d4a094dcaad6e421f85b24c7c75153db72ab00c

Summary:

  The install command will download and install a package that matches the
  specification given on the command line. If the available version has the
  same git revision as a currently installed version, it will do nothing.

helptext

end

#run(argv) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ploy/command/install.rb', line 8

def run(argv)
  o = {
    :version => 'current',
    :branch  => 'master',
    :check   => true,
    :variant => nil
  }
  optparser(o).parse!(argv)
  pkg = Ploy::Package.new(o[:bucket], o[:deploy], o[:branch], o[:version], o[:variant])
  if (!o[:check] || pkg.check_new_version)
    pkg.install()
    puts "installed #{o[:deploy]}"
  else
    puts "no new version available"
  end
  return true
end