Module: Rebi

Extended by:
Rebi
Included in:
Rebi
Defined in:
lib/rebi.rb,
lib/rebi/ec2.rb,
lib/rebi/error.rb,
lib/rebi/config.rb,
lib/rebi/version.rb,
lib/rebi/erb_helper.rb,
lib/rebi/zip_helper.rb,
lib/rebi/application.rb,
lib/rebi/environment.rb,
lib/rebi/config_environment.rb

Defined Under Namespace

Classes: Application, Config, ConfigEnvironment, EC2, Environment, ErbHelper, Error, ZipHelper

Constant Summary collapse

COLORS =
[:red, :green, :yellow, :blue, :magenta, :cyan, :white]
VERSION =
'0.2.2'

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#config_fileObject

Returns the value of attribute config_file.



32
33
34
# File 'lib/rebi.rb', line 32

def config_file
  @config_file
end

Instance Method Details

#appObject



51
52
53
# File 'lib/rebi.rb', line 51

def app
  return Rebi::Application.get_or_create_application(config.app_name)
end

#client(c = nil) ⇒ Object



39
40
41
# File 'lib/rebi.rb', line 39

def client c=nil
  @@client = c || Aws::ElasticBeanstalk::Client.new
end

#colorize_prefix(prefix) ⇒ Object



69
70
71
72
73
74
# File 'lib/rebi.rb', line 69

def colorize_prefix(prefix)
  h = prefix.chars.inject(0) do |m, c|
    m + c.ord
  end
  return ColorizedString[prefix].colorize(COLORS[h % COLORS.count])
end

#config {|Rebi::Config.instance| ... } ⇒ Object

Yields:



55
56
57
58
# File 'lib/rebi.rb', line 55

def config
  yield Rebi::Config.instance if block_given?
  return Rebi::Config.instance
end

#ec2Object



43
44
45
# File 'lib/rebi.rb', line 43

def ec2
  @@ec2_client = Rebi::EC2.new
end

#iamObject



47
48
49
# File 'lib/rebi.rb', line 47

def iam
  @@iam_client = Aws::IAM::Client.new
end

#log(mes, prefix = nil) ⇒ Object



64
65
66
# File 'lib/rebi.rb', line 64

def log mes, prefix=nil
  puts "#{prefix ? "#{colorize_prefix(prefix)}: " : ""}#{mes}"
end

#reload!Object



60
61
62
# File 'lib/rebi.rb', line 60

def reload!
  config.reload!
end

#rootObject



35
36
37
# File 'lib/rebi.rb', line 35

def root
  Dir.pwd
end