You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@buildr.apache.org by Mark Petrovic <ms...@gmail.com> on 2010/09/08 03:07:28 UTC

Intellij Plugin to provide clear view of buildfile

It would be nice to have an Intellij plugin that provides a nice, clean view of a buildfile, with collapse-able handles for each 'define <project>' node and whatever other eye candy one could come up with.  I have some experience writing plugins for NetBeans, and have reviewed a few plugin examples for IJ.

Does anyone have any experience with buildfile parsers, which I assume we'd need to write such a plugin?  The buildfile is not actually Ruby per-se, right?  

--
Mark Petrovic



Re: Intellij Plugin to provide clear view of buildfile

Posted by Peter Donald <pe...@realityforge.org>.
> Sorry to subject you to this, but if the buildfile is Ruby, how do the 'desc' and 'define' keywords fit into this?

Both of those are just methods (on Object IIRC?). So these methods
just call out to some buildr specific code and create the underlying
project objects.

If you "execute" the buildfile script you should be able to get a list
of all the projects through the method "Buildr.projects" so in theory
you could traverse the project graph and get all the information you
need to do the ui for an intellij plugin.

Put something like the following at the end of a build script to get a
feel for it

Buildr.projects.each do |project|
  puts project.name
end

Buildr.application.tasks.each do |task|
 if task.comment
     puts "#{task.name_with_args}: #{task.full_comment}"
 end
end

-- 
Cheers,

Peter Donald

Re: Intellij Plugin to provide clear view of buildfile

Posted by Chiaming Hsu <ca...@yahoo.com>.
A capable Ruby syntax coloring engine should mark them as "method calls", even 
though the IDE may not see the method definitions.  It is fairly common in Ruby 
to call methods that are not defined (yet), due to its dynamic nature.

I don't use IntelliJ, so I don't know how well it can tell...  but if you want 
them (desc, define, etc.) to be marked with the same color as language keywords, 
you probably need to write some custom stuffs only for Buildr / Rake.  They are 
really not keywords...

Cheers,
Chiaming Hsu



----- Original Message ----
From: Mark Petrovic <ms...@gmail.com>
To: users@buildr.apache.org
Sent: Tue, September 7, 2010 7:47:54 PM
Subject: Re: Intellij Plugin to provide clear view of buildfile

I see.

So the existing Ruby plugin, which I'm using and I assume you're using, cannot 
show a pretty view of the buildfile in Structure View because it doesn't know 
anything about the desc and define methods?


On Sep 7, 2010, at 7:01 PM, Chiaming Hsu wrote:

> The 'desc', 'define', and other similar terms are method names, not language 
> keywords.
> 
> When you run builds, buildr loads itself first, which define these special 
> methods.  And then the buildfile calls these special methods to define project 

> structure.
> 
> For example:
> desc 'a sample project'
> is calling a method named desc with a string argument 'a sample project'
> 
> define 'killer-app' do
>   ...
> end
> is calling a method named define with a string argument 'killer-app' and a 
>block 
>
> doing something more.
> 
> 
> This is Ruby meta-programming magic...
> 
> Cheers,
> Chiaming Hsu
> 
> 
> ----- Original Message ----
> From: Mark Petrovic <ms...@gmail.com>
> To: users@buildr.apache.org
> Sent: Tue, September 7, 2010 6:39:52 PM
> Subject: Re: Intellij Plugin to provide clear view of buildfile
> 
> I actually started down the path of writing such an IJ plugin, but found while 

> reading the docs that I had to provide an extension for the file, as you found 

> with NB.  I suspect there is a way around this, as when I actually 
> double-clicked my buildfile, IJ prompted me to bind it to a language, which I 
> did (Ruby).  And now I get all the supported-language goodness when I edit the 

> buildfile in IJ.
> 
> The plugin development documentation for a given IDE can be somewhat sketchy 
>and 
>
> rather decentralized.  I may have missed something.
> 
> Sorry to subject you to this, but if the buildfile is Ruby, how do the 'desc' 
> and 'define' keywords fit into this?
> 
> 
> On Sep 7, 2010, at 6:29 PM, Chiaming Hsu wrote:
> 
>> The buildfile is Ruby code.  Would you be able to make IntelliJ treat the 
>> buildfile as a Ruby source file?  I tell my gEdit that the buildfile is Ruby 
>> and 
>> 
>> it adds the syntax coloring nicely.  I had trouble doing that with NetBeans, 
>> though, since NetBeans insists that file type association must be done through 
>
> 
>> "file extension" but my buildfile is just named buildfile without any file 
>> extension...
>> 
>> Cheers,
>> Chiaming Hsu
>> 
>> 
>> 
>> ----- Original Message ----
>> From: Mark Petrovic <ms...@gmail.com>
>> To: Buildr Users <us...@buildr.apache.org>
>> Sent: Tue, September 7, 2010 6:07:28 PM
>> Subject: Intellij Plugin to provide clear view of buildfile
>> 
>> It would be nice to have an Intellij plugin that provides a nice, clean view of 
>>
>> 
>> a buildfile, with collapse-able handles for each 'define <project>' node and 
>> whatever other eye candy one could come up with.  I have some experience 
>> writing 
>> 
>> plugins for NetBeans, and have reviewed a few plugin examples for IJ.
>> 
>> Does anyone have any experience with buildfile parsers, which I assume we'd 
>> need 
>> 
>> to write such a plugin?  The buildfile is not actually Ruby per-se, right?  
>> 
>> 
>> --
>> Mark Petrovic
> 
> 
> --
> Mark Petrovic


--
Mark Petrovic

Re: Intellij Plugin to provide clear view of buildfile

Posted by Mark Petrovic <ms...@gmail.com>.
I see.

So the existing Ruby plugin, which I'm using and I assume you're using, cannot show a pretty view of the buildfile in Structure View because it doesn't know anything about the desc and define methods?


On Sep 7, 2010, at 7:01 PM, Chiaming Hsu wrote:

> The 'desc', 'define', and other similar terms are method names, not language 
> keywords.
> 
> When you run builds, buildr loads itself first, which define these special 
> methods.  And then the buildfile calls these special methods to define project 
> structure.
> 
> For example:
> desc 'a sample project'
> is calling a method named desc with a string argument 'a sample project'
> 
> define 'killer-app' do
>   ...
> end
> is calling a method named define with a string argument 'killer-app' and a block 
> doing something more.
> 
> 
> This is Ruby meta-programming magic...
> 
> Cheers,
> Chiaming Hsu
> 
> 
> ----- Original Message ----
> From: Mark Petrovic <ms...@gmail.com>
> To: users@buildr.apache.org
> Sent: Tue, September 7, 2010 6:39:52 PM
> Subject: Re: Intellij Plugin to provide clear view of buildfile
> 
> I actually started down the path of writing such an IJ plugin, but found while 
> reading the docs that I had to provide an extension for the file, as you found 
> with NB.  I suspect there is a way around this, as when I actually 
> double-clicked my buildfile, IJ prompted me to bind it to a language, which I 
> did (Ruby).  And now I get all the supported-language goodness when I edit the 
> buildfile in IJ.
> 
> The plugin development documentation for a given IDE can be somewhat sketchy and 
> rather decentralized.  I may have missed something.
> 
> Sorry to subject you to this, but if the buildfile is Ruby, how do the 'desc' 
> and 'define' keywords fit into this?
> 
> 
> On Sep 7, 2010, at 6:29 PM, Chiaming Hsu wrote:
> 
>> The buildfile is Ruby code.  Would you be able to make IntelliJ treat the 
>> buildfile as a Ruby source file?  I tell my gEdit that the buildfile is Ruby 
>> and 
>> 
>> it adds the syntax coloring nicely.  I had trouble doing that with NetBeans, 
>> though, since NetBeans insists that file type association must be done through 
> 
>> "file extension" but my buildfile is just named buildfile without any file 
>> extension...
>> 
>> Cheers,
>> Chiaming Hsu
>> 
>> 
>> 
>> ----- Original Message ----
>> From: Mark Petrovic <ms...@gmail.com>
>> To: Buildr Users <us...@buildr.apache.org>
>> Sent: Tue, September 7, 2010 6:07:28 PM
>> Subject: Intellij Plugin to provide clear view of buildfile
>> 
>> It would be nice to have an Intellij plugin that provides a nice, clean view of 
>> 
>> a buildfile, with collapse-able handles for each 'define <project>' node and 
>> whatever other eye candy one could come up with.  I have some experience 
>> writing 
>> 
>> plugins for NetBeans, and have reviewed a few plugin examples for IJ.
>> 
>> Does anyone have any experience with buildfile parsers, which I assume we'd 
>> need 
>> 
>> to write such a plugin?  The buildfile is not actually Ruby per-se, right?  
>> 
>> 
>> --
>> Mark Petrovic
> 
> 
> --
> Mark Petrovic


--
Mark Petrovic



Re: Intellij Plugin to provide clear view of buildfile

Posted by Chiaming Hsu <ca...@yahoo.com>.
The 'desc', 'define', and other similar terms are method names, not language 
keywords.

When you run builds, buildr loads itself first, which define these special 
methods.  And then the buildfile calls these special methods to define project 
structure.

For example:
desc 'a sample project'
is calling a method named desc with a string argument 'a sample project'

define 'killer-app' do
   ...
end
is calling a method named define with a string argument 'killer-app' and a block 
doing something more.


This is Ruby meta-programming magic...

Cheers,
Chiaming Hsu


----- Original Message ----
From: Mark Petrovic <ms...@gmail.com>
To: users@buildr.apache.org
Sent: Tue, September 7, 2010 6:39:52 PM
Subject: Re: Intellij Plugin to provide clear view of buildfile

I actually started down the path of writing such an IJ plugin, but found while 
reading the docs that I had to provide an extension for the file, as you found 
with NB.  I suspect there is a way around this, as when I actually 
double-clicked my buildfile, IJ prompted me to bind it to a language, which I 
did (Ruby).  And now I get all the supported-language goodness when I edit the 
buildfile in IJ.

The plugin development documentation for a given IDE can be somewhat sketchy and 
rather decentralized.  I may have missed something.

Sorry to subject you to this, but if the buildfile is Ruby, how do the 'desc' 
and 'define' keywords fit into this?


On Sep 7, 2010, at 6:29 PM, Chiaming Hsu wrote:

> The buildfile is Ruby code.  Would you be able to make IntelliJ treat the 
> buildfile as a Ruby source file?  I tell my gEdit that the buildfile is Ruby 
>and 
>
> it adds the syntax coloring nicely.  I had trouble doing that with NetBeans, 
> though, since NetBeans insists that file type association must be done through 

> "file extension" but my buildfile is just named buildfile without any file 
> extension...
> 
> Cheers,
> Chiaming Hsu
> 
> 
> 
> ----- Original Message ----
> From: Mark Petrovic <ms...@gmail.com>
> To: Buildr Users <us...@buildr.apache.org>
> Sent: Tue, September 7, 2010 6:07:28 PM
> Subject: Intellij Plugin to provide clear view of buildfile
> 
> It would be nice to have an Intellij plugin that provides a nice, clean view of 
>
> a buildfile, with collapse-able handles for each 'define <project>' node and 
> whatever other eye candy one could come up with.  I have some experience 
>writing 
>
> plugins for NetBeans, and have reviewed a few plugin examples for IJ.
> 
> Does anyone have any experience with buildfile parsers, which I assume we'd 
>need 
>
> to write such a plugin?  The buildfile is not actually Ruby per-se, right?  
> 
> 
> --
> Mark Petrovic


--
Mark Petrovic

Re: Intellij Plugin to provide clear view of buildfile

Posted by Mark Petrovic <ms...@gmail.com>.
I actually started down the path of writing such an IJ plugin, but found while reading the docs that I had to provide an extension for the file, as you found with NB.  I suspect there is a way around this, as when I actually double-clicked my buildfile, IJ prompted me to bind it to a language, which I did (Ruby).  And now I get all the supported-language goodness when I edit the buildfile in IJ.

The plugin development documentation for a given IDE can be somewhat sketchy and rather decentralized.  I may have missed something.

Sorry to subject you to this, but if the buildfile is Ruby, how do the 'desc' and 'define' keywords fit into this?


On Sep 7, 2010, at 6:29 PM, Chiaming Hsu wrote:

> The buildfile is Ruby code.  Would you be able to make IntelliJ treat the 
> buildfile as a Ruby source file?  I tell my gEdit that the buildfile is Ruby and 
> it adds the syntax coloring nicely.  I had trouble doing that with NetBeans, 
> though, since NetBeans insists that file type association must be done through 
> "file extension" but my buildfile is just named buildfile without any file 
> extension...
> 
> Cheers,
> Chiaming Hsu
> 
> 
> 
> ----- Original Message ----
> From: Mark Petrovic <ms...@gmail.com>
> To: Buildr Users <us...@buildr.apache.org>
> Sent: Tue, September 7, 2010 6:07:28 PM
> Subject: Intellij Plugin to provide clear view of buildfile
> 
> It would be nice to have an Intellij plugin that provides a nice, clean view of 
> a buildfile, with collapse-able handles for each 'define <project>' node and 
> whatever other eye candy one could come up with.  I have some experience writing 
> plugins for NetBeans, and have reviewed a few plugin examples for IJ.
> 
> Does anyone have any experience with buildfile parsers, which I assume we'd need 
> to write such a plugin?  The buildfile is not actually Ruby per-se, right?  
> 
> 
> --
> Mark Petrovic


--
Mark Petrovic



Re: Intellij Plugin to provide clear view of buildfile

Posted by Chiaming Hsu <ca...@yahoo.com>.
The buildfile is Ruby code.  Would you be able to make IntelliJ treat the 
buildfile as a Ruby source file?  I tell my gEdit that the buildfile is Ruby and 
it adds the syntax coloring nicely.  I had trouble doing that with NetBeans, 
though, since NetBeans insists that file type association must be done through 
"file extension" but my buildfile is just named buildfile without any file 
extension...

Cheers,
Chiaming Hsu



----- Original Message ----
From: Mark Petrovic <ms...@gmail.com>
To: Buildr Users <us...@buildr.apache.org>
Sent: Tue, September 7, 2010 6:07:28 PM
Subject: Intellij Plugin to provide clear view of buildfile

It would be nice to have an Intellij plugin that provides a nice, clean view of 
a buildfile, with collapse-able handles for each 'define <project>' node and 
whatever other eye candy one could come up with.  I have some experience writing 
plugins for NetBeans, and have reviewed a few plugin examples for IJ.

Does anyone have any experience with buildfile parsers, which I assume we'd need 
to write such a plugin?  The buildfile is not actually Ruby per-se, right?  


--
Mark Petrovic