Module: Bootlace::Bundler

Includes:
Logger
Included in:
Base
Defined in:
lib/bootlace/bundler.rb

Instance Method Summary collapse

Methods included from Logger

#logger

Instance Method Details

#bundlerObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/bootlace/bundler.rb', line 8

def bundler
  checksum = get_bundle_checksum

  begin
    installed = File.read('.bundle/checksum')
  rescue Errno::ENOENT
    logger.info "No checksum cache file, will bundle."
  end

  unless installed == checksum
    logger.info "Bundling"
    system 'bundle install --quiet'
  else
    logger.info "Bundle up-to-date; not bundling"
  end

  unless Dir.exist? '.bundle'
    Dir.mkdir '.bundle'
  end

  File.open('.bundle/checksum', 'w+') do |f|
    f.write checksum
  end
end