Sha256: 302930e700d052aaa160bb2e5b1af8ba20288614126834c26e0ead920d6efda0
Contents?: true
Size: 1.35 KB
Versions: 4
Compression:
Stored size: 1.35 KB
Contents
module Gator module Configuration class Config attr_reader :options def initialize @options = {} @loaded = false self end def loaded @loaded end def load_config config_file = File.join(File.expand_path("~"), ".gator", "configuration.rb") ConfigurationGenerator.new.create_configuration config_file unless File.exists? config_file @loaded = true load config_file end end class << self attr_accessor :config end self.config = Config.new def configuration config = Gator::Configuration.config config.load_config unless config.loaded config end #TODO: Refactor into gator default plugin class ConfigurationGenerator < Thor include Thor::Actions no_tasks { def create_configuration(config_file) Gator.shell.say "Configuration file not found at: #{config_file}!", :red Gator.shell.say "" Gator.shell.say "Let's create one!", :green create_file config_file do render = "" render += "#This file has been generated by gator and wants to be edited by you!\n" render += "configuration.options[:author] = \"#{Gator.shell.ask "\nAuthor:"}\"\n" render end end } end end end
Version data entries
4 entries across 4 versions & 1 rubygems