Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be able to create dev and RC releases with npm #2187

Merged
merged 2 commits into from
May 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ transifex-init: $(TX_DEPENDENCIES) c2cgeoportal/locale/c2cgeoportal.pot
.PHONY: import-ngeo-apps
import-ngeo-apps: $(APPS_HTML_FILES) $(APPS_JS_FILES)

ngeo: NGEO_GIT_ARGS ?= --branch=$(VERSION)
ngeo:
git clone --depth 1 $(NGEO_GIT_ARGS) https://github.com/camptocamp/ngeo.git
ngeo: .build/requirements.timestamp
if [ ! -e "ngeo" ] ; then git clone --depth 1 --branch=$(shell .build/venv/bin/ngeo-version) https://github.com/camptocamp/ngeo.git ; fi
touch --no-create $@

.PRECIOUS: ngeo/contribs/gmf/apps/%/index.html
ngeo/contribs/gmf/apps/%/index.html: ngeo
Expand Down
14 changes: 13 additions & 1 deletion c2cgeoportal/scaffolds/update/CONST_Makefile_tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -713,11 +713,23 @@ node_modules/ngeo/contribs/gmf/fonts/fontawesome-webfont.%: node_modules/font-aw
cp $< $@
touch --no-create $@

.PRECIOUS: node_modules/ngeo/contribs/gmf/fonts/gmf-icons.%
.PRECIOUS: node_modules/ngeo/contribs/gmf/fonts/gmf-icons.svg
node_modules/ngeo/contribs/gmf/fonts/gmf-icons.%: .build/node_modules.timestamp
$(PRERULE_CMD)
touch --no-create $@

.PRECIOUS: node_modules/ngeo/contribs/gmf/fonts/gmf-icons.ttf
node_modules/ngeo/contribs/gmf/fonts/gmf-icons.ttf: node_modules/ngeo/contribs/gmf/fonts/gmf-icons.svg
node_modules/.bin/svg2ttf $< $@

.PRECIOUS: node_modules/ngeo/contribs/gmf/fonts/gmf-icons.eot
node_modules/ngeo/contribs/gmf/fonts/gmf-icons.eot: node_modules/ngeo/contribs/gmf/fonts/gmf-icons.ttf
node_modules/.bin/ttf2eot $< $@

.PRECIOUS: node_modules/ngeo/contribs/gmf/fonts/gmf-icons.woff
node_modules/ngeo/contribs/gmf/fonts/gmf-icons.woff: node_modules/ngeo/contribs/gmf/fonts/gmf-icons.ttf
node_modules/.bin/ttf2woff $< $@

.PRECIOUS: $(PACKAGE)/static-ngeo/fonts/gmf-icons.%
$(PACKAGE)/static-ngeo/fonts/gmf-icons.%: node_modules/ngeo/contribs/gmf/fonts/gmf-icons.%
$(PRERULE_CMD)
Expand Down
43 changes: 39 additions & 4 deletions c2cgeoportal/scripts/import_ngeo_apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,47 @@ def __call__(self, matches):
self.constant, self.route, query
)

RE_NPM_VERSION = re.compile("^([0-9]+)\.([0-9]+)\.([0-9]+)$")
RE_NPM_PRERELEASE_VERSION = re.compile("^([0-9]+)\.([0-9]+)\.([0-9]+)\.?([a-z]+)([0-9]+)$")


def _ngeo_version():
if os.environ["TRAVIS_TAG"]:
match = RE_NPM_VERSION.match(os.environ["TRAVIS_TAG"])
prerelease_match = RE_NPM_PRERELEASE_VERSION.match(os.environ["TRAVIS_TAG"])
if match is not None:
return "{}.{}.{}".format(match.group(1), match.group(2), match.group(3))
if prerelease_match is not None:
return "{}.{}.{}-{}.{}".format(
prerelease_match.group(1),
prerelease_match.group(2),
prerelease_match.group(3),
prerelease_match.group(4),
prerelease_match.group(5)
)
return None


def _ngeo_git_version():
version = _ngeo_version()
if version is not None:
return version
if os.environ["TRAVIS_TAG"]:
return os.environ["TRAVIS_TAG"]
return "master"


def ngeo_git_version():
print(_ngeo_git_version())


def _get_ngeo_version():
return os.environ["TRAVIS_TAG"] \
if len(os.environ.get("TRAVIS_TAG", "")) > 0 \
else "git://github.com/camptocamp/ngeo#{}".format(
subprocess.check_output(["git", "rev-parse", "HEAD"], cwd="ngeo").strip())
version = _ngeo_version()
if version is not None:
return version
return "git://github.com/camptocamp/ngeo#{}".format(
subprocess.check_output(["git", "rev-parse", "HEAD"], cwd="ngeo").strip()
)


def main():
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
"l10nv1tov2 = c2cgeoportal.scripts.l10nv1tov2:main",
"import-ngeo-apps = c2cgeoportal.scripts.import_ngeo_apps:main",
"gen-version = c2cgeoportal.scripts.gen_version:main",
"ngeo-version = c2cgeoportal.scripts.import_ngeo_apps:ngeo_git_version",
],
"pyramid.scaffold": [
"c2cgeoportal_create = c2cgeoportal.scaffolds:TemplateCreate",
Expand Down