Skip to content

Commit

Permalink
New task md-files in miga doctor
Browse files Browse the repository at this point in the history
  • Loading branch information
lmrodriguezr committed Jun 23, 2024
1 parent 384bcff commit 74c5cb7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/miga/cli/action/doctor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def perform
# TODO Implement this check:
# refdb: ['ref-db', 'Check index format of reference databases'],
status: ['status', 'Update metadata status of all datasets'],
mdfiles:['md-files', 'Remove unregistered files in metadata'],
db: ['databases', 'Check integrity of database files'],
dist: ['distances', 'Check distance summary tables'],
bidir: ['bidirectional', 'Check distances are bidirectional'],
Expand Down
18 changes: 18 additions & 0 deletions lib/miga/cli/action/doctor/operations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,24 @@ def check_files(cli)
cli.say
end

##
# Perform md-files operation with MiGA::Cli +cli+
def check_mdfiles(cli)
cli.say 'Looking for unregistered files in the metadata folder'
md = File.join(cli.load_project.path, 'metadata')
Dir.each_child(md) do |file|
expected_ds = File.basename(file, '.json')
next if cli.load_project.dataset_names.include?(expected_ds)
file_path = File.join(md, file)
if Dir.exist?(file_path)
cli.say " > Ignoring directory: #{file}"
else
cli.say " > Removing: #{file}"
File.unlink(File.join(md, file))
end
end
end

##
# Perform cds operation with MiGA::Cli +cli+
def check_cds(cli)
Expand Down
2 changes: 1 addition & 1 deletion lib/miga/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module MiGA
# - String indicating release status:
# - rc* release candidate, not released as gem
# - [0-9]+ stable release, released as gem
VERSION = [1.3, 15, 12].freeze
VERSION = [1.3, 16, 0].freeze

##
# Nickname for the current major.minor version.
Expand Down

0 comments on commit 74c5cb7

Please sign in to comment.