Sha256: e0cc12914d1963d2b307a2c15d21ca08a19c01d25c2866160ace498013bd86e7
Contents?: true
Size: 783 Bytes
Versions: 2
Compression:
Stored size: 783 Bytes
Contents
#!/usr/bin/env ruby require 'geektool_kit' require 'thor' require 'yaml' class MyCLI < Thor BASE_FOLDER = File.expand_path "~/geektool_kit" CONFIG_FILE = File.join(BASE_FOLDER, 'config.yml') desc "setup", "Sets up the geektool_kit folder" def setup Dir.mkdir BASE_FOLDER unless Dir.exists? BASE_FOLDER settings = {} if File.exists? CONFIG_FILE settings = YAML::load_file(CONFIG_FILE) end add_default_settings settings File.open(CONFIG_FILE, 'w') {|f| f.write settings.to_yaml } end no_commands do def add_default_settings settings defaults = {} defaults.each {|key, value| settings[key] = value unless settings.has_key? key } settings.delete_if { |key, value| defaults[key].nil? } end end end MyCLI.start(ARGV)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
geektool_kit-0.2.1 | bin/geektool_kit |
geektool_kit-0.2.0 | bin/geektool_kit |