Module: Pipedream::Core
Instance Method Summary collapse
- #check_pipedream_project! ⇒ Object
- #env ⇒ Object
- #env_extra ⇒ Object
- #root ⇒ Object
-
#set_aws_profile! ⇒ Object
Overrides AWS_PROFILE based on the Pipedream.env if set in configs/settings.yml 2-way binding.
- #settings ⇒ Object
Instance Method Details
#check_pipedream_project! ⇒ Object
48 49 50 51 52 53 54 55 56 |
# File 'lib/pipedream/core.rb', line 48 def check_pipedream_project! check_path = "#{Pipedream.root}/.pipedream" unless File.exist?(check_path) puts "ERROR: No .pipedream folder found. Are you sure you are in a project with pipedream setup?".color(:red) puts "Current directory: #{Dir.pwd}" puts "If you want to set up pipedream for this prjoect, please create a settings file via: pipe init" exit 1 unless ENV['TEST'] end end |
#env ⇒ Object
14 15 16 17 18 19 |
# File 'lib/pipedream/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 ⇒ Object
22 23 24 25 26 |
# File 'lib/pipedream/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 ⇒ Object
9 10 11 12 |
# File 'lib/pipedream/core.rb', line 9 def root path = ENV['PIPE_ROOT'] || '.' Pathname.new(path) end |
#set_aws_profile! ⇒ Object
Overrides AWS_PROFILE based on the Pipedream.env if set in configs/settings.yml 2-way binding.
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/pipedream/core.rb', line 31 def set_aws_profile! return if ENV['TEST'] return unless File.exist?("#{Pipedream.root}/.pipedream/settings.yml") # for rake docs return unless settings # Only load if within Pipedream project and there's a settings.yml data = settings || {} if data[:aws_profile] puts "Using AWS_PROFILE=#{data[:aws_profile]} from PIPE_ENV=#{Pipedream.env} in config/settings.yml" ENV['AWS_PROFILE'] = data[:aws_profile] end end |