How to integrate Hybris Custom and Config folder to local installation? - bitbucket

I installed Hybris 1905 out of the box locally on my machine and I would like to include the custom code which our project stores on bitbucket.
To track the progress of the commits, I installed earlier Sourcetree and have integrated the repository. The repo is stored locally in directory
C:\git\projectname
How can I now get the folders custom and config into my local installation to be able to run always the latest code in my local machine? Thanks!

You can create a symlink or directory junction.
Assuming your custom config is stored in C:\git\projectname\config and your custom code is stored in C:\git\projectname\bin\custom
In hybrisHomeDirectory, open command prompt then type :
mklink /J config C:\git\projectname\config
this will create a directory junction that link your config to hybris installation folder.
In hybrisHomeDirectory/bin, open command prompt then type :
mklink /J custom C:\git\projectname\bin\custom
This will create a directory junction that link your custom code.
If you want to create a symlink instead of directory junction (requires admin), then open cmd as administrator and type mklink /D instead of mlink /J

Config folder
In order to refer a config folder(other than the default one) you can edit your hybris\bin\platform\setantenv.bat. For example please have a look at my setantenv.bat that I used in the past:
#echo off
set ANT_OPTS=-Xmx2g -Dfile.encoding=UTF-8 -Djdk.util.jar.enableMultiRelease=force
set ANT_HOME=%~dp0apache-ant
set PATH=%ANT_HOME%\bin;%PATH%
rem deleting CLASSPATH as a workaround for PLA-8702
set CLASSPATH=
Rem Custom zone start
set HYBRIS_RUNTIME_PROPERTIES=%~dp0local_custom.properties
chcp 65001
set HYBRIS_CONFIG_DIR=%~dp0..\..\..\gitrepo\config
echo -------CustomChanges--------
echo CustomChanges: configFolder: %HYBRIS_CONFIG_DIR%
echo CustomChanges: runTimeProperties: %HYBRIS_RUNTIME_PROPERTIES%
echo -------CustomChanges--------
Rem Custom zone end
echo ant home: %ANT_HOME%
echo ant opts: %ANT_OPTS%
ant -version
Between Rem Custom zone start and Rem Custom zone end there is the Custom section that, among other things, sets the path to the config folder.
In my case, hybris folder and gitrepo folder are right next to eachother(in the same parent folder) and that is why the following path(also mentioned above) works:
set HYBRIS_CONFIG_DIR=%~dp0..\..\..\gitrepo\config
Keeping these two folders next to each other makes it easier to use relatives paths in order to easily use resources from git Repo into Hybris.
Custom folder
In order for Hybris to take into consideration the custom extensions, their folder needs to be specified in the localextensions.xml as exemplified below:
<path autoload="true" dir="${HYBRIS_BIN_DIR}/../../gitRepo/extensions"/>
Again, above relative path works for me because hybris and gitrepo folders are next to each other.

Related

Copying Source Directory to a shared network folder within a TFS Build

I am trying to copy all the files within my source folder in a TFS collection to a VM that I have set up. The VM has a shared folder I can access within the file explorer by typing \\*IPAddress*\share (where IPAddress is the IP of the VM).
I tried to copy the source folder by adding a "Copy Files" build task in TFS 2015.
In the Source Folder section I have added the folder that I wish to copy.
In the Contents section I have left it as ** to get each file within the Source Folder
In Target Folder I have put the address that I can navigate to within the file explorer : \\*IPAddress*\share (where IPAddress is the IP of the VM)
When I queue the build and run it I get the following error:
Unable to create directory '\\*IPAddress*\share'. Unable to verify the directory exists: '\\*IPAddress*\share'. If directory is a file share, please verify the share name is correct, the share is online, and the current process has permission to access the share.
When I hover of the the little "I" next to target folder it states that it can be a UNC Path, so I know I'm able to copy the files but I'm not sure if I'm referencing the share folder correctly.
How would I reference this? One thing that may also be giving an issue is that when I navigate to the share from the File Explorer I have to enter credentials to access the share folder, so maybe it doesn't have permission to access the share because of this.
Tested and Windows Machine File Copy task works for me with providing the credential to access the shared path.
For Copy Files task, you can try to grant the Read and Write permissions for the build agent service account (Which you specified during deploy the agent), then try it again.
Besides, you can also create a script to copy the files, then add a command line or PowerShell task to run the script.
For example, you can use below PowerShell script to copy the sources files with the specific username and password provided:
$Source = $env:BUILD_SOURCESDIRECTORY
$Dest = "\\172.17.16.115\CopyTest"
$Username = "domain\username"
$Password = ConvertTo-SecureString "PasswordHere" -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential($Username, $Password)
New-PSDrive -Name J -PSProvider FileSystem -Root $Dest -Credential $mycreds -Persist
Copy-Item -Path $Source -Recurse -Force -Destination $Dest

yeoman creates project in Desktop even though I CD into directory

I am having a issue creating a yeoman project. I cd in the directory type yo and it says:
Here is it suppose to asked me project name etc and it wants to throw everything on my desktop not the file I cd into. It defaults to mvn and I want gradle. I even npm uninstall -g generator-jhipster
and reinstalled it and got the same issue.
If you have a .yo-rc.json file in a parent directory, Yeoman will load that configuration and generate from that file instead of prompting. This allows developers to run a yo command from any folder in the project and have it apply to the correct files.
To solve this, remove the .yo-rc.json from the parent directory, in your case /Users/drew/Desktop.
For example, if you are in the directory /Users/drew/Desktop/new-project but /Users/drew/Desktop has a .yo-rc.json inside, Yeoman will change to the parent directory (Desktop), load the configuration, and generate the files from that folder instead of the child folder.
Based on your log it's looks like you are running yo in a folder where a .yo-rc.json is already existing. Careful under windows the .yo-rc.json can be that is of type hidden and you can't see it in explorer. Because of an existing .yo-rc.json you are not asked anymore for info e.g. project name, build tool etc. My recommendation will be to create a new folder run inside yo command

Change fortify .NST file Generation Location

Currently, the .NST files after build are getting generated at "C:\Users\XYZ\AppData\Local\Fortify\sca6.2\build" folder. How can I change the it to some other folder in my system?
There are two files that need to be updated, located in the /Core/config:
fortify.properties
com.fortify.WorkingDirectory=${win32.LocalAppdata}/Fortify
fortify-sca.properties
com.fortify.sca.ProjectRoot=${win32.LocalAppdata}/Fortify
If you are also using the Eclipse plugin, make sure to change the files inside of there as well:
\plugins\com.fortify.dev.ide.eclipse_X.XX.X\Core\config\fortify.properties"
Make sure that fortify will have permissions to read/write to the new target location. Depending on how locked down your environment is (permissions, GPs) this could be tricky.
Update:
If you wanted to change a setting for once scan and/or cannot update the properties files, you can update the properties through commandline arguments.
You would need to pass these arguments on all commands to sourceanalyzer to work (clean, translate, and scan).
For any propertie that needs to change, you pass the following in the command:
-D<property>=<value>
In this case (assuming you want to put the working directory D:\Samples\eightball\working Directory):
-Dcom.fortify.sca.ProjectRoot="D:\Samples\eightball\working Directory"
Here is the batch file I used to scan the EightBall.java example file (normally located at <fortify Install Dir>\Samples\Basic\EightBall\ and moved it to D:\Samples\EightBall\
# Clean
sourceanalyzer -b eightball -Dcom.fortify.WorkingDirectory="D:\Samples\eightball\working Directory" -Dcom.fortify.sca.ProjectRoot="D:\Samples\eightball\working Directory" -clean
# Translate
sourceanalyzer -b eightball -Dcom.fortify.WorkingDirectory="D:\Samples\eightball\working Directory" -Dcom.fortify.sca.ProjectRoot="D:\Samples\eightball\working Directory" -source 1.5 EightBall.java
# Scan
sourceanalyzer -b eightball -Dcom.fortify.WorkingDirectory="D:\Samples\eightball\working Directory" -Dcom.fortify.sca.ProjectRoot="D:\Samples\eightball\working Directory" -scan -f EightBall.fpr

Permanently add bower proxy

How do I permanently add bower proxy to my system so I do not have to edit the .bowerrc file for every project and add
{
"proxy":"http://<proxy>:<port>",
"https-proxy":"https://<proxy>:<port>",
}
I have added the proxys to my OS with:
export HTTP_PROXY=http://<proxy_url>:<port>
export HTTPS_PROXY=http://<proxy_url>:<port>
But it seams bower does not get it. Thank you in advance for your response
Put the .bowerrc file in your home folder (it will work on Windows as well).
From http://bower.io/docs/config/:
Placement & Order
The config is obtained by merging multiple configurations by this
order of importance:
CLI arguments via --config
Environment variables
Local .bowerrc located in the current working directory
All .bowerrc files upwards the directory tree
.bowerrc file located in user’s home folder (~)
.bowerrc file located in the global folder (/)
Example of CLI arguments:
--config.endpoint-parser=
--config.storage.cache=
Example of valid environment variables:
bower_endpoint_parser is evaluated as endpoint-parser
bower_storage__cache is evaluated as storage.cache

How to 'set path' automatically when opening Vim from a directory?

I'm trying to get :A (e.g. switch between controller and spec) working in vim-rails. If I navigate to my rails project, run vim ., open a controller file and run :A, I get the error:
E345: Can't find file "app/controllers/widgets_controller.rb" in path
If I then set the path explicitly:
:set path=/Users/me/Documents/Code/my-project
then :A works as expected. How can I set the path initially when I open a directory with Vim?
Not exactly when opening a directory: since you seem to be working with projects, give the project plugin a try.
Using that, you could execute arbitrary commands when entering or leaving a project.
From the plugin description:
You can use this plugin's basic functionality to set up a list of
frequently-accessed files for easy navigation. The list of files
will be displayed in a window on the left side of the Vim
window, and you can press or double-click on
filenames in the list to open the files. This is similar to how
some IDEs I've used work. I find this easier to use than
having to navigate a directory hierarchy with the file-explorer.
It also obviates the need for a buffer explorer because you
have your list of files on the left of the Vim Window.
This is what I do to have a local .vimrc file per project:
In my ~/.vimrc file I define the following:
let s:project_root = finddir('.git/..', expand('%:p:h').';')
let s:local_vimrc = join([s:project_root, '.vimrc'], '/')
if filereadable(s:local_vimrc)
exec "source " . s:local_vimrc
endif
In the project root (which usually has a .git dir) I do the following:
touch /path/to/project/.vimrc
In the .vimrc file, I prepend the path variable (notice the ^path). Using :set path^= instead of :set path+= prepends the new directory to the beginning of the path instead of appending it to the end. This makes it faster for the find command to search for your files.
let s:project_root = finddir('.git/..', expand('%:p:h').';')
exec 'setlocal path^='.s:project_root
setlocal wildmode=longest,list,full
setlocal wildmenu
setlocal tags=/path/to/project/root/tags
Now the :find command should only display files and directories relative to the project root.

Resources