Recommend groovy development software?

What development software would you recommend to a hobbyist for groovy?

1 Like

IntelliJ has a free version that works reasonably well.

1 Like

Definitely check out the "official" Groovy language website which lists some tools and SDK materials you may wanna pick up – The Apache Groovy programming language - Install Groovy

3 Likes

Of course, don't forget to browse the Hubitat Public repository over on Github, since it contains quite a few working examples of Drivers and Apps that you can read, inspect and modify to suit your needs. Can't think of a better jumping off point!

You could also look at using Microsoft's VS Code. It can integrate with Git and opens up the option to develop a range of code in the one ide.

2 Likes

I use VS Code with GitHub extensions, and also this Hubitat Extension

3 Likes

I've started using VSCode and it's working well. Question, though. I sometimes code from my macbook and sometimes from my windows laptop. Here's the setup I'm thinking about to handle that:
(1) Clone github repository to both computers, using a synced Google Drive folder as the "local" folder
(2) Use the Hubitat VSCode plugin to push updates to Hubitat

Is this going to work well with multiple computers? When I commit an update on one computer, I think that should get pushed to Google Drive and Github. If I resume coding on a different computer, I just need to make sure to close any already open files and then re-open them, which should presumably pull the files from Google Drive (or Github?) for seamless editing.

Does this sound right to you?

1 Like

I use about the same setup with Dropbox. Even if you do not commit changes but just have local uncommitted changes those should sync using google drive as well. I have never tested sync between machines with committing local changes and not pushing them upstream. Everything should be saved locally in the local repo folders so it should sync between machines with Google drive.

The only thing you might run into is the VSCode plugin uses a full path in the metadata file to keep track of what ID number each file belongs to (and the version on the hub). The path might differ from one machine to another so you will end up with two entries for files with both paths. You may get some warnings about the version number not matching when you publish which you could turn off or ignore and publish anyway.

I thought about bringing this up to the plugin author, if maybe it should use a relative path from the head of the workspace instead of a full path? @lparks

2 Likes

I think for now, best just to keep the master source in github and make sure to commit/push and pull before we begin working on a different computer.

add the .hubitat directory to your .gitignore file because as @jtp10181 mentioned the paths in the .hubitat/metadata.json are full paths so they will be different on mac and windows. You'll have to re-add the file id to each file. Or, if you have a lot, perhaps you could copy the metadata.json from one machine to another and change path manually.

Sorry, it's not ideal for development on multiple machines. I like @jtp10181 ideas of perhaps using relative paths. I will look into it, when some time frees up

2 Likes

That would be much appreciated! I switch very often between computers, so this is a big bottleneck for me.

1 Like

It wont really be that big of a deal once you get going with it. The metadata file will sync on Google drive. Each file may end up with two entries in the file. When you switch computers the first publish may complain the version number is off but you can publish anyway. Thats about the only problem you will have.

1 Like

I've been using my macbook so far. On my macbook, I cloned the github repository to my local drive whcih is synched to Google Drive. Now, on my windows laptop, how do I set it up? Should I do the same thing, i.e., clone the github repository and store on the local Google Drive? Or is that going to cause conflict to where I just need to open the local Google drive and not github?

If you have the files synced via Google drive you have the cloned repo already. If you need to attach it to something like Github Desktop so you can push upstream there is a way to just "open" an existing cloned repo. I am not sure how to do it with the regular Git software but I am sure there is a way. If you use the VS Code Git plugin it will actually find it automatically when you create the workspace and it finds all the git repo files in there.

2 Likes

Yup, you're right. Been using it as you say and it's working just fine. Thanks!

1 Like

Ha, well, as soon as I say that, now I can't get out of a GIT issue:


[info] fatal: cannot lock ref 'HEAD': Unable to create 'G:/My Drive/Cloud Files/Code/QuickCharts/.git/HEAD.lock': File exists.

Another git process seems to be running in this repository, e.g.

an editor opened by 'git commit'. Please make sure all processes

are terminated then try again. If it still fails, a git process

may have crashed in this repository earlier:

remove the file manually to continue.

error: could not commit staged changes.

I've tried aborting rebasing and everything, but nothing works. Can't get back to normal sync status on the windows laptop. I don't know GIT commands at all, though, so maybe it's my naiveness of it....

I closed out of everything on my macbook too, so don't know what else to do.

1 Like

I think its telling you you may need to remove the HEAD.lock file by deleting it. Maybe just move it somewhere else first in case it breaks everything. I suspect it is just a temporary file though to prevent two process both updating the repo at the same time. Somehow it did not get cleaned up after a push/pull.

1 Like

Yeah, that did it. Thankfully, I had backed up a local copy (outside of the git repo) when I noticed problems. Otherwise I would have lost a signficant amount of work... Hmm..

1 Like

Now I'm getting Request failed with Status code 500 when tryin to push to Hubitat though... that's not a very helpful error code... Might not be a VSCode extension issue though because when i try to copy/paste into the HE editor, i get a message "Unable to save to the hub, plesae try again and check if the hub is responding". Same thing after reboot. Ugh.

The error 500 likely means your driver has a syntax issue probably in the top metadata section that stops the upload from working.

2 Likes

Also a symptom of trying to push a driver to the app code section, or an app to the driver code section (which is by definition a metadata error.:sunglasses:)

2 Likes