Skip to content

Commit

Permalink
fix optional prompting in rakefile
Browse files Browse the repository at this point in the history
  • Loading branch information
wr0ngway committed Nov 10, 2023
1 parent 6e0e9fb commit 816d5a8
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ CLIENT_DIR = "client"
require 'rake/clean'
CLEAN << TMP_DIR << CLIENT_DIR

def get_var(name, env_name: name.to_s.upcase, yml_name: name.to_s.downcase.to_sym, default: nil, prompt: true, required: true)
def get_var(name, env_name: name.to_s.upcase, yml_name: name.to_s.downcase.to_sym, default: nil, prompt: false, required: true)
value = ENV[env_name]
value ||= APP[yml_name]
value ||= default
Expand Down Expand Up @@ -84,7 +84,7 @@ end
task :helm_package => [:helm_index]

task :build_development => [:client] do
image_name = get_var(:image_name, default: "#{APP[:name]}", prompt: false, required: false)
image_name = get_var(:image_name, default: "#{APP[:name]}", required: false)
sh "docker build --target development -t #{image_name}:latest -t #{image_name}:development ."
end

Expand All @@ -103,7 +103,7 @@ task :rspec do
end

task :build_release => [:client] do
image_name = get_var(:image_name, default: "#{APP[:name]}", prompt: false, required: false)
image_name = get_var(:image_name, default: "#{APP[:name]}", required: false)
sh "docker build --target release -t #{image_name}:latest -t #{image_name}:release ."
end

Expand Down Expand Up @@ -144,12 +144,12 @@ task :changelog do
entries = ""
sha_url_format = "../../commit/%h"

current_version = get_var('CURRENT_VERSION', prompt: false, yml_name: :version)
current_version = get_var('CURRENT_VERSION', yml_name: :version)

starting_version = nil
ending_version = nil, ending_version_name = nil

version_range = get_var('VERSION_RANGE', prompt: false, required: false)
version_range = get_var('VERSION_RANGE', required: false)
if version_range
first_ver, second_ver = version_range.split("..")
starting_version = "v#{first_ver.gsub(/^[^\d]*/, '')}" if ! first_ver.nil? && first_ver.size > 0
Expand Down Expand Up @@ -222,8 +222,8 @@ task :changelog do
end

task :console do
local = get_var(:local, prompt: false, required: false, default: false)
image_name = get_var(:image_name, default: "#{APP[:name]}", prompt: false, required: false)
local = get_var(:local, required: false, default: false)
image_name = get_var(:image_name, default: "#{APP[:name]}", required: false)

if local
$LOAD_PATH.unshift File.expand_path("lib", __dir__)
Expand Down Expand Up @@ -266,10 +266,10 @@ end
task :client => "#{CLIENT_DIR}/Gemfile"

task :install do
build_type = get_var(:build_type, prompt: false, required: false, default: "development")
namespace = get_var(:namespace, prompt: false, required: false)
values_file = get_var(:values_file, prompt: false, required: false)
helm_args = get_var(:helm_args, prompt: false, required: false)
build_type = get_var(:build_type, required: false, default: "development")
namespace = get_var(:namespace, required: false)
values_file = get_var(:values_file, required: false)
helm_args = get_var(:helm_args, required: false)

system("minikube version", [:out, :err] => "/dev/null") || fail("dev dependency not installed - minikube")
system("minikube status", [:out, :err] => "/dev/null") || fail("dev dependency not running - minikube")
Expand All @@ -296,7 +296,7 @@ task :install do
end

task :clean_install do
namespace = get_var(:namespace, prompt: false, required: false)
namespace = get_var(:namespace, required: false)
cmd = "helm delete"
cmd << " --namespace #{namespace}" if namespace
cmd << " kubetruth"
Expand Down

0 comments on commit 816d5a8

Please sign in to comment.