guilhermegeek/ken 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

guilhermegeek/ken

Composer 安装命令:

composer require guilhermegeek/ken

包简介

Build automation tool for Hacklang projects

README 文档

README

Ken is a project automation tool in Hacklang and can be used as a general build tool as well.

Ken exists because of Bob, a great PHP tool it's based on. I haven't forked because the project changed too much.

How it works

Ken doesn't use XML/JSON for task files. Instead, tasks are registered with the PHP language itself using the TaskLibraryInterface or configuration files.

Application is the core object used by developers to register task files or libraries.

The tasks are created by TaskFactory.

Getting Started

If not specified, the default configuration file is loaded from ken_config.php

If the folder ken_tasks exists, then all files inside it are threated as configuration files.

A configuration file is required at runtime and uses 2 functions:

  • task(name, dependencies, action) - register a new task ..+ task(name, dependencies) ..+task(name, action) ..+task(action)
  • desc(text) - provides the description for the next task defined

The configuration file has also a global instance of Application that can be accesed outside the task closure, internally know as action.

desc('Concat clientside code');
task('concat', function(Application $app) {
	// concat files
});

desc('Minify clientside code');
task('minify', function(Application $app) {
	// minify files
});

task('default', ['concat', 'minify'])

To provide a better OOO approach, you can define tasks instead with TaskLibraryInterface.

Libraries are registered in Application with:

register(TaskLibraryInterface $taskLib, array $parameters = array())

To create a new library you must implement the TaskLibraryInterface. For an example, check the ComposerLibrary which manage composer packages.

Client Interfaces

The ClientInterface represents the entry point for developers to use the Ken library.

For now there're two implementations for ClientInterface:

  • Cli: The CLI implementation to be used with HHVM client
  • Host: An implementation to be used inside another framework or existing project (you're able to execute tasks from inside your code easily)

While the CLI is used to execute tasks directly from the command line, the Host is used to be consumed inside other code.

Both Cli and Host initialize the client dependencies creating a new Application then the method run is invoked.

Cli

The CLI is pretty straightford and you can access it through bin/ken.

When called the run method, the Cli executes the tasks.

Host

The Host client must be run at Application Startup, before any consumption to Ken is done. To execute the tasks, the developer invokes the task method.

Install

Pre Requesites

Ken needs at least hhvm 3.8 to run.

Composer

Add the guilhermegeek/ken package to the require-dev section in your composer

{
	"require-dev": {
		"guilhermegeek/ken": "master"
	}
}

Then run composer install -dev

You can invoke ken with:

hhvm bin/ken

统计信息

  • 总下载量: 5
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: Hack

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-04-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固