1
0
Fork 0
forked from 0x2620/oxjs

remove unneeded Ox. prefix from path and file names

This commit is contained in:
rolux 2014-09-26 15:51:50 +02:00
commit 51696562f1
1365 changed files with 43 additions and 43 deletions

View file

@ -48,37 +48,37 @@ def build_oxjs(downloads=False, geo=False):
for item in os.listdir(path):
full_path = '%s%s' % (path, item)
if os.path.isdir(full_path):
if not (geo == False and item == 'Ox.Geo'):
if not (geo == False and item == 'Geo'):
shutil.rmtree(full_path)
else:
os.remove(full_path)
# Ox.UI Theme Data
theme_data = {}
themes = [dirname for dirname in os.listdir(source_path + 'Ox.UI/themes/') if not dirname[0] in '._']
themes = [dirname for dirname in os.listdir(source_path + 'UI/themes/') if not dirname[0] in '._']
for theme in themes:
theme_data[theme] = read_jsonc(source_path + 'Ox.UI/themes/%s/json/theme.jsonc' % theme)
theme_data[theme] = read_jsonc(source_path + 'UI/themes/%s/json/theme.jsonc' % theme)
theme_data[theme]['themeClass'] = 'OxTheme' + theme[0].upper() + theme[1:]
# Ox.UI CSS
css = read_file(source_path + 'Ox.UI/css/Ox.UI.css')
css = read_file(source_path + 'UI/css/UI.css')
css = css.replace('$import', '\n'.join([
'@import url("../themes/%s/css/theme.css?%s");' % (theme, version) for theme in themes
]))
write_file('%sOx.UI/css/Ox.UI.css' % build_path, css)
write_file('%sOx.UI/css/Ox.UI.css' % dev_path, css)
write_file('%sUI/css/UI.css' % build_path, css)
write_file('%sUI/css/UI.css' % dev_path, css)
# Ox.UI Theme CSS
css = read_file(source_path + 'Ox.UI/css/theme.css')
css = read_file(source_path + 'UI/css/theme.css')
for theme in themes:
theme_css = parse_css(css, theme_data[theme])
theme_css = theme_css.replace('.png)', '.png?%s)' % version)
write_file('%sOx.UI/themes/%s/css/theme.css' % (build_path, theme), theme_css)
write_file('%sOx.UI/themes/%s/css/theme.css' % (dev_path, theme), theme_css)
write_file('%sUI/themes/%s/css/theme.css' % (build_path, theme), theme_css)
write_file('%sUI/themes/%s/css/theme.css' % (dev_path, theme), theme_css)
# Ox.UI SVGs
ui_images = {}
path = source_path + 'Ox.UI/svg/'
path = source_path + 'UI/svg/'
for filename in [filename for filename in os.listdir(path) if not filename[0] in '._']:
svg = read_file(path + filename)
svg = re.sub('\n\s*', '', svg)
@ -90,8 +90,8 @@ def build_oxjs(downloads=False, geo=False):
if filename.startswith('symbolLoading'):
for theme in themes:
theme_svg = re.sub('#808080', format_hex(theme_data[theme]['symbolDefaultColor']), svg)
write_file('%sOx.UI/themes/%s/svg/%s' % (build_path, theme, filename), theme_svg)
write_file('%sOx.UI/themes/%s/svg/%s' % (dev_path, theme, filename), theme_svg)
write_file('%sUI/themes/%s/svg/%s' % (build_path, theme, filename), theme_svg)
write_file('%sUI/themes/%s/svg/%s' % (dev_path, theme, filename), theme_svg)
# copy & link
ui_files = {'build': [], 'dev': []}
@ -100,8 +100,8 @@ def build_oxjs(downloads=False, geo=False):
if not '_' in path and not filename[0] in '._' \
and not filename.endswith('~') \
and not filename.endswith('.css') \
and not '/Ox.UI/svg' in path \
and (geo or not '/Ox.Geo/' in path):
and not '/UI/svg' in path \
and (geo or not '/Geo/' in path):
# write copies in build path
source = os.path.join(path, filename)
is_jquery = re.search('^jquery-[\d\.]+\.js$', filename)
@ -115,7 +115,7 @@ def build_oxjs(downloads=False, geo=False):
if is_jquery_plugin:
ui_files['build'].append(target.replace(build_path, ''))
ui_files['dev'].append(target.replace(build_path, ''))
if not '/Ox/js/' in source and not '/Ox.UI/js/' in source and not is_jquery:
if not '/Ox/js/' in source and not '/UI/js/' in source and not is_jquery:
if re.match('^Ox\..+\.js$', filename) or is_jsonc:
js = read_file(source)
write_file(target, ox.js.minify(js, '' if is_jsonc else comment))
@ -202,7 +202,7 @@ def build_oxjs(downloads=False, geo=False):
# Ox.UI
js = ''
root = source_path + 'Ox.UI/'
root = source_path + 'UI/'
for path, dirnames, filenames in os.walk(root):
for filename in sorted(filenames):
# jquery gets included by Ox.UI loader
@ -216,24 +216,24 @@ def build_oxjs(downloads=False, geo=False):
and not 'locale' in filename \
and not filename.endswith('theme.css') \
and not filename.endswith('.svg') \
and not 'Ox.UI/png' in path:
and not 'UI/png' in path:
ui_files['dev'].append(os.path.join(path.replace(source_path, ''), filename))
if not '/js/' in path:
ui_files['build'].append(os.path.join(path.replace(source_path, ''), filename))
if filename.endswith('.js'):
js += read_file(os.path.join(path, filename)) + '\n'
filename = build_path + 'Ox.UI/js/Ox.UI.js'
filename = build_path + 'UI/js/UI.js'
write_file(filename, ox.js.minify(js, comment))
ui_files['build'].append(filename.replace(build_path, ''))
write_file(build_path + 'Ox.UI/json/Ox.UI.json', json.dumps({
write_file(build_path + 'UI/json/UI.json', json.dumps({
'files': sorted(ui_files['build']),
'images': ui_images
}, sort_keys=True))
write_file(dev_path + 'Ox.UI/json/Ox.UI.json', json.dumps({
write_file(dev_path + 'UI/json/UI.json', json.dumps({
'files': sorted(ui_files['dev']),
'images': ui_images
}, indent=4, sort_keys=True))
ui_files['dev'].append('Ox.UI/Ox.UI.js')
ui_files['dev'].append('UI/UI.js')
# index
data = {
@ -242,7 +242,7 @@ def build_oxjs(downloads=False, geo=False):
lambda x: re.search('\.js$', x),
ui_files['dev']
) + map(
lambda x: 'Ox.%s/Ox.%s.js' % (x, x),
lambda x: '%s/%s.js' % (x, x),
['Geo', 'Image', 'Unicode']
)),
'examples': sorted(sum(map(