class Pantograph::Actions::EnsureEnvVarsAction
Public Class Methods
available_options()
click to toggle source
# File pantograph/lib/pantograph/actions/ensure_env_vars.rb, line 23 def self.available_options [ PantographCore::ConfigItem.new( key: :vars, description: 'The ENV variables keys to verify', type: Array, verify_block: proc do |value| UI.user_error!('Specify at least one environment variable key') if value.empty? end ) ] end
category()
click to toggle source
# File pantograph/lib/pantograph/actions/ensure_env_vars.rb, line 48 def self.category :misc end
description()
click to toggle source
# File pantograph/lib/pantograph/actions/ensure_env_vars.rb, line 16 def self.description 'Raises an exception if the specified env vars are not set' end
details()
click to toggle source
# File pantograph/lib/pantograph/actions/ensure_env_vars.rb, line 20 def self.details end
example_code()
click to toggle source
# File pantograph/lib/pantograph/actions/ensure_env_vars.rb, line 40 def self.example_code [ 'ensure_env_vars( vars: [\'GITHUB_USER_NAME\', \'GITHUB_API_TOKEN\'] )' ] end
is_supported?(platform)
click to toggle source
# File pantograph/lib/pantograph/actions/ensure_env_vars.rb, line 52 def self.is_supported?(platform) true end
run(params)
click to toggle source
# File pantograph/lib/pantograph/actions/ensure_env_vars.rb, line 4 def self.run(params) null_keys = params[:vars].reject do |var| ENV.key?(var) end if null_keys.any? UI.user_error!("Unable to find ENV Variable(s):\n#{null_keys.join("\n")}") end UI.success("ENV variable(s) '#{params[:vars].join('\', \'')}' set!") end