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
Related
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.
In both Hydrogen and using a plug-in terminal platform, the default directory is one folder up from where my code file resides.
E.g., I’ll be working on a file with path, say, parent/code/file.py. When I run pwd in the plug-in's terminal or the equivalent via Hydrogen in the python script I get parent/, but I need it to be parent/code/ to import files etc.
Perhaps the default directory for Atom is the project that is folder of the project that is open?
Any ideas how to change the default current directory for Atom (or is it package specific) to the file i’m working on/executing in Hydrogen?
In the hydrogen settings you can choose the location where the kernel should be started.
The default is the 'First started project's directory'. You can choose 'Current directory of the file' there, which should give you what you want.
In Ansible, i need to take a parent directory or current path of file automatically, in some of chef framework we have chef::config,it ll take automatically file path.
e.g:
/tasks/main.yml:
name: execute cmd
command: python file.py
If I have my "file.py" in a tasks folder, I need to execute my playbook from that path only like: /home/playbook/roles/sample/tasks ,then only it taking a script file and running.Suppose when i run from root path i mean /home/playbook/ path,it shows "No such file or directory"
I have tried lookup(env,HOME), It just takes /home alone but not related to that file path.
So to take a current file path how to give in ansible???
Thanks
Answer from comments
script module will copy the file first and then run it. if you use roles, you should place scripts into roles/my_role/files folder.
I'm experimenting running scripts with Xcode and have got a couple of questions:
1) Xcode says to drag n drop the script into the run script section but that creates an absolute path: /Users/Me/Desktop/Project/etc. which is obviously no use if somebody else or a CI machine checks out the code. How to specify a relative path?
2) There's a permission denied error during the build when the script gets executed.
(I'm using scripts off here to experiment with https://gist.github.com/sekati/3172554)
"$SRCROOT" gives the project folder:
i.e: Users/yourUserName/MyProject
but if you have a workspace folder with multiple projects inside:
i.e: Users/yourUserName/MyWorkspace/MyProject
And you need just the workspace folder, use 2 dots:
"../SomeFodler"
While someFolder will be created in the workspace folder.
Simple as that.
1) Edit your script with the following:
Root of the project: ${SRCROOT}
Root of the build: ${CONFIGURATION_BUILD_DIR}
2) Press ⌘+8, click Build and read the error.
1) In an Xcode project of mine, I have the following script that generates the source code documentation. As you can see each line of the script uses a relative path. I don't even need to use ${SRCROOT}.
# change directory because Doxyfile is configured with a relative input path ".."
cd doxygen
# clean the directory
rm -rf html
# generate docs
/opt/local/bin/doxygen Doxyfile
# open the html documentation
open html/index.html
2) The reason for the "permission denied" error may be that you have not set the executable bit on the script. On the console, type this command to set the executable bit, then try again to run the script.
chmod +x /path/to/xcode-build-bump.sh
Xcode includes a flexible build rules system. The documentation is all but non-existant however.
A project I am working on for iOS 5 and iOS 6 includes an rtf help file. For iOS 6, I can convert the rtf file into an archived NSAttributedString object, then load that at runtimeand display it directly to a UITextView. For iOS 5, I can't (without a lot of work in Core Text...) so I want just the text without the style info.
I wrote a command line tool, RTFToData that takes an RTF file as input and generates a .txt file and a .data file (where the .data file contains a version of the styled text that my project knows how to use.)
Here is the syntax of my command line tool:
RTFToData [-o] source_path [destination_path]
-o (optional) overwite existing files
source_path (required) path to source RTF file (must have extension "rtf" or "RTF"
destination_directory (optional.) writes output files to source file directory if no destination specified
destination_directory must exist if specified.
I want to set up my project so that I can add .rtf files as sources (with the "add to target" checkbox NOT checked.) I want Xcode to run my RTFToData command on each file specifying that the output files should be copied into a directory and then added to the target.
Ideally, I'd like the build process to know about the dependencies between my source .rtf files and the processed .data and .txt files. If I touch a .rtf file, I'd like the build process to re-run the rtftodata command.
I am a makefile and unix scripting neophyte. I THINK I can use a run script build rule that will do this, but I am unclear on how. I guess I need to write a script that finds all files of type ".rtf", pipes that list of files into an invocation of my RTFToData.
Can somebody outline the steps I need to take in the Xcode IDE to make my project handle this smoothly?
As a side-note, is there some directory where you can put command line tools so they are available to the current version of Xcode? So far I've been installing the RTFToData command in /Library/usr/bin, but I'd really like the build tool to be included in the project, or at the very least, not have to use sudo to set up every development machine that is used to build this project.
Create a custom build phase
Add the .rtf files to your project and make sure they are added to your target.
Go to your target settings and select the "Build Rules" tab:
Click the "Add Build Rule" button at the bottom.
You want to configure your rule based on something like this:
Enter a standard wildcard glob for the files you want to match (*.rtf).
Inside the script section you can make use of a number of environment variables. Assuming your glob has matched the input file Test.rtf you have access to these vars:
INPUT_FILE_PATH = /path/to/your/project/source/Test.rtf
INPUT_FILE_NAME = Test.rtf
INPUT_FILE_BASE = Test
INPUT_FILE_SUFFIX = .rtf
INPUT_FILE_DIR = /path/to/your/project/source/
You want to process your file and send it to the ${DERIVED_FILES_DIR} directory with whatever new filename or extension you need. In this case we take the base filename from the input and give it a new extension.
Fill out the "Output Files" section with the same output file you used in the script. This will ensure the dependency system works and that the file will be copied to your .app. The script will only be run if the input has changed or the output file is missing from the .app.
Note that the "Output Files" should not have double quotes. The paths will be quoted for you by Xcode.
If your script generates multiple output files, add extra entries for those as well.
Once this is all set up, .rtf files added to your target will be converted to whatever output files your script generates. The original .rtf files will not exist in the final .app.
Where to put scripts/programs
As a side-note, is there some directory where you can put command line
tools so they are available to the current version of Xcode?
Put your tools somewhere below the directory that contains your .xcproject. Then from your build phase/rules use the ${SRCROOT} environment variable, which is the directory containing your project:
Assuming this file system layout:
/path/to/project/project.xcodeproj
/path/to/project/Tools/CommandLineTool
Use this in your build phase/rules:
"${SRCROOT}/Tools/CommandLineTool" "${INPUT_FILE_PATH}" ...
Remember to use double-quotes everywhere you can!