Class: Dply::Cli::Devbuild

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

Instance Method Summary collapse

Methods included from Logger

#debug?, #logger, stderr, #stderr

Constructor Details

#initialize(argv) ⇒ Devbuild

Returns a new instance of Devbuild.



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

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

Instance Method Details

#clear_bundle_configObject



41
42
43
# File 'lib/dply/cli/devbuild.rb', line 41

def clear_bundle_config
  FileUtils.rm ".bundle/config" if File.exists? ".bundle/config"
end

#lockObject



37
38
39
# File 'lib/dply/cli/devbuild.rb', line 37

def lock
  @lock ||= Lock.new(Dir.pwd)
end

#optsObject



45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/dply/cli/devbuild.rb', line 45

def opts
  OptionParser.new do |opts|

    opts.banner = "Usage: drake devbuild [options] [target]"

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

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

#runObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/dply/cli/devbuild.rb', line 17

def run
  lock.acquire
  opts.parse!(@argv)
  revision = @options[:revision] || "dev"
  ENV["BUILD_NUMBER"] = revision

  build_artifacts = "tmp/build_artifacts"
  FileUtils.mkdir_p build_artifacts

  clear_bundle_config
  util.install_pkgs(build_mode: true)
  util.run :build
ensure
  clear_bundle_config
end

#utilObject



33
34
35
# File 'lib/dply/cli/devbuild.rb', line 33

def util
  @util ||= ::Dply::Util.new
end