承接 massive/build-bundle 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

massive/build-bundle

Composer 安装命令:

composer require massive/build-bundle

包简介

Massive Art Build Bundle

README 文档

README

Test Workflow Status

The Massive Build Bundle provides a massive:build command which runs build targets.

Targets are classes which execute arbitary code, and are registred in the dependency injection container via. tags. Targets can depend on other targets.

Virtual targets can be created in you applications configuration file. These virtual targets simply declare depenencies, enabling you to configure custom build processes.

The aim of this bundle is to provide an extensible, decoupled, way of building software project environments, especially in a development context.

If you often find youself executing several Symfony commands consecutively to establish your environment, then this bundle is for you.

This tool is not mean to replace Make or Ant or Phing. The bundle should only be used to execute build steps which are contained in the client application.

Defining targets

You can define new build targets in you applications configuration file:

massive_build:
    targets:
        main:
            dependencies:
                target_one: ~
                target_two: ~
                target_three: ~
        quick:
            dependencies:
                target_one: ~

The above will allow you to execute:

$ php app/console massive:build main

and:

$ php app/console massive:build quick

Creating build classes

You create builder classes in your application / bundles. Each build class should have a specific responsiblity.

A minimal example:

<?php

namespace My\Web\Application;

use Massive\Bundle\BuildBundle\Build\BuilderInterface;

class MyBuilder implements BuilderInterface
{
    protected $context;

    public function getName()
    {
        return 'mybuildername';
    }

    public function getDependencies()
    {
        return array();
    }

    public function build()
    {
        $application = $this->context->getApplication();
        $input = $this->context->getInput();
        $output = $this->context->getOutput();

        $output->writeln('Hello World!');
    }

    public function setContext(BuilderContext $context)
    {
        $this->context = $context;
    }
}
  • getName: Return a name for the builder.
  • getDependencies: Return the names of any builders that this builder depends on.
  • build: Execute all logic in this method
  • setContext: Called automatically by the master build command, contains the Input, Output and Application.

Registring the builder class

You can register the builder class in the dependency injection container and# then tag it with

<service id="sulu.core.build.builder.database" class="My\Web\Application\Builder\FooBuilder">
    <tag name="massive_build.builder" />
</service>

Adding global options and customization

You can make options available to your commands (e.g. to specify that they should destroy the database, or that the name of user "x" should be set to "y").

By taking this approach you are free to customize the build command in anyway that you like.

To so this you need to extend the massive BuildCommand and configuring the MassiveBuild bundle to use your extended class.

<?php

namespace Sulu\Bundle\CoreBundle\Command;

use Massive\Bundle\BuildBundle\Command\BuildCommand;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;

class SuluBuildCommand extends BuildCommand
{
    public function configure()
    {
        parent::configure();

        // change the name of the command from "massive:build"
        $this->setName('myapp:build');

        // add an option
        $this->addOption('destroy', null, InputOption::VALUE_NONE, 'Destroy existing data');
    }
}

Launching the build

You can launch all the builders with the following command:

$ php app/console massive:build

Launch a specific target:

$ php app/console massive:build mytarget

If you want to see which targets are available, use the --nobuild option:

$ php app/console massive:build --nobuild
Build Targets
=============

+---+----------+--------------------+
| # | Builder  | Deps               |
+---+----------+--------------------+
| 0 | database |                    |
| 1 | phpcr    | database           |
| 2 | fixtures | database           |
| 3 | user     | database, fixtures |
+---+----------+--------------------+

By default if you specify a specific target, the build system will build any dependencies it has, to disable this use the --nodeps option.

$ php app/console massive:build --nodeps

massive/build-bundle 适用场景与选型建议

massive/build-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.5M 次下载、GitHub Stars 达 47, 最近一次更新时间为 2014 年 08 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 massive/build-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 massive/build-bundle 我们能提供哪些服务?
定制开发 / 二次开发

基于 massive/build-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1.5M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 48
  • 点击次数: 28
  • 依赖项目数: 7
  • 推荐数: 0

GitHub 信息

  • Stars: 47
  • Watchers: 10
  • Forks: 9
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-08-08