module RbBCC::Plugin

Constants

ScriptLocation

Public Class Methods

find_script_name(name) click to toggle source
# File lib/rbbcc/plugin.rb, line 9
def self.find_script_name(name)
  scripts.find{|s|
    s.name == name || "#{s.name}.rb" == name
  }&.location
end
register!() click to toggle source
# File lib/rbbcc/plugin.rb, line 15
def self.register!
  caller_loc = caller[0].split(':')[0]
  plugin_loc = File.expand_path("../../script", caller_loc)
  unless File.directory?(plugin_loc)
    raise "Cannot find a script directory #{plugin_loc}. Maybe an invalid project"
  end

  found = Dir.glob("#{plugin_loc}/*.rb")
            .map{|path| ScriptLocation.new File.basename(path, '.rb'), path }
  self.scripts.concat found
  self.scripts
end
scripts() click to toggle source
# File lib/rbbcc/plugin.rb, line 5
def self.scripts
  @scripts ||= []
end