Sha256: d4b20583ebaaaca7a07b677a033f78a58f9577c9ff2ce013271c273e1a73a5d4
Contents?: true
Size: 1.64 KB
Versions: 1
Compression:
Stored size: 1.64 KB
Contents
#!/usr/bin/env ruby -wKU $KCODE='u' require 'yaml' require 'optparse' require 'kconv' require 'pathname' require 'base64' YAPRA_ROOT = File.join(File.dirname(__FILE__), '..') $:.insert(0, *[ File.join(YAPRA_ROOT, 'lib-plugins'), File.join(YAPRA_ROOT, 'lib') ]) legacy_plugin_directory_paths = [ Pathname.new(YAPRA_ROOT) + 'legacy_plugins', Pathname.new(YAPRA_ROOT) + 'plugins' ] require 'yapra/runtime' require 'yapra/config' require 'yapra/legacy_plugin/registry_factory' Version = '0.1.0' mode = 'compatible' config_file = "config.yaml" loglebel = nil opt = OptionParser.new opt.on("-c", "--configfile CONFIGFILE") {|v| config_file = v } opt.on("-p", "--plugindir PLUGINDIR") {|v| legacy_plugin_directory_paths << Pathname.new(v) } opt.on("-m", "--mode MODE", 'compatible / advance') { |v| mode = v } opt.on("--log-level LOGLEVEL", 'fatal / error / warn / info / debug') { |v| loglebel = v } # opt.on("-u", "--pluginusage PLUGINNAME") {|v| $plugins[v].source.gsub(/^## ?(.*)/){ puts $1 }; exit } # opt.on("-l", "--listplugin") { $plugins.keys.sort.each{|k| puts k }; exit } # opt.on("-w", "--where") { puts(Pathname.new(__FILE__).parent + "plugin"); exit } opt.parse! legacy_plugin_registry_factory = Yapra::LegacyPlugin::RegistryFactory.new(legacy_plugin_directory_paths, mode) config = YAML.load(File.read(config_file).toutf8.gsub(/base64::([\w+\/]+=*)/){ Base64.decode64($1) }) config = Yapra::Config.new(config) config.env.update({ 'log' => { 'level' => loglebel } }) if loglebel Yapra::Runtime.logger = config.create_logger yapra = Yapra::Runtime.new( config.env, legacy_plugin_registry_factory ) yapra.execute(config.pipeline_commands)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
yapra-0.1.0 | bin/yapra |