Class: Dply::Cli::Build

Inherits:
Object
  • Object
show all
Includes:
Logger
Defined in:
lib/dply/cli/build.rb

Instance Method Summary collapse

Methods included from Logger

#debug?, #logger, stderr, #stderr

Constructor Details

#initialize(argv) ⇒ Build

Returns a new instance of Build.



12
13
14
# File 'lib/dply/cli/build.rb', line 12

def initialize(argv)
  @argv = argv
end

Instance Method Details

#buildObject



22
23
24
# File 'lib/dply/cli/build.rb', line 22

def build
  @build ||= ::Dply::Build.new(config)
end

#configObject



26
27
28
# File 'lib/dply/cli/build.rb', line 26

def config
  @config ||= ::Dply::BuildConfig.new.to_struct
end

#dirObject



30
31
32
# File 'lib/dply/cli/build.rb', line 30

def dir
  @dir ||= Dir.pwd
end

#lockObject



34
35
36
# File 'lib/dply/cli/build.rb', line 34

def lock
  @lock ||= ::Dply::Lock.new
end

#optsObject



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/dply/cli/build.rb', line 38

def opts
  OptionParser.new do |opts|

    opts.banner = "Usage: drake build [options] [target]"
    
    opts.on("-b", "--branch [BRANCH]" , "Specify git branch") do |b|
      config.branch = b
    end

    opts.on("-r", "--revision [REVISION]", "Specify revision") do |r|
      config.revision = r
    end

    opts.on("--no-pull", "Enable/disable git pull") do |e|
      config.no_pull = true
    end

    opts.on("--use-yum", "use yum to install packages") do |e|
      config.use_yum = true
    end

    opts.on("--skip-git", "Disable git") do |e|
      config.git = false
    end  

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

#runObject



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

def run
  lock.acquire
  opts.parse!(@argv)
  build.run
end