module Bosh::AwsCliPlugin::MigrationHelper

Public Class Methods

all_rds_instances_available?(rds, opts = {}) click to toggle source
# File lib/bosh_cli_plugin_aws/migration_helper.rb, line 140
def self.all_rds_instances_available?(rds, opts = {})
  silent = opts[:silent]
  say("checking rds status...") unless silent
  rds.databases.all? do |db_instance|
    say("  #{db_instance.db_name} #{db_instance.db_instance_status} #{db_instance.endpoint_address}") unless silent
    !db_instance.endpoint_address.nil?
  end
end
aws_migration_directory() click to toggle source
# File lib/bosh_cli_plugin_aws/migration_helper.rb, line 116
def self.aws_migration_directory
  File.expand_path("../../migrations", File.dirname(__FILE__))
end
aws_spec_migration_directory() click to toggle source
# File lib/bosh_cli_plugin_aws/migration_helper.rb, line 120
def self.aws_spec_migration_directory
  File.expand_path("../../spec/migrations", File.dirname(__FILE__))
end
generate_migration_file(name) click to toggle source
# File lib/bosh_cli_plugin_aws/migration_helper.rb, line 124
def self.generate_migration_file(name)
  template = Template.new(name)

  filename = "#{aws_migration_directory}/#{template.file_prefix}.rb"
  spec_filename = "#{aws_spec_migration_directory}/#{template.file_prefix}_spec.rb"

  puts "Creating #{filename} and #{spec_filename}"

  File.open(filename, 'w+') { |f| f.write(template.render) }
  File.open(spec_filename, 'w+') { |f| f.write(template.render("aws_migration_spec")) }
end
to_class_name(name) click to toggle source
# File lib/bosh_cli_plugin_aws/migration_helper.rb, line 136
def self.to_class_name(name)
  name.split('_').map(&:capitalize).join('')
end