module Ebfly::Command
Constants
- PREDEFINED_SOLUTION_STACKS
- SUPPORTED_SOLUTION_STACKS
Public Instance Methods
debug(obj)
click to toggle source
# File lib/ebfly/ebfly.rb, line 57 def debug(obj) pp obj if ENV["DEBUG"] end
eb()
click to toggle source
# File lib/ebfly/ebfly.rb, line 29 def eb @eb ||= AWS::ElasticBeanstalk.new @eb.client end
env_name(app, env)
click to toggle source
# File lib/ebfly/ebfly.rb, line 72 def env_name(app, env) "#{app}-#{env}" end
exist_command?(cmd)
click to toggle source
# File lib/ebfly/ebfly.rb, line 61 def exist_command?(cmd) exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : [''] ENV['PATH'].split(File::PATH_SEPARATOR).each do |path| exts.each { |ext| exe = File.join(path, "#{cmd}#{ext}") return exe if File.executable? exe } end return nil end
run() { || ... }
click to toggle source
# File lib/ebfly/ebfly.rb, line 38 def run(&block) begin res = yield raise res.error unless res.successful? res rescue => err style_err(err) exit 1 end end
s3()
click to toggle source
# File lib/ebfly/ebfly.rb, line 34 def s3 @s3 ||= AWS::S3.new end
s3_bucket()
click to toggle source
# File lib/ebfly/ebfly.rb, line 49 def s3_bucket @s3_bucket ||= (run { eb.create_storage_location }[:s3_bucket]) end
solution_stack(name)
click to toggle source
# File lib/ebfly/ebfly.rb, line 88 def solution_stack(name) return PREDEFINED_SOLUTION_STACKS[name] if PREDEFINED_SOLUTION_STACKS.key?(name) return name end
style_err(err)
click to toggle source
# File lib/ebfly/ebfly.rb, line 53 def style_err(err) puts "ERR! #{err.message}" end
tier(type)
click to toggle source
# File lib/ebfly/ebfly.rb, line 76 def tier(type) if type == "web" return { name: "WebServer", type: "Standard", version: "1.0" } elsif type == "worker" return { name: "Worker", type: "SQS/HTTP", version: "1.1" } elsif type == "worker1.0" return { name: "Worker", type: "SQS/HTTP", version: "1.0" } else raise "Environment tier definition not found" end end