diff options
author | Azul <azul@riseup.net> | 2012-09-24 12:16:14 +0200 |
---|---|---|
committer | Azul <azul@riseup.net> | 2012-09-24 12:16:14 +0200 |
commit | c90d30621e042cc3e52ffc87e3491ab110a57e9e (patch) | |
tree | 9ebb5b3026dddd4c3c56f4eb333201327a2641aa /lib | |
parent | 06b8d8c971a07df3f96fdfd0e753a8284d0dac5a (diff) |
ported over proper ways of creating certs
Will now use .txt as the extention
Returns the actual content on .zipped
With tests.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/leap_ca/cert.rb | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/leap_ca/cert.rb b/lib/leap_ca/cert.rb index 80adfbb..1459e01 100644 --- a/lib/leap_ca/cert.rb +++ b/lib/leap_ca/cert.rb @@ -13,7 +13,7 @@ class Cert < CouchRest::Model::Base validates :random, :presence => true, :numericality => {:greater_than => 0, :less_than => 1} - validates :zipped, :presence => true + validates :zip_attachment, :presence => true design do end @@ -23,15 +23,20 @@ class Cert < CouchRest::Model::Base end def attach_zip - self.create_attachment :file => StringIO.new("dummy cert"), :name => zipname + file = File.open File.join(LEAP_CA_ROOT, "config", "cert") + self.create_attachment :file => file, :name => zipname end def zipname - 'cert.zip' + 'cert.txt' end - def zipped + def zip_attachment attachments[zipname] end + def zipped + read_attachment(zipname) + end + end |