Sha256: 3d6c533c337a710f3722a9c6ac43cf79958c0e154e471d3fafe3a6703a970a32

Contents?: true

Size: 490 Bytes

Versions: 6

Compression:

Stored size: 490 Bytes

Contents

require 'hairballs'

# Adds the Object#require_project_lib method as a shortcut for
#
#     require 'lib/my_library'          # Or...
#     require 'lib/my/nested/project'   # i.e. gem = my-nested-project
#
Hairballs.add_plugin(:require_project_lib) do |plugin|
  plugin.on_load do
    Object.class_eval do
      def require_project_lib
        require_dir = File.join(*Hairballs.project_name.split('-'))
        require_relative "#{Dir.pwd}/lib/#{require_dir}"
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
hairballs-0.2.1 lib/hairballs/plugins/require_project_lib.rb
hairballs-0.2.0 lib/hairballs/plugins/require_project_lib.rb
hairballs-0.1.3 lib/hairballs/plugins/require_project_lib.rb
hairballs-0.1.2 lib/hairballs/plugins/require_project_lib.rb
hairballs-0.1.1 lib/hairballs/plugins/require_project_lib.rb
hairballs-0.1.0 lib/hairballs/plugins/require_project_lib.rb