Sha256: ff08cde6db2743a8a76c30e8e3f53969dc41552f11d6f7ddbe4eec0445b6da41

Contents?: true

Size: 962 Bytes

Versions: 5

Compression:

Stored size: 962 Bytes

Contents

#!/usr/bin/env ruby

# frozen_string_literal: true

# This is an example "editor" used to test the `friends edit` command.
# It inserts a new activity into the second line of the file, allowing
# us to test that friends and locations added in an `edit` command are
# subsequently added during the `clean` stage after the editor closes.

filename = ARGV[0]
current_file_contents = File.read(filename).split("\n")
File.open(filename, "w") do |file|
  file.puts current_file_contents[0]

  # We add two activities that contain the same new friend and new
  # location, to test that this doesn't crash `friends edit` as
  # previously happened.
  file.puts "- 2014-12-15: I just had a possible **Bigfoot** sighting! "\
            "I think I may have seen **Bigfoot** in the _Mysterious Mountains_."
  file.puts "- 2014-12-16: Okay, yep, I definitely just saw **Bigfoot** in "\
            "the _Mysterious Mountains_!"
  file.puts current_file_contents.drop(1)
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
friends-0.55 test/editor
friends-0.54 test/editor
friends-0.53 test/editor
friends-0.52 test/editor
friends-0.51 test/editor