Module: RbBCC::Plugin
- Defined in:
- lib/rbbcc/plugin.rb
Defined Under Namespace
Classes: ScriptLocation
Class Method Summary collapse
Class Method Details
.find_script_name(name) ⇒ Object
9 10 11 12 13 |
# 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! ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rbbcc/plugin.rb', line 15 def self.register! caller_loc = caller[0].split(':')[0] plugin_loc = File.("../../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 ⇒ Object
5 6 7 |
# File 'lib/rbbcc/plugin.rb', line 5 def self.scripts @scripts ||= [] end |