Class: Suspenders::ImportDumpGenerator

Inherits:
Generators::Base
  • Object
show all
Defined in:
lib/suspenders/generators/import_dump_generator.rb

Instance Method Summary collapse

Methods inherited from Generators::Base

default_source_root

Methods included from Actions

#action_mailer_asset_host, #action_mailer_host, #configure_environment, #expand_json, #replace_in_file

Instance Method Details

#copy_scriptObject



5
6
7
8
# File 'lib/suspenders/generators/import_dump_generator.rb', line 5

def copy_script
  template "bin_import_dump.erb", "bin/import_dump"
  chmod "bin/import_dump", 0o755
end

#inform_userObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/suspenders/generators/import_dump_generator.rb', line 10

def inform_user
  instructions = <<~MARKDOWN

    ## Importing a dump from Heroku

    If you have configured the heroku remotes successfully,
    you can import a fresh dump from staging or production with:

        % ./bin/import_dump staging
        % ./bin/import_dump production

    ## Resetting a database

    If you want to reset (destroy and recreate) a database on Heroku, you
    cannot use `heroku run rake db:drop`, instead use:

        % heroku pg:reset DATABASE_URL --remote=staging

    ( source: https://devcenter.heroku.com/articles/heroku-postgresql#pg-reset )

    To load schema and seeds, you cannot use `heroku run rake db:setup`, instead use:

        % heroku run rails db:schema:load db:seed --remote=staging

    Remember to create a new backup schedule on Heroku after you reset your database!

        % heroku pg:backups:schedule DATABASE_URL --at '2:00 UTC' --remote=staging

    ( source: https://devcenter.heroku.com/articles/heroku-postgres-backups#scheduling-backups )

  MARKDOWN

  append_file "README.md", instructions
end