Class: CemAcpt::Bolt::Project

Inherits:
YamlFile
  • Object
show all
Defined in:
lib/cem_acpt/bolt/project.rb

Overview

Provides an abstraction for the Bolt project file / config

Constant Summary

Constants included from Logging

Logging::LEVEL_MAP

Instance Attribute Summary collapse

Attributes inherited from YamlFile

#path

Instance Method Summary collapse

Methods inherited from YamlFile

#delete!, #eq_to_disk?, #gte_to_disk?, #load!, #lte_to_disk?, #save!, #to_h

Methods included from Logging

current_log_config, #current_log_config, current_log_format, #current_log_format, #current_log_level, current_log_level, included, #logger, logger, new_log_config, #new_log_config, new_log_formatter, #new_log_formatter, #new_log_level, new_log_level, #new_logger, new_logger, verbose?, #verbose?

Constructor Details

#initialize(config, module_name) ⇒ Project

Returns a new instance of Project.



12
13
14
15
16
17
18
# File 'lib/cem_acpt/bolt/project.rb', line 12

def initialize(config, module_name)
  path = config.get('bolt.project.path') || 'bolt-project.yaml'
  super(path)
  @config = config
  @module_name = module_name
  @hash = new_bolt_project_hash(module_name, config)
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



10
11
12
# File 'lib/cem_acpt/bolt/project.rb', line 10

def config
  @config
end

#module_nameObject (readonly)

Returns the value of attribute module_name.



10
11
12
# File 'lib/cem_acpt/bolt/project.rb', line 10

def module_name
  @module_name
end

Instance Method Details

#latest_saved?Boolean

Returns:

  • (Boolean)


20
21
22
23
24
# File 'lib/cem_acpt/bolt/project.rb', line 20

def latest_saved?
  # We consider the project file to be up to date if it is subset of the contents on disk
  # or equal to the contents on disk
  (@hash == @saved_hash) || lte_to_disk?
end