Method: EAD#import_JSON

Defined in:
lib/ead.rb

#import_JSON(user_arguments) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ead.rb', line 7

def import_JSON(user_arguments)
  file = File.read(user_arguments[0] || './EAD.json')

  unless ['0.4.0', '0.4.1', '0.4.2', '0.4.3', '0.4.4', '0.4.5', '0.4.6'].include? JSON.parse(file)['version']
    puts "\n\n----------------"
    puts "\e[31m#{
      'Versions of your EAD file and the gem are not compatible. '\
        'So, you may have some unexpected results.'\
        'To run your EAD file correctly, please run'
    }\e[0m"

    puts "\e[31m#{
      "\ngem install ead -v #{JSON.parse(file)['version']}"
    }\e[0m"
    puts "----------------\n\n"

    raise StandardError, msg = 'Incompatible version'
  end

  file
end