Sha256: 87d9d69ff46cffb8f05b2b4229a97cc72a4d7349c0664ef86fb565ba5155058d

Contents?: true

Size: 824 Bytes

Versions: 4

Compression:

Stored size: 824 Bytes

Contents

require 'version'
require 'rubygems'

module Swing

  # Requires ruby source file(s), given as single filename/glob or Array of filenames/globs.
  # Accepts following options:
  # :*file*:: Lib(s) required relative to this file - defaults to __FILE__
  # :*dir*:: Required lib(s) located under this dir name - defaults to gem name
  #
  def self.require_libs( libs, opts={} )
    file = Pathname.new(opts[:file] || __FILE__)
    [libs].flatten.each do |lib|
      name = file.dirname + (opts[:dir] || file.basename('.*')) + lib.gsub(/(?<!.rb)$/, '.rb')
      Pathname.glob(name.to_s).sort.each {|rb| require rb}
    end
  end
end  # module Swing

# Require all ruby source files located under directory lib/swing
# If you need files in specific order, you should specify it here before the glob
Swing.require_libs %W[**/*]

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
swing-0.0.5 lib/swing.rb
swing-0.0.3 lib/swing.rb
swing-0.0.2 lib/swing.rb
swing-0.0.1 lib/swing.rb