diff --git a/.travis.yml b/.travis.yml index b6a805e..550bccf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,10 +31,6 @@ matrix: before_script: - go get github.com/urfave/gfmxr/... - $pip_install flake8 -- mkdir -p .extracted-examples -- curl -sSL -o .extracted-examples/README.md - 'https://raw.githubusercontent.com/urfave/cli/v1/README.md' -- pushd .extracted-examples && gfmxr extract -o . ; popd script: - flake8 runtests cli-v1-to-v2 @@ -42,9 +38,4 @@ script: - ./runtests test - ./runtests gfmxr - ./cli-v1-to-v2 --selftest -- for f in .extracted-examples/*.go ; do - ./cli-v1-to-v2 -w $f ; - go build -o .extracted-examples/example $f ; - ./cli-v1-to-v2 -w $f ; - go build -o .extracted-examples/example $f ; - done +- ./runtests migrations diff --git a/appveyor.yml b/appveyor.yml index e93734d..ae80b2f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -24,3 +24,4 @@ build_script: - python runtests test - python runtests gfmxr - python cli-v1-to-v2 --selftest +- python runtests migrations diff --git a/runtests b/runtests index c9cbf5e..5dffd7d 100755 --- a/runtests +++ b/runtests @@ -2,7 +2,9 @@ from __future__ import print_function import argparse +import glob import os +import shutil import sys import tempfile @@ -65,6 +67,30 @@ def _vet(): _run('go vet ./...'.split()) +@_target +def _migrations(): + migration_script = os.path.abspath( + os.environ.get('V1TOV2', './cli-v1-to-v2') + ) + v1_readme_url = os.environ.get( + 'V1README', + 'https://raw.githubusercontent.com/urfave/cli/v1/README.md' + ) + + tmpdir = tempfile.mkdtemp() + try: + os.chdir(tmpdir) + _run('curl -sSL -o README.md {}'.format(v1_readme_url).split()) + _run('gfmxr extract -o .'.split()) + + for gofile in glob.glob('*.go'): + for i in (0, 1): + _run(['python', migration_script, '-w', gofile]) + _run('go build -o tmp.out {}'.format(gofile).split()) + finally: + shutil.rmtree(tmpdir, ignore_errors=True) + + def _run(command): print('runtests: {}'.format(' '.join(command)), file=sys.stderr) check_call(command)