I have an EXE, let's call it MyApp.exe
I then have a folder containing a a list of unit tests. Eg.
-MyTest1.txt
-MyTest2.txt
-MyTest3.txt
-MyTest4.txt
I'd like to run:
MyApp.exe --File=MyTest1.txt (obviously if it was MyTest2.txt that was modified I'd want to have that be the input).
any time MyTest1.txt or one of the other files are modified.
What's the simplest way to do this with Grunt?
Turned out to be pretty simple.
See: https://www.npmjs.org/package/grunt-contrib-watch
Search page for:
"A very common request is to only compile files as needed. Here is an example that will only lint changed files with the jshint task:"
Related
Here's what I'm trying to achieve:
Every time make is called, inside my Makefile I have a call to a script which runs a lint tool. However I want to avoid telling lint to search the entire code base again, instead it should only run against the files that make did an incremental build. If the file was not re-compiled, there is no need to run lint on it again.
I don't know how make checks which files need to be re-compiled on incremental builds. I don't think that is stored as a list anywhere either.
If I don't want to wrap make with script that logs its output and then later analyses its stdout to see which files have been re-compiled, is there any other way to get this incremental build list?
It's not clear to me why you only want to run lint on the files that were out of date on this invocation of make. What if you run make 5 times and only during the fifth you re-run the lint tool... then you'd just lint the files that were modified during the fifth run of make but you wouldn't lint the files modified during the first four runs.
It seems to me like you really want to run lint on all the files that have been modified since the last time you ran lint. This is trivial to do:
run-lint: $(SOURCES)
lint $?
#touch $#
The $? automatic variable expands to just the files that are newer than the target file, then after the lint is complete we touch the target file so it's now up to date. Every time you run make run-lint it will lint all the files that have changed since the last time you ran it.
I am using Robot Framework, to run 50 Testcases. Everytime its creating following three files as expected:
c:\users\<user>\appdata\local\output.xml
c:\users\<user>\appdata\local\log.html
c:\users\<user>\appdata\local\report.html
But when I run same robot file, these files will be removed and New log files will be created.
I want to keep all previous run logs to refer in future. Log files should be saved in a folder with a time-stamp value in that.
NOTE: I am running robot file from command prompt (pybot test.robot). NOT from RIDE.
Could any one guide me on this?
Using the built-in features of robot
The robot framework user guide has a section titled Timestamping output files which describes how to do this.
From the documentation:
All output files listed in this section can be automatically timestamped with the option --timestampoutputs (-T). When this option is used, a timestamp in the format YYYYMMDD-hhmmss is placed between the extension and the base name of each file. The example below would, for example, create such output files as output-20080604-163225.xml and mylog-20080604-163225.html:
robot --timestampoutputs --log mylog.html --report NONE tests.robot
To specify a folder, this too is documented in the user guide, in the section Output Directory, under Different Output Files:
...The default output directory is the directory where the execution is started from, but it can be altered with the --outputdir (-d) option. The path set with this option is, again, relative to the execution directory, but can naturally be given also as an absolute path...
Using a helper script
You can write a script (in python, bash, powershell, etc) that performs two duties:
launches pybot with all the options you wan
renames the output files
You then just use this helper script instead of calling pybot directly.
I'm having trouble working out how to create a timestamped directory at the end of the execution. This is my script it timestamps the files, but I don't really want that, just the default file names inside a timestamped directory after each execution?
CALL "C:\Python27\Scripts\robot.bat" --variable BROWSER:IE --outputdir C:\robot\ --timestampoutputs --name "Robot Execution" Tests\test1.robot
You may use the directory creation for output files using the timestamp, like I explain in RIDE FAQ
This would be in your case:
-d ./%date:~-4,4%%date:~-10,2%%date:~-7,2%
User can update the default output folder of the robot framework in the pycharm IDE by updating the value for the key "OutputDir" in the Settings.py file present in the folder mentioned below.
..ProjectDirectory\venv\Lib\site-packages\robot\conf\settings.py
Update the 'outputdir' key value in the cli_opts dictionary to "str(os.getcwd()) + "//Results//Report" + datetime.datetime.now().strftime("%d%b%Y_%H%M%S")" of class _BaseSettings(object):
_cli_opts = {
# Update the abspath('.') to the required folder path.
# 'OutputDir' : ('outputdir', abspath('.')),
'OutputDir' : ('outputdir', str(os.getcwd()) + "//Results//Report_" + datetime.datetime.now().strftime("%d%b%Y_%H%M%S") + "//"),
'Report' : ('report', 'report.html'),
I'm converting a premake4 config to premake5. My prebuildcommands are failing because the commands are executed from the root working directory, not the directory that the premake5.lua is in that contains the 'prebuildcommands'. premake4 executed them in the subdirectory containing the prebuildcommands call.
Is this the new intended behavior? If so, it's not documented anywhere that I can find. I don't mind correcting the paths as long as it's not an bug.
This looks like the correct behavior to me. Premake doesn't attempt to parse the commands to identify paths, so they are left intact as entered. The command itself is executed by the build tool (Visual Studio, GMake, etc.) and so will operate in whatever directory the tool makes current at that time.
If I'm reading it right, you would like the command to execute in the project directory, so what about:
prebuildcommands {
"%{prj.location}/styx/utils/ndate > %{prj.location}/include/kerndate.h"
}
For Visual Studio, Premake will convert those tokens to $(ProjectDir) so they will stay relative to the generated project file.
I have a Grunt task to concat 3x JS files into a single plugins.js file. I now no longer require one of the files (let's call it unrequired.js), so I've removed it from the list of source files in Gruntfile.js. However, whenever I run grunt concat, the output file still contains unrequired.js. The only way around it is to trash unrequired.js and then run the task again. Is there some kind of caching feature at play here? Does the concat task ignore changes being made to Gruntfile? What am I missing?
I have tried both ways to compile a project using compass (i.e. via the gui app, and the command line.)
I get this error in both instances. "Nothing to compile. If you're trying to start a new project, you have left off the directory argument.
Run "compass -h" to get help."
Where do you add the directory argument?
I suspect the way to get this working is just switch to your directory for your project and then run
compass init
This will then create you a "working" config.rb, and a directory called sass, and a directory stylesheets
and a couple of start scss files.
If you do not want them, or want to use different directories, you can of course now edit your freshly created and working config.rb, and change your directories (and then delete the old automatically created ones)
Anyway having done that(or not) you should then be able to run
compass watch
and all should be good , i.e. your scss files get compiled to css files
Or then run your gui tool
More information to be found in the compass documentation here