Top Level Namespace

Defined Under Namespace

Modules: RailsInitGem Classes: NewGenerator

Constant Summary collapse

TRANSLATION_STORE =
Redis.new(db: 2)

Instance Method Summary collapse

Instance Method Details

#secret_tokenObject



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/generators/new/templates/secret_token.rb', line 14

def secret_token
  token_file = Rails.root.join('.secret')
  if File.exist?(token_file)
    # Use the existing token.
    File.read(token_file).chomp
  else
    # Generate a new token and store it in token_file.
    token = SecureRandom.hex(64)
    File.write(token_file, token)
    token
  end
end