Sha256: 02a38d548936167b794270e056b18b717e47d7c8d900c43f25ecb26137337159

Contents?: true

Size: 505 Bytes

Versions: 1

Compression:

Stored size: 505 Bytes

Contents

require_relative '../../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

1 entries across 1 versions & 1 rubygems

Version Path
hairballs-0.0.1 lib/hairballs/plugins/require_project_lib.rb