[build] update gulp debug logger

This commit is contained in:
2017-12-20 17:53:58 +03:00
parent 69c2b735a0
commit 6345ddcd19
17 changed files with 212 additions and 77 deletions

44
config/deploy.rb Normal file
View File

@@ -0,0 +1,44 @@
require_relative 'service'
app = 'tankz'
user = 'adman'
set :scm, :git
set :application, app
set :repo_url, "git@bitbucket.org:shmyga/#{app}.git"
set :user, user
set :deploy_to, "/home/#{user}/repo/#{app}"
namespace :build do
task :lib do
on roles(:app) do
execute "mkdir ~/haxelib 2>/dev/null || :"
execute "haxelib setup ~/haxelib"
execute "haxelib install lime"
execute "haxelib install openfl"
execute "haxelib install protohx"
execute "haxelib install orm"
execute "haxelib git haxework git@bitbucket.org:shmyga/haxework.git"
end
end
task :gen do
on roles(:app) do
execute "cd #{release_path} && haxelib run protohx generate protohx.json"
execute "cd #{release_path} && haxelib run orm mysql://shmyga:xkbp8jh9z2@localhost:3306/armageddon -s src-gen/haxe -c ru.m.tankz.db -a ru.m.tankz.db"
end
end
task :run do
on roles(:app) do
execute "cd #{release_path} && openfl build html5"
execute "cd #{release_path} && openfl build flash"
execute "cd #{release_path} && haxe server.hxml"
end
end
end
before 'build:run', 'build:lib'
before 'build:run', 'build:gen'
before 'deploy:updated', 'build:run'

10
config/deploy/develop.rb Normal file
View File

@@ -0,0 +1,10 @@
role :app, %w{localhost}
role :web, %w{localhost}
role :db, %w{localhost}
user = fetch(:user)
server 'localhost', ssh_options: { port: 22, user: user, forward_agent: true }
set :tmp_dir, "/home/#{user}/tmp"
set :branch, 'master'

View File

@@ -0,0 +1,10 @@
role :app, %w{test.instreamatic.com}
role :web, %w{test.instreamatic.com}
role :db, %w{test.instreamatic.com}
user = fetch(:user)
server 'test.instreamatic.com', ssh_options: { port: 3607, user: user, forward_agent: true }
set :tmp_dir, "/home/#{user}/tmp"
set :branch, 'master'

52
config/service.rb Normal file
View File

@@ -0,0 +1,52 @@
module Service
class Manager
def initialize(env)
@env = env
end
def execute(action, command)
Airbrussh.configure do |config|
config.command_output = true
end
service_role = "service_role_#{action}".to_sym
role = fetch(service_role)
on roles(role) do
execute :sudo, "/bin/systemctl #{command} #{action}"
end
end
end
end
services = %w{tankz}
namespace :service do
task :restart, :param do |task, args|
services = args[:param] ? [args[:param]] : services
services.each { |service|
Service::Manager.new(self).execute(service, 'restart')
}
end
task :stop, :param do |task, args|
services = args[:param] ? [args[:param]] : services
services.each { |service|
Service::Manager.new(self).execute(service, 'stop')
}
end
task :start, :param do |task, args|
services = args[:param] ? [args[:param]] : services
services.each { |service|
Service::Manager.new(self).execute(service, 'start')
}
end
task :status, :param do |task, args|
services = args[:param] ? [args[:param]] : services
services.each { |service|
Service::Manager.new(self).execute(service, 'status')
}
end
end
set :service_role_tankz, :app