diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/cert.rb | 3 | ||||
-rw-r--r-- | lib/pool.rb | 19 |
2 files changed, 22 insertions, 0 deletions
diff --git a/lib/cert.rb b/lib/cert.rb index c937fb8..80adfbb 100644 --- a/lib/cert.rb +++ b/lib/cert.rb @@ -15,6 +15,9 @@ class Cert < CouchRest::Model::Base validates :zipped, :presence => true + design do + end + def set_random self.random = rand end diff --git a/lib/pool.rb b/lib/pool.rb new file mode 100644 index 0000000..76c1963 --- /dev/null +++ b/lib/pool.rb @@ -0,0 +1,19 @@ +require 'yaml' + +module LeapCA + class Pool + def initialize(filename) + @config = YAML.load(File.open(filename, 'r')) + end + + def fill + while Cert.count < self.size do + Cert.create! + end + end + + def size + @config[:size] ||= 10 + end + end +end |