Skip to content
This repository has been archived by the owner on Sep 15, 2023. It is now read-only.

Commit

Permalink
Fixed process.cwd() changes and reverted previous fixes
Browse files Browse the repository at this point in the history
Changing from `--gulpfile node_modules/blendid/gulpfile.js` to
`--gulpfile node_modules/blendid/gulpfile.js/index.js` had the unintended
consequence of making the `process.cwd()` not the same being one directory
lower than before.

As such, a workaround fix was performed in 19e4825 & 538c85c to make
blendid assets now relative one level lower also.

This was not a proper fix and instead, the `bin/blendid` script has been
updated to use one level lower by pointing to the previous directory
directly instead of pointing to the main file of the directory. Previous
modifications of previous workaround were reverted.

As part of testing, fixed a bunch of small globbing problem with Gulp like
.gitkeep files not copied or some other files not ignored correctly.
  • Loading branch information
maoueh authored and benjtinsley committed Jan 24, 2018
1 parent 6809dd4 commit 6a29c48
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions bin/blendid.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
const path = require('path')

const additionalArgs = require('minimist')(process.argv.slice(2))._
const blendidEntryFile = path.resolve(__dirname, '../gulpfile.js/index.js')
const blendidEntryDir = path.resolve(__dirname, '../gulpfile.js')
const gulpModulePath = path.dirname(require.resolve('gulp'))
const gulpBinaryFile = path.join(gulpModulePath, '/bin/gulp')

let args = ['--gulpfile', blendidEntryFile]
let args = ['--gulpfile', blendidEntryDir]

if(additionalArgs.length) {
args = args.concat(additionalArgs)
Expand Down
4 changes: 2 additions & 2 deletions gulpfile.js/tasks/http2-upgrade.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ gulp.task('http2-upgrade', function() {
del([projectPath(PATH_CONFIG.src, PATH_CONFIG.stylesheets.src)], { force: true })
log(colors.green('Cleaned stylesheets directory'))

const configStream = gulp.src('../extras/http2/**/*')
const configStream = gulp.src('extras/http2/**/*')
.pipe(gulp.dest(projectPath()))

const srcStream = gulp.src(['../src/stylesheets', '../src/javascripts', '../src/html'])
const srcStream = gulp.src(['src/stylesheets', 'src/javascripts', 'src/html'])
.pipe(gulp.dest(projectPath(PATH_CONFIG.src)))

log(colors.green('Created HTTP/2 ready stylesheets directory'))
Expand Down
4 changes: 2 additions & 2 deletions gulpfile.js/tasks/init-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ var colors = require('ansi-colors')
var projectPath = require('../lib/projectPath')
var merge = require('merge-stream')

gulp.task('init-config', function() {
var configStream = gulp.src(['./path-config.json', './task-config.js'])
gulp.task('init-config', function () {
var configStream = gulp.src(['gulpfile.js/path-config.json', 'gulpfile.js/task-config.js'])
.pipe(gulp.dest(projectPath('config')))

log(colors.green('Adding default path-config.json and task-config.js files to ./config/'))
Expand Down
4 changes: 2 additions & 2 deletions gulpfile.js/tasks/init-craft.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ const mergeStream = require('merge-stream')
const projectPath = require('../lib/projectPath')

gulp.task('init-craft', function() {
const configStream = gulp.src(['../extras/craft/**/*', '*!ASSET-README.md'])
const configStream = gulp.src(['extras/craft/**/*', '!**/ASSETS-README.md'])
.pipe(gulp.dest(projectPath()))

const srcStream = gulp.src(['../src/**/*', '*.gitkeep', '!../src/html{,/**}', '!../src/static{,/**}'])
const srcStream = gulp.src(['src/**/*', 'src/**/.gitkeep', '!src/html{,/**}', '!src/static{,/**}'])
.pipe(gulp.dest(projectPath(PATH_CONFIG.src)))


Expand Down
4 changes: 2 additions & 2 deletions gulpfile.js/tasks/init-drupal.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ const projectPath = require('../lib/projectPath')
gulp.task('init-drupal', function() {
const envBasename = path.basename(process.env.INIT_CWD)

const configStream = gulp.src(['../extras/drupal/**/*', '!../extras/drupal/src/', '!../extras/drupal/src/**/*', '!**/README.md'])
const configStream = gulp.src(['extras/drupal/**/*', '!extras/drupal/src/', '!extras/drupal/src/**/*', '!**/README.md'])
.pipe(rename(function (filepath) {
filepath.basename = filepath.basename.replace('THEMENAME', envBasename);
}))
.pipe(replace('THEMENAME', envBasename))
.pipe(gulp.dest(projectPath()))

const srcStream = gulp.src(['../extras/drupal/src/**/*', '*.gitkeep'])
const srcStream = gulp.src(['extras/drupal/src/**/*', 'extras/drupal/src/**/.gitkeep'])
.pipe(gulp.dest(projectPath(PATH_CONFIG.src)))

log(colors.green('Created config/path-config.json'))
Expand Down
2 changes: 1 addition & 1 deletion gulpfile.js/tasks/init-rails.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var colors = require('ansi-colors')
var projectPath = require('../lib/projectPath')

gulp.task('init-rails', function() {
var stream = gulp.src(['../extras/rails/**/*', '*!README.md'])
var stream = gulp.src(['extras/rails/**/*', 'extras/rails/**/.gitkeep', '!**/ASSETS-README.md'])
.pipe(gulp.dest(projectPath()))

log(colors.green('Created app/helpers/blendid_asset_helper.rb'))
Expand Down
6 changes: 3 additions & 3 deletions gulpfile.js/tasks/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ var projectPath = require('../lib/projectPath')
var merge = require('merge-stream')

gulp.task('init', function() {
var defaultStream = gulp.src(['../extras/default/**/*'])
var defaultStream = gulp.src(['extras/default/**/*', 'extras/default/**/.*'])
.pipe(gulp.dest(projectPath()))

var configStream = gulp.src(['./path-config.json', './task-config.js'])
var configStream = gulp.src(['gulpfile.js/path-config.json', 'gulpfile.js/task-config.js'])
.pipe(gulp.dest(projectPath('config')))

var srcStream = gulp.src(['../src/**/*', '*.gitkeep'])
var srcStream = gulp.src(['src/**/*', 'src/**/.gitkeep'])
.pipe(gulp.dest(projectPath(PATH_CONFIG.src)))

log(colors.green('Generating default Blendid project files'))
Expand Down

0 comments on commit 6a29c48

Please sign in to comment.