Class: Licensed::Commands::Environment::AppEnvironment

Inherits:
Object
  • Object
show all
Includes:
Sources::ContentVersioning
Defined in:
lib/licensed/commands/environment.rb

Constant Summary

Constants included from Sources::ContentVersioning

Sources::ContentVersioning::CONTENTS, Sources::ContentVersioning::GIT

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Sources::ContentVersioning

#contents_hash, #contents_version, #git_version, #version_strategy

Constructor Details

#initialize(config) ⇒ AppEnvironment

Returns a new instance of AppEnvironment.



9
10
11
# File 'lib/licensed/commands/environment.rb', line 9

def initialize(config)
  @config = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



8
9
10
# File 'lib/licensed/commands/environment.rb', line 8

def config
  @config
end

Instance Method Details

#enabled_source_typesObject



13
14
15
# File 'lib/licensed/commands/environment.rb', line 13

def enabled_source_types
  config.sources.select { |s| s.enabled? }.map { |s| s.class.type }
end

#to_hObject



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/licensed/commands/environment.rb', line 17

def to_h
  {
    "name" => config["name"],
    "source_path" => config.source_path,
    "cache_path" => config.cache_path,
    "sources" => enabled_source_types,
    "allowed" => config["allowed"],
    "ignored" => config["ignored"],
    "reviewed" => config["reviewed"],
    "version_strategy" => self.version_strategy,
    "root" => config.root
  }
end