flyway sbt placeholder substitution not working - flyway

Using Flyway 2.3 on Windows, same result from command prompt and within cygwin. Production env is Linux, but haven't been able to test there yet.
My SQL file has the line:
alter table person add ${new_col} text;
I added the following to my build.sbt, based on what I saw on the the flyway sbt doc page:
flywayPlaceholders := Map(
"new_col" -> "temp_name"
)
When I run
> sbt flywayMigrate
I get this:
com.googlecode.flyway.core.api.FlywayException: No value provided for placeholder expressions: ${new_col}. Check your configuration!
Under cygwin it does work if I specify the substitution on the command line:
> sbt flywayMigrate -Dflyway.placeholders.new_col=temp_name
Command line plaveholder substitution doesn't work in Windows command prompt, but I suspect that's a different issue as none of my -D options are respected there.
I'm new to both sbt and Flyway, so I'm hoping this is something simple, but I couldn't find anything helpful by googling. thanks in advance for any help

The flywayPlaceholders in build.sbt are currently by the commandline configuration.
This is a bug in Flyway.
I created a pull request.

Related

Karate Runner -> karate jar : Command line args settings issue

I am using Visual Studio code and Karate Runner plugin is installed. Using karate-config.js with standalone jar (karate.jar). I have tried to configure in karate runner settings in VS code for Karate Runner -> karate jar : Command line args as "java -Dkarate.config.dir=test/resources/ -cp karate.jar com.intuit.karate.Main" but it throws an exception like
Executing task: java -Dkarate.config.dir=test/resources/ -cp karate.jar com.intuit.karate.Main "d:\GitHub\KarateTestFramework\test\features\script\all_users.feature:9" <
Error: Could not find or load main class .config.dir=test.resources.
The terminal process "C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe -Command java -Dkarate.config.dir=test/resources/ -cp karate.jar com.intuit.karate.Main "d:\GitHub\KarateTestFramework\test\features\script\all_users.feature:9"" terminated with exit code: 1.
Terminal will be reused by tasks, press any key to close it.
Also, I have tried full path for -Dkarate.config.dir=D:/GitHub/KarateTestFramework/test/resources but didn't work either.
Please guide me to resolve this issue.
#ChandramohanRamabadran, I tried to replicate the issue on my system. I believe it's not a bug!
It's happening because your VisualStudio is using PowerShell instead of CMD. I believe you might have missed the step to change the default shell of VisualStudio after installing Karate. Try updating the default shell from PowerShell to CMD; then you should be good.
However, if you still want to use PowerShell, then update the command
java -Dkarate.config.dir=test/resources/ -cp karate.jar com.intuit.karate.Main
to
java `-Dkarate.config.dir`=test/resources/ -cp karate.jar com.intuit.karate.Main
More context over the issue:
PowerShell has a more standard rule to parse system-properties parameters which are different from CMD. In a PowerShell command, the parameter names always begin with a hyphen. The hyphen tells PowerShell that the item in the command is a parameter name.
Here, we are passing the parameter as -Dkarate.config.dir, PowerShell sights the parameter name-tag as -Dkarate and not -Dkarate.config.dir; hence the error.
This is a bug. Thanks for reporting it: https://github.com/intuit/karate/issues/1330
For now please find a workaround. Karate will look for karate-config.js in the current directory or the classpath. So if you change the command to something like this (please try variations) it should work
-cp 'karate.jar;test/resources/'
I have changed preferred terminal shell from Powershell to command as default for VS code and followed the below listed steps
Press Ctrl + Shift + P to show all commands.
Type shell in the displayed text box to filter the list.
Select Terminal: Select Default Shell .
You will be prompted to Select your preferred terminal shell, you can change this later in your settings or follow the same process as we do now.
I have changed the karate runner->karate jar:Command Line Args settings as java -Dkarate.config.dir=resources/ -cp karate.jar com.intuit.karate.Main
Now its working fine.

Installing Python modules

I am trying to install the pyperclip module for Python 3.6 on Windows (32 bit). I have looked at various documentations (Python documentation, pypi.python.org and online courses) and they all said the same thing.
1) Install and update pip
I downloaded get-pip.py from python.org and it ran immediately, so pip should be updated.
2) Use the command python -m pip install SomePackage
Okay here is where I'm having issues. Everywhere says to run this in the command line, or doesn't specify a place to run it.
I ran this in the command prompt: python -m pip install pyperclip. But I got the error message "'python' is not recognized as an internal or external command, operable program or batch file.
If I run it in Python 3.6, it says pip is an invalid syntax. Running it in IDLE gives me the same message.
I have no idea where else to run it. I have the pyperclip module in my python folder. It looks like a really simple problem, but I have been stuck on this for ages!
You need to add the location of the python.exe to your $PATH variable. This depends on your installation location. In my case it is C:\Anaconda3. The default is C:\Python as far as I know.
To edit your path variable you can do the following thing. Go to your Control Panel then search for system. You should see something like: "Edit the system environment variables". Click on this and then click on environment variables in the panel that opened. There you have a list of system variables. You should now look for the Path variable. Now click edit and add the Python path at the end. Make sure that you added a semicolon before adding the path to not mess with your previous configuration.

Can't open Sqlite on Git Bash

I'm trying to access my sqlite database on my current directory at /c/wamp/www/laravel5 on my local project folder, with windows as my OS. I added the sqlite3 executable on the directory.
The database doesn't seem to open using git bash. When using the default command in windows command prompt it works seamlesly. sqlite3.exe storage/database.sqlite
Tried on Git Bash:
$ ./sqlite3.exe
and
$ ./sqlite3.exe storage/database.sqlite
These didn't work.
The error message is:
bash: sqlite3.exe: command not found
Here's a snapshot:
I'd like to see the database tables and schema using git bash since it has cooler font colors compare with the windows cmd.
Any help would be greatly appreciated.
if you have the same problem I had, then see my question here.
In short, using "winpty" to start sqlite3 worked:
$ winpty sqlite3
Building on the previous answer by #user172431, add the following alias to your .bashrc
alias sqlite3="winpty sqlite3.exe"
This will make the workflow a tad quicker and feel like a ninja rock-star in the process. I use this shortcut via Git Bash

Combine sbt tasks from different scopes

I use sbt with the native packager plugin, in order to build Debian packages for our Play 2.2 applications. We use the debian:publish in order to upload the packages to our Artifactory server, and the publish command to publish the regular Java jars.
I'd like to be able to use the regular publish command to published both the jar files and the Debian packages. I think I need to somehow combine the publish task in the Debian scope with the regular one in the Compile scope, but I can't really find any documentation on how to do that.
I came up with the following code, which works, but seems to me to be the 'wrong' way to do it:
publish := { // Also publish deb files
val value = publish.value
(publish in Debian).value
}
Especially the second line seems wrong, since it's ignoring the value. The val is there to quiet a warning, which is another smell.
Is there a better way to do this?
You can use triggeredBy. In your build.sbt add following line:
publish in Debian <<= (publish in Debian).triggeredBy(publish in Compile)
PS. I think the way you did it is also fine. If you're worried about the warning you can assign the result to some val.
Here, the dependsOn task is appropriate, if you don't care about the return value:
publish := publish.dependsOn(publish in Debian).value

Building Brackets Shell (After running the grunt build command)

On windows after running the grunt build command for creating brackets shell it gives done without errors but i dont see any .exe file generated..
What might be the problem???
Here are some possible solutions:
Are you following the full brackets-shell build instructions, including all prerequisites?
Make sure Brackets isn't running at the same time. The build will fail silently if the .exe file is currently in use (see bug).
Try with a fresh git clone of the repo. If your brackets-shell local copy has been around for a while, sometimes the build & deps folders can get in a bad state. (I'm assuming you haven't modified the source at all. If you have, try with an unmodified copy of the source first to make sure it builds correctly without any of your changes).
Check that python --version shows 2.7.x
Verbose build output would also be helpful in diagnosing issues like this, but unfortunately there's not yet an easy way to get that...
If you follow the instructions on bracket-shell's wiki page, the Windows executable should be created in the Release directory.

Resources