Class: Pah::Templates::SecretToken
- Inherits:
-
Pah::Template
- Object
- Rails::Generators::Base
- Pah::Template
- Pah::Templates::SecretToken
- Defined in:
- lib/pah/templates/secret_token.rb
Instance Method Summary collapse
Methods inherited from Pah::Template
#ask_unless_test, #copy_static_file, #git_commit, #static_files, #will_you_like_to?
Instance Method Details
#call ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/pah/templates/secret_token.rb', line 4 def call append_to_file '.env', "SECRET_KEY_BASE: #{SecureRandom.hex(60)}\n" gsub_file 'config/secrets.yml', /secret_key_base: (.*)/, "secret_key_base: <%= ENV[\"SECRET_KEY_BASE\"] %>" git add: 'config/secrets.yml' git add: '.env' git_commit 'Replace secret key base with environment variable.' end |