Sha256: 349811528bad202fa1f7a889bcbf9f12f6cfed5b78f7c1c69c4301679b172258
Contents?: true
Size: 1.3 KB
Versions: 1
Compression:
Stored size: 1.3 KB
Contents
# frozen_string_literal: true require_relative 'aid/version' module Aid def self.load_paths @load_paths ||= [ File.expand_path(File.dirname(__FILE__) + '/aid/scripts'), '.aid', "#{Aid.project_root}/.aid", ENV['AID_PATH'] ].compact end def self.load_scripts! load_paths.each do |path| Dir.glob("#{path}/*.rb").each do |file| require File.expand_path(file) unless %r{/config\.rb$}.match?(file) end end end def self.load_configs! load_paths.each do |path| config = File.expand_path("#{path}/config.rb") require config if File.exist?(config) end end def self.script_name ARGV.first end def self.script_args ARGV[1..-1] end def self.project_root @project_root ||= begin current_search_dir = Dir.pwd loop do git_index = "#{current_search_dir}/.git" git_index_exists = Dir.exist?(git_index) || File.exist?(git_index) return current_search_dir if git_index_exists break if current_search_dir == '/' current_search_dir = File.expand_path("#{current_search_dir}/..") end nil end end end require_relative 'aid/colorize' require_relative 'aid/inheritable' require_relative 'aid/plugins' require_relative 'aid/script' require_relative 'aid/scripts'
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
aid-0.2.2 | lib/aid.rb |