Sha256: b82a04e6ad390931ca5d52d2234b1cbdd261742176986d9dfbf99f453a62c3f8

Contents?: true

Size: 1.86 KB

Versions: 2

Compression:

Stored size: 1.86 KB

Contents

#!/usr/bin/env ruby

require 'escort'
require_relative '../lib/cli'

I18n.enforce_available_locales = false

fail ArgumentError, 'Set path for configuration file and define action. More details you can find in README.' if ARGF.argv.empty?
fail ArgumentError, "Missing '--config-file' argument. The correct is form: 'database-exporter --config-file PATH_TO_CONFIGURATION_FILE --action'. View README." unless ARGV.include?('--config-file')

Escort::App.create do |app|
  app.summary 'Executable file of Database exporter'

  app.options do |opts|
    opts.opt :file, '--config-file', short: '-f', long: '--config-file', type: :string

    app.command '--create-content-model-from-json' do |command|
      command.summary 'Create content types files, based on contentful structure json file. View README'
      command.action do |options, arguments|
        Command::CLI.new(options, arguments).execute
      end
    end
    app.command '--convert-content-model-to-json' do |command|
      command.summary 'Transform content_model file into contentful_structure import form. View README'
      command.action do |options, arguments|
        Command::CLI.new(options, arguments).execute
      end
    end
    app.command '--extract-to-json' do |command|
      command.summary 'Query data from Database'
      command.action do |options, arguments|
        Command::CLI.new(options, arguments).execute
      end
    end
    app.command '--prepare-json' do |command|
      command.summary 'Prepare JSON files to Import'
      command.action do |options, arguments|
        Command::CLI.new(options, arguments).execute
      end
    end
    app.command '--list-tables' do |command|
      command.summary 'List all names of tables from Database and save them to JSON file. View README'
      command.action do |options, arguments|
        Command::CLI.new(options, arguments).execute
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
database-exporter-0.0.2 bin/database-exporter
database-exporter-0.0.1 bin/database-exporter