Skip to content

Commit

Permalink
yo phovea:update
Browse files Browse the repository at this point in the history
  • Loading branch information
sgratzl committed Aug 21, 2017
1 parent 01d4d7c commit fe8c86a
Show file tree
Hide file tree
Showing 14 changed files with 175 additions and 184 deletions.
10 changes: 4 additions & 6 deletions .yo-rc.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
{
"generator-phovea": {
"type": "app-slib",
"type": "lib-slib",
"name": "tdp_core",
"author": "datavisyn",
"githubAccount": "datavisyn",
"modules": [
"phovea_clue"
],
"extensions": [
],
"sextensions": [
],
"extensions": [],
"sextensions": [],
"libraries": [
"d3",
"jquery",
Expand Down Expand Up @@ -49,4 +47,4 @@
"today": "Sun, 06 Nov 2016 15:02:36 GMT",
"clientOnly": false
}
}
}
21 changes: 8 additions & 13 deletions buildInfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@
* Created by sam on 13.11.2016.
*/


const spawnSync = require('child_process').spawnSync;
const path = require('path');
const resolve = path.resolve;
const fs = require('fs');


function dependencyGraph(cwd) {
const npm = process.platform === 'win32' ? 'npm.cmd' : 'npm';
const r = spawnSync(npm, ['ls', '--prod', '--json'], {
Expand Down Expand Up @@ -55,6 +53,7 @@ function resolveWorkspace() {
const workspaceDeps = dependencyGraph('..').dependencies;
const modules = new Set(resolveModules());

let deps = null;
const resolveModule = (m) => {
console.log('resolve', m);
const pkg = require(`../${m}/package.json`);
Expand All @@ -63,11 +62,11 @@ function resolveWorkspace() {
return {
name: pkg.name,
version: pkg.version,
resolved: head ? `${repo.endsWith('.git') ? repo.slice(0, repo.length-4) : repo}/commit/${head}` : pkg.version,
resolved: head ? `${repo.endsWith('.git') ? repo.slice(0, repo.length - 4) : repo}/commit/${head}` : pkg.version,
dependencies: deps(pkg.dependencies)
};
};
const deps = (deps) => {
deps = (deps) => {
const r = {};
Object.keys(deps).forEach((d) => {
if (d in workspaceDeps) {
Expand Down Expand Up @@ -121,21 +120,18 @@ function generate() {
const isWorkspaceContext = fs.existsSync('../phovea_registry.js');
if (isWorkspaceContext) {
return resolveWorkspace();
} else {
return resolveSingle();
}
return resolveSingle();
}


const IS_WINDOWS = process.platform === 'win32';

function tmpdir() {
if (IS_WINDOWS) {
return process.env.TEMP || process.env.TMP ||
(process.env.SystemRoot || process.env.windir) + '\\temp';
} else {
return process.env.TMPDIR || process.env.TMP || process.env.TEMP || '/tmp';
(process.env.SystemRoot || process.env.windir) + '\\temp';
}
return process.env.TMPDIR || process.env.TMP || process.env.TEMP || '/tmp';
}

function resolveScreenshot() {
Expand All @@ -159,21 +155,20 @@ function metaData(pkg) {
}

module.exports.metaData = metaData;
module.exports.metaDataTmpFile = function(pkg) {
module.exports.metaDataTmpFile = function (pkg) {
const s = metaData(pkg);
const file = `${tmpdir()}/metaData${Math.random().toString(36).slice(-8)}.txt`;
fs.writeFileSync(file, JSON.stringify(s, null, ' '));
return file;
};
module.exports.generate = generate;
module.exports.tmpFile = function() {
module.exports.tmpFile = function () {
const s = generate();
const file = `${tmpdir()}/buildInfo${Math.random().toString(36).slice(-8)}.txt`;
fs.writeFileSync(file, JSON.stringify(s, null, ' '));
return file;
};


if (require.main === module) {
fs.writeFile('deps.json', JSON.stringify(generate(), null, ' '));
}
8 changes: 0 additions & 8 deletions deploy/Dockerfile

This file was deleted.

68 changes: 0 additions & 68 deletions deploy/nginx-default.conf

This file was deleted.

51 changes: 51 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/* *****************************************************************************
* Caleydo - Visualization for Molecular Biology - http://caleydo.org
* Copyright (c) The Caleydo Team. All rights reserved.
* Licensed under the new BSD license, available at http://caleydo.org/license
**************************************************************************** */

/**
* generates and object that contain all modules in the src folder accessible as properties
*/

/**
* magic file name for the pseudo root file
* @type {string}
*/
var INDEX_FILE = './index.ts';
/**
* sorts the given filename by name ensuring INDEX is the first one
* @param a
* @param b
* @returns {number}
*/
function byName(a, b) {
if (a === INDEX_FILE) {
return a === b ? 0 : -1;
}
if (b === INDEX_FILE) {
return 1;
}
return a.toLowerCase().localeCompare(b.toLowerCase());
}
// list all modules in the src folder excluding the one starting with _
var req = require.context('./src', true, /^\.\/(?!internal)(([^_][\w]+)|(\w+\/index))\.tsx?$/);

var files = req.keys().sort(byName);

// root file exists? else use anonymous root object
if (files[0] === INDEX_FILE) {
module.exports = req(files.shift());
} else {
module.exports = {};
}

// generate getter for all modules
files.forEach(function (f) {
Object.defineProperty(module.exports, f.substring(2, f.lastIndexOf('/index.') > 0 ? f.lastIndexOf('/index.') : f.lastIndexOf('.')), {
get: function () {
return req(f);
},
enumerable: true
});
});
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = (config) => {

// list of files / patterns to load in the browser
files: [
'tests.webpack.js' //just load this file
'tests.webpack.js' // just load this file
],

// preprocess matching files before serving them to the browser
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"homepage": "https://phovea.caleydo.org",
"version": "2.1.2-SNAPSHOT",
"author": {
"name": "The Caleydo Team",
"name": "datavisyn",
"email": "contact@caleydo.org",
"url": "https://caleydo.org"
},
Expand Down Expand Up @@ -37,7 +37,7 @@
"iojs": ">= 3"
},
"scripts": {
"check": "flake8",
"check": "flake8 --exclude=.git,venv,deploy,docs,__pycache__,node_modules",
"pretest": "echo hybrid",
"test": "npm run test:web && npm run test:python",
"predist": "echo hybrid",
Expand Down Expand Up @@ -87,6 +87,7 @@
"@types/jquery": "2.0.33",
"jquery": "3.1.1"
},
"main": "build/tdp_core.js",
"devDependencies": {
"@types/jasmine": "2.5.41",
"awesome-typescript-loader": "3.0.3",
Expand Down Expand Up @@ -117,6 +118,6 @@
"typescript": "2.2.0",
"url-loader": "0.5.7",
"webpack": "2.2.1",
"webpack-dev-server": "2.3.0"
"webpack-dev-server": "2.4.2"
}
}
3 changes: 3 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ universal=1

[aliases]
test=pytest

[metadata]
description-file = README.md
16 changes: 10 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Licensed under the new BSD license, available at http://caleydo.org/license
###############################################################################
from __future__ import with_statement, print_function
from setuptools import setup
from setuptools import setup, find_packages
from codecs import open
from os import path

Expand All @@ -30,15 +30,19 @@ def packaged(*files):
return r


def requirements(file):
return [r.strip().encode('ascii') for r in read_it(file).strip().split('\n') if not r.startswith('-e git+https://')]


def to_version(v):
import datetime
now = datetime.datetime.utcnow()
return v.replace('SNAPSHOT', now.strftime('%Y%m%d-%H%M%S'))


setup(
name=pkg['name'],
version=to_version(pkg['version']),
url=pkg['homepage'],
description=pkg['description'],
long_description=read_it('README.md'),
keywords=pkg.get('keywords', ''),
Expand All @@ -57,22 +61,22 @@ def to_version(v):
'Intended Audience :: Developers',
'Operating System :: OS Independent',
# Pick your license as you wish (should match "license" above)
'License :: OSI Approved :: ' + pkg['license'],
'License :: OSI Approved :: ' + ('BSD License' if pkg['license'] == 'BSD-3-Clause' else pkg['license']),
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.4'
],

# You can just specify the packages manually here if your project is
# simple. Or you can use find_packages().
py_modules=[pkg['name']],
packages=find_packages(exclude=['docs', 'tests*']),

# List run-time dependencies here. These will be installed by pip when
# your project is installed. For an analysis of "install_requires" vs pip's
# requirements files see:
# https://packaging.python.org/en/latest/requirements.html
install_requires=[r for r in read_it('requirements.txt').split('\n') if not r.startswith('-e git+https://')],
tests_require=read_it('requirements_dev.txt').split('\n'),
install_requires=requirements('requirements.txt'),
tests_require=requirements('requirements_dev.txt'),

# If there are data files included in your packages that need to be
# installed, specify them here. If using Python 2.6 or less, then these
Expand Down
5 changes: 3 additions & 2 deletions tests.webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@
* Licensed under the new BSD license, available at http://caleydo.org/license
**************************************************************************** */

//build registry
// build registry
require('./phovea_registry.js');

/**
* find all tests in the spec directory and load them
*/
var context = require.context('./tests', true, /\.test\.ts$/); //make sure you have your directory and regex test set correctly!
var context = require.context('./tests', true, /\.test\.ts$/); // make sure you have your directory and regex test set correctly!
context.keys().forEach(context);
4 changes: 3 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
"experimentalDecorators": true,
"lib": [
"dom",
"es2015"
"es2015",
"es2016.array.include",
"es2017.object"
],
"baseUrl": "../",
"noImplicitAny": false,
Expand Down
6 changes: 6 additions & 0 deletions tsconfig_dev.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"target": "es6"
}
}
5 changes: 5 additions & 0 deletions tsd.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@ declare module "*.scss" {
const content:string;
export default content;
}
declare module "*.css" {
const content:string;
export default content;
}
declare module "*.png";
declare module "*.jpg";
//allow html dependencies
declare module "*.html" {
const content:string;
Expand Down
Loading

0 comments on commit fe8c86a

Please sign in to comment.