Class: GemMirror::Configuration
- Inherits:
-
Confstruct::Configuration
- Object
- Confstruct::Configuration
- GemMirror::Configuration
- Defined in:
- lib/gem-mirror/configuration.rb
Overview
Configuration class used for storing data about a mirror such as the destination directory, sources, ignored Gems, etc.
Class Method Summary collapse
- .default_configuration_file ⇒ String
-
.marshal_identifier ⇒ String
Returns the name of the directory that contains the quick specification files.
-
.marshal_version ⇒ String
Returns a String containing the Marshal version.
- .template_directory ⇒ String
-
.versions_file ⇒ String
Returns the name of the file that contains an index of all the versions.
Instance Method Summary collapse
- #gems_directory ⇒ String
-
#ignore_gem(name, version) ⇒ Object
Adds a Gem to the list of Gems to ignore.
-
#ignore_gem?(name, version) ⇒ TrueClass|FalseClass
Checks if a Gem should be ignored.
-
#ignored_gems ⇒ Hash
Returns a Hash containing various Gems to ignore and their versions.
- #logger ⇒ Logger
- #mirror_directory ⇒ GemMirror::MirrorDirectory
-
#source(name, url, &block) {|source| ... } ⇒ Object
Adds a new source to mirror.
-
#sources ⇒ Array
Returns a list of sources to mirror.
Class Method Details
.default_configuration_file ⇒ String
31 32 33 |
# File 'lib/gem-mirror/configuration.rb', line 31 def self.default_configuration_file return File.('config.rb', Dir.pwd) end |
.marshal_identifier ⇒ String
Returns the name of the directory that contains the quick specification files.
41 42 43 |
# File 'lib/gem-mirror/configuration.rb', line 41 def self.marshal_identifier return "Marshal.#{marshal_version}" end |
.marshal_version ⇒ String
Returns a String containing the Marshal version.
59 60 61 |
# File 'lib/gem-mirror/configuration.rb', line 59 def self.marshal_version return "#{Marshal::MAJOR_VERSION}.#{Marshal::MINOR_VERSION}" end |
.template_directory ⇒ String
24 25 26 |
# File 'lib/gem-mirror/configuration.rb', line 24 def self.template_directory return File.('../../../template', __FILE__) end |
.versions_file ⇒ String
Returns the name of the file that contains an index of all the versions.
50 51 52 |
# File 'lib/gem-mirror/configuration.rb', line 50 def self.versions_file return "specs.#{marshal_version}.gz" end |
Instance Method Details
#gems_directory ⇒ String
73 74 75 |
# File 'lib/gem-mirror/configuration.rb', line 73 def gems_directory return File.join(destination, 'gems') end |
#ignore_gem(name, version) ⇒ Object
Adds a Gem to the list of Gems to ignore.
92 93 94 95 |
# File 'lib/gem-mirror/configuration.rb', line 92 def ignore_gem(name, version) ignored_gems[name] ||= [] ignored_gems[name] << version end |
#ignore_gem?(name, version) ⇒ TrueClass|FalseClass
Checks if a Gem should be ignored.
104 105 106 |
# File 'lib/gem-mirror/configuration.rb', line 104 def ignore_gem?(name, version) return ignored_gems[name].include?(version) end |
#ignored_gems ⇒ Hash
Returns a Hash containing various Gems to ignore and their versions.
82 83 84 |
# File 'lib/gem-mirror/configuration.rb', line 82 def ignored_gems return @ignored_gems ||= Hash.new { |hash, key| hash[key] = [] } end |
#logger ⇒ Logger
17 18 19 |
# File 'lib/gem-mirror/configuration.rb', line 17 def logger return @logger ||= Logger.new(STDOUT) end |
#mirror_directory ⇒ GemMirror::MirrorDirectory
66 67 68 |
# File 'lib/gem-mirror/configuration.rb', line 66 def mirror_directory return @mirror_directory ||= MirrorDirectory.new(gems_directory) end |
#source(name, url, &block) {|source| ... } ⇒ Object
Adds a new source to mirror.
125 126 127 128 129 130 |
# File 'lib/gem-mirror/configuration.rb', line 125 def source(name, url, &block) source = Source.new(name, url) source.instance_eval(&block) sources << source end |
#sources ⇒ Array
Returns a list of sources to mirror.
113 114 115 |
# File 'lib/gem-mirror/configuration.rb', line 113 def sources return @sources ||= [] end |