Class: Verge::Server::Exec
- Inherits:
-
Object
- Object
- Verge::Server::Exec
- Defined in:
- lib/verge/server/exec.rb
Instance Method Summary collapse
-
#initialize(argv) ⇒ Exec
constructor
A new instance of Exec.
Constructor Details
#initialize(argv) ⇒ Exec
Returns a new instance of Exec.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/verge/server/exec.rb', line 8 def initialize(argv) = {} signature = nil database = nil signature_file = nil OptionParser.new do |opts| opts. { "Usage: verge [options]" } # Sinatra params opts.on('-x') { [:lock] = true } opts.on('-s server') { |val| [:server] = val } opts.on('-e env') { |val| [:environment] = val.to_sym } opts.on('-p port') { |val| [:port] = val.to_i } # Verge params opts.on('-g generic-signature') { |val| signature = val } opts.on('-d database') { |val| database = val } opts.on('-S signature-file') { |val| signature_file = val } opts.on_tail('-h', '--help', "Show this message") { puts opts ; exit } end Verge::Server::Config.database_path = database unless database.nil? Verge::Server::Config.generic_signature = signature unless signature.nil? begin YAML.load_file(signature_file).each do |key, value| Verge::Server::Config.site_signatures[key] = value end unless signature_file.nil? rescue puts "Can't read signature file!" end if Verge::Server::Site.count == 0 token = Verge::Crypto.token Verge::Server::Config.generic_signature = token puts "Verge created the GENERIC_HOST token:\n#{token}\n" end Verge::Server::Base.run! end |