Module: Bosh::AwsCliPlugin::MigrationHelper
- Defined in:
- lib/bosh_cli_plugin_aws/migration_helper.rb
Defined Under Namespace
Class Method Summary collapse
- .all_rds_instances_available?(rds, opts = {}) ⇒ Boolean
- .aws_migration_directory ⇒ Object
- .aws_spec_migration_directory ⇒ Object
- .generate_migration_file(name) ⇒ Object
- .to_class_name(name) ⇒ Object
Class Method Details
.all_rds_instances_available?(rds, opts = {}) ⇒ Boolean
140 141 142 143 144 145 146 147 |
# 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 ⇒ Object
116 117 118 |
# File 'lib/bosh_cli_plugin_aws/migration_helper.rb', line 116 def self.aws_migration_directory File.("../../migrations", File.dirname(__FILE__)) end |
.aws_spec_migration_directory ⇒ Object
120 121 122 |
# File 'lib/bosh_cli_plugin_aws/migration_helper.rb', line 120 def self.aws_spec_migration_directory File.("../../spec/migrations", File.dirname(__FILE__)) end |
.generate_migration_file(name) ⇒ Object
124 125 126 127 128 129 130 131 132 133 134 |
# 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) ⇒ Object
136 137 138 |
# File 'lib/bosh_cli_plugin_aws/migration_helper.rb', line 136 def self.to_class_name(name) name.split('_').map(&:capitalize).join('') end |