summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/api-client.php20
-rwxr-xr-xscripts/create-random-projects.php18
-rwxr-xr-xscripts/create-random-tasks.php47
-rwxr-xr-xscripts/create-random-users.php17
-rwxr-xr-xscripts/create-sample-burndown.php55
-rwxr-xr-xscripts/create-sample-cfd.php63
-rwxr-xr-xscripts/find-strings.sh23
-rw-r--r--scripts/kanboard.py1104
-rwxr-xr-xscripts/make-archive.sh77
-rwxr-xr-xscripts/make-assets.sh64
-rwxr-xr-xscripts/sync-locales.php8
11 files changed, 1447 insertions, 49 deletions
diff --git a/scripts/api-client.php b/scripts/api-client.php
deleted file mode 100755
index 0fb45117..00000000
--- a/scripts/api-client.php
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/env php
-<?php
-
-require 'vendor/JsonRPC/Client.php';
-
-if ($argc !== 3) {
- die('Usage: '.$argv[0].' <url> <token>'.PHP_EOL);
-}
-
-$client = new JsonRPC\Client($argv[1], 5, true);
-$client->authentication('jsonrpc', $argv[2]);
-
-
-$client->createProject('Test API');
-
-
-$r = $client->getAllProjects();
-
-var_dump($r);
-
diff --git a/scripts/create-random-projects.php b/scripts/create-random-projects.php
new file mode 100755
index 00000000..2b68174e
--- /dev/null
+++ b/scripts/create-random-projects.php
@@ -0,0 +1,18 @@
+#!/usr/bin/env php
+<?php
+
+require __DIR__.'/../app/common.php';
+
+use Model\Project;
+use Model\ProjectPermission;
+
+$projectModel = new Project($container);
+$permissionModel = new ProjectPermission($container);
+
+for ($i = 0; $i < 100; $i++) {
+ $id = $projectModel->create(array(
+ 'name' => 'Project #'.$i
+ ));
+
+ $permissionModel->addMember($id, 1);
+}
diff --git a/scripts/create-random-tasks.php b/scripts/create-random-tasks.php
index 9391c68c..203c414d 100755
--- a/scripts/create-random-tasks.php
+++ b/scripts/create-random-tasks.php
@@ -3,10 +3,34 @@
require __DIR__.'/../app/common.php';
-use Model\Task;
+use Model\TaskCreation;
+use Model\Subtask;
+use Model\Project;
+use Model\ProjectPermission;
+use Model\User;
-$task_per_column = 250;
-$taskModel = new Task($registry);
+$task_per_column = 200;
+
+$userModel = new User($container);
+$projectModel = new Project($container);
+$permissionModel = new ProjectPermission($container);
+$taskModel = new TaskCreation($container);
+$subtaskModel = new Subtask($container);
+
+$project_id = $projectModel->create(array(
+ 'name' => 'Project #1'
+));
+
+$permissionModel->addMember($project_id, 1);
+
+for ($i = 0; $i <= 5; $i++) {
+ $userModel->create(array(
+ 'username' => 'user'.$i,
+ 'password' => 'password'.$i,
+ 'name' => 'User #'.$i,
+ 'email' => 'user'.$i.'@localhost',
+ ));
+}
foreach (array(1, 2, 3, 4) as $column_id) {
@@ -16,12 +40,19 @@ foreach (array(1, 2, 3, 4) as $column_id) {
'title' => 'Task #'.$i.'-'.$column_id,
'project_id' => 1,
'column_id' => $column_id,
- 'owner_id' => rand(0, 1),
- 'color_id' => rand(0, 1) === 0 ? 'green' : 'purple',
- 'score' => rand(0, 21),
- 'is_active' => rand(0, 1),
+ 'owner_id' => 1,
+ 'color_id' => mt_rand(0, 1) === 0 ? 'green' : 'purple',
+ 'score' => mt_rand(0, 21),
+ 'is_active' => mt_rand(0, 1),
);
- $taskModel->create($task);
+ $id = $taskModel->create($task);
+
+ $subtaskModel->create(array(
+ 'title' => 'Subtask of task #'.$id,
+ 'user_id' => 1,
+ 'status' => mt_rand(0, 2),
+ 'task_id' => $id,
+ ));
}
}
diff --git a/scripts/create-random-users.php b/scripts/create-random-users.php
new file mode 100755
index 00000000..a8b7e4d3
--- /dev/null
+++ b/scripts/create-random-users.php
@@ -0,0 +1,17 @@
+#!/usr/bin/env php
+<?php
+
+require __DIR__.'/../app/common.php';
+
+use Model\User;
+
+$userModel = new User($container);
+
+for ($i = 0; $i < 500; $i++) {
+ $userModel->create(array(
+ 'username' => 'user'.$i,
+ 'password' => 'password'.$i,
+ 'name' => 'User #'.$i,
+ 'email' => 'user'.$i.'@localhost',
+ ));
+}
diff --git a/scripts/create-sample-burndown.php b/scripts/create-sample-burndown.php
new file mode 100755
index 00000000..ae0b2627
--- /dev/null
+++ b/scripts/create-sample-burndown.php
@@ -0,0 +1,55 @@
+#!/usr/bin/env php
+<?php
+
+require __DIR__.'/../app/common.php';
+
+use Model\ProjectDailySummary;
+use Model\TaskCreation;
+use Model\TaskStatus;
+
+$pds = new ProjectDailySummary($container);
+$taskCreation = new TaskCreation($container);
+$taskStatus = new TaskStatus($container);
+
+for ($i = 1; $i <= 15; $i++) {
+
+ $task = array(
+ 'title' => 'Task #'.$i,
+ 'project_id' => 1,
+ 'column_id' => rand(1, 4),
+ 'score' => rand(1, 21)
+ );
+
+ $taskCreation->create($task);
+}
+
+$pds->updateTotals(1, date('Y-m-d', strtotime('-7 days')));
+
+$taskStatus->close(1);
+$pds->updateTotals(1, date('Y-m-d', strtotime('-6 days')));
+
+$taskStatus->close(2);
+$taskStatus->close(3);
+$pds->updateTotals(1, date('Y-m-d', strtotime('-5 days')));
+
+$taskStatus->close(4);
+$pds->updateTotals(1, date('Y-m-d', strtotime('-4 days')));
+
+$taskStatus->close(5);
+$pds->updateTotals(1, date('Y-m-d', strtotime('-3 days')));
+
+$taskStatus->close(6);
+$taskStatus->close(7);
+$taskStatus->close(8);
+$pds->updateTotals(1, date('Y-m-d', strtotime('-2 days')));
+
+$taskStatus->close(9);
+$taskStatus->close(10);
+$pds->updateTotals(1, date('Y-m-d', strtotime('-2 days')));
+
+$taskStatus->close(12);
+$taskStatus->close(13);
+$pds->updateTotals(1, date('Y-m-d', strtotime('-1 days')));
+
+$taskStatus->close(1);
+$pds->updateTotals(1, date('Y-m-d')); \ No newline at end of file
diff --git a/scripts/create-sample-cfd.php b/scripts/create-sample-cfd.php
new file mode 100755
index 00000000..73135f7a
--- /dev/null
+++ b/scripts/create-sample-cfd.php
@@ -0,0 +1,63 @@
+#!/usr/bin/env php
+<?php
+
+require __DIR__.'/../app/common.php';
+
+use Model\ProjectDailySummary;
+use Model\TaskCreation;
+use Model\TaskPosition;
+
+$pds = new ProjectDailySummary($container);
+$taskCreation = new TaskCreation($container);
+$taskPosition = new TaskPosition($container);
+
+for ($i = 1; $i <= 15; $i++) {
+
+ $task = array(
+ 'title' => 'Task #'.$i,
+ 'project_id' => 1,
+ 'column_id' => 1,
+ );
+
+ $taskCreation->create($task);
+}
+
+$pds->updateTotals(1, date('Y-m-d', strtotime('-7 days')));
+
+$taskPosition->movePosition(1, 1, 2, 1);
+$taskPosition->movePosition(1, 2, 2, 1);
+$taskPosition->movePosition(1, 3, 2, 1);
+$pds->updateTotals(1, date('Y-m-d', strtotime('-6 days')));
+
+$taskPosition->movePosition(1, 3, 3, 1);
+$taskPosition->movePosition(1, 4, 3, 1);
+$taskPosition->movePosition(1, 5, 3, 1);
+$pds->updateTotals(1, date('Y-m-d', strtotime('-5 days')));
+
+$taskPosition->movePosition(1, 5, 4, 1);
+$taskPosition->movePosition(1, 6, 4, 1);
+$pds->updateTotals(1, date('Y-m-d', strtotime('-4 days')));
+
+$taskPosition->movePosition(1, 7, 4, 1);
+$taskPosition->movePosition(1, 8, 4, 1);
+$pds->updateTotals(1, date('Y-m-d', strtotime('-3 days')));
+
+$taskPosition->movePosition(1, 9, 3, 1);
+$taskPosition->movePosition(1, 10, 2, 1);
+$pds->updateTotals(1, date('Y-m-d', strtotime('-2 days')));
+
+$taskCreation->create(array('title' => 'Random task', 'project_id' => 1));
+$taskPosition->movePosition(1, 11, 2, 1);
+$taskPosition->movePosition(1, 12, 4, 1);
+$taskPosition->movePosition(1, 13, 4, 1);
+$pds->updateTotals(1, date('Y-m-d', strtotime('-2 days')));
+
+$taskPosition->movePosition(1, 14, 3, 1);
+$pds->updateTotals(1, date('Y-m-d', strtotime('-1 days')));
+
+$taskPosition->movePosition(1, 15, 4, 1);
+$taskPosition->movePosition(1, 16, 4, 1);
+
+$taskCreation->create(array('title' => 'Random task', 'project_id' => 1));
+
+$pds->updateTotals(1, date('Y-m-d')); \ No newline at end of file
diff --git a/scripts/find-strings.sh b/scripts/find-strings.sh
new file mode 100755
index 00000000..752a2f83
--- /dev/null
+++ b/scripts/find-strings.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+REF_LANG=${1:-fr_FR}
+
+###
+APP_DIR=`dirname $0`/../app
+LANG_FILE=$APP_DIR/Locale/$REF_LANG/translations.php
+TMPFILE=`mktemp`
+
+# find all strings used with t() or e() and write them to a temp buffer
+find $APP_DIR -name '*.php' -print | xargs -n 1 cat | grep -oP -e "\b[et]\((\"\K.*?\"|\'\K.*?\') *[\)\,]" | sed -e "s/'[),]$//" -e 's/\\/\\\\/g' | sort | uniq > $TMPFILE
+
+echo "Missing strings from $REF_LANG: (if none printed, none missing)"
+while read LINE
+do
+ grep -F "$LINE" $LANG_FILE > /dev/null
+ if [[ $? -ne 0 ]]; then
+ echo " '$LINE' => '',"
+ fi
+done < $TMPFILE
+
+# delete the work file
+rm $TMPFILE
diff --git a/scripts/kanboard.py b/scripts/kanboard.py
new file mode 100644
index 00000000..6c9d2287
--- /dev/null
+++ b/scripts/kanboard.py
@@ -0,0 +1,1104 @@
+#!/usr/bin/env python
+'''
+This module implements Kanboard Json-RPC API in Python.
+
+Example:
+ kanboard = Kanboard("kanboard-token")
+
+ projects = kanboard.getAllProjects()
+
+ for p in projects:
+ proj = kanboard.getProjectById(p['id'])
+
+ pprint(proj)
+
+ categories = kanboard.getAllCategories(p['id'])
+ for c in categories:
+ category = kanboard.getCategory(c['id'])
+
+ try:
+ pprint(category)
+ except:
+ print("Cannot print category %s" % category['id'])
+ continue
+
+ tasks = kanboard.getAllTasks(p['id'], 1)
+ for t in tasks:
+ task = kanboard.getTask(t['id'])
+
+ try:
+ pprint(task)
+ except:
+ print("Cannot print task %s" % task['id'])
+ continue
+
+ subtasks = kanboard.getAllSubtasks(task['id'])
+ for st in subtasks:
+ subtask = kanboard.getSubtask(st['id'])
+
+ try:
+ pprint(subtask)
+ except:
+ print("Cannot print subtask %s" % subtask['id'])
+ continue
+
+ comments = kanboard.getAllComments(task['id'])
+ for c in comments:
+ comment = kanboard.getComment(c['id'])
+
+ try:
+ pprint(comment)
+ except:
+ print("Cannot print comment %s" % comment['id'])
+ continue
+
+Created on 18.09.2014
+
+@author: dzudek
+'''
+
+import requests
+import json
+from datetime import datetime
+
+
+def getfromid(iid, ilist, arg='name'):
+ for u in ilist:
+ if u['id'] == iid:
+ return u[arg]
+
+
+getdate = lambda timestamp: getfromtimestamp("%x", timestamp)
+
+getdatetime = lambda timestamp: getfromtimestamp("%x %X", timestamp)
+
+getfromtimestamp = lambda format, timestamp: datetime.fromtimestamp(int(timestamp)).strftime(format) if timestamp is not None else None
+
+class Kanboard():
+ url = "http://localhost/kanboard/jsonrpc.php"
+ headers = {'content-type': 'application/json'}
+
+ username = "jsonrpc"
+ token = None
+
+ _id = 0
+
+ def __init__(self, token, url = None):
+ if url is not None:
+ self.url = url
+
+ self.token = token
+
+ def _getId(self):
+ self._id += 1
+ return self._id
+
+ def getTimezone(self):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "getTimezone",
+ "id" : kid,
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+ assert response.ok
+ assert response.json()['id'] == kid
+ return response.json()['result']
+
+ def createProject(self, name):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "createProject",
+ "id" : kid,
+ "params": {
+ "name": name
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def getProjectById(self, project_id):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "getProjectById",
+ "id" : kid,
+ "params": {
+ "project_id": project_id
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def getProjectByName(self, name):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "getProjectByName",
+ "id" : kid,
+ "params": {
+ "name": name
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def getAllProjects(self):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "getAllProjects",
+ "id" : kid
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def updateProject(self, project_id, name, is_active = None, token = None, is_public = None):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "updateProject",
+ "id" : kid,
+ "params": {
+ "id": project_id,
+ "name": name
+ }
+ }
+
+ #optional parameters
+ if is_active is not None:
+ params['params']["is_active"] = is_active
+ if token is not None:
+ params['params']["token"] = token
+ if is_public is not None:
+ params['params']["is_public"] = is_public
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def enableProject(self, project_id):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "enableProject",
+ "id" : kid,
+ "params": {
+ "project_id": project_id
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def disableProject(self, project_id):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "disableProject",
+ "id" : kid,
+ "params": {
+ "project_id": project_id
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def removeProject(self, project_id):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "removeProject",
+ "id" : kid,
+ "params": {
+ "project_id": project_id
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def enableProjectPublicAccess(self, project_id):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "enableProjectPublicAccess",
+ "id" : kid,
+ "params": {
+ "project_id": project_id
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def disableProjectPublicAccess(self, project_id):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "disableProjectPublicAccess",
+ "id" : kid,
+ "params": {
+ "project_id": project_id
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def getAllowedUsers(self, project_id):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "getAllowedUsers",
+ "id" : kid,
+ "params": {
+ "project_id": project_id
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def revokeUser(self, project_id, user_id):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "revokeUser",
+ "id" : kid,
+ "params": {
+ "project_id": project_id,
+ "user_id": user_id
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def allowUser(self, project_id, user_id):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "allowUser",
+ "id" : kid,
+ "params": {
+ "project_id": project_id,
+ "user_id": user_id
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def getBoard(self, project_id):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "getBoard",
+ "id" : kid,
+ "params": {
+ "project_id": project_id
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def getColumns(self, project_id):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "getColumns",
+ "id" : kid,
+ "params": {
+ "project_id": project_id
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def getColumn(self, column_id):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "getColumn",
+ "id" : kid,
+ "params": {
+ "column_id": column_id
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def moveColumnUp(self, project_id, column_id):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "moveColumnUp",
+ "id" : kid,
+ "params": {
+ "project_id": project_id,
+ "column_id": column_id
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def moveColumnDown(self, project_id, column_id):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "moveColumnDown",
+ "id" : kid,
+ "params": {
+ "project_id": project_id,
+ "column_id": column_id
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def updateColumn(self, column_id, title, task_limit=None):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "updateColumn",
+ "id" : kid,
+ "params": {
+ "column_id": column_id,
+ "title": title,
+ }
+ }
+
+ #optional parameter
+ if task_limit is not None:
+ params['params']["task_limit"] = task_limit
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def addColumn(self, project_id, title, task_limit=None):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "addColumn",
+ "id" : kid,
+ "params": {
+ "project_id": project_id,
+ "title": title,
+ }
+ }
+
+ #optional parameter
+ if task_limit is not None:
+ params['params']["task_limit"] = task_limit
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def removeColumn(self, column_id):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "removeColumn",
+ "id" : kid,
+ "params": {
+ "column_id": column_id
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def createTask(self, project_id, title, color_id=None, column_id=None, description=None, owner_id=None, creator_id=None, score=None, date_due=None, category_id=None):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "createTask",
+ "id" : kid,
+ "params": {
+ "project_id": project_id,
+ "title": title,
+ }
+ }
+
+ #optional parameters
+ if color_id is not None:
+ params['params']["color_id"] = color_id
+ if column_id is not None:
+ params['params']["column_id"] = column_id
+ if description is not None:
+ params['params']["description"] = description
+ if owner_id is not None:
+ params['params']["owner_id"] = owner_id
+ if creator_id is not None:
+ params['params']["creator_id"] = creator_id
+ if score is not None:
+ params['params']["score"] = score
+ if date_due is not None:
+ params['params']["date_due"] = date_due
+ if category_id is not None:
+ params['params']["category_id"] = category_id
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def getTask(self, task_id):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "getTask",
+ "id" : kid,
+ "params": {
+ "task_id": task_id
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def getAllTasks(self, project_id, status_id):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "getAllTasks",
+ "id" : kid,
+ "params": {
+ "project_id": project_id,
+ "status_id": status_id
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def updateTask(self, task_id, project_id=None, title=None, color_id=None, column_id=None, description=None, owner_id=None, creator_id=None, score=None, date_due=None, category_id=None):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "createTask",
+ "id" : kid,
+ "params": {
+ "id": task_id,
+ }
+ }
+
+ #optional parameters
+ if title is not None:
+ params['params']["title"] = title
+ if project_id is not None:
+ params['params']["project_id"] = project_id
+ if color_id is not None:
+ params['params']["color_id"] = color_id
+ if column_id is not None:
+ params['params']["column_id"] = column_id
+ if description is not None:
+ params['params']["description"] = description
+ if owner_id is not None:
+ params['params']["owner_id"] = owner_id
+ if creator_id is not None:
+ params['params']["creator_id"] = creator_id
+ if score is not None:
+ params['params']["score"] = score
+ if date_due is not None:
+ params['params']["date_due"] = date_due
+ if category_id is not None:
+ params['params']["category_id"] = category_id
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def openTask(self, task_id):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "openTask",
+ "id" : kid,
+ "params": {
+ "task_id": task_id
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def closeTask(self, task_id):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "closeTask",
+ "id" : kid,
+ "params": {
+ "task_id": task_id
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def removeTask(self, task_id):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "removeTask",
+ "id" : kid,
+ "params": {
+ "task_id": task_id
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def moveTaskPosition(self, project_id, task_id, column_id, position):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "removeTask",
+ "id" : kid,
+ "params": {
+ "project_id": project_id,
+ "task_id": task_id,
+ "column_id": column_id,
+ "position": position
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def createUser(self, username, password, name=None, email=None, is_admin=None, default_project_id=None):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "createUser",
+ "id" : kid,
+ "params": {
+ "username": username,
+ "password": password
+ }
+ }
+
+ #optional parameters
+ if name is not None:
+ params['params']["name"] = name
+ if email is not None:
+ params['params']["email"] = email
+ if is_admin is not None:
+ params['params']["is_admin"] = is_admin
+ if default_project_id is not None:
+ params['params']["default_project_id"] = default_project_id
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def getUser(self, user_id):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "getUser",
+ "id" : kid,
+ "params": {
+ "user_id": user_id
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def getAllUsers(self):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "getAllUsers",
+ "id" : kid
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def updateUser(self, user_id, username=None, name=None, email=None, is_admin=None, default_project_id=None):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "updateUser",
+ "id" : kid,
+ "params": {
+ "id": user_id
+ }
+ }
+
+ #optional parameters
+ if username is not None:
+ params['params']["username"] = username
+ if name is not None:
+ params['params']["name"] = name
+ if email is not None:
+ params['params']["email"] = email
+ if is_admin is not None:
+ params['params']["is_admin"] = is_admin
+ if default_project_id is not None:
+ params['params']["default_project_id"] = default_project_id
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def removeUser(self, user_id):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "removeUser",
+ "id" : kid,
+ "params": {
+ "user_id": user_id
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def createCategory(self, project_id, name):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "createCategory",
+ "id" : kid,
+ "params": {
+ "project_id": project_id,
+ "name": name
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def getCategory(self, category_id):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "getCategory",
+ "id" : kid,
+ "params": {
+ "category_id": category_id
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def getAllCategories(self, project_id):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "getAllCategories",
+ "id" : kid,
+ "params": {
+ "project_id": project_id
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def updateCategory(self, category_id, name):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "updateCategory",
+ "id" : kid,
+ "params": {
+ "id": category_id,
+ "name": name
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def removeCategory(self, category_id):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "updateCategory",
+ "id" : kid,
+ "params": {
+ "id": category_id
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def createComment(self, task_id, user_id, content):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "createComment",
+ "id" : kid,
+ "params": {
+ "task_id": task_id,
+ "user_id": user_id,
+ "content": content
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def getComment(self, comment_id):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "getComment",
+ "id" : kid,
+ "params": {
+ "comment_id": comment_id
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def getAllComments(self, task_id):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "getAllComments",
+ "id" : kid,
+ "params": {
+ "task_id": task_id
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def updateComment(self, comment_id, content):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "updateComment",
+ "id" : kid,
+ "params": {
+ "id": comment_id,
+ "content": content
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def removeComment(self, comment_id):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "removeComment",
+ "id" : kid,
+ "params": {
+ "id": comment_id
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def createSubtask(self, task_id, title, user_id=None, time_estimated=None, time_spent=None, status=None):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "createSubtask",
+ "id" : kid,
+ "params": {
+ "task_id": task_id,
+ "title": title
+ }
+ }
+
+ #optional parameters
+ if user_id is not None:
+ params['params']["user_id"] = user_id
+ if time_estimated is not None:
+ params['params']["time_estimated"] = time_estimated
+ if time_spent is not None:
+ params['params']["time_spent"] = time_spent
+ if status is not None:
+ params['params']["status"] = status
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def getSubtask(self, subtask_id):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "getSubtask",
+ "id" : kid,
+ "params": {
+ "subtask_id": subtask_id
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def getAllSubtasks(self, task_id):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "getAllSubtasks",
+ "id" : kid,
+ "params": {
+ "task_id": task_id
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def updateSubtask(self, subtask_id, task_id, title=None, user_id=None, time_estimated=None, time_spent=None, status=None):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "updateSubtask",
+ "id" : kid,
+ "params": {
+ "id": subtask_id,
+ "task_id": task_id
+ }
+ }
+
+ #optional parameters
+ if title is not None:
+ params['params']["title"] = title
+ if user_id is not None:
+ params['params']["user_id"] = user_id
+ if time_estimated is not None:
+ params['params']["time_estimated"] = time_estimated
+ if time_spent is not None:
+ params['params']["time_spent"] = time_spent
+ if status is not None:
+ params['params']["status"] = status
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
+ def removeSubtask(self, subtask_id):
+ kid = self._getId()
+ params = {
+ "jsonrpc": "2.0",
+ "method": "removeSubtask",
+ "id" : kid,
+ "params": {
+ "subtask_id": subtask_id
+ }
+ }
+
+ response = requests.post(self.url, data=json.dumps(params), headers=self.headers, auth=(self.username, self.token))
+
+ assert response.ok
+ assert response.json()['id'] == kid
+
+ return response.json()['result']
+
diff --git a/scripts/make-archive.sh b/scripts/make-archive.sh
index 2518f020..b99e87ab 100755
--- a/scripts/make-archive.sh
+++ b/scripts/make-archive.sh
@@ -1,29 +1,72 @@
#!/bin/sh
-VERSION=$1
+if [ "$#" -lt 1 ]
+then
+ echo "Usage: $0 <version> [destination]"
+ exit 1
+fi
+
APP="kanboard"
+VERSION=$1
+DESTINATION=$2
-cd /tmp
+if [ -z "$2" ]
+then
+ DESTINATION=~/Devel/websites/$APP
+fi
+
+echo "Build package for version $VERSION => $DESTINATION"
+
+# Cleanup
rm -rf /tmp/$APP /tmp/$APP-*.zip 2>/dev/null
-git clone --depth 1 https://github.com/fguillot/$APP.git
+# Download source code
+cd /tmp
+git clone --depth 1 -q https://github.com/fguillot/$APP.git >/dev/null
+
+# Install vendors
+cd /tmp/$APP
+composer --prefer-dist --no-dev --optimize-autoloader --quiet install
+
+# Remove useless files
+rm -rf data/*.sqlite \
+ .git \
+ .gitignore \
+ scripts \
+ tests \
+ Vagrantfile \
+ .*.yml \
+ README.markdown \
+ docs \
+ Dockerfile \
+ composer.* \
+ app.json
-rm -rf $APP/data/*.sqlite \
- $APP/.git $APP/.gitignore \
- $APP/scripts \
- $APP/tests \
- $APP/Vagrantfile \
- $APP/.*.yml \
- $APP/README.markdown \
- $APP/docs
+find ./vendor -name doc -type d -exec rm -rf {} +;
+find ./vendor -name notes -type d -exec rm -rf {} +;
+find ./vendor -name test -type d -exec rm -rf {} +;
+find ./vendor -name tests -type d -exec rm -rf {} +;
+find ./vendor -name composer.json -delete
+find ./vendor -name phpunit.xml -delete
+find ./vendor -name .travis.yml -delete
+find ./vendor -name README.* -delete
+find ./vendor -name .gitignore -delete
-sed -i.bak s/master/$VERSION/g $APP/app/constants.php && rm -f $APP/app/*.bak
-zip -r $APP-$VERSION.zip $APP
+# Set the version number
+sed -i.bak s/master/$VERSION/g app/constants.php && rm -f app/*.bak
+
+# Make the archive
+cd /tmp
+zip -r $APP-$VERSION.zip $APP > /dev/null
+mv $APP-$VERSION.zip $DESTINATION
-mv $APP-$VERSION.zip ~/Devel/websites/$APP
+cd $DESTINATION
-cd ~/Devel/websites/$APP/
-unlink $APP-latest.zip
-ln -s $APP-$VERSION.zip $APP-latest.zip
+# Make symlink for generic archive
+if [ -L $APP-latest.zip ]
+then
+ unlink $APP-latest.zip
+ ln -s $APP-$VERSION.zip $APP-latest.zip
+fi
rm -rf /tmp/$APP 2>/dev/null
diff --git a/scripts/make-assets.sh b/scripts/make-assets.sh
new file mode 100755
index 00000000..22d496c8
--- /dev/null
+++ b/scripts/make-assets.sh
@@ -0,0 +1,64 @@
+#!/bin/bash
+
+print_css="print links table board task comment subtask markdown"
+app_css="base links title table form button alert tooltip header board task comment subtask markdown listing activity dashboard pagination popover confirm sidebar responsive dropdown"
+vendor_css="jquery-ui.min chosen.min fullcalendar.min font-awesome.min"
+
+app_js="base board calendar analytic swimlane dashboard budget screenshot"
+vendor_js="jquery-1.11.1.min jquery-ui.min jquery.ui.touch-punch.min chosen.jquery.min dropit.min moment.min fullcalendar.min mousetrap.min mousetrap-global-bind.min app.min"
+lang_js="da de es fi fr hu it ja nl pl pt-br ru sv sr th tr zh-cn"
+
+function merge_css {
+
+ local app_file="assets/css/app.css"
+ local print_file="assets/css/print.css"
+
+ rm -f $app_file 2>/dev/null
+ rm -f $print_file 2>/dev/null
+ echo "/* DO NOT EDIT: AUTO-GENERATED FILE */" > $app_file
+ echo "/************************************/" >> $app_file
+ echo "/* DO NOT EDIT: AUTO-GENERATED FILE */" > $print_file
+ echo "/************************************/" >> $print_file
+
+ for file in $vendor_css; do cat "assets/css/vendor/${file}.css" >> $app_file; done
+ for file in $vendor_css; do cat "assets/css/vendor/${file}.css" >> $print_file; done
+
+ for file in $app_css; do cat "assets/css/src/${file}.css" >> $app_file; done
+ for file in $print_css; do cat "assets/css/src/${file}.css" >> $print_file; done
+}
+
+function minify_js {
+
+ local tmp_file="assets/js/minify.js"
+ local dst_file="assets/js/vendor/app.min.js"
+
+ rm -f $dst_file $tmp_file 2>/dev/null
+
+ for file in $app_js; do cat "assets/js/src/${file}.js" >> $tmp_file; done
+
+ curl -s \
+ -d compilation_level=SIMPLE_OPTIMIZATIONS \
+ -d output_format=text \
+ -d output_info=compiled_code \
+ --data-urlencode "js_code@${tmp_file}" \
+ http://closure-compiler.appspot.com/compile > $dst_file
+
+ rm -f $tmp_file 2>/dev/null
+}
+
+function merge_js {
+
+ local tmp_file="assets/js/vendor/app.min.js"
+ local dst_file="assets/js/app.js"
+
+ rm -f $dst_file 2>/dev/null
+
+ for file in $vendor_js; do cat "assets/js/vendor/${file}.js" >> $dst_file; done
+ for file in $lang_js; do cat "assets/js/vendor/lang/${file}.js" >> $dst_file; done
+
+ rm -f $tmp_file 2>/dev/null
+}
+
+merge_css
+minify_js
+merge_js
diff --git a/scripts/sync-locales.php b/scripts/sync-locales.php
index 00d6c897..472a6b2b 100755
--- a/scripts/sync-locales.php
+++ b/scripts/sync-locales.php
@@ -2,7 +2,7 @@
<?php
$reference_lang = 'fr_FR';
-$reference_file = 'app/Locales/'.$reference_lang.'/translations.php';
+$reference_file = 'app/Locale/'.$reference_lang.'/translations.php';
$reference = include $reference_file;
@@ -15,7 +15,7 @@ function update_missing_locales(array $reference, $outdated_file)
foreach ($reference as $key => $value) {
- if (isset($outdated[$key])) {
+ if (! empty($outdated[$key])) {
//$output .= " '".str_replace("'", "\'", $key)."' => '".str_replace("'", "\'", $value)."',\n";
$output .= " '".str_replace("'", "\'", $key)."' => '".str_replace("'", "\'", $outdated[$key])."',\n";
}
@@ -30,11 +30,11 @@ function update_missing_locales(array $reference, $outdated_file)
}
-foreach (new DirectoryIterator('app/Locales') as $fileInfo) {
+foreach (new DirectoryIterator('app/Locale') as $fileInfo) {
if (! $fileInfo->isDot() && $fileInfo->isDir() && $fileInfo->getFilename() !== $reference_lang) {
- $filename = 'app/Locales/'.$fileInfo->getFilename().'/translations.php';
+ $filename = 'app/Locale/'.$fileInfo->getFilename().'/translations.php';
echo $fileInfo->getFilename().' ('.$filename.')'.PHP_EOL;