Class: GemEnforcer::Setup::Helper::Retrieval

Inherits:
Object
  • Object
show all
Defined in:
lib/gem_enforcer/setup/helper/retrieval.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(gem_name:, server:, git:) ⇒ Retrieval

Returns a new instance of Retrieval.



9
10
11
12
13
# File 'lib/gem_enforcer/setup/helper/retrieval.rb', line 9

def initialize(gem_name:, server:, git:)
  @gem_name = gem_name
  @server = server
  @git = git
end

Instance Attribute Details

#gem_nameObject (readonly)

Returns the value of attribute gem_name.



7
8
9
# File 'lib/gem_enforcer/setup/helper/retrieval.rb', line 7

def gem_name
  @gem_name
end

#gitObject (readonly)

Returns the value of attribute git.



7
8
9
# File 'lib/gem_enforcer/setup/helper/retrieval.rb', line 7

def git
  @git
end

#retrieval_factoryObject (readonly)

Returns the value of attribute retrieval_factory.



7
8
9
# File 'lib/gem_enforcer/setup/helper/retrieval.rb', line 7

def retrieval_factory
  @retrieval_factory
end

#serverObject (readonly)

Returns the value of attribute server.



7
8
9
# File 'lib/gem_enforcer/setup/helper/retrieval.rb', line 7

def server
  @server
end

Instance Method Details

#errorsObject



19
20
21
# File 'lib/gem_enforcer/setup/helper/retrieval.rb', line 19

def errors
  @errors ||= []
end

#retrieve_version_listObject



23
24
25
26
27
28
29
# File 'lib/gem_enforcer/setup/helper/retrieval.rb', line 23

def retrieve_version_list
  unless valid_config?
    raise ConfigError, "Attempted to run validations with invalid Version Configurations"
  end

  retrieval_factory.gem_versions(name: gem_name).sort
end

#valid_config?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/gem_enforcer/setup/helper/retrieval.rb', line 15

def valid_config?
  @valid_config ||= validate_config
end