Class: Rails::Generators::EncryptedFileGenerator
- Defined in:
- lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb
Overview
:nodoc:
Instance Method Summary collapse
Methods inherited from Base
base_root, class_option, default_source_root, desc, exit_on_failure?, hide!, hook_for, inherited, namespace, remove_hook_for, source_root
Methods included from Actions
#add_source, #after_bundle, #capify!, #environment, #gem, #gem_group, #generate, #git, #initialize, #initializer, #lib, #rails_command, #rake, #rakefile, #readme, #route, #vendor
Instance Method Details
#add_encrypted_file_silently(file_path, key_path, template = encrypted_file_template) ⇒ Object
10 11 12 13 14 15 |
# File 'lib/rails/generators/rails/encrypted_file/encrypted_file_generator.rb', line 10 def add_encrypted_file_silently(file_path, key_path, template = encrypted_file_template) unless File.exist?(file_path) setup = { content_path: file_path, key_path: key_path, env_key: "RAILS_MASTER_KEY", raise_if_missing_key: true } ActiveSupport::EncryptedFile.new(setup).write(template) end end |