Class: Gemirro::Configuration

Inherits:
Confstruct::Configuration
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#ignored_gemsHash

Returns a Hash containing various Gems to ignore and their versions.

Returns:

  • (Hash)


97
98
99
# File 'lib/gemirro/configuration.rb', line 97

def ignored_gems
  @ignored_gems
end

#loggerLogger (readonly)

Returns the logger

Returns:

  • (Logger)


24
25
26
# File 'lib/gemirro/configuration.rb', line 24

def logger
  @logger
end

#mirror_directoryGemirro::MirrorDirectory (readonly)

Return mirror directory



79
80
81
# File 'lib/gemirro/configuration.rb', line 79

def mirror_directory
  @mirror_directory
end

#sourceObject

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_fileString

Returns default configuration file path

Returns:

  • (String)


42
43
44
# File 'lib/gemirro/configuration.rb', line 42

def self.default_configuration_file
  File.expand_path('config.rb', Dir.pwd)
end

.marshal_identifierString

Returns the name of the directory that contains the quick specification files.

Returns:

  • (String)


52
53
54
# File 'lib/gemirro/configuration.rb', line 52

def self.marshal_identifier
  "Marshal.#{marshal_version}"
end

.marshal_versionString

Returns a String containing the Marshal version.

Returns:

  • (String)


70
71
72
# File 'lib/gemirro/configuration.rb', line 70

def self.marshal_version
  "#{Marshal::MAJOR_VERSION}.#{Marshal::MINOR_VERSION}"
end

.template_directoryString

Returns the template path to init directory

Returns:

  • (String)


33
34
35
# File 'lib/gemirro/configuration.rb', line 33

def self.template_directory
  File.expand_path('../../../template', __FILE__)
end

.versions_fileString

Returns the name of the file that contains an index of all the versions.

Returns:

  • (String)


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.

Parameters:

  • name (String)
  • url (String)
  • block (Proc)


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_directoryString

Returns gems directory

Returns:

  • (String)


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.

Parameters:

  • name (String)
  • version (String)


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.

Parameters:

  • name (String)
  • version (String)

Returns:

  • (TrueClass|FalseClass)


119
120
121
# File 'lib/gemirro/configuration.rb', line 119

def ignore_gem?(name, version)
  ignored_gems[name].include?(version)
end