Class: Radon::Environments

Inherits:
Object
  • Object
show all
Defined in:
lib/core/environments.rb

Constant Summary collapse

@@all =

The list of all supported environments and their associeted data paths

{
  'gradle' => File.join(DATA_DIR, 'gradle.zip'),
  'java'   => File.join(DATA_DIR, 'java.zip'),
  'maven'  => File.join(DATA_DIR, 'maven.zip'),
  'python' => File.join(DATA_DIR, 'python.zip'),
  'c'      => File.join(DATA_DIR, 'c.zip'),
  'ruby'   => File.join(DATA_DIR, 'ruby.zip'),
  'crystal'=> File.join(DATA_DIR, 'crystal_app.zip'),
  'go_s'   => File.join(DATA_DIR, 'go_s.zip'),
  'website'=> File.join(DATA_DIR, 'website.zip')
}

Class Method Summary collapse

Class Method Details

.extract(key, target) ⇒ Object

Extract the zip



29
30
31
32
33
34
35
36
# File 'lib/core/environments.rb', line 29

def self.extract(key, target)
  envs = get_all_names
  if envs.include? key
    send "extract_#{key}", target
  else
    fail_with("#{key} is not a supported environment.\nYou can suggest it be added at https://github.com/cbrnrd/radon/issues")
  end
end

.get_all_namesObject

Gets all environments as an array of strings



19
20
21
# File 'lib/core/environments.rb', line 19

def self.get_all_names
  @@all.keys
end

.get_target_of(key) ⇒ Object

Gets the value (corrosponding zip) of the key



24
25
26
# File 'lib/core/environments.rb', line 24

def self.get_target_of(key)
  @@all[key]
end