Concern/RubyFeature ?

8 views
Skip to first unread message

Marcelo de Moraes Serpa

unread,
May 8, 2012, 10:16:51 PM5/8/12
to project...@googlegroups.com
Hi Luke,

Could you elaborate on the "concern" and "RubyFeature" concepts? I've been trying to understand its use inside the sprouts gem, but so far haven't go to fully understand it.

I didn't really get what this means:

  # This class represents a Feature that is written in
  # Ruby code that exists on the other side of the
  # Ruby load path.

What is "other side" of the Ruby load path?

Thanks!

- Marcelo.

Luke Bayes

unread,
May 9, 2012, 3:11:57 AM5/9/12
to project...@googlegroups.com
These are great questions, unfortunately the answer is pretty complicated. I'll do my best to explain, but please forgive me as these topics are pretty nuanced and it's been a long while since I was fully immersed in them.

The 'Concern' was literally just copied out of Rails and if I remember correctly, it just makes it a little prettier to create 'ClassMethods' and 'InstanceMethods' blocks that get applied to the appropriate object (that includes it) at the appropriate time.

RubyFeature defines a collection of 'ClassMethods' (that Concern applies to any class that 'includes' RubyFeature). These class methods provide the main glue of Sprouts. RubyFeature is included by Library, Generator, Specification and Executable and it gives each of them the hooks they need to register dependencies and file targets and other such things. RubyFeature is the fundamental building block of Sprouts.

The idea is that you get concrete RubyFeatures into your load path and require them. Once they're loaded by the Ruby VM, they get registered and made available to other Sprout entities. The Specification describes the remote targets where these dependencies can be resolved, but once they've been downloaded, unpacked and required, it's RubyFeature that makes it all work together.

Please let me know as you find more questions, or if that's still not quite clear.

Thanks,

Luke



- Marcelo.

--
You received this message because you are subscribed to the Google Groups "ProjectSprouts" group.
To post to this group, send email to project...@googlegroups.com
To unsubscribe from this group, send email to projectsprout...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/projectsprouts?hl=en
 
For other info you can visit our project at: http://projectsprouts.org, or on Github at: http://github.com/lukebayes/project-sprouts

Reply all
Reply to author
Forward
0 new messages