Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#41957 closed defect (bug) (fixed)

Fix Grunt tasks to run without needing access to svn or git

Reported by: azaozz's profile azaozz Owned by: azaozz's profile azaozz
Milestone: 4.9 Priority: normal
Severity: normal Version: 4.9
Component: Build/Test Tools Keywords: has-patch commit
Focuses: Cc:

Description

In the Grunt config we (cleverly) test which files were modified before running the precommit task to save some time and not process and test unmodified files.

However in some cases the svn or git commands may not be globally accessible in the terminal. This usually happens when they are installed as part of larger packages like IDEs, GUIs, etc.

In these cases we exit with an error but we can still perform all building and testing tasks.

Attachments (2)

41957.patch (2.7 KB) - added by azaozz 7 years ago.
41957.2.patch (3.1 KB) - added by azaozz 7 years ago.

Download all attachments as: .zip

Change History (9)

@azaozz
7 years ago

#1 @azaozz
7 years ago

  • Keywords has-patch added

#2 in reply to: ↑ description ; follow-up: @netweb
7 years ago

Replying to azaozz:

However in some cases the svn or git commands may not be globally accessible in the terminal. This usually happens when they are installed as part of larger packages like IDEs, GUIs, etc.

In testing this I also thought of the scenario where a zip file of the WordPress devlop repo is downloaded and extracted to a folder, this could be either:

As such there is no .git or .svn folders yet the git and svn commands may still be available and running grunt precommit from the terminal Grunt throws a fatal and exits:

  • grunt.fatal( 'This WordPress install is not under version control.' ); ( Gruntfile.js#L864 )

@azaozz I'm guessing this still occurs in the environment you've tested with using the 41957.patch and that the Grunt fatal is suppressed though and not seen, as such your patch then allows precommit to continue.

I'm thinking rather than Grunt throw a fatal in the first place we should add support to have a more generic fallback for when neither the Git or SVN folders or commands are available to then as you propose to run the full grunt precommit suite of tasks?

#3 in reply to: ↑ 2 @azaozz
7 years ago

Replying to netweb:

Yep, with the patch when there is no .svn or .git dir Grunt still throws the fatal.

I'm thinking rather than Grunt throw a fatal in the first place we should add support to have a more generic fallback...

Sounds good.

@azaozz
7 years ago

#4 @azaozz
7 years ago

Something like 41957.2.patch should work whether svn or git are used or not.

#5 follow-up: @netweb
7 years ago

  • Keywords commit added

I'm not able to test this until next week (on holidays for a week) but visually it looks good to me @azaozz :)

#6 in reply to: ↑ 5 @azaozz
7 years ago

Replying to netweb:

Sure, lets add this. Feel free to tweak it or revert it as you see fit :)

#7 @azaozz
7 years ago

  • Owner set to azaozz
  • Resolution set to fixed
  • Status changed from new to closed

In 41708:

Tools: enable Grunt precommit task to run without requiring SVN or GIT.

Fixes #41957

Note: See TracTickets for help on using tickets.