[add] ansible deploy

This commit is contained in:
2020-01-15 20:20:45 +03:00
parent 7f03514c3e
commit 527c6c53f6
15 changed files with 89 additions and 13 deletions

2
.gitignore vendored
View File

@@ -1,4 +1,4 @@
build/
/build/
target/
src-gen/
out/

11
ansible/ansible.cfg Normal file
View File

@@ -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

14
ansible/deploy.yml Normal file
View File

@@ -0,0 +1,14 @@
---
- hosts: all
vars:
ansible_user: "{{ deploy_user }}"
roles:
- ansible-deploy
- build
post_tasks:
- include_role:
name: ansible-deploy
tasks_from: complete.yml
- include_role:
name: service
tasks_from: restart.yml

View File

@@ -0,0 +1,2 @@
all:
hosts: localhost

View File

@@ -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

View File

@@ -0,0 +1,4 @@
all:
hosts: shmyga.ru
vars:
config_src: "/home/holop/puzzlez/config.json"

5
ansible/requirements.yml Normal file
View File

@@ -0,0 +1,5 @@
---
- name: ansible-deploy
src: git@bitbucket.org:shmyga/ansible-deploy.git
version: master
scm: git

View File

@@ -0,0 +1,2 @@
config_src: "{{ deploy_release_dir }}/config.{{ inventory_hostname }}.json"
config_dest: "{{ deploy_release_dir }}/config.json"

View File

@@ -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 }}"

View File

@@ -22,7 +22,7 @@ const config = new Project.Config({
meta: {
title: 'Puzzle\'z',
filename: 'puzzlez',
icon: 'src/client/resources/icon.png',
icon: 'src/icon.png',
pack: 'ru.m.puzzlez',
author: 'shmyga <shmyga.z@gmail.com>',
company: 'MegaLoMania',

View File

@@ -19,7 +19,7 @@ class PartView extends Sprite {
}
private var size:Point;
private var bitmap:Bitmap;
public var bitmap:Bitmap;
public function new(id:Int, image:BitmapData, size:Point) {
super();

View File

@@ -1,14 +1,15 @@
package ru.m.puzzlez.render;
import haxework.net.ImageLoader;
import ru.m.puzzlez.core.ImageSource;
import haxework.signal.Signal;
import flash.display.BitmapData;
import flash.display.PNGEncoderOptions;
import flash.display.Sprite;
import flash.events.MouseEvent;
import flash.geom.Point;
import flash.geom.Rectangle;
import flash.net.FileReference;
import flash.utils.ByteArray;
import haxework.signal.Signal;
import haxework.view.SpriteView;
import openfl.Assets;
import ru.m.puzzlez.core.GameEvent;
import ru.m.puzzlez.core.GameState;
@@ -109,10 +110,19 @@ class Render extends SpriteView implements IRender {
signal.emit(GameEvent.PART_PUT(activePart.id, partPosition.clone()));
table.stage.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
table.stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp);
//save(activePart);
activePart = null;
activePoint = null;
}
private function save(part:PartView):Void {
var file = new FileReference();
var bitmapData = part.bitmap.bitmapData;
var data = new ByteArray();
bitmapData.encode(new Rectangle(0, 0, bitmapData.width, bitmapData.height), new PNGEncoderOptions(), data);
file.save(data, "icon.png");
}
private function clean() {
for (partView in parts) {
table.removeChild(partView);

View File

@@ -1,5 +1,6 @@
package ru.m.puzzlez.view;
import haxework.view.form.ButtonView;
import haxework.net.JsonLoader;
import haxework.view.data.DataView;
import haxework.view.group.VGroupView;
@@ -33,12 +34,6 @@ typedef PixabayResponse = {
images.data = [for (name in Assets.list(AssetType.IMAGE)) ASSET(name)];
render.scale = 0.75;
scale.position = render.scale - scale.ratio;
/*new JsonLoader<PixabayResponse>()
.GET('https://pixabay.com/api/?key=14915210-5eae157281211e0ad28bc8def&category=nature')
.then(function(result:PixabayResponse) {
images.data = images.data.concat([for (item in result.hits) URL(item.largeImageURL)]);
});*/
}
private function imageViewFactory(index:Int, image:ImageSource):ImageView {
@@ -50,6 +45,15 @@ typedef PixabayResponse = {
return result;
}
private function moreImages(view:ButtonView):Void {
view.visible = false;
new JsonLoader<PixabayResponse>()
.GET('https://pixabay.com/api/?key=14915210-5eae157281211e0ad28bc8def&category=nature')
.then(function(result:PixabayResponse) {
images.data = images.data.concat([for (item in result.hits) URL(item.largeImageURL)]);
});
}
public function setScale(value:Float):Void {
render.scale = value + scale.ratio;
}

View File

@@ -22,6 +22,10 @@ views:
+onDataSelect: ~start
geometry.margin: 5
overflow.y: scroll
- id: more
$type: haxework.view.form.ButtonView
text: More
+onPress: ~moreImages
- id: scale
$type: haxework.view.list.VScrollBarView
ratio: 0.5

BIN
src/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB