PhpStorm - Run tests from Git Scope - phpunit

I'm using Git Scope plugin for PhpStorm. I really like the feature allowing me to search within files that were changed in all commits that I made in the current branch.
I'm looking for a similar way to run tests (all affected files) that were changed. I tried to select files from Git Scope tree and use the context menu, but there are only diff options. I also tried to change run/debug configuration for PHPUnit but I cannot find any ways to set input files as Git Scope.

Related

Ctrl-r do not run when the build directory has been changed

By default the build directory of a project is a sibling, withing the same directory than the project himself.
To have a better organisation in my backup process, I have moved the defaut build path in a directory which is sibling of the parent directory of all my projects. The compilation default path has been updated accordingly.
Now I only backup my projects, without the builds.
The problem I'm facing now is about the execute key combo Ctrl-r for which I get the compilation progress bar, but in fact, the project is not compiled now. This is confirmed because the compiled files do not update within the buid directory.
The only way, now, to update compilation is through the menu Build-> build all. It works but without key binding and I need after to execute.
Is there a way to recover Ctrl-r when changing the build directory path ?
Thanks for help
When you run a project from Qt Creator, it gets rebuilt only if needed, as clearly stated here:
Run configurations start the application in the location where it was
copied by the deploy configuration. By default, when you select the
Run function, Qt Creator builds the project, deploys it to the device
defined in the kit, and runs it there. However, if you have not made
any changes to the project since you last built and deployed it, Qt
Creator simply runs it again.
The only way to force build is to issue the rebuild command explicitely (you can use the Ctrl-B shortcut for that purpose).
If the default build directory is changed (in Tools>Options>Build & Run>General) this setting will apply (as a default) for subsequently created projects. Existing projects will keep their build directory, as specified in the project Build Settings.
You may also want to check if the options
Always build project before deploying it
Always deploy project before running it
in Tools>Options>Build & Run>General are set.
Sometimes, editing a header file does not trigger a build, even if the file is included in some cpp file. To solve this issue in Qt Creator, just add a line like this to the pro file:
DEPENDPATH += path/to/the/header(s)

Proper way to remove Gruntjs, package.json and other files from release branch

I am developing a wordpress theme. I am new to using Grunt and composer for packages.
I have also integrated git flows. At the moment I am developing on develop branch and then merge to master once I am satisfied with the code.
The problem I am facing is that my master branch has Gruntfile.js as well as package.json in it. Similarly there are sass files in css folders. I want a clean release branch, in which there are only required theme files and no gruntjs, pacakge.json and sass files.
These all files are being tracked in master, how can I create a clean release branch.
I have followed the Woocommerce repository for making my development environment.
I could not find a build process in it also. Am I missing any proper step?
P.S : I don't know if I should be sharing any code samples here, but if you want anything I can share it here.
As far as I'm aware you can't do what you're trying to do and I don't believe git is meant to work that way. Having your grunt & SASS files in the master branch is the correct way of doing this, those files are also in the Woocommerce repository you've linked to.
I'm guessing what you're trying to do is create a release of a theme that doesn't have any of the 'development only files', for lack of a better term, to give to the the end user installing the theme? If so that release would be a separate 'thing' to git as git is mainly for developer version control. What I think you're after is just creating a stand-alone downloadable zip file by the sounds of things?
For example if you were to submit your theme to WordPrss.org they take it as a zip file rather than a link to a git repository.

Should build folders be included in a git repo?

I'm trying to set up a git repository for my bespoke WordPress theme builds, using gulp to compile the code but im struggling to understand how to manage the repo.
The outcome I'm after:
Use a separate repo to pull in my gulp workflow. (Could be housed as a submodule)
Offer developers full access to my gulp workflow, src and build.
Push the build folder to remote servers such as production and staging.
Current Scenario
My gulp workflow will be held in a separate repo as it will be used amongst several different builds.
The current workflow I can think of would look like this:
gulp-wp-build -> git repo
src -> git repo
build -> WordPress ready theme not held in a repo
Ideally though I'd like to be able to push my code to the production and staging servers through git and I understand that to do this I'd need to do include the build folder inside of my repo. But would including both my src folder and build folder within the repo be overkill?
I like the idea of containing everything inside of one repo so other developers can work on the theme later down the line using either their gulp workflow or the one I used for the build.
But really in terms of pushing changes through git I'd only want the build to be pushed live so could I separate this build folder from the repo when pushed to a certain remote?
Use a .gitignore file to do that.
create a .gitignore file and inside put the path or the files that will be ignored by git.
relative/Path/to/your/autogenerated/files/*
after you finish, commit and push your file to your remote repository
check this link

Ignore git files locally but do not remove them from the repository

My team has is working on a git repository which contains a fully deployable Wordpress app. This was configured in this way so that it could be deployed to a AWS stack quite easily. The repository contains a caching plugin which creates two folders in the wp-content/ folder named
cache/
w3tc-config/
When devs are checking out this application they are removing the caching features for development and thus the plugin is writing these changes to the two directories it uses. Which then encourages .git to stage them for a commit.
Is there anyway we can ignore these folders on dev machines but not remove them from the repo? Also i'd be interested in hearing other solutions which might help me get round this problem even if it is a larger change.
If you check out your repository and let master follow that, then you can create a devel branch where you just add cache w3tc-config to .gitignore.
I do something similar at work where I use git-svn to work with a svn repository which "links" in another svn repository for a sub module. Git clone did not fetch that sub module, so I just copied in the content from a svn checkout, checked into a devel branch (leaving master following the svn trunk branch), and added the sub module directory to .gitignore.
This is a solution that will require specific action from each developer, and not something you can push out from the repository. But similar to git hooks, if you create a tools/do_it.sh script that does the required actions it is possible to lower the bar considerably.
You cannot have it both ways. Either the files are tracked or they are not. You cannot keep files in the repository but avoid tracking changes to them. Once they are tracked, it is up to you to not git add them. (And it is worth noting that git does not track folders ever.)
Create an archive called UnzipMeRightAfterCloning.zip that contains all the stuff you want ignored. Anyone cloning the repo needs to extract that archive, and it will add all the files/folders blocked by your .gitignore settings. (And given your current setup, you will have to untrack the files in those folders first.)
Put these in your .gitignore file. (Do not put in asterisk.)
cache/
w3tc-config/
Yes, create a local .gitignore file in the project directory.
in the file paste the following
cache/*
w3tc-config/*
Now, these files will be excluded from git, but they won't be removed from the repository.

How can Hudson delete the artifacts created by my build?

Our organization's custom build tools write out a lot of intermediate data, and I'd like it if Hudson could detect which files were created as part of a build and archive those. I'm not sure if it already does so, but if it does there's no user-visible explanation of it, and certainly deleting a build does not delete its output.
In detail here's what I want. Suppose I start with a bare workspace. After build 1, I have this:
ws/
src/...
obj/
1/...
log/
1/...
pkg/
pkg-1.tgz
Now, I run build 2:
ws/
src/...
obj/
1/...
2/...
log/
1/..
2/..
pkg/
pkg-1.tgz
pkg-2.tgz
The source code is checked out into ws/src each build; there's a custom checkout process, so I can't use the svn RCS method :/.
When I delete a build, I'd like to delete everything that came from that build. Can I do this?
The Hudson way would be to clean up all temporary files at the beginning of the build, and then use Hudson's artifacts archive facility to save the output from each build - specify pkg/**/*.tgz for the "Archive the Artifacts" post build step and then the tgz files will all be copied into the job specific storage area.
The workspace is just a workspace - it's not intended for long term storage.
What I would do, if I were in your shoes, would be to solve the problem a different way. I would write a task or script that specifically deletes everything you don't want to keep, and run that task or script at the end of each job.
Hudson assumes you're cleaning up temp files on your own. If that's not happening, I don't believe Hudson has any facility to help you.
It's difficult to answer without understanding your "custom checkout process", but typically all of the project's build artifacts are created beneath a single directory apart from the src, e.g. "build" or "target".
That way, the project's "clean" target can simply remove that directory, and you can instruct Hudson to include this target for each build.
It appears your build artifacts are contained in multiple directories relative to 'src': 'obj', 'log', and 'pkg'. Can you introduce a "clean" target that will explicitly delete each of those directories?

Resources