require 'repertoire/media/media' require 'repertoire/extensions/meta' require 'repertoire/compat' module Repertoire module Media module Type def self.included(base) base.meta_def(:name) do @name ||= nil end base.meta_def('name=') do |name| @name = name.to_sym end base.meta_def(:schemes) do @schemes ||= [] end base.meta_def(:directory) do @directory ||= nil end base.meta_def('directory=') do |dir| @directory = dir.to_s end base.module_eval do protected # # Register a Media type with the specified _names_. # # known_as :svn # def self.known_as(name) name = name.to_sym self.name = name Media.types[name] = self end # # Register a Media type for the specified _schemes_. # # uses_schemes 'cvs' # # uses_schemes 'svn', 'svn+ssh' # def self.uses_schemes(*schemes) schemes.each do |scheme| scheme = scheme.to_s self.schemes << scheme Media.schemes[scheme] = self end end # # Registers a Media type that uses the directory of the specified # _name_ to store media information. # # uses_directory '.svn' # def self.uses_directory(name) name = name.to_s self.directory = name Media.directories[name] = self end # # See Compat.sh. # def self.sh(program,*args) Compat.sh(program,*args) end end end end end end