module Codepipe::Core
Public Instance Methods
check_codepipeline_project!()
click to toggle source
# File lib/codepipe/core.rb, line 48 def check_codepipeline_project! check_path = "#{Codepipe.root}/.codepipeline" unless File.exist?(check_path) puts "ERROR: No .codepipeline folder found. Are you sure you are in a project with codepipeline setup?".color(:red) puts "Current directory: #{Dir.pwd}" puts "If you want to set up codepipeline for this prjoect, please create a settings file via: codepipeline init" exit 1 unless ENV['TEST'] end end
env()
click to toggle source
# File lib/codepipe/core.rb, line 14 def env # 2-way binding pipe_env = env_from_profile || 'development' pipe_env = ENV['PIPE_ENV'] if ENV['PIPE_ENV'] # highest precedence ActiveSupport::StringInquirer.new(pipe_env) end
env_extra()
click to toggle source
# File lib/codepipe/core.rb, line 22 def env_extra env_extra = ENV['PIPE_ENV_EXTRA'] if ENV['PIPE_ENV_EXTRA'] # highest precedence return if env_extra&.empty? env_extra end
root()
click to toggle source
# File lib/codepipe/core.rb, line 9 def root path = ENV['PIPE_ROOT'] || '.' Pathname.new(path) end
set_aws_profile!()
click to toggle source
Overrides AWS_PROFILE based on the Codepipe.env if set in configs/settings.yml 2-way binding.
# File lib/codepipe/core.rb, line 31 def set_aws_profile! return if ENV['TEST'] return unless File.exist?("#{Codepipe.root}/.codepipeline/settings.yml") # for rake docs return unless settings # Only load if within Codepipe project and there's a settings.yml data = settings || {} if data[:aws_profile] puts "Using AWS_PROFILE=#{data[:aws_profile]} from PIPE_ENV=#{Codepipe.env} in config/settings.yml" ENV['AWS_PROFILE'] = data[:aws_profile] end end
settings()
click to toggle source
# File lib/codepipe/core.rb, line 43 def settings Setting.new.data end
Private Instance Methods
env_from_profile()
click to toggle source
# File lib/codepipe/core.rb, line 59 def env_from_profile Codepipe::Setting.new.pipe_env end