2017 © Pedro Peláez
 

project subsplit-service

Flashtag services...

image

flashtag/subsplit-service

Flashtag services...

  • Saturday, August 6, 2016
  • by ryanwinchester
  • Repository
  • 4 Watchers
  • 40 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

Flashtag Subsplit Service

version license, (*1)

Webhook and Scheduler

Have you ever wanted to split some of your code from your project into components... maybe read-only github repositories like Symfony and Laravel?, (*2)

Well, I certainly did. It took me a while to find a good way to do it and now I'm going to help you do the same. This subsplit project will help you to automate the process with webhooks and/or scheduled commands., (*3)

Webhooks

git push webhook that runs the subtree split command from a github, bitbucket, or gitlab webhook, (*4)

Scheduled commands

A flashtag:subsplit command will run the subtree split command and publish to the subtree repositories., (*5)

Install

Install with composer:, (*6)

composer create-project flashtag/subsplit-service --prefer-dist

From the project directory:, (*7)

cd .git-subsplit; ./install.sh

Setup

Edit the build/flashtag-subsplit.sh file to match your repo, and this package should actually just work almost out-of-the-box for your own repos as well., (*8)

git subsplit init git@github.com:flashtag/flashtag.git
git subsplit publish --heads="master" app/Admin:git@github.com:flashtag/admin.git
git subsplit publish --heads="master" app/Api:git@github.com:flashtag/api.git
git subsplit publish --heads="master" app/Client:git@github.com:flashtag/client.git
git subsplit publish --heads="master" app/Cms:git@github.com:flashtag/cms.git
git subsplit publish --heads="master" app/Data:git@github.com:flashtag/data.git
rm -rf .subsplit/

Would change to look like:, (*9)

git subsplit init git@github.com:Foobar/Parent.git
git subsplit publish --heads="master" src/One:git@github.com:Foobar/one.git
git subsplit publish --heads="master" src/Two:git@github.com:Foobar/two.git
git subsplit publish --heads="master" src/Three:git@github.com:Foobar/three.git
# . . .
# etc.
# . . .
rm -rf .subsplit/

For webhooks:

Copy the example environment file cp .env.example .env and change the appropriate properties., (*10)

Uncomment the line corresponding to the service you are using to send the webhook in app/Http/routes/php and comment out any you aren't using., (*11)

Currently, the gitlab route is commented out by default because I don't know of any way to validate the request., (*12)

// Github
$app->post('github', [
    'middleware' => 'github',
    'uses' => 'App\Http\Controllers\WebhooksController@push',
]);

// Bitbucket
$app->post('bitbucket', [
    'middleware' => 'bitbucket',
    'uses' => 'App\Http\Controllers\WebhooksController@push',
]);

// // Gitlab
// $app->post('gitlab', [
//     'middleware' => 'gitlab',
//     'uses' => 'App\Http\Controllers\WebhooksController@push',
// ]);
GITHUB

The WEBHOOK_SECRET is what you will also set the secret property to in the github webhook setup:, (*13)

Github add webhook, (*14)

Your github push webhook payload url path is /webhooks/github so an example webhook url would look something like https://subsplit.whateveryourdomain.com/webhooks/github, (*15)

BITBUCKET

Your bitbucket push webhook url path is /webhooks/bitbucket so an example webhook url would look something like https://subsplit.whateveryourdomain.com/webhooks/bitbucket, (*16)

GITLAB

Your gitlab push webhook url path is /webhooks/gitlab so an example webhook url would look something like https://subsplit.whateveryourdomain.com/webhooks/gitlab, (*17)

For the scheduled command:

You can either use the scheduler as lumen intended in the app/Console/Kernel, by setting up this cron job:, (*18)

* * * * * php /path/to/project/artisan schedule:run

or schedule the command yourself. For my own project, I've set up this cron job to just execute this every night:, (*19)

0 0 * * * php /path/to/project/artisan flashtag:subsplit, (*20)

Powered by

Sometimes re-inventing the wheel is a good idea and sometimes you have great packages like:, (*21)

The Versions

06/08 2016

dev-master

9999999-dev

Flashtag services...

  Sources   Download

MIT

The Requires

 

The Development Requires

commands schedule webhooks

19/02 2016

v0.3.1

0.3.1.0

Flashtag services...

  Sources   Download

MIT

The Requires

 

The Development Requires

commands schedule webhooks

19/02 2016

v0.3.0

0.3.0.0

Flashtag services...

  Sources   Download

MIT

The Requires

 

The Development Requires

commands schedule webhooks

09/12 2015

v0.2.1

0.2.1.0

Flashtag services...

  Sources   Download

MIT

The Requires

 

The Development Requires

commands schedule webhooks

09/12 2015

v0.2.0

0.2.0.0

Flashtag services...

  Sources   Download

MIT

The Requires

 

The Development Requires

commands schedule webhooks

06/11 2015

v0.1.0

0.1.0.0

Flashtag services...

  Sources   Download

MIT

The Requires

 

The Development Requires

commands schedule webhooks