Skip to content

Commit

Permalink
Merge branch 'travis-ruby' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
lethosor committed Mar 16, 2015
2 parents c9f990b + be89db5 commit 51a6d88
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 25 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ before_install:
script:
- python travis/pr-check-base.py
- python travis/lint.py
- python travis/luac.py
- python travis/script-syntax.py --ext=lua --cmd="luac$LUA_VERSION -p"
- python travis/script-syntax.py --ext=rb --cmd="ruby -c"
- ./fixTexts.sh --force
notifications:
email: false
24 changes: 0 additions & 24 deletions travis/luac.py

This file was deleted.

32 changes: 32 additions & 0 deletions travis/script-syntax.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import argparse, os, sys, subprocess

parser = argparse.ArgumentParser()
parser.add_argument('--path', default='.', help='Root directory')
parser.add_argument('--ext', help='Script extension', required=True)
parser.add_argument('--cmd', help='Command', required=True)
args = parser.parse_args()

def main():
root_path = os.path.abspath(args.path)
cmd = args.cmd.split(' ')
ext = '.' + args.ext
if not os.path.exists(root_path):
print('Nonexistent path: %s' % root_path)
sys.exit(2)
err = False
for cur, dirnames, filenames in os.walk(root_path):
parts = cur.replace('\\', '/').split('/')
if '.git' in parts or 'depends' in parts:
continue
for filename in filenames:
if not filename.endswith(ext):
continue
full_path = os.path.join(cur, filename)
try:
subprocess.check_output(cmd + [full_path])
except subprocess.CalledProcessError:
err = True
sys.exit(int(err))

if __name__ == '__main__':
main()

0 comments on commit 51a6d88

Please sign in to comment.