Class: LetsencryptPlugin::FileStore

Inherits:
ChallengeStore show all
Defined in:
lib/letsencrypt_plugin/file_store.rb

Instance Method Summary collapse

Methods inherited from ChallengeStore

#store

Constructor Details

#initialize(challenge_content, challenge_dir_name) ⇒ FileStore

Returns a new instance of FileStore.



5
6
7
8
# File 'lib/letsencrypt_plugin/file_store.rb', line 5

def initialize(challenge_content, challenge_dir_name)
  super(challenge_content)
  @challenge_dir_name = challenge_dir_name
end

Instance Method Details

#store_contentObject



10
11
12
13
14
# File 'lib/letsencrypt_plugin/file_store.rb', line 10

def store_content
  full_challenge_dir = File.join(Rails.root, @challenge_dir_name)
  Dir.mkdir(full_challenge_dir) unless File.directory?(full_challenge_dir)
  File.open(File.join(full_challenge_dir, 'challenge'), 'w') { |file| file.write(@content) }
end