Sha256: 6c1dd6139455350b261101ebfb49bb3dd57339b24644324604adf9989d35fe5f
Contents?: true
Size: 1.46 KB
Versions: 3
Compression:
Stored size: 1.46 KB
Contents
#!/usr/bin/env ruby # == Imports ================================================================ require 'fileutils' require 'optparse' require_relative '../lib/configature' # == Main =================================================================== options = { verbose: false, quiet: false, config_dir: Configature::Directory.find('config') } program = OptionParser.new do |opts| opts.banner = "Usage: config [options]" opts.on('-q', '--quiet', 'Run quietly with no output') do options[:quiet] = true end opts.on('-v', '--[no-]verbose', 'Run verbosely') do |v| options[:verbose] = v end opts.on('-d', '--config-dir DIR', 'Configuration directory target') do |dir| options[:config_dir] = dir end end args = program.parse! if (options[:verbose]) puts 'Checking configuration directory %s' % options[:config_dir] end if (options[:quiet]) $stdout = StringIO.new end case (arg = args.first) when 'clean' Configature::Stamper.new(options[:config_dir]).clean! do |target| puts "* %s: removed" % File.basename(target) end when nil Configature::Stamper.new(options[:config_dir]).apply! do |source, target, created:, existing:, config_required:| if (created) print "* %s: created" % File.basename(target) else print "* %s: present" % File.basename(target) end if (config_required) print ' (requires configuration)' end puts end else $stderr.puts("Unknown command #{arg.inspect}") exit(-1) end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
configature-0.3.7 | exe/config |
configature-0.3.4 | exe/config |
configature-0.3.3 | exe/config |