Class: Tagfish::CLI::UpdateCommand

Inherits:
BaseCommand
  • Object
show all
Includes:
Update
Defined in:
lib/tagfish/cli/update_command.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/tagfish/cli/update_command.rb', line 18

def execute
  filters = [
    URIFilters.must_be_tagged,
    URIFilters.must_not_be_tagged_latest,
    URIFilters.must_match_repository(only)
  ]
  updater = Updater.new(filters)
  original = File.read(file)
  updated = Tokeniser.dump(updater.update(Tokeniser.tokenise(original)))

  puts Differ.diff(original, updated)

  if not dry_run?
    File.write(file, updated)
  end
end