Class: S3Backup::Pg::Import
- Inherits:
-
Object
- Object
- S3Backup::Pg::Import
- Defined in:
- lib/s3_backup/pg/import.rb
Instance Attribute Summary collapse
-
#database ⇒ Object
readonly
Returns the value of attribute database.
-
#pg_database_name ⇒ Object
readonly
Returns the value of attribute pg_database_name.
Instance Method Summary collapse
-
#initialize(pg_database_name) ⇒ Import
constructor
A new instance of Import.
- #now! ⇒ Object
Constructor Details
#initialize(pg_database_name) ⇒ Import
Returns a new instance of Import.
8 9 10 11 12 13 |
# File 'lib/s3_backup/pg/import.rb', line 8 def initialize(pg_database_name) @pg_database_name = pg_database_name config = Rails.configuration.database_configuration @database = config[Rails.env]['database'] end |
Instance Attribute Details
#database ⇒ Object (readonly)
Returns the value of attribute database.
6 7 8 |
# File 'lib/s3_backup/pg/import.rb', line 6 def database @database end |
#pg_database_name ⇒ Object (readonly)
Returns the value of attribute pg_database_name.
6 7 8 |
# File 'lib/s3_backup/pg/import.rb', line 6 def pg_database_name @pg_database_name end |
Instance Method Details
#now! ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/s3_backup/pg/import.rb', line 15 def now! puts 'Setup local database ...' setup_local_database puts 'Downloading pg database ...' S3Backup::Storage::S3.new.download!(pg_database_name, Config.s3_pg_path, pg_dump_s3_file.path) umcompress_file puts "Loading data in #{database} ..." load_file clean_env puts '🍺 Done!' end |