Class: DebtCeiling::ArcheologicalDig
- Inherits:
-
Object
- Object
- DebtCeiling::ArcheologicalDig
- Defined in:
- lib/debt_ceiling/archeological_dig.rb
Constant Summary collapse
- ARCHEOLOGY_RECORD_VERSION_NUMBER =
increment for backward incompatible changes in record format
"v0"
Instance Attribute Summary collapse
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#records ⇒ Object
readonly
Returns the value of attribute records.
-
#redis ⇒ Object
readonly
Returns the value of attribute redis.
-
#source_control ⇒ Object
readonly
Returns the value of attribute source_control.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(path = '.', opts = {}) ⇒ ArcheologicalDig
constructor
A new instance of ArcheologicalDig.
Constructor Details
#initialize(path = '.', opts = {}) ⇒ ArcheologicalDig
Returns a new instance of ArcheologicalDig.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/debt_ceiling/archeological_dig.rb', line 14 def initialize(path='.', opts={}) @redis = redis_if_available @path = path @opts = opts @source_control = SourceControlSystem::Base.create DebtCeiling.load_configuration unless opts[:preconfigured] @records = source_control.revisions_refs(path).map do |commit| if note = config_note_present_on_commit(commit) extract_record_from_note(note) else build_record(commit) end end redis.set(self.class.dig_json_key(path), records.to_json) if redis end |
Instance Attribute Details
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
7 8 9 |
# File 'lib/debt_ceiling/archeological_dig.rb', line 7 def opts @opts end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
7 8 9 |
# File 'lib/debt_ceiling/archeological_dig.rb', line 7 def path @path end |
#records ⇒ Object (readonly)
Returns the value of attribute records.
7 8 9 |
# File 'lib/debt_ceiling/archeological_dig.rb', line 7 def records @records end |
#redis ⇒ Object (readonly)
Returns the value of attribute redis.
7 8 9 |
# File 'lib/debt_ceiling/archeological_dig.rb', line 7 def redis @redis end |
#source_control ⇒ Object (readonly)
Returns the value of attribute source_control.
7 8 9 |
# File 'lib/debt_ceiling/archeological_dig.rb', line 7 def source_control @source_control end |
Class Method Details
.dig_json_key(path) ⇒ Object
9 10 11 12 |
# File 'lib/debt_ceiling/archeological_dig.rb', line 9 def self.dig_json_key(path) project_name = File.(path).split('/').last "DebtCeiling_#{project_name}_#{ARCHEOLOGY_RECORD_VERSION_NUMBER}" end |