Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
227a83d1f0 |
+2
-2
@@ -1,5 +1,5 @@
|
|||||||
PROJECT=puzzlez
|
PROJECT=puzzlez
|
||||||
#VERSION=$(grep -m 1 'version' ./package.json | grep -oP '"version"\s*:\s*"\K\d+\.\d+.\d+')
|
VERSION=$(grep -m 1 'version' ./package.json | grep -oP '"version"\s*:\s*"\K\d+\.\d+.\d+')
|
||||||
SDK_PATH=$HOME/sdk
|
SDK_PATH=$HOME/sdk
|
||||||
PUBLISH_PATH=$HOME/public/$PROJECT
|
PUBLISH_PATH=$HOME/public/$PROJECT
|
||||||
BUILD_PATH=./build
|
BUILD_PATH=./build
|
||||||
@@ -8,7 +8,7 @@ KEY_STORE=<keystore.jks>
|
|||||||
KEY_PASS=<passphrase>
|
KEY_PASS=<passphrase>
|
||||||
|
|
||||||
# publish
|
# publish
|
||||||
PUBLISH_REPO=https://git.shmyga.ru/api/packages/InfernalGames
|
REPO=https://git.shmyga.ru/api/packages/InfernalGames
|
||||||
PUBLISH_USER=<username>
|
PUBLISH_USER=<username>
|
||||||
PUBLISH_PASSWORD=<passphrase>
|
PUBLISH_PASSWORD=<passphrase>
|
||||||
|
|
||||||
|
|||||||
+5
-5
@@ -1,4 +1,4 @@
|
|||||||
build/
|
/build/
|
||||||
target/
|
target/
|
||||||
src-gen/
|
src-gen/
|
||||||
out/
|
out/
|
||||||
@@ -10,8 +10,8 @@ out/
|
|||||||
.idea/
|
.idea/
|
||||||
.ideaDataSources/
|
.ideaDataSources/
|
||||||
config.json
|
config.json
|
||||||
node_modules
|
/node_modules
|
||||||
log
|
/log
|
||||||
ansible/*.retry
|
/ansible/*.retry
|
||||||
.npmrc
|
.npmrc
|
||||||
.env
|
.env
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
modules = ["."]
|
|
||||||
|
|
||||||
[presets.docker]
|
|
||||||
variables.docker_target = "web"
|
|
||||||
variables.docker_name = "{{ project_name }}-web"
|
|
||||||
|
|
||||||
[presets.docker.tasks.build.compose]
|
|
||||||
priority = 1
|
|
||||||
variables.sdk_path = "{{ 'SDK_PATH' | env('$HOME/sdk') }}"
|
|
||||||
variables.publish_path = "{{ 'PUBLISH_PATH' | env('$HOME/public/' + project_name) }}"
|
|
||||||
variables.build_path = "{{ 'BUILD_PATH' | env('./build') }}"
|
|
||||||
variables.target_path = "{{ 'TARGET_PATH' | env('./target') }}"
|
|
||||||
commands = [
|
|
||||||
"mkdir -p \"{{ sdk_path }}\" \"{{ publish_path }}\" \"{{ build_path }}\" \"{{ target_path }}\" \"src-gen\"",
|
|
||||||
"docker compose run --rm --user $(id -u):$(id -g) --build --remove-orphans builder",
|
|
||||||
]
|
|
||||||
|
|
||||||
[presets.gitea]
|
|
||||||
variables.publish_artefacts.debian = "target/app/debian/{{ project_name }}_{{ project_version }}_all.deb"
|
|
||||||
variables.publish_artefacts.android = "target/app/android/{{ project_name }}_{{ project_version }}.apk"
|
|
||||||
variables.publish_artefacts.archive_linux = "target/app/archive/{{ project_name }}_{{ project_version }}_linux.tar.gz"
|
|
||||||
variables.publish_artefacts.archive_win = "target/app/archive/{{ project_name }}_{{ project_version }}_win.zip"
|
|
||||||
variables.publish_artefacts.installer = "target/app/installer/{{ project_name }}_{{ project_version }}.exe"
|
|
||||||
+10
-11
@@ -1,10 +1,10 @@
|
|||||||
FROM ubuntu:noble AS base
|
FROM ubuntu:noble AS base
|
||||||
RUN apt update && apt install -y \
|
RUN apt update && apt install -y \
|
||||||
nodejs \
|
nodejs \
|
||||||
npm \
|
npm \
|
||||||
openjdk-11-jre \
|
openjdk-11-jre \
|
||||||
protobuf-compiler \
|
protobuf-compiler \
|
||||||
jq
|
jq
|
||||||
RUN node -v
|
RUN node -v
|
||||||
RUN npm -v
|
RUN npm -v
|
||||||
|
|
||||||
@@ -12,17 +12,16 @@ FROM base AS builder
|
|||||||
ENV GRADLE_USER_HOME=/sdk/gradle
|
ENV GRADLE_USER_HOME=/sdk/gradle
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package.json package-lock.json ./
|
COPY package.json package-lock.json ./
|
||||||
RUN --mount=type=cache,target=/root/.npm \
|
RUN npm ci
|
||||||
npm ci
|
|
||||||
COPY gulpfile.js protohx.json ./
|
COPY gulpfile.js protohx.json ./
|
||||||
COPY tasks ./tasks
|
COPY tasks ./tasks
|
||||||
COPY config.example.json ./config.example.json
|
COPY config.example.json ./config.example.json
|
||||||
RUN --mount=type=secret,id=KEY_STORE \
|
RUN --mount=type=secret,id=KEY_STORE \
|
||||||
cat /run/secrets/KEY_STORE > ./key.jks
|
cat /run/secrets/KEY_STORE > ./key.jks
|
||||||
RUN --mount=type=secret,id=KEY_PASS,env=KEY_PASS \
|
RUN --mount=type=secret,id=KEY_PASS,env=KEY_PASS \
|
||||||
jq --arg key_pass "$KEY_PASS" \
|
jq --arg key_pass "$KEY_PASS" \
|
||||||
'.SdkDir = "/sdk" | .PublishDir = "/app/publish" | .Key.store = "key.jks" | .Key.pass = $key_pass' \
|
'.SdkDir = "/sdk" | .PublishDir = "/app/publish" | .Key.store = "key.jks" | .Key.pass = $key_pass' \
|
||||||
config.example.json > config.json
|
config.example.json > config.json
|
||||||
COPY src ./src
|
COPY src ./src
|
||||||
COPY dependencies ./dependencies
|
COPY dependencies ./dependencies
|
||||||
VOLUME ["/sdk", "/app/build", "/app/target", "/app/publish", "/app/src-gen"]
|
VOLUME ["/sdk", "/app/build", "/app/target", "/app/publish", "/app/src-gen"]
|
||||||
|
|||||||
@@ -1,13 +1,9 @@
|
|||||||
# Puzzle'z
|
# Puzzlez
|
||||||
|
|
||||||
Puzzle game
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## Play
|
## Play
|
||||||
|
|
||||||
https://shmyga.ru/puzzlez/html5/index.html
|
https://shmyga.ru/puzzlez/html5/index.html
|
||||||
|
|
||||||
## Releases
|
## Packages
|
||||||
|
|
||||||
https://git.shmyga.ru/InfernalGames/puzzlez/releases
|
https://git.shmyga.ru/InfernalGames/-/packages/generic/puzzlez
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
[defaults]
|
||||||
|
hash_behaviour = merge
|
||||||
|
host_key_checking = False
|
||||||
|
#callback_whitelist = profile_tasks
|
||||||
|
display_skipped_hosts = False
|
||||||
|
stdout_callback = yaml
|
||||||
|
bin_ansible_callbacks = True
|
||||||
|
|
||||||
|
[ssh_connection]
|
||||||
|
pipelining = True
|
||||||
|
ssh_args = -o ForwardAgent=yes
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
- hosts: all
|
||||||
|
vars:
|
||||||
|
ansible_user: "{{ deploy_user }}"
|
||||||
|
roles:
|
||||||
|
- ansible-deploy
|
||||||
|
- build
|
||||||
|
post_tasks:
|
||||||
|
- include_role:
|
||||||
|
name: ansible-deploy
|
||||||
|
tasks_from: complete.yml
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
all:
|
||||||
|
hosts: localhost
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
project_name: puzzlez
|
||||||
|
project_user: holop
|
||||||
|
|
||||||
|
deploy_user: "{{ project_user }}"
|
||||||
|
deploy_project: "{{ project_name }}"
|
||||||
|
deploy_repo_url: "git@bitbucket.org:infernalgames/{{ project_name }}.git"
|
||||||
|
deploy_repo_version: master
|
||||||
|
deploy_npm: yes
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
all:
|
||||||
|
hosts: shmyga.ru
|
||||||
|
vars:
|
||||||
|
config_src: "/home/holop/puzzlez/config.json"
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- name: ansible-deploy
|
||||||
|
src: git@bitbucket.org:shmyga/ansible-deploy.git
|
||||||
|
version: master
|
||||||
|
scm: git
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
config_src: "{{ deploy_release_dir }}/config.{{ inventory_hostname }}.json"
|
||||||
|
config_dest: "{{ deploy_release_dir }}/config.json"
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
---
|
||||||
|
- name: "Copy config"
|
||||||
|
copy:
|
||||||
|
src: "{{ config_src }}"
|
||||||
|
dest: "{{ config_dest }}"
|
||||||
|
remote_src: true
|
||||||
|
|
||||||
|
- name: "Gulp build"
|
||||||
|
command: "{{ deploy_release_dir }}/node_modules/.bin/gulp default"
|
||||||
|
args:
|
||||||
|
chdir: "{{ deploy_release_dir }}"
|
||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"SdkDir": "$HOME/sdk",
|
"SdkDir": "C:\\sdk",
|
||||||
"BuildDir": null,
|
"BuildDir": null,
|
||||||
"PublishDir": "$HOME/public/puzzlez",
|
"PublishDir": "",
|
||||||
"PublishUrl": "https://shmyga.ru/repo/puzzlez",
|
"PublishUrl": "https://shmyga.ru/repo/puzzlez",
|
||||||
"Develop": false,
|
"Develop": false,
|
||||||
"Key": {
|
"Key": {
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 357 KiB |
+3
-6
@@ -5,20 +5,17 @@ const packageInfo = require("./package.json");
|
|||||||
const { System, Sdk, Haxe, Project } = require("gulp-haxetool");
|
const { System, Sdk, Haxe, Project } = require("gulp-haxetool");
|
||||||
const dateformat = require("dateformat");
|
const dateformat = require("dateformat");
|
||||||
const publish = require("./tasks/gulp-publish");
|
const publish = require("./tasks/gulp-publish");
|
||||||
const os = require("os");
|
|
||||||
|
|
||||||
const resolvePath = (path) => path.replace("$HOME", os.homedir());
|
|
||||||
|
|
||||||
if (packageInfo.haxe) {
|
if (packageInfo.haxe) {
|
||||||
Haxe.VERSION = packageInfo.haxe;
|
Haxe.VERSION = packageInfo.haxe;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.SdkDir) {
|
if (Config.SdkDir) {
|
||||||
Sdk.dir = resolvePath(Config.SdkDir);
|
Sdk.dir = Config.SdkDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Config.BuildDir) {
|
if (Config.BuildDir) {
|
||||||
Haxe.buildDir = resolvePath(Config.BuildDir);
|
Haxe.buildDir = Config.BuildDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.clean = function clean() {
|
exports.clean = function clean() {
|
||||||
@@ -107,7 +104,7 @@ const server = new Project(
|
|||||||
module.exports.publish = publish(
|
module.exports.publish = publish(
|
||||||
packageInfo.name,
|
packageInfo.name,
|
||||||
packageInfo.version,
|
packageInfo.version,
|
||||||
resolvePath(Config.PublishDir),
|
Config.PublishDir,
|
||||||
Config.PublishUrl,
|
Config.PublishUrl,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
+1
-4
@@ -1,10 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "puzzlez",
|
"name": "puzzlez",
|
||||||
"version": "0.6.1",
|
"version": "0.6.1",
|
||||||
"scripts": {
|
"private": true,
|
||||||
"build": "gulp",
|
|
||||||
"dev": "gulp app:flash:test"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"dateformat": "^3.0.3",
|
"dateformat": "^3.0.3",
|
||||||
"fs-extra": "^10.0.0",
|
"fs-extra": "^10.0.0",
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ class NginxImageSource implements ImageSource {
|
|||||||
public var id(default, never):String = "nginx";
|
public var id(default, never):String = "nginx";
|
||||||
|
|
||||||
private var baseUrl:String;
|
private var baseUrl:String;
|
||||||
|
private var cache:Map<String, Promise<NginxResponse>> = new Map();
|
||||||
|
|
||||||
public function new(baseUrl:String) {
|
public function new(baseUrl:String) {
|
||||||
this.baseUrl = baseUrl;
|
this.baseUrl = baseUrl;
|
||||||
@@ -36,31 +37,35 @@ class NginxImageSource implements ImageSource {
|
|||||||
|
|
||||||
public function getPage(page:Page):Promise<DataPage<ImageId>> {
|
public function getPage(page:Page):Promise<DataPage<ImageId>> {
|
||||||
var category = page.filter.get("category");
|
var category = page.filter.get("category");
|
||||||
return new JsonLoader<NginxResponse>().GET(category != null ? this.baseUrl + category + "/" : this.baseUrl)
|
var url = category != null ? this.baseUrl + category + "/" : this.baseUrl;
|
||||||
.then((response:NginxResponse) -> {
|
if (!this.cache.exists(url)) {
|
||||||
var data:Array<ImageId> = [];
|
this.cache.set(url, new JsonLoader<NginxResponse>().GET(url));
|
||||||
for (item in response) {
|
}
|
||||||
if (item.type == NginxResponseItemType.FILE) {
|
return this.cache.get(url).then((response:NginxResponse) -> {
|
||||||
var itemId = category != null ? category + "@" + item.name : item.name;
|
var data:Array<ImageId> = [];
|
||||||
data.push(new ImageId().setSource(id).setId(itemId));
|
for (item in response) {
|
||||||
}
|
if (item.type == NginxResponseItemType.FILE) {
|
||||||
|
var itemId = category != null ? category + "@" + item.name : item.name;
|
||||||
|
data.push(new ImageId().setSource(id).setId(itemId));
|
||||||
}
|
}
|
||||||
return {
|
}
|
||||||
page: page,
|
data = data.slice(page.index * page.count, (page.index + 1) * page.count);
|
||||||
data: data,
|
return {
|
||||||
total: response.length,
|
page: page,
|
||||||
}
|
data: data,
|
||||||
});
|
total: response.length,
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public function load(id:String, thumb:Bool = false):Promise<ImageValue> {
|
public function load(id:String, thumb:Bool = false):Promise<ImageValue> {
|
||||||
var url = this.baseUrl + StringTools.replace(id, "@", "/");
|
var url = this.baseUrl + StringTools.replace(id, "@", "/");
|
||||||
if (thumb) {
|
// TODO: default size by screen width?
|
||||||
var parts = url.split(".");
|
var width = thumb ? 360 : 1920;
|
||||||
var index = parts.length - 2;
|
var parts = url.split(".");
|
||||||
parts[index] = parts[index] + "-thumbnail";
|
var index = parts.length - 2;
|
||||||
url = parts.join(".");
|
parts[index] = parts[index] + '-w${width}';
|
||||||
}
|
url = parts.join(".");
|
||||||
return Promise.promise(ImageValue.URL(url));
|
return Promise.promise(ImageValue.URL(url));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user