Hey Carlos,
Thanks so much for the detailed question, and for working through (and sharing) the solution.
You've bumped into something that is definitely confusing, and based on your description, I'm not exactly sure why it's working at this point. I'll do my best to explain the parts I understand, and hopefully that'll help us both figure out why it's working.
The first issue is the Gemfile.
One of the main design changes in the new Sprouts, is that everything is fundamentally, basically Ruby and nothing in the core reaches out and depends on (or manipulates) RubyGems. That said, RubyGems (and Gem Bundler) are reasonably clean tools for getting new, external Ruby code into your currently-running virtual machine.
So, if you have some Ruby code (like a
Sprout spec, or other
Sprout tools), that is available as a RubyGem, you can make that code
available to your project by adding a reference to it's name to your Gemfile. Once that code has been made
available, you'll need to do something that actually
loads it.
This is where the 'library' statement comes in. Deep in the implementation of the 'library' statement, Sprouts will first attempt to load the registered library with the provided name, and if one is not registered, it will attempt to 'require' a Ruby file with the optionally-provided 'pkg_name'. If no 'pkg_name' is provided, it will use the library name itself. This is probably the most confusing part of this story.
This line:
library :flexdatavis
Will ultimately turn into this:
require 'flexdatavis'
But if there's no file like, 'flexdatavis.rb' in your load path, then you'll get an error like:
Could not load the required file (flexdatavis) - Maybe you need to
run 'gem install flexdatavis' or maybe 'bundle install'?
That require statement will not be executed if some Ruby file has already been loaded that does something like this:
Sprout::Library.register :name => :flexdatavis, :path => '/path/to/lib.swc'
This work is actually performed by the Sprout::Specification '
add_library' method, and it is usually done after a Sprout::Specification is made
available by RubyGems, and subsequently
required at the top of a Rakefile.
Given all of that, I'm not exactly sure how the datavis source ended up in your project load path without something like the following:
A Sprout::Specification that registers the swc under a given alias like:
t.add_library :flexdatavis, "frameworks/blah/blah.swc"
Followed by the declaration and addition of the library dependency to an mxmlc task like:
library :flexdatavis
mxmlc 'foo.swf' => :flexdatavis
In order to avoid all of this hassle for libraries that aren't included in a Sprout::Specification, you can easily, manually add any source or SWC files to a folder of your choice in your project, and manually add them to your tasks like:
mxmlc 'foo.swf' do |t|
t.library_path << 'relative/path/to.swc'
end
Or:
mxmlc 'foo.swf' do |t|
t.source_path << 'relative/path/to/source'
end
I suspect one of two following options has happened to get you unblocked:
1) Updating the flex frameworks folder clobbered the usual framework SWC with one that includes the datavis components and therefore doesn't require any changes to the load path.
2) One of the previous steps copied the datavis SWC into your project 'lib' path, and you're auto-including everything that's in that folder.
Thanks again!
Luke