Method: OpenC3::TargetModel.modified_files

Defined in:
lib/openc3/models/target_model.rb

.modified_files(target_name, scope:) ⇒ Object

Given target’s modified file list



119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/openc3/models/target_model.rb', line 119

def self.modified_files(target_name, scope:)
  modified = []

  if ENV['OPENC3_LOCAL_MODE']
    modified = OpenC3::LocalMode.modified_files(target_name, scope: scope)
  else
    resp = Bucket.getClient().list_objects(
      bucket: ENV['OPENC3_CONFIG_BUCKET'],
      # The trailing slash is important!
      prefix: "#{scope}/targets_modified/#{target_name}/",
    )
    resp.each do |item|
      # Results look like DEFAULT/targets_modified/INST/procedures/new.rb
      # so split on '/' and ignore the first two values
      modified << item.key.split('/')[2..-1].join('/')
    end
  end
  # Sort to enable a consistent listing of the modified files
  modified.sort
end