Top Level Namespace
Defined Under Namespace
Modules: Drydocker
Instance Method Summary collapse
-
#parse(args) ⇒ Object
Command line parser to setup options :name, :command, :image, :entrypoint, :path.
Instance Method Details
#parse(args) ⇒ Object
Command line parser to setup options :name, :command, :image, :entrypoint, :path
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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'bin/drydocker', line 8 def parse(args) = Drydocker::Config.default_config opt_parser = OptionParser.new do |opts| opts. = "Usage: drydocker [options]" opts.separator "" opts.separator "Specific options:" opts.on("-f", "--filename [FILENAME]", "File of options to load") do |fn| .load(fn) end opts.on("-n", "--name [NAME]", "Container name to run tests in, default \"<imagename>-test\"") do |name| [:name] = name end opts.on("-C", "--clean", "clean old container before running") do |clean| [:clean] = clean end opts.on("-c", "--command [COMMAND]", "command to run, default '#{options[:command]}'") do |cmd| [:command] = cmd end opts.on("-i", "--image [IMAGE]", "image to run for testing, default '#{options[:image]}'") do |img| [:image] = img end opts.on("-e", "--entrypoint [ENTRYPOINT]", "entrypoint in case you need to override that, default nil") do |entry| [:entrypoint] = entry end opts.on("-p", "--path [PATH]", "directory to monitor and mount for testing, default '#{options[:path]}'") do |path| [:path] = path end opts.on("-o", "--[no-]once", "run once and exit") do |once| [:once] = once end opts.on("-v", "--[no-]verbose", "verbose output") do |verbose| [:verbose] = verbose end opts.on("--version", "Show version") do puts File.exist?("VERSION") ? File.read("VERSION").strip : "" exit end end opt_parser.parse!(args) end |