From b3c15d2d42c9be803cd55d52b0566041c8a1420e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Sun, 10 Jun 2012 23:32:30 +0200 Subject: add simple bin/edoors.rb to load *.json files --- bin/edoors.rb | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100755 bin/edoors.rb diff --git a/bin/edoors.rb b/bin/edoors.rb new file mode 100755 index 0000000..cbd6d7e --- /dev/null +++ b/bin/edoors.rb @@ -0,0 +1,71 @@ +#! /usr/bin/env ruby +# -*- coding: UTF-8 -*- +# +# Copyright 2012 Jérémy Zurcher +# +# This file is part of edoors-ruby. +# +# edoors-ruby is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# edoors-ruby is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. +# +# You should have received a copy of the GNU Affero General Public License +# along with edoors-ruby. If not, see . + +require 'edoors' +require 'optparse' + +@options = { :require=>[] } + +@parser ||= OptionParser.new do |opts| + opts.banner = "Usage: #{$0.split('/').last} [options] config" + + opts.on_tail("-r", "--require", "Print this message") { puts opts; exit 0 } + opts.on_tail("-h", "--help", "Print this message") { puts opts; exit 0 } + opts.on_tail("-v", "--version", "Print version info then exit") { puts "edoors-ruby #{Edoors::VERSION}"; exit 0 } + opts.on_tail("-l", "--license", "Print license info then exit") { puts DATA.read; exit 0 } + opts.on_tail("-r", "--require FILE", "require the library") { |file| @options[:require] << file } +end + +@parser.parse!(ARGV) + +config_path = ARGV.shift +if config_path.nil? + puts "no config file provided, what the hell should I do ?" + exit 1 +end +if not File.exists? config_path + puts "#{config_path} does not exists." + exit 1 +end + +@options[:require].each do |file| + load file +end + +dom0 = Edoors::Spin.resume! config_path +dom0.spin! + +__END__ + +Copyright 2012 Jérémy Zurcher + +edoors-ruby is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +edoors-ruby is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with edoors-ruby. If not, see . + -- cgit v1.1-2-g2b99