Groovy Scripting - Getting Started?

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
Tympanix
Power User
Posts: 4
Joined: 27 Aug 2013, 17:18

Groovy Scripting - Getting Started?

Post by Tympanix »

Hi there!

I am planning to code some Groovy scripts for my personal needs and would like some help with IDE integration in Eclipse or IntelliJ. All that is said at GitHub (https://github.com/filebot/scripts) is:
If you want to run scripts from a local file or if you want to make your own modifications just clone the repository into your local filesystem.
However this seems to be a simplification. The Groovy scripts strongly depend on classes from the core of Filebot (https://github.com/filebot/filebot). What is the best setup for Groovy development for Filebot if i want to:
  • Do unit testing of Groovy scripts right from the IDE
  • Have Groovy scripts resolve references to core Filebot classes/methods
I have already done the following:
  • Downloaded Filebot from source into my favourite IDE
  • Downloaded all dependencies from ivy.xml
  • Resolved correct Java and Groovy SDK
  • Tried to tie in the Groovy scripts without luck
The Groovy scripts have no package defined (default package) and uses no imports (nor from java classes or groovy classes) which seems strange to me. How do they fit in?

Thank you, Tym.
User avatar
rednoah
The Source
Posts: 24014
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Groovy Scripting - Getting Started?

Post by rednoah »

Well, FileBot scripts are written in the Groovy language, but you'll still need to run them with filebot -script instead of groovy because of all the extra that FileBot adds to the Groovy environment.


The FileBot Groovy Extensions are all defined here:

Format/Filter Expression Extensions: FileBot Script Extensions: Default Imports:
Just putting the filebot jar into the classpath should make the extension methods work, not sure how to set a base class and default imports.


I just write scripts with Sublime and run scripts with filebot -script so I'm not sure how to recreate the FileBot/Groovy environment in a Groovy IDE and get code completion and unit testing and stuff like that.

Depending on what you're doing it's good to have the filebot source as a reference, but you don't really need it for anything other than "documentation" of all the FileBot/Groovy extensions.
:idea: Please read the FAQ and How to Request Help.
Tympanix
Power User
Posts: 4
Joined: 27 Aug 2013, 17:18

Re: Groovy Scripting - Getting Started?

Post by Tympanix »

Oh! So that's how it ties in. I was quite sure i had missed something.

Thank you - old school with sublime text it is! :D
Post Reply