Sha256: c8e33cd2321cc6658b450de072f0902c41380fec2ae720438adae7b226aa17b4
Contents?: true
Size: 1.97 KB
Versions: 3
Compression:
Stored size: 1.97 KB
Contents
require 'repertoire/media/extensions/meta' require 'repertoire/media/media' require 'repertoire/compat' module Repertoire module Media class Type # # The name of the Media Type. # def self.name nil end # # The supports URI schemes of the Media Type. # def self.schemes [] end # # The directory which is used by the Media Type to store metadata. # def self.directory nil end protected # # Register a Media type with the specified _names_. # # known_as :svn # def self.known_as(name) name = name.to_sym meta_def(:name) { name } Media.types[name] = self end # # Register a Media type for the specified _schemes_. # # uses_schemes 'svn' # # uses_schemes 'svn', 'svn+ssh' # def self.uses_schemes(*schemes) meta_def(:schemes) { schemes } schemes.each do |scheme| scheme = scheme.to_s 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 meta_def(:directory) { name } Media.directories[name] = self end # # Changes the current working directory to the specified _path_. # def self.cd(path) Dir.chdir(path.to_s) end # # Switches to the specified _path_, calls the given _block_ and then # switches back to the previous directory. # def self.switch_dir(path,&block) current = Dir.pwd cd path block.call if block cd current end # # See Compat.sh. # def self.sh(program,*args) Compat.sh(program,*args) end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
repertoire-0.2.0 | lib/repertoire/media/type.rb |
repertoire-0.2.2 | lib/repertoire/media/type.rb |
repertoire-0.2.1 | lib/repertoire/media/type.rb |