Module: Perkins::Build::Script::Bundler

Included in:
Ruby
Defined in:
lib/perkins/build/script/bundler.rb

Constant Summary collapse

DEFAULT_BUNDLER_ARGS =
"--jobs=3 --retry=3"

Instance Method Summary collapse

Instance Method Details

#announceObject



23
24
25
26
# File 'lib/perkins/build/script/bundler.rb', line 23

def announce
  super
  cmd "bundle --version", timing: false
end

#cache_slugObject



7
8
9
# File 'lib/perkins/build/script/bundler.rb', line 7

def cache_slug
  super << "--gemfile-" << config[:gemfile].to_s
end

#installObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/perkins/build/script/bundler.rb', line 28

def install
  gemfile? do |sh|
    sh.if "-f #{config[:gemfile]}.lock" do |sub|
      directory_cache.add(sub, bundler_path) if data.cache?(:bundler)
      sub.cmd bundler_command("--deployment"), fold: "install.bundler", retry: true
    end

    sh.else do |sub|
      # Cache bundler if it has been explicitly enabled
      directory_cache.add(sub, bundler_path) if data.cache?(:bundler, false)
      sub.cmd bundler_command, fold: "install.bundler", retry: true
    end
  end
end

#prepare_cacheObject



43
44
45
# File 'lib/perkins/build/script/bundler.rb', line 43

def prepare_cache
  cmd("bundle clean") if bundler_path
end

#setupObject



15
16
17
18
19
20
21
# File 'lib/perkins/build/script/bundler.rb', line 15

def setup
  super

  gemfile? do |sh|
    sh.set "BUNDLE_GEMFILE", "$PWD/#{config[:gemfile]}"
  end
end

#use_directory_cache?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/perkins/build/script/bundler.rb', line 11

def use_directory_cache?
  super || data.cache?(:bundler)
end