Class: Putpaws::ApplicationConfig

Inherits:
Struct
  • Object
show all
Defined in:
lib/putpaws/application_config.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#build_log_group_prefixObject

Returns the value of attribute build_log_group_prefix

Returns:

  • (Object)

    the current value of build_log_group_prefix



7
8
9
# File 'lib/putpaws/application_config.rb', line 7

def build_log_group_prefix
  @build_log_group_prefix
end

#build_project_name_prefixObject

Returns the value of attribute build_project_name_prefix

Returns:

  • (Object)

    the current value of build_project_name_prefix



7
8
9
# File 'lib/putpaws/application_config.rb', line 7

def build_project_name_prefix
  @build_project_name_prefix
end

#build_regionObject

Returns the value of attribute build_region

Returns:

  • (Object)

    the current value of build_region



7
8
9
# File 'lib/putpaws/application_config.rb', line 7

def build_region
  @build_region
end

#clusterObject

Returns the value of attribute cluster

Returns:

  • (Object)

    the current value of cluster



7
8
9
# File 'lib/putpaws/application_config.rb', line 7

def cluster
  @cluster
end

#ecs_regionObject

Returns the value of attribute ecs_region

Returns:

  • (Object)

    the current value of ecs_region



7
8
9
# File 'lib/putpaws/application_config.rb', line 7

def ecs_region
  @ecs_region
end

#log_group_prefixObject

Returns the value of attribute log_group_prefix

Returns:

  • (Object)

    the current value of log_group_prefix



7
8
9
# File 'lib/putpaws/application_config.rb', line 7

def log_group_prefix
  @log_group_prefix
end

#log_regionObject

Returns the value of attribute log_region

Returns:

  • (Object)

    the current value of log_region



7
8
9
# File 'lib/putpaws/application_config.rb', line 7

def log_region
  @log_region
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



7
8
9
# File 'lib/putpaws/application_config.rb', line 7

def name
  @name
end

#networkObject

Returns the value of attribute network

Returns:

  • (Object)

    the current value of network



7
8
9
# File 'lib/putpaws/application_config.rb', line 7

def network
  @network
end

#regionObject

Returns the value of attribute region

Returns:

  • (Object)

    the current value of region



7
8
9
# File 'lib/putpaws/application_config.rb', line 7

def region
  @region
end

#schedulesObject

Returns the value of attribute schedules

Returns:

  • (Object)

    the current value of schedules



7
8
9
# File 'lib/putpaws/application_config.rb', line 7

def schedules
  @schedules
end

#serviceObject

Returns the value of attribute service

Returns:

  • (Object)

    the current value of service



7
8
9
# File 'lib/putpaws/application_config.rb', line 7

def service
  @service
end

#targetObject

Returns the value of attribute target

Returns:

  • (Object)

    the current value of target



7
8
9
# File 'lib/putpaws/application_config.rb', line 7

def target
  @target
end

#task_name_prefixObject

Returns the value of attribute task_name_prefix

Returns:

  • (Object)

    the current value of task_name_prefix



7
8
9
# File 'lib/putpaws/application_config.rb', line 7

def task_name_prefix
  @task_name_prefix
end

Class Method Details

.allObject



24
25
26
27
28
29
# File 'lib/putpaws/application_config.rb', line 24

def self.all
  load.map{|k,v|
    data = v.slice(*self.members)
    new(data.merge(name: k.to_s))
  }
end

.find(name) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/putpaws/application_config.rb', line 31

def self.find(name)
  application_data = load
  data = application_data[name.to_sym]
  return nil unless data
  data = data.slice(*self.members)
  new(data.merge({name: name.to_s}))
end

.load(path_prefix: '.putpaws') ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/putpaws/application_config.rb', line 15

def self.load(path_prefix: '.putpaws')
  @application_data ||= begin
    path = Pathname.new(path_prefix).join("application.json").to_s
    data = File.exist?(path) ?
      JSON.parse(File.read(path), symbolize_names: true).to_h :
      {}
  end
end

Instance Method Details

#build_log_command_paramsObject



55
56
57
58
59
60
# File 'lib/putpaws/application_config.rb', line 55

def build_log_command_params
  {
    region: build_region || region,
    log_group_prefix: build_log_group_prefix,
  }
end

#codebuild_command_paramsObject



76
77
78
79
80
81
# File 'lib/putpaws/application_config.rb', line 76

def codebuild_command_params
  {
    region: build_region || region,
    project_name_prefix: build_project_name_prefix,
  }
end

#ecs_command_paramsObject



39
40
41
42
43
44
45
46
# File 'lib/putpaws/application_config.rb', line 39

def ecs_command_params
  {
    region: ecs_region || region,
    cluster: cluster,
    service: service,
    task_name_prefix: task_name_prefix,
  }
end

#log_command_paramsObject



48
49
50
51
52
53
# File 'lib/putpaws/application_config.rb', line 48

def log_command_params
  {
    region: log_region || region,
    log_group_prefix: log_group_prefix,
  }
end