Sha256: 0148050c2e7684df24ea821d9e2e7efa2b6589754dfc83996e068a1c5088ada2

Contents?: true

Size: 756 Bytes

Versions: 16

Compression:

Stored size: 756 Bytes

Contents

require 'set'

module ZergXcode::Plugins
  def self.all
    plugin_dir = File.join(File.dirname(__FILE__), '..')
    plugins = Dir.entries(plugin_dir).select { |entry|
      /^[^_].*\.rb$/ =~ entry 
    }.map { |entry| entry[0..-4] }
    return Set.new(plugins)
  end 
  
  def self.require_all
    all.each { |plugin| self.require plugin }
  end
  
  def self.require(plugin_name)
    Kernel.require "zerg_xcode/plugins/#{plugin_name}.rb"
  end
  
  def self.get(plugin_name)
    self.require plugin_name
    ZergXcode::Plugins.const_get(plugin_name.capitalize).new
  end
  
  def self.run(plugin_name, args)
    self.get(plugin_name).run args
  end
  
  def self.help(plugin_name)
    self.get(plugin_name).help
  end
end

# :nodoc:
module ZergXcode
end

Version data entries

16 entries across 16 versions & 2 rubygems

Version Path
costan-zerg_xcode-0.1 lib/zerg_xcode/plugins/core/core.rb
costan-zerg_xcode-0.2.1 lib/zerg_xcode/plugins/core/core.rb
costan-zerg_xcode-0.2 lib/zerg_xcode/plugins/core/core.rb
costan-zerg_xcode-0.3.1 lib/zerg_xcode/plugins/core/core.rb
costan-zerg_xcode-0.3.2 lib/zerg_xcode/plugins/core/core.rb
costan-zerg_xcode-0.3.3 lib/zerg_xcode/plugins/core/core.rb
costan-zerg_xcode-0.3.4 lib/zerg_xcode/plugins/core/core.rb
costan-zerg_xcode-0.3 lib/zerg_xcode/plugins/core/core.rb
zerg_xcode-0.3.4 lib/zerg_xcode/plugins/core/core.rb
zerg_xcode-0.3.3 lib/zerg_xcode/plugins/core/core.rb
zerg_xcode-0.3.1 lib/zerg_xcode/plugins/core/core.rb
zerg_xcode-0.3.2 lib/zerg_xcode/plugins/core/core.rb
zerg_xcode-0.2.1 lib/zerg_xcode/plugins/core/core.rb
zerg_xcode-0.2 lib/zerg_xcode/plugins/core/core.rb
zerg_xcode-0.1 lib/zerg_xcode/plugins/core/core.rb
zerg_xcode-0.3 lib/zerg_xcode/plugins/core/core.rb