title: How to provide config file for Ruby command line utility written in Ruby?
body: <p>I have a command line utility written in Ruby using <code>GLI</code> framework. I would like to have configuration for my command line utility in my home directory, using Ruby itself as DSL to handle it (similar to <code>Gemfile</code> or <code>Rakefile</code>).</p>
  
  <p>I have in class ConfigData in folder lib/myapp. The class looks like following way:</p>
  
  <pre><code>class ConfigData
    @@data = {}
  
    class ConfigItem
      def initialize
        @data = {}
      end
      def missing_method(name, *args)
        @data[name] = args[0]
      end
    end
  
    def self.add(section)
      item = ConfigItem.new()
      yield item
      @@data[section]=item
    end
  
  end
  </code></pre>
  
  <p>Now, what I would like to have, is the config file, preferrably with name <code>Myappfile</code>, in current working folder, with the following content</p>
  
  <pre><code>add('section1') do |i|
    i.param1 'Some data'
    i.param2 'More data'
  end
  </code></pre>
  
  <p>When this code was included between <code>class</code> and <code>end</code> of ConfigData, it worked fine. But now I would like to have it placed in the working folder, where I start the application.</p>
  
  <p>I tried require('./Myappfile') between <code>class</code> and <code>end</code> of ConfigData, but it doesn't work for me. I tried to read the source codes of rake, but it is not very much clear to me.</p>
  
  <p>Any hint how this can be solved? </p>