Skip to content

Commit

Permalink
[WIP] [1023-6] refactor-app-to-build-in-OS (#456)
Browse files Browse the repository at this point in the history
* add Prerequisites and yarn
delete npm - build with yarn
included node
update app cache
add autoremove

* install npx global
add script login npm

* update version node 10x
add offline=TRUE
remove autoremove
comment out tmply translation languages

* add self inspector make art

* docs: install vscode rasbian on kano OS

* install kash web cli and ios-true

* feat: fix exception
move the check for "if it is a Windows machine"
before the variable Windows is required

* install kash web and build with yarn
build:web for the general app
yarn build to run gulp for css
install from out/www/* for KanoOS

* install fonts (path) in kano-OS

* feat add path icons

* feat: add config variable immediately for template

* delete package.json from dependency
install @kano/styles
install kano/kit-app-shell-web

* Serve the right file/folder throught Jade
change the jade which take care to serve the right file
in the right folder

* add changes for pull request

* add fonts and --production in rules

* comment about what to do

* remove useless property SEGMENTIO_ID and TEST_MODE
kash doesn't need to export these property in window.CONFIG

* upgrade yarn.lock

* fix build:web

* delete facebook and twitter features

* remove UNKNOWN_USER
  • Loading branch information
lauraenria authored and Paul Varache committed Aug 23, 2019
1 parent 828ecbd commit 1e180e7
Show file tree
Hide file tree
Showing 44 changed files with 1,068 additions and 1,055 deletions.
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,39 @@ Art.

user@kano-os ~ $ cd ~/make-art/bin
user@kano-os ~ $ ./kano-draw

## [Installing VS Code on Raspbian Kano OS](https://www.raspberrypi.org/forums/viewtopic.php?p=1440336)


1) **Install GPG key**

`sudo wget -qO - https://packagecloud.io/headmelted/codebuilds/gpgkey | sudo apt-key add -;`

2) **Add source repository**

`sudo nano /etc/apt/sources.list`
and add ...

`deb https://packagecloud.io/headmelted/codebuilds/raspbian/ jessie main`
Ctrl-X, Y, enter to exit 'nano' and save the updated file.

Note it should be "jessie" even when using "stretch".

3) **Install VS Code (code-oss)**

`sudo apt-get update
sudo apt-get install code-oss`

Note the "sudo apt-get update" is essential. Failing to do that will result in an "E: Unable to locate package code-oss" error.

Note that "sudo apt-get update" from now on will will show entries for
"packagecloud.io/headmelted/codebuilds/raspbian", and
"packages.microsoft.com/repos/vscode".

4) **Launching VS Code (code-oss)**

Under the Pi desktop start menu, under Programming, there should now be a "Code - OSS" link.

VS Code can also be launched from the command line with -

`code-oss`
4 changes: 2 additions & 2 deletions debian/kano-draw-i18n-orig.install
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
locales/messages.pot /mnt/translations/translations/kano-draw/
locales/messages-docs.pot /mnt/translations/translations/kano-draw/
# locales/messages.pot /mnt/translations/translations/kano-draw/
# locales/messages-docs.pot /mnt/translations/translations/kano-draw/
9 changes: 7 additions & 2 deletions debian/kano-draw.install
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#!/usr/bin/dh-exec
bin/* /usr/bin
kano_draw /usr/lib/python2.7/dist-packages
www/* /usr/share/kano-draw

out/www/* /usr/share/kano-draw
node_modules/@kano/styles/fonts/* /usr/share/kano-draw/www/www/fonts
resources/icon-set/fonts/icomoon* /usr/share/kano-draw/www/www/fonts
/assets/layout/ /usr/share/kano-draw/www/www/fonts


kdesktop/Draw.lnk usr/share/kano-desktop/kdesk/kdesktop/
kdesktop/kano-draw.xml /usr/share/mime/packages/
Expand All @@ -12,4 +17,4 @@ icon/kano-draw-hover.png usr/share/icons/Kano/88x88/apps
icon/kano-draw.app usr/share/applications
media /usr/share/kano-draw/

kano-content-blacklist/kano-draw.json /usr/share/kano-content/blacklists
kano-content-blacklist/kano-draw.json /usr/share/kano-content/blacklists
3 changes: 1 addition & 2 deletions debian/kano-draw.lintian-overrides
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
kano-draw binary: privacy-breach-facebook
kano-draw binary: privacy-breach-twitter

32 changes: 22 additions & 10 deletions debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,27 @@

override_dh_auto_build:
# NodeJS and npm
cd po && ./lang-extract-doc-strings
cd po && ./lang-extract-strings
# Add NPM repository and install Node
curl --silent --location https://deb.nodesource.com/setup_6.x | bash -
apt-get install --yes nodejs
# FIXME - these must be fix for internationalization languages
# cd po && ./lang-extract-doc-stringsgit
# cd po && ./lang-extract-strings
# Add NPM repository
curl -sL https://deb.nodesource.com/setup_10.x | bash -
# Prerequisites for yarn
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
# update
apt-get update
# install Node and yarn
apt-get install --yes nodejs yarn
# login npm and npx
npm i -g npx
npm i npm-login-cmd
npx npm-login-cmd
# Actually build
npm install
./node_modules/bower/bin/bower --allow-root install
NODE_ENV=production OFFLINE=true npm run build
dh_lintian
yarn
yarn install
OFFLINE=true NODE_ENV=production yarn build --production
OFFLINE=true NODE_ENV=production yarn build:web --production

override_dh_auto_install override_dh_auto_test:

override_dh_auto_install override_dh_auto_test:
12 changes: 2 additions & 10 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,10 @@ var gulp = require('gulp'),
server = lr(),
env = process.env.NODE_ENV || 'development',
production = env === 'production',
segmentioId = process.env.SEGMENTIO_ID || null,
facebookAppId = process.env.FACEBOOK_APP_ID || null,
unknown_user = process.env.UNKNOWN_USER || null,
api_url = process.env.API_URL || null,
api_url_v2 = process.env.API_URL_V2 || null,
world_url = process.env.WORLD_URL || null,
offline = process.env.OFFLINE === 'true',
testmode = process.env.TEST_MODE === 'true',
chDescriptorsPath = 'assets/challenges/descriptors/',
libPath = 'lib/challenges/',
locales = ["", "ja", "es-AR"],
Expand All @@ -39,7 +35,7 @@ var gulp = require('gulp'),
function handleError(error) {
console.log(color.bold('[ error caught ]:\n') + color.red(error));
}

console.log(env, "<=====ENV")
gulp.task('styles', function () {
return gulp.src(paths.styles.src)
.pipe(stylus({
Expand All @@ -59,14 +55,10 @@ gulp.task('views', function () {
env : env,
production : production,
offline : offline,
segmentioId : segmentioId,
facebookAppId : facebookAppId,
api_url : api_url,
api_url_v2 : api_url_v2,
api_url_v2 : api_url_v2,
world_url : world_url,
testmode : testmode,
challenges_url : "/assets/challenges/descriptors",
unknown_user : unknown_user
}, jadeHelpers)
}))
.on('error', handleError)
Expand Down
1 change: 0 additions & 1 deletion kano_draw/draw.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
class Draw(WebApp):
def __init__(self, load_path='', make=False, play=False):
super(Draw, self).__init__()

base_url = 'http://localhost:8000/{path}'

if make:
Expand Down
15 changes: 12 additions & 3 deletions lib/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
*
* Define behaviour for app `run` and `config`
*/

// just pass this config
import config from './core/config.js';


import tracking from './core/tracking.js';
import { angular } from './modules/angular.js';
import authFactory from './core/auth.js';
Expand All @@ -17,16 +21,18 @@ export const app = angular.module('draw', ['ngRoute'], function ($compileProvide
$compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|file|chrome-extension|ms-appx-web|ms-appx):/);
});


// remove
const cfg = angular.extend(config.default, config[window.ENV]);

// in json file
const envCfg = {
API_URL: cfg.API_URL,
API_URL_V2: cfg.API_URL_V2,
WORLD_URL: cfg.WORLD_URL,
OFFLINE: cfg.OFFLINE,
};
// end

//pass config
const auth = authFactory(envCfg);
const api = apiFactory(envCfg);

Expand All @@ -43,7 +49,10 @@ app.config(($locationProvider, $compileProvider) => {
});

// Run app
app.run(($rootScope, $window, $location) => {
app.run(($rootScope, $window, $location, _config) => {
// immediately set config for the template
// it's needed because othwerwise it's gonna be call before the variable it's define
$rootScope._config = _config;
const win = angular.element($window);
let progressGroups;

Expand Down
4 changes: 1 addition & 3 deletions lib/challenges/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@
"certificate_after": 2,
"share_strategy": "optional",
"socialText": {
"email": "Hack your way through video game history with Pixel Hack from Kano!",
"facebook": "Hack your way through video game history with #PixelHack from Kano",
"twitter": "Hack your way through video game history with #PixelHack from @TeamKano!\nhttp://art.kano.me/challenges/pixelhack/"
"email": "Hack your way through video game history with Pixel Hack from Kano!"
}
},
{
Expand Down
4 changes: 1 addition & 3 deletions lib/challenges/locales/es-AR/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@
"teachers_guide": "/guides/PixelHackEducatorGuide.zip",
"share_strategy": "optional",
"socialText": {
"email": "¡Hackea tu propio camino a lo largo de la historia de los videojuegos con Pixel Hack desde Kano!",
"facebook": "¡Hackea tu propio camino a lo largo de la historia de los videojuegos con #PixelHack desde Kano!",
"twitter": "¡Hackea tu propio camino a lo largo de la historia de los videojuegos con #PixelHack desde @TeamKano! \nhttp://art.kano.me/challenges/pixelhack/"
"email": "¡Hackea tu propio camino a lo largo de la historia de los videojuegos con Pixel Hack desde Kano!"
}
},
{
Expand Down
4 changes: 1 addition & 3 deletions lib/challenges/locales/ja/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@
"field": "entry.1965349241"
},
"socialText": {
"email": "Kanoのピクセルハックで、ビデオゲームのアート歴史をハックしよう。",
"facebook": "Kanoの #ピクセルハック で、ビデオゲームのアート歴史をハックしよう。",
"twitter": "@TeamKano の #ピクセルハック で、ビデオゲームのアート歴史をハックしよう!\nhttp://art.kano.me/challenges/pixelhack/"
"email": "Kanoのピクセルハックで、ビデオゲームのアート歴史をハックしよう。"
}
},
{
Expand Down
41 changes: 1 addition & 40 deletions lib/controller/challenge.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,7 @@ app.controller('ChallengeController', function ($scope, $routeParams, $window, $
$rootScope.successful = false;
$scope.closeChallengeComplete();
socialService.init();
socialService.twitter.share(function (res) {
if (res) {
$scope.closeShareModal();
if (!$scope.nextModal) {
$scope.openNextModal();
}
$scope.$apply();
}
});

api = $rootScope.api;
VALIDATE_DELAY = $rootScope.cfg.OFFLINE ? 1020 : 20;

Expand Down Expand Up @@ -238,37 +230,6 @@ app.controller('ChallengeController', function ($scope, $routeParams, $window, $
}
};

$scope.twitterShare = function (creation) {
var url = socialService.twitter.build(creation);
window.open(url, '_blank', 'height=500,width=500');
tracking.dispatchTrackingEvent('worldExternalShare');
};

$scope.facebookShare = function (creation) {
var options = {
title: creation.title + ' on Make Art',
url: creation.url,
picture: creation.cover_url,
caption: 'Shared by ' + creation.username + ' through ' + creation.world,
text: creation.description
};

socialService.facebook.share(options, function (err, res) {
if (err) {
return err;
}

if (res) {
tracking.dispatchTrackingEvent('worldExternalShare');
$scope.closeShareModal();
if (!$scope.nextModal) {
$scope.openNextModal();
}
$scope.$apply();
}
});
};

$scope.sendMail = function (creation) {
var emailObj;
if (!creation.email) {
Expand Down
2 changes: 1 addition & 1 deletion lib/controller/challenges.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ app.controller('ChallengesController', function ($scope, $rootScope, $routeParam
$scope.certModal = false;
contentService.world.getAll().then(function gotWorlds(data) {
$rootScope.worlds = data;
$rootScope._config = _config;

if (routeWorldId) {
//a world has been selected through the URL
$rootScope.worlds.forEach(function (world) {
Expand Down
17 changes: 4 additions & 13 deletions lib/core/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,10 @@ export default {
DEBUG_LEVEL : 1,
PRODUCTION : window.CONFIG ? window.CONFIG.PRODUCTION : false,
OFFLINE : window.CONFIG ? window.CONFIG.OFFLINE : false,
SEGMENTIO_ID : window.CONFIG ? window.CONFIG.SEGMENTIO_ID : null,
TEST_MODE : window.CONFIG ? window.CONFIG.TEST_MODE : false,
FACEBOOK_APP_ID : window.CONFIG ? window.CONFIG.FACEBOOK_APP_ID : false,
API_URL : window.CONFIG ? window.CONFIG.API_URL : false,
API_URL_V2 : window.CONFIG ? window.CONFIG.API_URL_V2 : false,
WORLD_URL : window.CONFIG ? window.CONFIG.WORLD_URL : false,
CHALLENGES_URL : window.CONFIG ? window.CONFIG.CHALLENGES_URL : false,
UNKNOWN_USER : window.CONFIG ? window.CONFIG.UNKNOWN_USER : null,
DOMAIN_CFG: {
"hourofcode.kano.me": {
'mapToWorld': 'pixelhack',
Expand All @@ -34,33 +30,28 @@ export default {
languageSynonyms: langSynonyms
},
"development": {
FACEBOOK_APP_ID : '832712683515218',
WORLD_URL : 'http://localhost:5000',
API_URL : 'http://localhost:1234',
API_URL_V2 : 'http://localhost:1234',
"AUTH_INTEGRATION_URL": "https://art.auth.kano.me/integration.js",
"AUTH_SIGNUP_URL": "https://art.auth.kano.me/index.html?env=staging#signup",
"AUTH_LOGIN_URL": "https://art.auth.kano.me/index.html?env=staging#login",
UNKNOWN_USER : 'tanc'
"AUTH_LOGIN_URL": "https://art.auth.kano.me/index.html?env=staging#login"
},
"staging": {
FACEBOOK_APP_ID : '832712683515218',
API_URL : 'https://api-staging.kano.me',
API_URL_V2 : 'https://worldapi.kes.kano.me',
WORLD_URL : 'https://world-staging.kano.me',
"AUTH_INTEGRATION_URL": "https://staging.auth.kano.me/integration.js",
"AUTH_SIGNUP_URL": "https://staging.auth.kano.me/index.html?env=staging#signup",
"AUTH_LOGIN_URL": "https://staging.auth.kano.me/index.html?env=staging#login",
UNKNOWN_USER : 'tanc'},
"AUTH_LOGIN_URL": "https://staging.auth.kano.me/index.html?env=staging#login"
},
"production": {
FACEBOOK_APP_ID : '832712683515218',
API_URL : 'https://api.kano.me',
API_URL_V2 : 'https://worldapi.kes.kano.me',
WORLD_URL : 'http://world.kano.me',
"AUTH_INTEGRATION_URL": "https://art.auth.kano.me/integration.js",
"AUTH_SIGNUP_URL": "https://art.auth.kano.me/index.html?env=production#signup",
"AUTH_LOGIN_URL": "https://art.auth.kano.me/index.html?env=production#login",
UNKNOWN_USER : 'tanc'
"AUTH_LOGIN_URL": "https://art.auth.kano.me/index.html?env=production#login"
}

};
Loading

0 comments on commit 1e180e7

Please sign in to comment.