Class: Gemirro::Configuration
- Inherits:
-
Confstruct::Configuration
- Object
- Confstruct::Configuration
- Gemirro::Configuration
- Defined in:
- lib/gemirro/configuration.rb
Overview
Configuration class used for storing data about a mirror such as the destination directory, source, ignored Gems, etc.
Instance Attribute Summary collapse
-
#ignored_gems ⇒ Hash
Returns a Hash containing various Gems to ignore and their versions.
-
#logger ⇒ Logger
readonly
Returns the logger.
-
#mirror_directory ⇒ Gemirro::MirrorDirectory
readonly
Return mirror directory.
-
#source ⇒ Object
Returns the value of attribute source.
Class Method Summary collapse
-
.default_configuration_file ⇒ String
Returns default configuration file path.
-
.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
Returns the template path to init directory.
-
.versions_file ⇒ String
Returns the name of the file that contains an index of all the versions.
Instance Method Summary collapse
-
#define_source(name, url, &block) ⇒ Object
Define the source to mirror.
-
#gems_directory ⇒ String
Returns gems directory.
-
#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.
Instance Attribute Details
#ignored_gems ⇒ Hash
Returns a Hash containing various Gems to ignore and their versions.
97 98 99 |
# File 'lib/gemirro/configuration.rb', line 97 def ignored_gems @ignored_gems end |
#logger ⇒ Logger (readonly)
Returns the logger
24 25 26 |
# File 'lib/gemirro/configuration.rb', line 24 def logger @logger end |
#mirror_directory ⇒ Gemirro::MirrorDirectory (readonly)
Return mirror directory
79 80 81 |
# File 'lib/gemirro/configuration.rb', line 79 def mirror_directory @mirror_directory end |
#source ⇒ Object
Returns the value of attribute source.
17 18 19 |
# File 'lib/gemirro/configuration.rb', line 17 def source @source end |
Class Method Details
.default_configuration_file ⇒ String
Returns default configuration file path
42 43 44 |
# File 'lib/gemirro/configuration.rb', line 42 def self.default_configuration_file File.('config.rb', Dir.pwd) end |
.marshal_identifier ⇒ String
Returns the name of the directory that contains the quick specification files.
52 53 54 |
# File 'lib/gemirro/configuration.rb', line 52 def self.marshal_identifier "Marshal.#{marshal_version}" end |
.marshal_version ⇒ String
Returns a String containing the Marshal version.
70 71 72 |
# File 'lib/gemirro/configuration.rb', line 70 def self.marshal_version "#{Marshal::MAJOR_VERSION}.#{Marshal::MINOR_VERSION}" end |
.template_directory ⇒ String
Returns the template path to init directory
33 34 35 |
# File 'lib/gemirro/configuration.rb', line 33 def self.template_directory File.('../../../template', __FILE__) end |
.versions_file ⇒ String
Returns the name of the file that contains an index of all the versions.
61 62 63 |
# File 'lib/gemirro/configuration.rb', line 61 def self.versions_file "specs.#{marshal_version}.gz" end |
Instance Method Details
#define_source(name, url, &block) ⇒ Object
Define the source to mirror.
130 131 132 133 134 135 |
# File 'lib/gemirro/configuration.rb', line 130 def define_source(name, url, &block) source = Source.new(name, url) source.instance_eval(&block) @source = source end |
#gems_directory ⇒ String
Returns gems directory
88 89 90 |
# File 'lib/gemirro/configuration.rb', line 88 def gems_directory File.join(destination, 'gems') end |
#ignore_gem(name, version) ⇒ Object
Adds a Gem to the list of Gems to ignore.
107 108 109 110 |
# File 'lib/gemirro/configuration.rb', line 107 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.
119 120 121 |
# File 'lib/gemirro/configuration.rb', line 119 def ignore_gem?(name, version) ignored_gems[name].include?(version) end |