Skip to content

Commit

Permalink
Rename Yo P2 to Outrigger Drupal (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
grayside authored Jun 5, 2017
1 parent 70eb5aa commit 9b87567
Show file tree
Hide file tree
Showing 15 changed files with 71 additions and 69 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## v3.1.0 (June 2017)

* Changed name to generator-outrigger-drupal
* Relocated to Github: https://github.com/phase2/generator-outrigger-drupal

## v3.0.1 (June 2017)

* Missed a couple minor bugfixes.
Expand Down
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ docker-compose run --rm cli npm test

## Testing Branches without Docker

If you would like to test out changes to generator-p2 or one of the above
If you would like to test out changes to generator-outrigger-drupal or one of the above
projects, please take the following steps:

1. `git clone git@bitbucket.org:phase2tech/generator-p2.git`
2. Check out the alternate branch of generator-p2. If testing alternate
1. `git clone git@github.com:phase2/generator-outrigger-drupal.git`
2. Check out the alternate branch of generator-outrigger-drupal. If testing alternate
branches of one of the other generators, edit the package.json dependency entry
according to the [package.json dependency
documenation](https://docs.npmjs.com/files/package.json#git-urls-as-dependencies).
3. Run `npm link` to use this copy as the global version. (May require `sudo`)

If you would like to take it a step further and develop in the other generators
while testing with `yo p2`, clone those repositories as well and replace the
version installed in `generator-2/node_modules` with a symlink. **Note this may
while testing with `yo outrigger-drupal`, clone those repositories as well and replace the
version installed in `generator-outrigger-drupal/node_modules` with a symlink. **Note this may
not work in npm v3.x.**
37 changes: 16 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
# Yo P2! � the Phase2 Site Generator
# Outrigger Drupal

> Yeoman generator that weaves together multiple generators, tools, and Phase2
best practices to kick off Drupal projects in style.
> Yeoman generator that weaves together Outrigger with other best-in-class tools for your Drupal project.
This is an umbrella [Yeoman](http://yeoman.io/) generator that asks questions,
then passes the answers to multiple "child" generators that handle their own
aspect of the scaffolding. As the name implies, this generator focuses on Phase2
practices, where some of the other generators in use are focused on broader industry
best practices.
aspect of project scaffolding. As the name implies, this generator focuses on Outrigger practices, where some of the other generators in use are focused on broader industry best practices.

## Installation & Usage

Expand All @@ -17,21 +14,21 @@ Docker-based usage is available as of v3.0.0. It is the recommended approach as
updates tend to be less prone to complication.

```bash
git clone git@bitbucket.org:phase2tech/generator-p2.git
cd generator-p2
git clone git@github.com:phase2/generator-outrigger-drupal.git
cd generator-outrigger-drupal
git checkout v3.0.0
docker-compose run --rm cli npm install
mkdir ~/path/to/empty/directory
YO_PROJECT_DIRECTORY=~/path/to/empty/directory docker-compose run --rm yo p2
YO_PROJECT_DIRECTORY=~/path/to/empty/directory docker-compose run --rm yo outrigger-drupal
```

### Using npm

```bash
npm install --global git+ssh://bitbucket.org/phase2tech/generator-p2.git#v3.0.0
npm install --global git+ssh://github.com:phase2/generator-outrigger-drupal.git#v3.0.1
mkdir ~/path/to/empty/directory
cd ~/path/to/empty/directory
yo p2
yo outrigger-drupal
```

### Command-line Options
Expand Down Expand Up @@ -62,15 +59,15 @@ When you use this to generate a project, all your answers are recorded by Yeoman
in a .yo-rc.json file at the root of your repository. As long as you commit this
to the codebase, from then if you run the generator targeting that directory it
will use the previous answers as the defaults to every prompt. For even faster
usage, you can run `yo p2 --replay` and it will automatically run the generator
without stopping to ask old questions.
usage, you can run `yo outrigger-drupal --replay` and it will automatically run
the generator without stopping to ask old questions.

If you run the generator, it will overwrite files. That's the idea in this case,
as your goal is to cherrypick good new stuff the generator provides into your
project. Run `git add -p .` to view each change one chunk at a time, and decide
if it makes sense to discard or keep. Feel free to ask for help.

The extensive changelog notes are intended to help guide this process.
The extensive [CHANGELOG](./CHANGELOG.md) notes are intended to help guide this process.

### Retrofitting an Existing Project

Expand Down Expand Up @@ -104,9 +101,9 @@ and your site will be built and a new site installed.
development, continuous integration, and overall project tooling for the Drupal
application.

A best practice setup of GDT with a few extra goodies are provided by Yo P2's
use of [Generator Gadget](https://github.com/phase2/generator-gadget) to produce
the top-level Drupal application scaffolding.
A best practice setup of GDT with a few extra goodies are provided by
Yo Outrigger Drupal's use of [Generator Gadget](https://github.com/phase2/generator-gadget)
to produce the top-level Drupal application scaffolding.

### Component-driven Frontend

Expand All @@ -126,8 +123,7 @@ consistent, container-based, local development environment that can also be used
on Phase2's centralized Outrigger hosting to provide integration, testing, and
other environments.

This uses a sub-generator of generator-p2 which can be separately executed as
`yo p2:environment`.
This uses a sub-generator of generator-outrigger-drupal which can be separately executed as `yo outrigger-drupal:environment`.

#### Feature Breakdown

Expand Down Expand Up @@ -157,8 +153,7 @@ If you liked the Docker-based environments, you can also use our Docker-based
Jenkins instance to manage your central test environments, complete with default
jobs so you can start continuous integration with zero further configuration.

This uses a sub-generator of generator-p2 which can be separately executed as
`yo p2:jenkins`.
This uses a sub-generator of generator-outrigger-drupal which can be separately executed as `yo outrigger-drupal:jenkins`.

### Feature Breakdown

Expand Down
2 changes: 1 addition & 1 deletion bin/debug
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# Open your browser to http://debug.yo.vm:8080/debug?port=5858
#
# This script is currently triggered as part of
# * `docker-compose run --rm p2-debug`
# * `docker-compose run --rm debug`
##

node-inspector --no-preload --web-host="0.0.0.0" &
Expand Down
14 changes: 7 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ services:
cli:
extends:
service: yo
working_dir: /usr/local/lib/node_modules/generator-p2
working_dir: /usr/local/lib/node_modules/generator-outrigger-drupal
entrypoint: ["/usr/bin/env"]
command: "bash"

# Runs the primary yo generator with node-inspector debugging activated.
# Usage: docker-compose run --rm debug
# Usage: docker-compose run --rm debug
debug:
extends:
service: yo
entrypoint: "/usr/local/lib/node_modules/generator-p2/bin/debug 'p2 --no-insight --skip-install'"
entrypoint: "/usr/local/lib/node_modules/generator-outrigger-drupal/bin/debug 'outrigger-drupal --no-insight --skip-install'"
ports:
- "8080"
labels:
Expand All @@ -25,12 +25,12 @@ services:

# Run 'yo' inside the container.
# Usage: docker-compose run --rm yo
# docker-compose run --rm yo p2
# docker-compose run --rm yo p2:environment
# docker-compose run --rm yo p2:jenkins
# docker-compose run --rm yo outrigger-drupal
# docker-compose run --rm yo outrigger-drupal:environment
# docker-compose run --rm yo outrigger-drupal:jenkins
yo:
image: outrigger/yeoman
network_mode: "bridge"
volumes:
- ${YO_PROJECT_DIRECTORY:-~/Projects/newproject}:/generated
- .:/usr/local/lib/node_modules/generator-p2
- .:/usr/local/lib/node_modules/generator-outrigger-drupal
6 changes: 3 additions & 3 deletions generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,15 @@ module.exports = Generator.extend({
end: function() {
var version = {
gadget: require('generator-gadget/package.json').version,
env: require('generator-p2/package.json').version,
env: require('generator-outrigger-drupal/package.json').version,
pls: require('generator-pattern-lab-starter/package.json').version,
}

this.log(yosay('Yo P2 has completed generation of your Drupal project.'));
this.log(yosay('Outrigger Drupal has completed generation of your Drupal project.'));
this.log('Primary scaffolding created by ' + chalk.red('generator-gadget v' + version.gadget) + '.');
this.log('Check out your new READMEs to get oriented.');
if (options['useENV']) {
this.log('You have chosen a ' + chalk.bold('Docker-based development environment') + ' created by ' + chalk.red('generator-p2:environment v' + version.env) + '.');
this.log('You have chosen a ' + chalk.bold('Docker-based development environment') + ' created by ' + chalk.red('generator-outrigger-drupal:environment v' + version.env) + '.');
this.log(chalk.yellow('All tools and application code should be run via the Docker containers.'));
this.log(chalk.green('A handy TODOS.md checklist has been created for your next steps.'));
this.log('Want to see a running Drupal site without opening a text editor? Run ' + chalk.bold('bash bin/start.sh') + ' now.');
Expand Down
4 changes: 2 additions & 2 deletions generators/app/templates/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ and operational management of the application code. A build process downloads an

## Scaffolded with Generators

Initial generation of this project's code structure was built with [Yo P2](https://bitbucket.org/phase2tech/generator-p2)
Initial generation of this project's code structure was built with [Yo Outrigger Drupal](https://github.com/phase2/generator-outrigger-drupal)
and related code-generation projects.

To refresh your project with our latest practices, update your local copy of this
tool, and run `yo p2 --replay --force`. Do not forgot to carefully inspect each
tool, and run `yo outrigger-drupal --replay --force`. Do not forgot to carefully inspect each
change for compatibility with your ongoing project before committing.

The `--replay` option pulls configuration values for the generator from *.yo-rc.json*,
Expand Down
14 changes: 7 additions & 7 deletions generators/environment/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@ module.exports = Generator.extend({
npmConfig: function() {
var pkg = this.fs.readJSON('package.json');
if (!pkg) {
this.log(chalk.red('You must have a valid Grunt-Drupal-Tasks compatible codebase before running p2-env.'));
this.log(chalk.yellow('Try running `yo p2` or `yo gadget` first!'));
this.log(chalk.red('You must have a valid Grunt-Drupal-Tasks compatible codebase before running outrigger-drupal:environment.'));
this.log(chalk.yellow('Try running `yo outrigger-drupal` or `yo gadget` first!'));
if (!options['force']) {
this.env.error('Project not ready for p2-env processing.');
this.env.error('Project not ready for outrigger-drupal:environment processing.');
}
}
pkg = pkg || {};
Expand All @@ -203,10 +203,10 @@ module.exports = Generator.extend({
gruntConfig: function() {
var gcfg = this.fs.readJSON('Gruntconfig.json');
if (!gcfg) {
this.log(chalk.red('You must have a valid Grunt-Drupal-Tasks compatible codebase before running p2-env.'));
this.log(chalk.yellow('Try running `yo p2` or `yo gadget` first!'));
this.log(chalk.red('You must have a valid Grunt-Drupal-Tasks compatible codebase before running outrigger-drupal:environment.'));
this.log(chalk.yellow('Try running `yo outrigger-drupal` or `yo gadget` first!'));
if (!options['force']) {
this.env.error('Project not ready for p2-env processing.');
this.env.error('Project not ready for outrigger-drupal:environment processing.');
}
}
gcfg = gcfg || {}
Expand All @@ -219,7 +219,7 @@ module.exports = Generator.extend({
}
gcfg.project.db = '/opt/backups/latest.sql.gz';

// Backups configuration is introduced by p2-env.
// Backups configuration is introduced by outrigger-drupal:environment
gcfg.project.backups = {
url: 'http://' + env.virtualHost(false, 'backups') + '/' + options.projectName,
env: 'int'
Expand Down
2 changes: 1 addition & 1 deletion generators/environment/templates/bin/doctor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ if [ -z "$1" ] || [ "$1" == 'devtools' ]; then
fi

if [ -z "$1" ] || [ "$1" == 'generator' ]; then
heading 'Code Generated with Yo P2'
heading 'Code Generated with Yo Outrigger Drupal'
assertDir 'src' $ERROR
assertFile 'package.json' $ERROR
assertFile 'composer.json' $ERROR
Expand Down
6 changes: 3 additions & 3 deletions generators/environment/templates/bin/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ NAME=`basename "$0"`
NO_VALIDATE=''
NOOP=0
# This version is used to facilitate troubleshooting, by indicating which
# version of the generator-p2-env project produced this script. If you re-run
# the generator please include the update. If you make significant changes
# consider creating a compount version "number" indicating that.
# version of the generator-outrigger-drupal project produced this script.
# If you re-run the generator please include the update. If you make significant
# changes consider creating a compound version "number" indicating that.
START_VERSION=<%= pkg.version %>
# By default we install a new Drupal site rather than update an existing Drupal site.
UPDATE=0
Expand Down
12 changes: 7 additions & 5 deletions generators/lib/tokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ var gadgetTokens = require('generator-gadget/generators/lib/util').tokens;
var dockerComposeLink = require('./util').dockerComposeLink;

/**
* Produces tokens based on flagged options and prompt answers for p2:app or
* other sub-generators. These tokens are used by the templating process.
* Produces tokens based on flagged options and prompt answers for
* outrigger-drupal:app or other sub-generators. These tokens are used by
* the templating process.
*
* @todo move more of these pieces to the hosting platform sub-system.
*/
Expand All @@ -17,9 +18,10 @@ module.exports = function(options) {

var tokens = options;

// This library is used by p2:environment and p2:jenkins directly, but those
// do not use or depend on prompts from generator-gadget which are needed to
// produce the gadget tokens.
// This library is used by outrigger-drupal:environment and
// outrigger-drupal:jenkins directly, but those do not use or depend
// on prompts from generator-gadget which are needed to produce
// the gadget tokens.
//
// These tokens are not needed either.
//
Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"name": "generator-p2",
"version": "3.0.1",
"description": "Phase2 Yeoman generator",
"name": "generator-outrigger-drupal",
"version": "3.1.0-pre",
"description": "Yeoman Generator for Outrigger-based Drupal projects.",
"license": "MIT",
"main": "app/index.js",
"repository": {
"type": "git",
"url": "https://bitbucket.org/phase2tech/generator-p2"
"url": "https://github.com/phase2/generator-outrigger-drupal"
},
"private": true,
"engines": {
"node": ">=4"
},
Expand All @@ -23,7 +22,8 @@
"yeoman-generator",
"drupal",
"docker",
"jenkins"
"jenkins",
"outrigger"
],
"dependencies": {
"chalk": "^1.0.0",
Expand Down
12 changes: 6 additions & 6 deletions test/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var gdtFiles = [
'test/features/example.feature'
];

describe('p2:app w/ Gadget', function () {
describe('outrigger-drupal:app w/ Gadget', function () {
before(function () {
return test.run(path.join(__dirname, '../generators/app'))
.inDir(appDir)
Expand Down Expand Up @@ -91,7 +91,7 @@ describe('p2:app w/ Gadget', function () {

});

describe('p2:app --replay', function () {
describe('outrigger-drupal:app --replay', function () {
var originalTestDirectory = test.testDirectory;

before(function (done) {
Expand Down Expand Up @@ -131,17 +131,17 @@ describe('p2:app --replay', function () {
it ('uses projectName based on previously stored option', function() {
var pkg = require(path.resolve(appDir, 'package.json'));
var yoRC = require(path.resolve(appDir, '.yo-rc.json'));
assert.equal(pkg.name, yoRC['generator-p2']['projectName']);
assert.equal(pkg.name, yoRC['generator-outrigger-drupal']['projectName']);
});
});

describe('p2:app w/ Gadget + p2:environment', function () {
describe('outrigger-drupal:app w/ Gadget + outrigger-drupal:environment', function () {
before(function (done) {
test.run(path.join(__dirname, '../generators/app'))
.inDir(appDir)
.withOptions({
'skip-install': true,
projectName: 'drupal8-p2env',
projectName: 'drupal8-outrigger-env',
projectDescription: 'test drupal8 project',
drupalDistro: 'drupal',
drupalDistroVersion: '8.x',
Expand All @@ -154,7 +154,7 @@ describe('p2:app w/ Gadget + p2:environment', function () {
mail: 'none',
environments: [],
offline: true,
domain: 'drupal8-p2env',
domain: 'drupal8-outrigger-env',
force: true
})
.on('end', done);
Expand Down
2 changes: 1 addition & 1 deletion test/environment.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var describeJson = function(appDir) {
};


describe('p2:environment', function() {
describe('outrigger-drupal:environment', function() {
var appDir = path.join(os.tmpdir(), './temp-test-environment');
console.log('Environment tests will be generated in "' + appDir + '"');

Expand Down
2 changes: 1 addition & 1 deletion test/jenkins.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ var describeXml = function(extended) {
};
}

describe('p2:jenkins', function() {
describe('outrigger-drupal:jenkins', function() {
var appDir = path.join(os.tmpdir(), './temp-test-jenkins');
console.log('Jenkins tests will be generated in "' + appDir + '"');

Expand Down

0 comments on commit 9b87567

Please sign in to comment.