+
+ # Returns an array with the available sources. Optionally formats the result
+ # so active sources are identified by an appended *
+ #
+ # @param [Boolean] format whether or not to render the stars for active
+ # sources.
+ # @return [Array] the names of the currently available sources.
+ def available_sources(format = false)
+ path_root = File.expand_path(File.dirname(__FILE__))
+ sources = Dir[path_root+"/sources/*.rb"].map{ |s|
+ name = s.split("/").last.gsub(/\.rb/, "")
+ name
+ }
+
+ # Remove arguments (Hack?) We don't want anybody to touch tihs one.
+ sources.delete("arguments")
+ if format
+ # Add a star to denote enabled sources
+ format_sources(sources)
+ else
+ sources
+ end
+ end
+
+ # Adds a star to all members of the array that correspond to an active
+ # source
+ #
+ # @param [Array] sources the array of sources to format
+ # @return [Array] the formatted array
+ def format_sources(sources)
+ sources.map{ |s|
+ s << "*" if @config["enabled_sources"].include?(s)
+ s
+ }
+ end