module Perkins::Build::Script::Bundler
Constants
- DEFAULT_BUNDLER_ARGS
Public Instance Methods
announce()
click to toggle source
Calls superclass method
# File lib/perkins/build/script/bundler.rb, line 23 def announce super cmd "bundle --version", timing: false end
cache_slug()
click to toggle source
Calls superclass method
# File lib/perkins/build/script/bundler.rb, line 7 def cache_slug super << "--gemfile-" << config[:gemfile].to_s end
install()
click to toggle source
# 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_cache()
click to toggle source
# File lib/perkins/build/script/bundler.rb, line 43 def prepare_cache cmd("bundle clean") if bundler_path end
setup()
click to toggle source
Calls superclass method
# 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?()
click to toggle source
Calls superclass method
# File lib/perkins/build/script/bundler.rb, line 11 def use_directory_cache? super || data.cache?(:bundler) end
Private Instance Methods
bundler_args()
click to toggle source
# File lib/perkins/build/script/bundler.rb, line 70 def bundler_args config[:bundler_args] end
bundler_args_path()
click to toggle source
# File lib/perkins/build/script/bundler.rb, line 53 def bundler_args_path args = Array(bundler_args).join(" ") path = args[/--path[= ](\S+)/, 1] path ||= "vendor/bundle" #if args.include?("--deployment") path end
bundler_command(args = nil)
click to toggle source
# File lib/perkins/build/script/bundler.rb, line 64 def bundler_command(args = nil) args = bundler_args || [DEFAULT_BUNDLER_ARGS, args].compact args = [args].flatten << "--path=#{bundler_path}" if data.cache?(:bundler) && !bundler_args_path ["bundle install", *args].compact.join(" ") end
bundler_path()
click to toggle source
# File lib/perkins/build/script/bundler.rb, line 60 def bundler_path bundler_args_path || "${BUNDLE_PATH:-vendor/bundle}" end
gemfile?(*args, &block)
click to toggle source
# File lib/perkins/build/script/bundler.rb, line 49 def gemfile?(*args, &block) self.if "-f #{config[:gemfile]}", *args, &block end