lib/dctl/main.rb in dctl_rb-0.6.2 vs lib/dctl/main.rb in dctl_rb-0.7.0

- old
+ new

@@ -9,16 +9,25 @@ ## # Generate the full tag for the given image, concatenating the org, # project, env, image name, and version. # + # Pass `version: nil` to exclude the version portion. + # # @example # image_tag("app") # => jutonz/dctl-dev-app:1 - def image_tag(image, version: versions[image]) + def image_tag(image, version: current_version_for_image(image)) org = settings.org project = settings.project - "#{org}/#{project}-#{env}-#{image}:#{version}" + tag = "#{org}/#{project}-#{env}-#{image}" + tag += ":#{version}" if !version.nil? + + tag + end + + def current_version_for_image(image) + versions[image] end ## # Returns the path to the given image's data directory (which includes at # minimum the Dockerfile, plus any other relevant files the user may have