Class: RubiGen::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/reactive-dev/rubigen_plugin_sources.rb

Overview

class PathReallyFilteredSource < PathFilteredSource

  def filter_str(filters)
    @filters = filters.first.is_a?(Array) ? filters.first : filters
    return "" if @filters.blank?
    filter_str = @filters.map {|filter| "#{filter}_"}.join(",")
    # filter_str += ","  <--- This is exactly what i don't want, because it traps the 'generators' dir at the root of the rubigen gem.
    "{#{filter_str}}"
  end
end

Direct Known Subclasses

Reactive::NamedBaseGenerator

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.use_plugin_sources!(*filters) ⇒ Object

Use reactive gem plugins generators (test_unit, etc).

  1. Current application. Use Reactive.dir_for(:generators).

  2. User home directory. Search ~/.rubigen/generators.

  3. GemPlugins. Search for loaded gems containing /scope_generators folder.



19
20
21
22
23
24
25
26
# File 'lib/reactive-dev/rubigen_plugin_sources.rb', line 19

def self.use_plugin_sources!(*filters)
  reset_sources
  new_sources = []
  new_sources << Reactive.dirs_for(:generators).collect{|dir| PathSource.new(:app, dir) } if Reactive.respond_to? :dirs_for
  new_sources << PathFilteredSource.new(:user, "#{Dir.user_home}/.rubigen/", *filters)
  new_sources << Reactive.configuration.gems.map(&:loaded_spec).compact.collect{|spec| RubiGen::PathFilteredSource.new(:GemPlugins, spec.full_gem_path, *filters) }
  write_inheritable_attribute(:sources, new_sources.flatten)
end

Instance Method Details

#klassObject



28
29
30
# File 'lib/reactive-dev/rubigen_plugin_sources.rb', line 28

def klass
  self.class
end