#!/usr/bin/env ruby require 'yaml' require 'i18n' require_relative '../lib/migrator' yaml_path = ARGV.shift fail 'Missing credentials.yml file, `storageroom-to-contentful credentials.yml`' unless yaml_path spec = Gem::Specification.find_by_name('storageroom-to-contentful') gem_root = spec.gem_dir puts gem_root APP_ROOT = Dir.pwd DATA_DIR = "#{APP_ROOT}/data" COLLECTIONS_DATA_DIR = "#{DATA_DIR}/collections" ENTRIES_DATA_DIR = "#{DATA_DIR}/entries" STORAGE_ROOM_URL = 'http://api.storageroomapp.com/accounts/' CONTENTFUL_TYPES = %w(Text Integer Number Boolean Symbol Array Entry Asset Date Location Object) CREDENTIALS = YAML.load_file(File.expand_path(yaml_path)) translations = "#{gem_root}/contenftul_fields_types.yml" I18n.load_path << translations I18n.enforce_available_locales = false Migrator.new.run