Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
How about that?...
Instead for looking under ../sites/all/libraries/[library_name] we could have it parse all subdirectories under that for different versions. This way we could have
../sites/all/libraries/[library_name]
../sites/all/libraries/[library_name]/1.0.2
../sites/all/libraries/[library_name]/1.1.4
The UI (Libraries API admin page) would offer the option to choose/switch to which version would be used globally per site. Later on, we could have it so modules that work only with specific versions of a library override this global site setting in their settings page.
Comment | File | Size | Author |
---|---|---|---|
#100 | 719896-docs-cleanup_3.patch | 39 KB | tstoeckler |
#95 | 719896-docs-cleanup_2.patch | 24.63 KB | tstoeckler |
#89 | 719896-docs-cleanup.patch | 20.83 KB | tstoeckler |
#86 | 719896_whitespace.patch | 3.64 KB | tstoeckler |
#85 | 719896-libraries_info_85.patch | 50.55 KB | tstoeckler |
Comments
Comment #1
tstoecklerThis is required to do
(from the project page), right?
I came up with a little patch that checks for versions.
It is an all-in approach, so that it is not possible to place libraries in a directory that is not nested with their version.
I.E. only sites/all/libraries/[library_name]/[version_number] is possible and not sites/all/libraries/[library_name]
I think that is required though, to properly handle versions, otherwise some libraries would have versions attached to them, and some wouldn't.
No UI as requested in the issue description.
Comment #2
tstoecklerP.S.: I moved the directory searching into a helper function _libraries_searchdir() simply for code readability. The nesting of if's and foreach's is deep enough that way already and would have been much worse with all the while's and additional if's. That's of course only a cosmetic decision and can be reverted if needed.
Comment #3
tstoecklerI just realized libraries_get_path needs a little rework as well. Will post updated patch soon.
Comment #4
tstoecklerHere we go. Back to needs review.
Comment #5
sunoh wow! Thanks for trying to push this forward!
However, I'm not really sure whether we want to take this route. The only way to prevent conflicts caused by multiple versions of the same library is to have only one version of the library installed.
When integrating external libraries, a Drupal module has to implement an observer pattern, because it does not know whether the proper library, and, whether a supported version of the library has been provided. Depending on the library version that actually has been provided, different features may be available.
Since modules need to do this anyway, I don't really see the benefit of supporting multiple versions of the same library. Contrary to a potential benefit, I rather see that it will be prone to errors, because you absolutely have to make sure that all modules requiring the library (in different versions) are NOT trying to load it on the same page or request. In essence, you wouldn't need Libraries API for that, because your goal is not to provide a common denonimator, and modules just try to take back authority.
In short: I'm not convinced that supporting multiple versions of the same library makes sense. Instead, I'm rather convinced that every module integrating with a certain library will be able to support multiple library versions and dynamically adjust itself for the one being available. Updating a module to account for changes in a new library version is not hard after all. The Wysiwyg module is a nice show-case and prototype for this behavior. Ideally, I'd rather like to advance on this observer behavior, making it easier for all modules to do what Wysiwyg module started to do. (but that's a different issue)
Lastly, the suggested directory structure here slightly clashes with the solution we still need to find for #465908: Scan: Name clashes
Thoughts?
Comment #6
tstoecklerAll right. I get everything up to the WYSIWYG reference. I will browse some WYSWIWYG code to see if I can get what you mean. Hopefully, then
module <- library -> module
will also make more sense to me =)Also
? Is that related to #465908: Scan: Name clashes? I thought I got that issue (I commented over there), but I don't get that.
Basically what this means, that there has to be some way for Libraries API (and via that any module) to retrieve the version information from a library. So I guess there has to be some kind of hook for which would Libraries API would give some defaults (jQuery, jQuery UI, etc.) and modules could implement their own (ideally with Libraries API integrating more and more along the way).
So that would be the forward, right?
(Back to active, the patch doesn't really count anymore :'( .... :)
Comment #7
tstoecklerYeah, I guess WYSIWYG's hook_plugin (or hook_editor?, they seem to be rather similar) is pretty much what we want, if I understood that correctly.
Thinking about a name, I just looked at Core's new hook_library and drupal_get_library. Now you said somewhere with very much emphasis (:)) that that is not what you want. The API page for drupal_get_library mentions the following:
Now if I have understood correctly, that is EXACTLY the limitation that you want to overcome with Libraries API. If not, then I just don't get what the difference is. In any case, a name for the hook would be a great start =)
Comment #8
sunRight, it's mainly hook_editor() in Wysiwyg that's aware of multiple library versions and implements library version detection. I think we can forget about hook_plugin() for now.
If you haven't read the following two issues already, then it would be good to do it, so we have a common base of knowledge:
#320562: Libraries API (the initial idea + discussion that lead to Libraries API)
#315100: Allow to add JS/CSS libraries (sets of files, settings, and dependent libraries) (the Drupal core hook_library() feature request, which contains plenty of background info for why we need Libraries API)
Note that the latest patch in the first issue for Wysiwyg was not committed yet. Wysiwyg is already using sites/all/libraries, so those changes would basically add a module dependency only, thus deferred until work on Wysiwyg 3.x actually starts.
As of now, Libraries API does not do much on its own. It's merely a helper function to retrieve directories from sites/all/libraries, so other modules can depend on it.
The rough and to be discussed plan to move forward looks like this:
libraries_get_version($library, $file, $lines, $pattern)
, whereas those arguments would be specified via 'version arguments' in hook_library(). This will most likely be suitable and sufficient for >90% of all libraries.libraries_install_instructions(array $libraries)
, and so we can improve usability once for all modules. #487690: Improve installation instructions contains some screenshots, ideas, and discussions around this.I hope this list contains everything, but I'm not sure. Until now, further progress on Libraries API was mainly blocked by not having people to discuss its design and architecture - as you can see, the todo list is pretty long and every single topic is very complex. It would be wrong to just start to do something in the hope that it "may work" ;)
Thoughts?
Comment #9
klonosHey Daniel and Tobias, thank you for considering my idea and for all your hard work.
@Daniel: you seem to be puzzled about the need of multiple versions of a library kept. Weeell... how about when there's a new version out and some of the modules are updated to use it while others not yet. People need to test and report issues to the modules that don't support it yet so that they eventually will. So, instead of copying versions back-and-forth to the server and trying to remember what version is placed under the ../sites/all/libraries folder, you can have different versions archived there and the Library API module would simply provide a UI to select which version will be 'exposed' to other modules. So, modules...
- could simply rely on Libraries API to 'point' them to the most current version of a library.
- or they could override the version by having one shipped with them (also useful for when people don't have Libraries API installed)
- if there are issues, they could also override the most current version of the library with an older one (once a way is found for modules to use different versions of the same library without issues)
There could also be some more reasons or use cases that I haven't thought of. Do you see the potential in this now?
Comment #10
sunThis is the situation we are actually facing in Wysiwyg module already. And there's no problem with having only one library version in place + multiple being supported. If you install a library version that's not supported by all modules that want to integrate with it, then you need to step back to a version that works with all modules.
For example: #695398: Support for TinyMCE 3.3
The remaining points of your follow-up are based on the paradigm/thinking that any module controls the version of a library that will be loaded...
Now multiply that thinking with another dimension: multiple modules.
And now, yet add another dimension: themes.
Which one wins? Which module's functionality will be broken?
That's why we can only support only a single instance of a library. We need to understand that libraries are third-party software, which we want to depend on.
This third-party software is made available by the site administrator, has different release cycles, and eventually even changing APIs in minor versions. All of these are (external) factors that can break your site, or the functionality of a particular module that wants ot use the library.
Therefore, all modules that want to integrate with a library need to act like consumers, implementing an observer pattern. Ultimately, Libraries API's goal is to take away the logic to discover and identify a library. But much like Wysiwyg's hook_editor(), consuming modules need to implement proper support for varying, evolving libraries, with the paradigm in mind that anything that can change, will change.
Comment #11
klonosI know... I understand all these points. And I know that multiple library support is not implemented yet (it might never). My point was to simply make the life of people that heavily test compatibility a bit easier. You know... the whole upload-extract and delete-(re)upload-(re)extract procedure.
I believe a lot of people (like myself) are found in a situation when they try different versions of libraries and if it so happens that something in their site breaks and they discover that a few days later, they start asking themselves 'Did I use version a or version b of that library?'. Then we start digging in the libraries directory and opening README and Changelog.txt files trying to answer that question.
If this feature ever gets implemented, it will not (initially) be for end users or live/production sites. It will be a helper for people like module developers and heavy dev release testers. You have to agree that the
../sites/all/libraries/[library_name]/[library_version]
is not such a bad idea and it helps keep things a bit tidier (plus it sets a starting point for this feature request). All that Libraries API has to do is provide the means to be able to quickly switch betweenversions easily (say with a drop-down menu in the admin UI) and only expose one version of each library each time.
Now, if in the meantime (cause my guess is it will take a long time) a way is found to have multiple versions of libraries, the foundations will be already set and hopefully then the benefits of this implementation will be available to a wider audience.
All that said, I realize that this issue could be set to 'postponed' and be picked up again at a later time when time and circumstances in general permit.
Once again, thanks for bothering your brains with my request/idea ;)
Comment #12
tstoecklerI think that is something, that we will eventually be able to prevent with Libraries API. Each module requiring an external Library will specify the version it requires, so if a different version than the required one is found it would make sense, for instance, for Libraries API to show a warning on the Status report page. Libraries API will not (!) help with actually having two different versions in parallel, but it can help you if you are developing with a module that depends on an outdated version.
That's at least what I imagine Libraries API would do in my perfect world. Don't know if that is on sun's list as well.
Comment #13
klonosMy thoughts exactly!... at least till a safe way is found to actually have more than one version in parallel.
Comment #14
tstoecklerRead the comments sun linked to above, why supporting different versions in parallel is not something we want to support. As you can see in my patch at the top this issue and suns comment, this a choice, not a technical limitation. Just, so you don't get your hopes up =)
Comment #15
klonosfair enough... but never say never ;)
Comment #16
tstoecklerThis is a draft of a hook_libraries which basically covers 1. and 2. from #8
If you give me green light, I'll work on implementing such a hook.
Comment #17
sundoh! Dreditor needs a .patch file ;)
Comment #18
tstoecklerWhat a chance to finally figure out that fakeadd thingy...
Comment #19
tstoecklerJust a note, that I will probably start coding this this week. (Also while re-titling I don't know, why I called the function hook_libraries_info()...)
So if it's totally off, now is the time to yell at me.
Comment #20
sunThat was actually correct :)
Note that we can probably copy the code from Wysiwyg API - actually I thought there even was a patch already... (?) - perhaps in the "Libraries API" issue, which I already linked above
Essentially, that code is a fork of Panels' plugin system, which has been abstracted and generalized into CTools in the meantime. We can surely go ahead with the current code from Wysiwyg HEAD, but ultimately, this will most probably mark the start of adding a dependency on CTools to not duplicate this effort. We can happily defer that to a follow-up issue though (and likely better than trying to revamp all of this in one shot).
Comment #21
tstoecklerYes, I had taken a big chunk from WYSIWYG API for the hook description in #16/#18.
Just to summarize (if only for my own reference) #16/#18 vs. hook_editor in WYSIWYG API vs. hook_library in core. (CTools is not in there because I didn't look at it originally. I just looked at it briefly and it seems to me, that utilizing CTools Plugin system is a non-trivial decision, so I am more than happy to defer that to a separate issue.)
libraries[] = mootools (4.7.2)
libraryeditor. That way it can give specific files 'title's and other meta-data. We don't need that (I think/hope!), so I omitted that and just went with a 'files' parameter to declare all relevant files. hook_library divides that into 'js' and 'css', but I think it would be just as easy to simply use an associative array with the keys being the filenames and the values being the types ('js', 'css', 'php') (NOTE: I just thought of that now, in #16/#18 'files' is a non-associative array, which is inflexible because we would have to hard-code 'file-ending' -> 'file-type' associations).Furthermore, in comparison to hook_editor, #16/#18 has
while it omits
because again I think/hope(!) that this is not needed.
Furthermore, in comparison to hook_library, #16/#18 has
One last note: I just realized that a bunch of parameters in #16/#18 have underscores where it is probably preferable to use simple spaces.
Comment #22
sunUgh, no - caution: we've lost one dimension here. :)
But I can understand that it's not very easy to grok the big picture. Let me try to clarify:
- based on the example of tinymce.inc -
This directly leads to the next topic: The properties 'js files' and 'css files' defined in 'versions' are also specific to Wysiwyg API, and technically, those only apply to Wysiwyg API. Those files are the actual integration/support files for the library, which Wysiwyg API loads when the library is loaded.
Most modules need to load integration code for the library that is being loaded. So this information should be registered with the library. Compared to 'libraries' ('variants'), the difference is that we talk about own files here, not third-party files. Ideally, this should be standardized as well, so a 'integration' (or similar) property, keyed by module, defines JS/CSS/PHP files to be loaded when the library is loaded.
Alternatively, or additionally, those integration files could be added by invoking registered callback functions. But I'd rather prefer to keep the "integration files" information in the registry.
In a follow-up issue, we'd have to think about ways to invoke/load a library - passing the module name, so the integration files would be automatically loaded (or not).
Effectively, something along the lines of:
Note: You can also find me on Skype.
Comment #23
tstoecklerThanks for taking the time to write up that awesome explanation!
After now re-reading for the 4th time and looking at wysiwyg_get_all_editors() I think I get the point.
I basically agree with everything you said in general, just some comments, which aren't really dealbreakers and which don't hold me up from actually trying to implement that in the coming days.
Concerning Skype: I don't have a headphone at the moment, I could jump on to IRC if that's requested, though. Personally, I don't really dislike this issue queue discussion, because it gives me time to figure stuff out on my own, before asking again. I could understand, though, (and that's meant in all sincerety) if you're tired of giving me a (free!) intro course on the inner-workings of WYSIWYG soon to become Libraries. So, in short: Whatever you say :)
Comment #24
sunGood thinking.
1) For now, we should keep the "possible" top-level properties as flexible as possible. If modules need to register more information for libraries (like Wysiwyg), then that information is very likely required information. Yes, property clashes are possible this way, when considering all 4 dimensions. But yeah, as we don't have real world data for a fully fledged multi-dimensional system yet, we can let this evolve and keep things easy (i.e. allow registering non-standard top-level properties).
2) Basically you're right with the "conditions" consideration. If there are variants, then the variant to load will most likely (but not necessarily) depend on external factors. In Wysiwyg's example, the editor library to load could depend on global settings defined system-wide elsewhere: a) JS aggregation b) JS minifying etc. So Wysiwyg would/could auto-load the appropriate variant depending on those conditions. However, that's pretty much up to the integrating module and likely vastly differs from library to library. Truth is that I didn't come around to implement support to configure the variant to load in Wysiwyg yet, and while that heavily hinders debugging, it's not that easy to support in Wysiwyg itself (as additional [own] integration files may need to be loaded or other conditions need to be triggered).
3) A top-level 'files' defining the default files to load, next to an optional 'variants' defining different sets of files sounds awesome! :)
re: Skype - I can't do calls myself either, only chat. IRC distracts too much from my day to day work, so I try to limit that to weekends ;) I offered it, so you don't have to wreck your desk by bashing your head on it, and may get quicker answers for questions around the weird nightmares of libraries. ;) I really appreciate that you want to work on this!
Comment #25
tstoecklerHere's a first step.
Various notes:
The example implementation begs an obvious question: If I declare a 'files' array in 'versions' do the actual files get added to the list in the top-level 'files' array or do they get replaced.? I'm thinking the former (in which case the documentation and code would have to updated) but I'm not sure.
Not implemented yet (partly already discussed, partly not):
Comment #26
tstoecklerDefinitely!
Comment #27
tstoecklerSomething that just came to mind:
If this is already a whole module only for this purpose, I think it should do its job right and, when checking for the existence of the library, not just check for the directory but check all the files as well. This would have to be done at the end, though, when the 'files' overloading has already taken place. Then we could even put in some error, like 'Your library seems to be corrupt, not all files were found' (in nice). This, of course, would above also go in the category 'not yet implemented'.
Comment #28
sunGreat!
We need to talk about your coding style at some point though. ;) http://drupal.org/node/1354 and surrounding pages hopefully help with the rough edges, so we can deal with remaining details afterwards. Let me know whether you want to do that upfront (before introducing more code that needs adjusting) or later :)
1) It seems you copied the version override logic from Wysiwyg. If you didn't alter it, then it should work (already tested by thousands of users ;)
2) You renamed the 'integration files' key, but its value is not suitable for anything I know. :) Also note that we absolutely need this data to be keyed by module. Since the subkeys are not files, the rename to 'integration files' probably isn't perfect. However, I agree that 'integration' is a very broad term.
3) The propertes in 'versions' need to replace the "default" properties. A later version of a library may remove files, rename them, or whatnot.
4) I agree that the plain registry needs to be split from the actual library detection and version handling. Most importantly, because we need to prepare (+ alter) + cache that registry info, without even knowing whether we will load or use any of those libraries on a page. Secondly, the squeezed in drupal_alter() mentioned in the last sentence needs a proper location, still not affecting actual usage of libraries. Lastly, I'm not even sure whether two stages are sufficient. I'd rather consider 3 stages: registry - detection - usage. We will need detection without usage for a central administration page that lists all supported/required libraries in a Drupal site (likely in Administer » Reports).
5) I agree on deferring variants handling. Let's just define how it should/could work out for the registry for now.
6) If the same library is registered by more than one module, then we need to account for module weights. We'll deal with all 4 dimensions when we have to (likely to happen when usage statistics reach >10,000 users).
7+8) yep, deferred.
9) The default version callback, we can equally copy from one of Wysiwyg's editors. YUI's version callback looks like a good template to me, just needs some variables replaced. Note that we should use named arguments for 'version arguments', i.e.
array('file' => 'sub/dir/file.txt', 'pattern' => '@(\d+)\.(\d+)@', 'lines' => 100)
.10) Not sure whether a further validation of files makes sense. What matters is that some primary files are located at the right place. We equally do not support partially uploaded Drupal modules or themes. And no one on this earth will support hacks or customizations in libraries. ;)
Lastly, you mentioned that you wrote yourself a testing module... btw, do you know how to write tests? :)
Comment #29
tstoecklerAll right, I hope I don't forget anything :):
0. I'll do coding style in the next round (not necessarily tomorrow, though).
1. Well I altered two things: a) Since we default to a version callback (ie we always have one) I removed an if. b) Since versions is now optional the whole thing is now in a giant if (...['versions']) {}. So if you don't specify versions, it will always succeed. The main parts are untouched, but before this is committed (at the very last) I will to one round of testing every possible scenario just to be sure.
2. Damn, I knew I forgot something. Yes, that totally needs to be keyed by module. I'm pretty sure, we're on the same page, but just to reiterate: I wouldn't actually change the signature of hook_libraries_info() to force modules to key 'integration files' by their own name, that should be done in libraries_get_info() (btw, what about the name, I just chose one that seemed somehow reasonable, but it's not really convincing, IMO).
Also , yeah, found what you mean.
3. That's good then, no code change. But I guess a comment in the doxygen to warn people about this behavior would be adequate.
4. References to drupal_alter() always make run in fear so I won't comment on that. I'll try a seperation of 'registry' and 'detection' in the next round. Any ideas for function names?
5., 6., 7., 8. Great
9. That's good. Also a candidate for the next round. Thanks for the pointer. I like the named version arguments. I thought about that too, but then didn't go for it, because you don't have that eg in hook_menu(). All the better.
10. Granted. I guess it would be overkill.
11. Yes, I know how to write tests. But you will need to tell me how to make tests find something in sites/all/libraries. Oh wait, I get it, you just want to test the correct hook invokation (ie that the information ends up correctly in the registry?!). Yeah, I didn't think about that. That would also cover 1. then. Also, I always hear people talk about unit testing (as opposed to functional testing. Or something?). But I never got that. So if you want unit tests (better: if unit tests are adequate here) I would need some advice.
So just a little TO-DO list for the next time I'm feeling ambitious:
Feel free to add more if I've missed something (or if something pops into your mind).
Comment #30
sunA libraries_get_info() or just simply libraries_info() API function to retrieve registered libraries is something we actually didn't really discuss yet ;) We can go with either one and keep it simple for now, i.e. build the registry, and return the key that has been asked for. Happy to defer this detail, as that talks about retrieval already, and registering itself is complex enough ;)
Note that Wysiwyg has some library detection error handling mixed into the registry process, which is quite valuable - differs between "not found", "unable to determine version", "not supported", and "cool, installed".
re: SimpleTests: Actually, I was rather kidding ;) I mean, it would be awesome, but we probably want to defer writing tests until we have a final patch/implementation RTBC here. Otherwise, we'd have to adjust those tests all over again. (I also have to prepare some initial .test files/directory to make this easier).
Comment #31
sunQuick follow-up, as I just saw another related issue hip-hopping around:
hook_library_info() currently defines
'path'
, the relative path to the library, (more or less) starting from sites/all/libraries. (Actually, the actual base path to start from is related to the Scan: Name clash issue, but anyway, different issue.)Currently, Wysiwyg processes that relative
'path'
into an (more or less) absolute'library path'
. (Actually, still relative, but the full filesystem path to the library.)There can be edge-cases, in which a drupal.org project, downloaded as usual into sites/all/modules, shall be used as library, instead of module (BUeditor). True - Wysiwyg could simply direct users to download that module and extract it in sites/all/libraries instead, but FWIW, it should be possible to (pre-)register the full 'library path' upfront, if that is known already.
btw, stream wrappers and external JS/CSS support in D7 sound like... hahahah, crazy areas we should explore after this issue... ;)
Comment #32
tstoecklerAll right, two things I don't quite get:
I don't get what you're trying to tell me here, sorry.
On the other things in #30:
1. Yes, that's how it currently works.
4. Function names sound good. Not that I currently stole all that error handling from WYSIWYG so we can differentiate exactly the 4 mentioned cases.
SimpleTests: Well, I wrote that test module which registers a page with hook_menu and does a print_r(libraries_info()) there. Now I didn't write any assertions yet (ie I looked at that page manually) but that shouldn't be that hard or time-costly to do. Good to know that it's not that high on the list (for now), though.
Oh, and one other thing to add to the list of crazy things to do in D7: Use the Plugin manager to automatically download the libraries if they're not installed.
Comment #33
sunNow that I mention it, note that Wysiwyg even auto-generates yet another 'editor path', which originally was something different, but I'm currently unable to grok my own code. ;)
Comment #34
tstoecklerNext round. More a cleanup version than anything new.
Not done (I guess in order of importance):
Random notes/questions:
I will try to provide 1. in the next few days, which would make this patch pretty self-contained, I guess...
Comment #35
tstoecklerAhh, found one thing you wouldn't have liked.
Comment #36
sunTo move forward, I've taken your patch, revamped the docs and also the implementation a bit, and committed the attached patch to HEAD (7.x).
This does not mean we're done with this yet. ;)
By comparing the patches and/or code, you should notice some coding style issues I fixed along the way.
Also added a couple of @todos, which we need to figure out.
Additionally, I'm not sure whether the current override system of 'variants' + 'versions' + 'integration files' will work out in the long run (i.e. when thinking in full 4D). I fear that this override system worked/works fine for a single module like Wysiwyg, but not necessarily if applied globally. To explain the dimensions again:
We perhaps need to invoke a new hook after detecting a library's version, to allow modules to return their integration files for the specific library version.
Or we need to drop the integration files from the registry and leave the inclusion/loading of those files to the integrating module. Though that would likely mean that we'd be targeting and limiting this system to a 1:1 relationship again (bad). So rather not.
Comment #37
tstoecklerAwesome!!! Love to see this move forward!
Some things I noticed reading your patch:
'chars' -> 'characters'
If multiple modules implement the same library, won't this be overwritten every time? Maybe, though, I don't get this property correctly. Modules that depend on a certain library should be detected someplace else, right?
Wow, I didn't know it was that easy... No reason to run in fear, I guess :)
I think you're not supposed to call parameters by reference, just declare the parameters by reference in the function declaration.
Awesome. I had thought about the need for something like that while writing the previous patch, but forgot to mention it. Great stuff!
Not that such a hook would be bad, but a module could also just specify integration files inside of the 'versions' array. That way it would conditionally be overwritten.
I think a more foolproof approach would be the following in linbraries_info():
1. Key the libraries by $libraries[$library_name][$module_name]
2. Merge the values from $libraries[$library_name][$module_name] into $libraries[$library_name] and check for each value, if the values are equal or not.
- If they are, just use the value
- If they aren't, throw some kind error. Probably a watchdog call would be sufficient.
Also, the 'integration files' key can just be merged as is.
Powered by Dreditor.
Comment #38
sunSome of the issues you raised are valid and we need to fix those. In general, however, let's try to forget that this code is already committed and treat it as subject to change. I.e. let's not get too detailed about the actual code yet, but rather discuss the big picture.
That said, I'm not sure whether I understood what you meant in detail with your last suggestion of keying library information by module. While we should think of the possibility of multiple modules registering the same library, there at least has to be one thing that registers a library. If there is only one module that registers a certain library, then there is nothing to merge. If multiple modules are registering a certain library, the question is: what do module authors expect to happen?
Comment #39
tstoecklerRight we only need to do the whole thing I described, if there are multiple declarations of the same library. What I described, was a way to handle those multiple declarations from a technical standpoint. As you say, the question, what the result of that 'merge' is to be, is still open.
In my explanation above it was:
- If the infos are identical -> Do nothing and use the information
- If they are not -> put a notice in watchdog. (Once we actually have a UI with a list of Libraries, something should go there too, of course)
I guess the problem/question is not directly for module developers, at least not in every case. When you develop a module you don't necessarily test it with every single other contrib module. But I guess, the behaviour above, would simplify bug reports of 'Hey, this library isn't being loaded'. The maintainer would just have to say: 'Search watchdog for "foo" and paste it here, I'll do the rest.'
Comment #40
sunI just had to re-learn why Wysiwyg uses a "library path" next to an "editor path": #752516: Version callback failed to open stream
In short: If a registered library specifies a "path", then libraries_detect_library() will compile the actual path to the library + that path into "library path". The version callback always needs to get the unprocessed/unappended/original path to the library as "library path", so as to be able to access a changelog.txt or similar file outside of the actual library directory.
I think I already ensured that before committing this code. However, we likely want to clarify this in docs/inline comments, so as to not unintentionally break it in the future. :) Perhaps we should think about a separate property that holds the vanilla path to the library only, too.
More relevant for this issue: The version callback of YUI editor was optimized due to aforementioned issue.
Comment #41
sunSince use-cases are more worth than hypothetical stuff, I continue with another issue:
#276465: Add support for TinyMCE gzip compressor tries to add support for TinyMCE's native gzip compressor. Background: TinyMCE ships with 3 variants by default; Minified, jQuery, Source. Users can optionally download a 4th variant that's called "gzip compressor", and effectively changes the way how the library needs to be loaded. It's basically a single JavaScript that invokes a server-side PHP script that takes a list of JS files to aggregate and return in a gzipped BLOB. All of that is irrelevant for us here, but what's relevant: The library variant is optional. But to support it, the module registering the library likely needs/wants to register that variant as well (as it's still the same library, only a new variant).
To actually use the variant, the integrating module needs to expose a select widget or some other mechanism to choose the variant to load. As of now, it cannot know whether the variant actually exists.
This most likely means that we need to detect whether library variants are installed - after detecting whether a library exists, and after merging the version-specific overrides into the global library properties.
Comment #42
klonosgood catch sun! I wasn't aware of that. I agree that it should be taken under consideration during implementation.
Comment #43
tstoecklerPatch contains libraries_get_version().
Well, that was a lot easier, than I thought. Thanks for the pointer to YUI.
This also fixes the two code-related issues I noted above.
This is untested, I will leave that to the hopefully soon coming SimpleTests.
Will work on libraries_load() now.
Todos:
- #41 (Variant detection)
- #37-#39 (Duplicate declarations. Maybe related to #465908: Scan: Name clashes?)
- 'library path' vs. 'path' vs. 'editor path': In order to avoid confusion, wouldn't it be easier to keep 'library path' as eg 'sites/all/libraries/tinymce' and then append 'path' to it when needed? That way we wouldn't have three different paths, of which two are a subset of the other.
- Resolving of the call-by-reference thing. Leave that to #466090: Scan: Cache results?
Comment #44
tstoecklerNow with libraries_load().
This one, too, is completely untested, so I'm pretty sure I messed up somewhere.
I hope to get some not so simple tests written for this after dinner.
Comment #45
sunDocblocks need to start with /**
The function summary should start with a verb in 2nd person (e.g. "Loads") and needs to end with a period.
Unfortunately, this is too simple... The array values can also be option arrays.
We likely have to fork most of the code from http://api.drupal.org/api/function/drupal_process_attached/7
Note that version callbacks with named arguments are getting a single argument (array). The PHPDoc needs to be updated, too.
Powered by Dreditor.
Comment #46
tstoecklerRerolled for the first three things.
I didn't get the other one:
We're calling user_func_array, so each of the array values gets passed as an own parameter. The docblock for hook_libraries_info() is a bit unprecise about that, if that is what you meant, but I don't get, how the code should be updated.
Maybe I'll find that out, when the tests I'm about to write fail.
Comment #47
tstoecklerWell I started with some tests.
I noticed that I currently don't have a working SimpleTest environment, so ironically, this is untested.
Will flesh this out, hopefully this week, but wanted to put this out there.
I'm not quite sure if I took a good approach in how to test the libraries so improvements are as always welcome.
Comment #48
Cyberwolf CreditAttribution: Cyberwolf commentedSubscribing.
Comment #49
gausarts CreditAttribution: gausarts commentedSubscribing in case I miss it. Thanks
Comment #50
Anonymous (not verified) CreditAttribution: Anonymous commentedSubscribing.
Comment #51
blg@bgreenaway.com CreditAttribution: blg@bgreenaway.com commentedSubscribing. wrt jQuery Libraries requirements.
Comment #52
tstoecklerIt's been quite a while, but I finally have a working development environment now.
New patch attached.
* Fixes a bunch of PHP errors / fatals
* Makes the SimpleTests work
Note:
On part of the test is commented out, because it does not work. I think that is because we currently just die if we don't find a file, instead of some kind of fallback, will investigate that, though.
@sun: I want to get the above mentioned problem working before I tackle the problems that are discussed above (ie variant detection among others, but I'm pretty sure there were others). I will have to read up on those things again, before I can even think about them. Assuming you've got a grand vision on mind, what we could do is that you just write the API documentation on how it should work and I'll see if I can get it to work that way.
I think the SimpleTests (while they most probably can be improved) do provide a more or less robust starting point for further development.
Also, if I'm feeling ambitious I might start an issue for a Libraries UI, because that would not only make sense in general, but would also ease testing, because running SimpleTest tends to be a bit slower than simply reloading a page which already gives you all the information.
(Disclaimer: I've not been around in this issue for the last ~4 weeks (and Drupal development in general), due to lack of time. The current week and the one after that, I should be able to squeeze in some time regularly and I plan to advance on this issue during that time. After that my efforts might be back to a minimum.)
Comment #53
tstoecklerTalk is silver...
Comment #54
tstoecklerNow this one actually works and passes all tests.
Next thing I'll do is re-read the last half of the issue and try to implement missing functionality.
Leaving at needs review, because the patch is now at a pretty self-contained and reviewable state.
Comment #55
tstoecklerDamn.
Comment #56
tstoecklerSorry for the noise.
Just a small note, that libraries_get_version is not working currently. That's because in hook_libraries_info under 'version arguments' => 'file' you only specify the relative path, which is then passed straight on. But since libraries_get_version, does fopen, etc. we really need the absolute path.
Don't have a solution right not off the top of my head, but I'll think about it.
Comment #57
tstoecklerI'll believe the TODO-list I wrote in #43.
This patch implements variant detection (and loading).
I also noticed that we didn't load integration files yet, so I implemented that.
Both of this is untested, but there are no fatals and the existing tests still pass.
Still left to do:
I think that's all, but I could be missing something.
Especially needs review on the implementation for:
I think those are the things that are new since your last review.
Also comes with a proper patch name now.
Comment #58
tstoecklerWill roll a new version soon which implements the tests for variant loading and integration files.
Regarding the latter, I just noticed using my approach we limit people to actually including existing JS and CSS files in their modules as integration files vs. all the other options drupal_add_js/css have. We support those for the actual library files (upon your request) but not for integration files.
I actually think that is a good thing, but it would not really be hard to remove that limitation, that would just mean more code.
Comment #59
tstoecklerWow, the last one was, again, pretty broken in relation to integration file and variant loading.
This one works, though! (Hurray for test-driven development).
#57 still stands, except that, well, it now works!
Comment #60
tstoecklerI was trying to build a UI for Libraries (will hopefully open a new issue soon), and I found a couple of bugs, which made me reconsider the previous testing method.
This now tests rather atomically library-detection with all possible failure cases, libraries_get_version(), and library-loading including variant-loading.
Pretty sweet!
Comment #61
tstoecklerSomething I thought about.
Imagine we support external JS (which isn't really hard (for D7) since we use drupal_add_js anyway) and Openlayers wants to use Libraries API. They have an external variant where the library is accessed online and one where you can download the library and access it directly. I guess that will be a fairly common pattern, when libraries implement external files. Then they will want to specify some 'order' in which the variants are assumed to be default if they are available. That way, if the internal library is available it would use that and if not it would use the external one by default.
We would get that feature (almost) for free, with following logic in libraries_load_files() (untested):
Also, I don't know if we want to support external JS in this patch. As noted, it shouldn't be too hard, we would just need to specify a way to declare that. I think it would be enough to define a constant such as LIBRARIES_EXTERNAL and then external libraries should use that as 'path', and then we check for that in libraries_detect_library().
Both of those basically need a decision on what we want (again...).
Comment #62
sun1) Are we sure that the "version" key isn't used already? Not sure whether "installed version" isn't more precise?
2) Alternatively, would it make sense to have "installed" not be a boolean in case of TRUE, but the installed version number? Not sure whether that makes sense. Perhaps not really clean.
(and elsewhere) Missing "(optional)" and info about the default value if omitted. See http://drupal.org/node/1354 for examples.
1) Why the extra newline?
2) What's happening here? Can we add a comment?
3) Why two separate if conditions?
Let's append a @see to this comment, stating from where we forked this code, for future comparison.
require[_once] and include[_once] are statements, not functions. We write them without parentheses.
Like below for $cols, I wonder whether we should also have a default value for $lines, e.g., 20.
Actually, should we default to a reasonable maximum length per line? For example, 100-200? fgets() will stop at whichever comes first, line end or maximum. That way, we'd prevent people from mistakenly reading entire compressed script files into memory...?
Why do we need call_user_func_array() here? That makes things even slower... ;)
Trailing white-space.
wow! I'm going to commit some empty files here.
Powered by Dreditor.
Comment #63
sunwow, I've to say this is some quite impressive and well work, tstoeckler! Well done!
I've just committed all files below /tests, including smaller quick fixes and changes not worth to mention (you may want to compare your working copy).
Not committed yet are the main API changes and additions. I hope to be able properly get back to this issue very soon, to re-read and re-confirm the proposed changes. But all in all, they look very promising!
Lastly, I'm feeling comfortable with granting CVS access to you now. Welcome on board! 8-) (Not sure whether we already talked about maintenance, but we have some best practices[, which actually state that you're free to go ahead if I won't come back to review this patch in a reasonable time-frame ;) ])
---
Also, you don't seem to have a twitter account... anyway, http://twitter.com/tha_sun/statuses/18677478499
Comment #64
sunerr, since I already have it applied, I could have re-attached this sucker. :)
Comment #65
tstoecklerWow, Thanks! That's great!!!
I read http://drupal.org/node/363367 and it seems to very coherent with what I would consider best practices, so that's good :)
I think now that we're on the verge of solving the very base problem of Libraries (for now!!!) once we've fleshed out this issue we can actually have contrib implement this and then see how all this works out with different libraries. Also this paves the way for the other major issues in the queue right now.
So I'm glad to be on board and look forward to (external) libraries support in Drupal 8 :) Hehe...
Now onto some comments. I'll leave things out that are uncontroversial/I agree with:
It isn't used, but it might be confused with "versions". On the other hand there is only one version at a time and that is of course the installed version so "installed version", which is what WYSIWYG uses, could be seen as redundant. I don't really care, but we wen't with "version" in the patch that was your previous commit, and the current patch just makes is consistent (== working).
I don't find that to be very clean either, but again, not very attached to that emotionally :)
That's just the variant override. Comment is definitely useful.
Just checking for the second one gives you a PHP5.3 notice, but from (re)reading it now, it seems like they could be one line?! Will try that out...
I think that's a great idea. Since everyone implementing a library has to have a version callback, we should try hard to make libraries_get_version() as simple as possible. Then most people would only have to enter a file and a PCRE expression. We could even document 3-4 common regular expressions for people to copy&paste.
There war a reason, ie something not working. But I don't remember that off the top of my head. Will look into that.
Concerning the @todos you added in the test files concerning the "missing" files:
1. I don't know if a top-level 'files' property makes sense, I just blindly assumed yes.
2. I originally had all of these "missing" files there and tested that they were NOT loaded, but at some point in time that seemed like overkill to me, so I removed it. Don't really know what makes sense here.
Comment #66
sunoopsie. heh, seems we're good to go then ;)
aight.
ok, would be good to find the common, maximum values from existing version callbacks in Wysiwyg then (they're quite different, IIRC).
you know what that means, right? Always document shit! :) Better one line of documentation too much than missing one.
Basically, whenever you're talking to yourself, or asking "WTF?", or starting to experiment, or whatnot -- all key signs for documentation being required.
But in the end, I believe we're able to remix this line without cufa().
IIRC, we discussed here that a top-level 'files' property makes sense for libraries, which don't implement variants; i.e., if there can only be one set of files, that's it. Otherwise, files need to be defined per variant.
Actually not sure whether we discussed this here, but it would make sense. :)
I'd consider this an essential part of the API that needs to be tested... if we are supposed to load certain files only, including support for version-specific overloading, then the API better doesn't load files it shouldn't load.
Comment #67
tstoecklerAll right. Just one thing left:
That actually means we won't have to add any more files though. We just remove the top-level files property, but leave the files for version '1' (the wrong one) as 'missing', because for version overrides we can just test what ends up in the $library array.
Comment #68
sunSure, but also not so sure. I think that we'll have to rebuild the tests at some point anyway, to make them more atomic unit tests. For example, the first libraries named after their special testing purpose will likely lead to more precise testing results than the other, big library that we're using to test variants, file loading, overloading, etc.
We likely can register many more libraries, from which some are referencing the same testing files, so as to being able to separately test a top-level files property, variant overloading, version overloading, variant + version overloading, loading of integration files, aso. - i.e. all the details that we are presuming and expecting right now.
Comment #69
tstoecklerAll right. New version attached.
This fixes all mentioned problems. Well, the easy ones...
A couple of "API changes":
example.xxx (could be omitted, potentially)
example_version_1.xxx
example_version_2.xxx
example_variant_1.xxx
example_variant_2.xxx
I tried splitting this up into smaller chunks to make it more reviewable, but I always got stuck somewhere. It's just too interconnected. On the other hand, once this sucker is in, it paves the way for a lot of other cool stuff...
Comment #70
tstoecklerLess whitespace and a small optimization, where libraries_load_files was calculating the library path twice.
Comment #71
tstoecklerThe whitespace is more persistent than I thought.
Comment #72
tstoecklerAhhhh....
I swear this is the last one. I just saw I forgot to update the parameter descriptions for libraries_get_version in the function declaration.
Still 35 assertions (yeah!).
Comment #73
sunThanks!
I'd pass the entire $library info, not just the path.
Would it make sense to start a new sub-property-list for 'variant callback' and 'variant arguments'? Of course, only containing special keys. It won't be easy to clearly state that the properties belong to each variant, i.e., onto a sub-key of a sub-key of 'variants' in reality.
Same as below with $library[_path] here.
d'oh! uhm, here you're removing the one-argument feature I'm talking about below... :-|
(and elsewhere) Attention: array_merge() potentially alters array keys. It's better to use
Also, we should be consistent with those callback arguments. The version callback supports an indexed list, which are passed as separate arguments.
In general, I'm more in love with the named parameters (which result in a single keyed array as argument to the version callback, also skipping cufa()), so I'd have no problem with standardizing on this type, perhaps. We could then pass $library as first, and $options as second argument. Also, AFAICS, the current code does not implement/ensure default values for the named parameters yet.
Should we prefix $file_path with DRUPAL_ROOT ?
First @param is missing in PHPDoc.
Powered by Dreditor.
Comment #74
tstoecklerWell, I did pass the whole $library first, but then I had some smaller errors, and doing a debug($library) is just horrible when you see everything twice. Technically not a problem, though.
Ahhh, now for the first time I understand what you're trying to tell me... Right I will adapt the code for that. Then of course the lines I removed for the single parameter handling are indeed needed. (They weren't needed because we were calling cufa() anyway...).
I'll roll the path accordingly, but if only for reference I must say, that I actually don't like it that way for 2 reasons:
1. It's inconsistent with what we do for example in hook_menu()
2. It makes the function declaration less readable (Instead of just seeing $param1, $param2, $param3, I actually have to look in the PHPDoc to see what's going on).
Also the version detection shouldn't be happening very often, so the cufa() shouldn't be that much of a problem.
I thought it'd be like form callbacks where we don't document the automatically prepended $form and $form_state either. No big deal, though.
Hopefully the next patch will be tonight.
It'd be cool, if we could commit some version of this soon and then maybe refine in follow-ups as this really holds up all other issues currently.
Comment #75
sunYou're right about the documentation issue. But if you also consider variable arguments, optional arguments, but also arguments that may be changing over time, then it quickly becomes apparent that arguments like
array(20, 20, 'foo', 1)
are also not very self-explanatory, and the corresponding function signature of$rows, $cols, $prefix, $someboolean
is poorly driven by expectations.That said, we can keep the current behavior and just support both. We just have to ensure that both callbacks/arguments behave the same, and named arguments are always getting certain default values.
You're also right that version detection shouldn't happen very often. However, as of now, Libraries API is not using any kind of caching, so it can literally happen on every single request, for every single library ;) [different issue]
To document $library, we should (already?) have a standard description text, which anything else can just copy and paste. Similar to $form_state being documented in form.inc (HEAD, that is).
Happy to see commits and de-block other issues, as long as we keep the remaining changes in the loop.
Comment #76
tstoecklerSo if I understand you correctly we would do the following logic:
if $library['version arguments'] is a string, just pass it as a second parameter after $library.
if $library['version arguments'] has numeric keys pass them as individual parameters after $library.
if $library['version arguments'] has string keys pass them as a single $options parameter after $library.
I would favor that approach. I mean we are trying to cater for all possible use-cases architecturally, so why not in this API decision also. We can always restrict the options later.
Comment #77
sunmmmmh, actually only the 2nd and 3rd, as the existing code for 'version arguments' should already cover. If people want to pass a simple string, they can pass array('anystring') :)
Comment #78
tstoecklerHere's where I got tonight.
1 Test is still failing. Will look into that.
The whole "double-API" is making things a lot more complicated internally, I have to say.
One thing that bothered me though is that during debugging I temporarily constructed the file path wrong, but only the PHP file tests failed, the CSS and JS tests didn't. So I'm guessing our tests are flawed =(.
Still to do:
- The renaming of the test files (will go with the 2. approach i #69 ?!)
Concerning a commit. I guess since we're in the middle of a rather important outward facing API change, I'll let this pass for another round of reviews.
I plan to provide a patch for #466090: Scan: Cache results soon and will open new issues for 1. handling of external JS and 2. automatic variant loading (see #61)
Comment #79
tstoecklerIt's late...
Oh, just noticing while looking at the patch file:
I tried some doc changes, but, well... ...it's late :), so I might not have nailed it.
Comment #80
tstoecklerI need a Dreditor plugin for gedit...
Comment #81
sunBy documenting the key "options", readers are getting confused about the key. Reading this, I would have assumed that I would have to specify an array key 'options', which holds the named arguments.
Actually not sure how to document this properly. Perhaps a list isn't the best solution.
Interestingly, all variant callbacks will have to pass arguments like that in order to identify, for which variant they are being called?
Stray newlines added here?
I'm pretty sure that file_exists() will return TRUE if 'file' is (mistakenly) an empty string, since the directory exists.
Could we rename this to libraries_test_return_version(), so as to clarify most of the testing code?
I.e.
libraries_test_return_version('2')
...does what? yes, return '2' :)
I think we're actually able to pass TRUE/FALSE/NULL as arguments... no? Why the special string value?
It would be lovely to learn why we need to fork the function to use a list of arguments instead -- the most important "why?" is missing in the PHPDoc :)
If it turns out that named arguments do not work as expected, then we might have to consider to drop them.
Powered by Dreditor.
Comment #82
sunJust wanted to make sure that #763378: Meta Issue: jQuery Module is on your radar; most likely the very first consumer of this new API functionality.
Comment #83
tstoecklerUpdated version now. This passes the tests now. And adds one test for the alternative version callback.
You were right regarding the variant callback. We now pass the $name in addition to $library.
TODO:
- Fix the docs on the "double API"
- Debug the miraculously not-failing CSS/JS tests + check the file_exists()
- General in-depth doc-review
- General in-depth test-review
If we can agree, that this is the API we want (regarding the version callback) I guess those items would make good follow-ups.
Comment #84
sunDRUPAL_ROOT only applies for PHP files. Totally #fails for JS + CSS files ;-)
After fixing that, i.e., aside from that, let's turn this around: If _you_ feel comfortable with this patch, please go ahead and commit. Documentation and stuff can be finalized and fixed in follow-up patches; though I'd rather keep those follow-up patches in this issue.
Comment #85
tstoecklerCommitted the attached version. YEAH!!! That feels good. :)
I went through the tests in detail (there was quite a bit of stale code) and made sure everything is how it is supposed to be.
That uncovered a couple minor bugs (eg I had forgotten some '/' when constructing the file paths, etc.) which are now fixed.
The CSS / JS loading and testing also works. Before I had added debug($library) somewhere while testing, so that the file names of the wrong files showed up inside of the debugging info, which caused the tests to always pass.
I added some CSS and JS into the test files for testing / debugging purposes, as we currently have no way to actually test a specific portion of JS or CSS was loaded. Just look at one of the "Debug messages" when you run the tests to see how that looks like.
Fixed DRUPAL_ROOT in drupal_add_css/js (...had I mentioned it was late?...)
What is left now is to finish up the docs. I read through the sections changed in this patch again, to make sure nothing is actually incorrect as of now, but there are some parts which could be better. Especially the fact that there is two ways to do version/variant callback (which is de-facto a good thing), can be quite confusing, since we currently don't do a very good job of explaining the situation (as you already pointed out above).
Also:
In #465908: Scan: Name clashes you mentioned an .info file approach. IMO since this is highly related to hook_libraries_info() (which is after all, the title of this issue :)...) this might also be a good follow-up. I won't insist, though, if you want to stay two-digit in here.
Comment #86
tstoecklerThe whitespace never dies...
Comment #87
tstoecklerJust a note that I signed us up for SimpleTesting over at:
#689990-55: Contrib projects to be included in beta stage of automated testing for modules
Comment #88
sunLovely. :)
So, in addition to the documentation issues already mentioned earlier:
I don't grok this comment. (...but see below...)
We can combine the two warnings into a single one.
Should be in the libraries_test namespace, not libraries.
Same like version here -- ..._return_status() ?
ah, now I get it! ;)
I think we can shorten those @file docs and more importantly tell something about multiple CSS and JS files applying different colors.
Powered by Dreditor.
Comment #89
tstoecklerI think this fixes all mentioned items.
Comment #90
tstoecklerHmm. Maybe some notes on the non-trivial changes:
1. The @file declarations in all the test JS/CSS files. I shortened those to a minimum and added an extensive paragraph in example_installed.txt explaining the testing method.
2. On discouraging people to use 'library path' and drupal_get_path. I tried hard to get the latter in there, but it didn't really make sense. 'Libraries API will automatically detect that' is kind of obvious, IMO. Maybe I was just not creative enough, though.
Comment #92
tstoecklerJust a note that I have no clue why the patch doesn't apply. It's probably something with my system as I'm getting weird conflicts when applying the patch. Should be review-able though, anyway.
Comment #93
sunWhat a nice way of pulling me into this issue :)
Somehow, most of this description is documentation about 'version arguments', but not about 'version callback'. Why do we document arguments for the callback property? :)
Hm... re-reading this with fresh eyes, I wonder whether it wouldn't be better to skip this function header description, but put short one-line notes right above the actual code lines that define the 'library path' property...?
Something along the lines of:
:) Had to look this up. After looking it up, I wondered why we don't simply call this _libraries_test_return_argument()? 8)
heh. With those extensive docs -- how about renaming this file to README.txt? :)
Aside from those, nothing left to hold off this commit. Anything else we still need to follow up or fix in this issue?
Of course, we want our tests to pass. However, making PIFR behave is not always easy, probably better to rule out in a separate issue.
Powered by Dreditor.
Comment #94
tstoecklerBecause different arguments are passed automatically to version callbacks and variant callbacks.
I don't like the function name that well either but I think it is clear in context with the arguments right below it:
Changed the rest of the comments. The API doc is now less redundant concerning the different ways to declare callback arguments.
Attaching patch for self-review, will commit later.
(Note that for a reason unknown to me, the removal of example_installed.txt is not included in this patch, I will do that manually)
Comment #95
tstoecklerJust like sending an e-Mail without an attachment...
Comment #97
tstoecklerDuh.
Comment #98
tstoeckler#95: 719896-docs-cleanup_2.patch queued for re-testing.
Comment #100
tstoecklerGood thing we have testing now, I can't believe I missed that.
In the meantime, I kind of refactored the tests a bit. We really don't have different versions and variants currently, but simply 4 sets of arbitrary files, that we, in our tests, associate with different versions and variants. It is impossible though, to find a naming that fits all.
Therefore, I renamed the files to example_1.css, ...js, ...php through example_4.php
I also but the asserting of files into a seperate helper function. That makes the code flow of the actual testing code easier to follow. As a side-effect we get a couple more assertions, because we now test that the wrong files are not loaded for all libraries (not just the 'complicated' one as it was before).
I guess I'll leave this for another review, to see if you like this change.
Comment #101
tstoecklerJust to let you know, I've just re-reviewed the code, rather thoroughly and am fine with it the way it is. As I've said above, since this makes a considerable change to the testing system, I'll let you review it once more.
Comment #102
lpalgarvio CreditAttribution: lpalgarvio commentedhere's my ideas again:
http://drupal.org/node/681034#comment-3437286
i see you guys want to do multiple versioning. that would be more complex and more functional ^^
but a question, won't loading multiple different version jquery.ui in the same page/node/region for example, create some chaos?
like in same function names but different code
Comment #103
tstoecklerPlease read the above issue for more information. Short version: We support different versions of a library, but only one at a time.
Comment #104
tstoecklerI reviewed this patch again and could find no issues with it. The (new) tests pass.
I decided to commit this, so we can move forward with other issues.
Marking fixed, because I'm pretty sure that nothing that came up in this issue hasn't been fixed now.
Comment #105
tstoecklerAnd here's the commit link.
Comment #106
tstoecklerEhhh... sorry.
http://drupal.org/cvs?commit=426000