We want to have the same VSCode settings for the whole crew of developers. Also it would be fine to have a oneline command to tear VSCode down and restart it from scratch with predefined settings and plugins so that you do not have to worry about trying out plugins and getting beck to the known state. Kind of Config-as-Code for VSCode.
I already found:
https://code.visualstudio.com/docs/editor/extension-gallery#_command-line-extension-management
https://github.com/microsoft/vscode-dev-containers
https://marketplace.visualstudio.com/items?itemName=Shan.code-settings-sync&ssr=false#qna
https://github.com/gantsign/ansible-role-visual-studio-code-extensions
https://code.visualstudio.com/docs/remote/containers
https://github.com/gantsign/ansible-role-visual-studio-code
But non of these provides a good solution to me
We are using Mac and Windows machines and develop most of the time locally (not remotely in the cloud or the like).
I imagine like having a script like
.... projectname up
or
.... projectname reset
(or
.... projectname down)
to receive/reset the configured settings and newest plugins that have been configured for the project.
Have any ideas or use a similar solution already?
After doing a lot of research, playing with Docker, Ansible and so on... it seems that although I excluded it at first the plugin Settings Sync Plugin from Shan Khan is the way to go. It has round about 1 million installs!
Only dependency - you need a GitHub account to host your configs. That is what held me back at first - but it should be not that much of a problem to get one for everyone in the team and connect it to like a company-github-account.
Copy the files settings.json and keybindings.json to your target machine(s) to copy the settings. You can find those files here:
Win: ~\AppData\Roaming\Code\User
Mac: ~/Library/Application Support/Code/User/
Linux: ~/.config/Code/User
You can copy extentions from ~/.vscode/extensions or C:\Users\username\.vscode\extensions from linux/mac or windows respectively.
FalcoGer's answer should explain how to copy the files in a way VS Code will pick them up. If you only need to copy the config files once, this solution would be fine.
If you need to "sync" these config files on a regular basis, I would advise to create a Git repository where all config files will be stored.
When cloning the repo to local machines, you can symlink the files to the config destinations (see FalcoGer's anwser). Then when you need to "sync", you only have to run git pull and restart VS Code to apply the changes.
For your other script-related question, you could create a CLI for this. Python would be the most friendly way to do this. You can find an example here.
I am using two different Xcode version with 2 different Command Line Tools version as well. On my Mac I have one user for development and the other one as a Jenkins slave and, for some reasons that don't belong here, I need to use different Command Line Tools version for each user. The thing is that every time I select a new Build Tools version, changes apply to all users.
Is there any way to select Build Tools version for EACH user?
The most direct way to solve yout problem would be using the environment var $DEVELOPER_DIR, as you can see here:
What is the difference between setting DEVELOPER_DIR and using xcode-select?
You can try to use this wrapper. It allows you to execute xcode-select without sudo permissions:
https://github.com/detroit-labs/safe-xcode-select
Alternatively, if that doesn't work for you, you can try allowing xcode-select to be executed with sudo permissions but without the password:
https://encyclopediaofdaniel.com/blog/sudo-without-a-password/
I hope it helps.
Find your toolchain name (say swift-dev) and then run:
export TOOLCHAINS=swift-dev
on login?
I am testing upgrading to 4.6, and there seems to be a change in the snitch. 4.5 ran fine with.
endpoint_snitch: com.datastax.bdp.snitch.DseDelegateSnitch
Configured in the cassandra.yaml file, but 4.6 fails to start. The only way I can get it to start is to use one of the classic snitches, but then I have to configure my Datacenter names and such... How do I use the DseDelegateSnitch.
I am getting the following error with the above config when I use the DseDelegateSnitch.
Fatal configuration error
org.apache.cassandra.exceptions.ConfigurationException: DseDelegateSnitch is now handled automatically; please set endpoint_snitch in cassandra.yaml to any valid IEndpointSnitch (probably whatever is configured for delegated_snitch in dse.yaml). Also remove delegated_snitch from dse.yaml if it is still set there.
at com.datastax.bdp.config.DseConfigurationLoader.loadConfig(DseConfigurationLoader.java:47)
at org.apache.cassandra.config.DatabaseDescriptor.loadConfig(DatabaseDescriptor.java:136)
at org.apache.cassandra.config.DatabaseDescriptor.<clinit>(DatabaseDescriptor.java:112)
The node will start when I use a snitch such as propertyfilesnitch.
Thanks in advance.
Update on solution
I did not have the delegate snitch in the dse.yaml file, but I did have DseDelegateSnitch in cassandra.yaml. I ran this:
sed -r 's/DseDelegateSnitch/DseSimpleSnitch/g' /etc/dse/cassandra/cassandra.yaml
And I am back in business.
Thanks to the Datastax's Docs team!
The updgrade instructions for the snitch are here: http://datastax.com/documentation/upgrade/doc/upgrade/datastax_enterprise/upgradeTo4_6.html
Starting in DataStax Enterprise 4.6, the endpoint snitch is set in cassandra.yaml, not dse.yaml. Add the emove the delegated_snitch setting from dse.yaml and
Procedure
Follow the steps in General upgrade procedure until you start the node.
Open cassandra.yaml in a text editor.
Add a endpoint_snitch option set to the snitch you set in
delegated_snitch in dse.yaml.
DataStax Enterprise 4.6 now automatically handles delegated snitches. If the old delegated_snitch in dse.yaml is set to com.datastax.bdp.snitch.DseDelegateSnitch, set the endpoint_snitch in cassandra.yaml to com.datastax.bdp.snitch.DseSimpleSnitch.
endpoint_snitch: com.datastax.bdp.snitch.DseSimpleSnitch
Open dse.yaml in a text editor and remove the delegated_snitch
option.
Repeat these steps for each node in the cluser.
As the error says, you need to move the delegated_snitch setting out of dse.yaml and set that in the cassandra.yaml.
When upgrading you really want to start from the new versions default dse.yaml and cassandra.yaml files and merge in any changes you made. The default settings and configs will usually change between major versions.
I have tried to create the cordova latest version(3.6.3) project. I'm working under the proxy environment. I have updated the proxy settings in npm. But still I'm getting the following error.
cordova create HelloPhonegap com.tyc.hello "HelloPhonegap"
Creating a new cordova project with name "HelloPhonegap" and id "com.tyc.hello" at location "/Users/Desktop/HelloPhonegap"
Downloading cordova library for www...
Error: tunneling socket could not be established, cause=Parse Error
at ClientRequest.onError (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/request/node_modules/tunnel-agent/index.js:159:17)
at ClientRequest.g (events.js:180:16)
at ClientRequest.emit (events.js:95:17)
at Socket.socketOnData (http.js:1588:9)
at TCP.onread (net.js:527:27)
How to resolve this problem? Please any one help me.
Thanks in advance.
Windows XP :
Open the Control Panel and click the System icon.
The System Properties dialog is displayed.
On the Advanced tab, click on Environment Variables.
The Environment Variables dialog is displayed.
Click New in the System variables panel.
The New Sytem Variable dialog is displayed.
Add http_proxy with the appropriate proxy information(http_proxy=http://proxy.example.org)
Unix/MAC :
export http_proxy xxxxxxxxxxx:xxx
We've been using Grails for a little while now and have been through a few Grails versions now. We don't always want to migrate our 'older' apps immediately but often use a newer version for new development. Changing the Windows environment variables is inconvenient since I sometimes have to work on two related projects at the same time that are running different versions of Grails.
In Linux, I'd probably create wrapper scripts or aliases to allow me to specify on the command line a version switch but I don't believe Grails supports this.
How are others that need to code against multiple versions of Grails managing it?
Update:
I created a gv.bat file to set the GRAILS\_HOME and PATH environment variables. I added a GRAILS\_INSTALLS environment variable (c:\usr\local\grails on my box) and removed the %GRAILS_HOME%\bin reference from my PATH.
gv.bat
#echo off
SET GRAILS_HOME=%GRAILS_INSTALLS%\grails-%1
SET PATH=%GRAILS_HOME%\bin;%PATH%
To do any Grails work I run > gv 1.1.2 or whatever version I need to work with. I'd like to figure out how to do a string replace in the PATH to change the value but that turned out to be difficult for me
I have a couple of bat files which changes the GRAILS_HOME and the system PATH according to which version I'm using.
It's not the most beautifull solution at all, but at least works for me.
I have a batch file, that looks like below.
#ECHO OFF
if "%1"=="231" goto grails231
if "%1"=="232" goto grails232
if "%1"=="233" goto grails233
if "%1"=="234" goto grails234
goto end
:grails231
set GRAILS_HOME=F:\softwares\grails-2.3.1
set PATH=%GRAILS_HOME%\bin;%PATH%
goto end
:grails232
set GRAILS_HOME=F:\softwares\grails-2.3.2
set PATH=%GRAILS_HOME%\bin;%PATH%
goto end
:grails233
set GRAILS_HOME=F:\softwares\grails-2.3.3
set PATH=%GRAILS_HOME%\bin;%PATH%
goto end
:grails234
set GRAILS_HOME=F:\softwares\grails-2.3.4
set PATH=%GRAILS_HOME%\bin;%PATH%
goto end
:end
It can be run like 'setgrails 233' and it will set the grails 2.3.3
IntelliJ allows you to specify which version of Grails to apply as a per-project facet configuration. The Eclipse plugin has yet to achieve this level of abstraction.
It's now MUCH much later, and GVM is not the tool it once was. Instead, I use SDKMAN (https://sdkman.io/) and, with Windows getting some linux-like tooling, or using Cygwin, etc. it's installable on Windows.
------ OLD answer below ------
GVM is a tool for unix/mac environments to manage Groovy/Gradle/Grails/more versions, and someone finally made a Windows equivalent called Posh-gvm (short for Power-shell GVM). It's very useful and easy to use to download and configure your environment for whichever version of these tools you want to use at any point in time.
If you're using an IDE, posh-gvm is still a great way to download/install the new versions as they come out, and your IDE can point into the posh-gvm install directories.
I have the same issue as you. For my concern, I have written a batch script (grails_version.bat) accessible from my Windows PATH home.
Set up your GRAILS_HOME to your standard Grails version and each time you want to run a Grails app into another version than the standard one, open a command prompt, run the batch script (>grails_version) and run your grails commands (ex: grails run-app).
If your are using IntelliJ, you can configure the grails version per application.
Here is the code:
#echo off
set v11=1.1
set v111=1.1.1
set v12M2=1.2-M2
set v12M3=1.2-M3
set v12M4=1.2-M4
set /p grails_version= What is the grails version (%v11%, %v111%, %v12M2%, %v12M3% (default), %v12M4%)?
if "%grails_version%" == "%v11%" goto :set_grails_home
if "%grails_version%" == "%v111%" goto :set_grails_home
if "%grails_version%" == "%v12M2%" goto :set_grails_home
if "%grails_version%" == "%v12M3%" goto :set_grails_home
if "%grails_version%" == "%v12M4%" goto :set_grails_home
if "%grails_version%" == "" goto :set_grails_home_default
:no_valid_input
echo The input version is not valid
exit
:set_grails_home_default
set grails_version=%v12M3%
:set_grails_home
set GRAILS_HOME=D:\Install\grails\grails-%grails_version%
path = %GRAILS_HOME%\bin;%PATH%
echo GRAILS_HOME=%GRAILS_HOME%
Enjoy.
I do that in Windows as below.
So I just change GRAILS_VER environment variable.
I can change my grails version anytime.
On Linux/Mac, GVM is a fantastic tool for installing and working with multiple versions of Grails, Groovy, etc. You can't use GVM itself on Windows1, but there is a clone posh-gvm that will run under Powershell on Windows.
AFAIK this is because Windows doesn't support symlinks
The thing I would change about these answers is the PATH handling. Each time you run the script and change versions, you will extend your path one more node. It works, but messy. Try creating a $path2 with no reference to your JAVA_HOME or GRAILS_HOME and the path become path2+grails+java. Example: set PATH="%PATH2%;F:\softwares\grails-2.3.1;path2java7.
The only reason I add the Java7 reference is that I need Java 6 for my older grails app and Java 7 for newer grails.
Check out this link, it explains exactly how to do that using cygwin and mapping several aliases.
Also, learn how the plugins directory work and replicate it several times for each version of Grails. I also use global plugins for the ones I use often, like tomcat, hibernate, dbUtil, console, etc.
Say you want to switch between 1.1 and 1.2M4 - you could have those directories setup with the plugins you are using:
c:\Users\username\.grails\1.2-M4\projects\projectname\plugins
c:\Users\username\.grails\1.1.1\projects\projectname\plugins
Then, take applications.groovy and make several copies, like
application.groovy.1.1
application.groovy.1.2M4
Now, to switch, you just need to rename the application.groovy.X to application.groovy and you are good to go (after running grails clean of course):
grails1.1 run-app
grails12M4 run-app
Lastly, there are other differences between versions (i.e. new 1.2 is introducing dependencies DSL), but most of the time things are backwards compatible enough that you can come up with a common denominator.
Some answers are outdated.
Seems that the best option nowadays is SDKMAN!:
SDKMAN! installs smoothly on Mac OSX, Linux, WLS, Cygwin, Solaris and FreeBSD. We also support Bash and ZSH shells.
Is also possible to install on Windows, but SDKMAN "can not be installed natively on Windows and requires WLS, Cygwin or MSYS+MinGW".
After that, you can choose the Grails SDK and which version you want. For example:
sdk install grails 1.3.7