I have a template file which contains the following
{ MERGEFIELD [#include 'some.txt' parse=false] \* MERGEFORMAT }
some.txt resides in the same directory as the template file:
both of them are in src/main/java/resources/template
I get this exception all the time, no matter how I provide the path*.
freemarker.template.TemplateNotFoundException: Template not found for name "fr.opensagres.xdocreport.document.docx.DocxReport#37fcf94c!word/some.txt
*I have tried these:
{ MERGEFIELD [#include 'some.txt' parse=false] \* MERGEFORMAT }
{ MERGEFIELD [#include './some.txt' parse=false] \* MERGEFORMAT }
{ MERGEFIELD [#include '/absolutepath/some.txt' parse=false] \* MERGEFORMAT }
{ MERGEFIELD [#include '*/some.txt' parse=false] \* MERGEFORMAT }
I am totally clueless, because my file is in the same directory as the template file and the official documentation states:
The path parameter can be a relative path like "foo.ftl" and
"../foo.ftl", or an absolute like "/foo.ftl". Relative paths are
relative to the directory of the template that contains the import
directive.
Related
I am trying to create shared libs for jenkins to build the app. When I am trying to pass the the json string from groovy function to shell block for build command execution. whereas json string passing without quotes. How to retain the quotes.
stage('build app') {
steps {
script {
build project:"TestApp.xcodeproj",
workspace: "TestApp.xcworkspace",
scheme: "Develop",
config: "Debug",
target: "{ "TestApp": { "info_plist": "TestApp/Info.plist", "profile_name": "Test App Debug (January 2021)", "app_id": "com.******.Debug" } }"
}
}
}
def build(Map buildParams) {
sh """#!/bin/bash -l
export XCODE_PROJ="${buildParams.project}"
export XCODE_WORKSPACE="${buildParams.workspace}"
export XCODE_BUILD_SCHEME="${buildParams.scheme}"
export XCODE_BUILD_CONFIGURATION="${buildParams.config}"
export XCODE_TARGET_JSON="${buildParams.target}"
#build App
fastlane build app
"""
}
Expecting the json string as it is in shell block with "Quotes". Whereas getting error expecting '}' found :. When i escape the quotes of json strings, getting, values without "quotes"
{ TestApp: { info_plist: TestApp/Info.plist, profile_name: Test App Debug (January 2021), app_id: com.******.Debug } }
which results fastlane throwing error invalid token. How to retain the quotes in shell block variable
Escaping the quotes in json string with backslash() is worked for me.
'{ "TestApp": { "info_plist": "TestApp/Info.plist", "profile_name": "Test App Debug (January 2021)", "app_id": "com.******.Debug" } }'
I want to get a copy of the logs file using programmability, I just tried to copy the files using this command
$co= Storage::copy('logs/laravel-'.$start.'.log',$filename);
dd($co);
but I have an error which says the file does not exist,
I believe that is because storage looking in the default driver of the config file, how can I tell laravel to look in logs folder when I want to run the copy command, is there any way to do that .
Hi You can get the path of the log file with storage_path() and copy your file anywhere you want with php copy function
I think that is a easy way that you can do it:
<?php
function copyLogFile($logFileName, $destination)
{
$logPathDir = storage_path().'/logs/';
$logFilePath = $logPathDir . $logFileName;
if (file_exists($logFilePath)) {
if( !#copy($logFilePath, $destination) ) {
echo "File can't be copied! \n";
$errors= error_get_last();
echo "COPY ERROR TYPE: ".$errors['type'].PHP_EOL;
echo "COPY ERROR MESSAGE: ".$errors['message'];
}
else {
echo "File has been copied! \n";
}
} else {
echo "The file $logFilePath does not exist";
}
}
// Store the path of destination file
$destination = '/home/azibom/Desktop/backup.log';
// Your log file name
$start = "2020-01-01";
$logFileName = 'laravel-'.$start.'.log';
copyLogFile($logFileName, $destination);
?>
In very brief, I want to find all files that ends with *.sql and copy them if they exist.
There might be 0 or more files in etc directory.
File sqlfiles = file('etc/' + '*.sql')
logger.info("Looking for SQL files: " + sqlfiles);
if (sqlfiles.exists())
{
logger.info("Found log SQL file: " + sqlfiles);
copy
{
from sqlfiles
into "$rpmStoredir"
}
}
else
{
logger.warn("No SQL file found - skipping");
}
With my code, the wildcard is not working here.
So adding "include" to the copy as in the below is working but I just want to figure how to add a logger if the file does not exist
copy
{
from "etc/"
include "*.sql"
into "$rpmStoredir"
}
file(...) is the wrong method to use as this returns a single java.io.File
You could do something like
FileTree myTree = fileTree('etc') {
include '*.sql'
}
if (myTree.empty) {
...
} else {
copy {
from myTree
...
}
}
See Project.fileTree(Object, Closure) and FileTree
I have written below code in sass / scss. Here i am facing an issue i.e. when i'm trying to loop and concatenate value with \ . I'm getting space when my value contains alpha numeric. Kindly suggest how to overcome form this
SCSS =>>
Input :
$data: (
a:2766,
b:27B3,
d:1F48C
);
#each $value1, $value2 in $data {
.#{$value1}{
content: str-slice("\x",1,1)+($value2);
}
}
Output :
.a {
content: "\2766";
}
.b {
content: "\27B 3";
}
.d {
content: "\1F 48C";
}
It looks like this is a bug in Sass itself. Update your Sass and your problem should be fixed.
You can see this is the case on sass playground. Copy and paste your sass code there and then select Sass v3.3.14 and Sass v3.4.21 (or any later/newer) and you'll see the difference. :)
Edit:
In order to add \x at the beginning, you can do it this way:
SCSS (Sass v3.4.21):
$data: (
a: 2766,
b: 27B3,
d: 1F48C
);
#each $value1, $value2 in $data {
.#{$value1}{
content: str-insert(#{$value2}, "\\x", 1);
}
}
CSS output:
.a {
content: \x2766;
}
.b {
content: \x27B3;
}
.d {
content: \x1F48C;
}
str-insert puts a string inside other string. \\ in \\x escapes to single \x. Oh, and as the reference states, first character in sass is 1, not 0.
I have a 'doc' directory containing HTML documentation and each HTML contains placeholders for the application version and the SVN revision:
Welcome to the ... V${version} r${buildNumber}
In my Grails/Gant build script we create a doc package for which we first copy the doc directory to a staging area before zipping it up. I now wanna replace these placeholders with values like this (assume the variables appVersion and svnRevision are set properly:
ant.mkdir(dir: "${baseDocDir}")
ant.copy(todir: "${baseDocDir}") {
fileset(dir: "./src/main/doc", includes: '*.html')
filterset {
filter ( token : 'version' , value: appVersion )
filter ( token : 'buildNumber' , value : svnRevision )
}
}
The copy works but somehow the filter does not!
I can answer the question myself now. The following code works:
ant.copy(todir: "${baseDocDir}") {
filterset(begintoken: "\${", endtoken: "}") {
filter(token: "version", value: appVersion)
filter(token: "buildNumber", value: svnRevision)
}
fileset(dir: "./src/main/doc/", includes: "**/*.html")
}