Sha256: 788bb3ec052a39e4582640ed8cfd39e7be633baf4e7e699d06ef08c21d24704a

Contents?: true

Size: 1.88 KB

Versions: 10

Compression:

Stored size: 1.88 KB

Contents

#!/usr/bin/env ruby

require_relative '../lib/i18n/migrations/migrator'
require_relative '../lib/i18n/migrations/config'

migrator = I18n::Migrations::Migrator.new

def extract_option(name)
  !!ARGV.delete(name)
end

case ARGV.shift
  when 'setup'
    puts 'Where should we create a default config file? [.]'
    dir = gets.chomp
    dir = dir == '' ? '.' : dir
    file = I18n::Migrations::Config.copy_default_config_file(dir)

    puts 'You will need to configure this file before you can get going.'
    puts File.expand_path(file)

  when 'new'
    name = ARGV.shift
    if name
      migrator.new_migration name
    else
      STDERR.puts 'Usage: im new [name]'
      exit 1
    end

  when 'migrate'
    migrator.migrate

  when 'rollback'
    migrator.rollback(ARGV[0] || 'all')

  when 'redo'
    migrator.rollback(ARGV[0] || 'all')
    migrator.migrate

  when 'pull'
    migrator.pull ARGV[0] || 'all'

  when 'push'
    force = extract_option('-f')
    migrator.push(ARGV[0] || 'all', force)

  when 'validate'
    migrator.validate(ARGV[0] || 'all')

  when 'new_locale'
    locale = ARGV.shift
    if locale
      migrator.new_locale(locale)
    else
      STDERR.puts 'Usage: im new_locale [name]'
      exit 1
    end

  when 'version'
    migrator.version

  else
    puts <<-USAGE
Usage: im [command]

Commands:
  setup - Setup a new project w/ i18n-migrations.
  new - Create a new migration.
  migrate - Migrate to current version.
  rollback - Rollback to previous version.
  redo - Rollback and then migrate again.
  pull - Pull latest translation spreadsheet. 
  push - Push to translation spreadsheet. (-f to force, without doing a pull first)
  validate - check all translations according to our rules and fix what we can
  new_locale - Copy your current main locale file to a new language, translating all keys.
  version - Print version of locales.

    USAGE
    puts
    puts "Commands:"
    puts
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
i18n-migrations-1.0.0 bin/i18n-migrate
i18n-migrations-0.2.5 bin/i18n-migrate
i18n-migrations-0.2.4 bin/i18n-migrate
i18n-migrations-0.2.3 bin/i18n-migrate
i18n-migrations-0.2.2 bin/i18n-migrate
i18n-migrations-0.2.1 bin/i18n-migrate
i18n-migrations-0.2.0 bin/i18n-migrate
i18n-migrations-0.1.4 bin/i18n-migrate
i18n-migrations-0.1.3 bin/i18n-migrate
i18n-migrations-0.1.2 bin/i18n-migrate