Update Task accidentally run twice (Page Attachments error)

I accidentally ran the rake update task for the Page Attachments
extension a second time. Now whenever I boot up the server I get the
following:

vendor/extensions/page_attachments/lib/geometry.rb:6: warning: already
initialized constant FLAGS
vendor/extensions/page_attachments/lib/geometry.rb:11: warning: already
initialized constant RFLAGS
vendor/extensions/page_attachments/lib/geometry.rb:28: warning: already
initialized constant RE

Is there a way to go back to the state before the update? I wouldn’t
otherwise mind, since this doesn’t seem to affect local operation, but
on Dreamhost, the server doesn’t take kindly to the messages.

Thanks in advance,

Ben

I get this error as well. Its because rails is seeing two geometry.rb
files. But what’s weird is that the attachment_fu plugin and
page_attachments extension require geometry.rb separately from each
other. So if you get rid of either, you’ll get dysfunctional breakage
both ways. I don’t quite know how to fix it.

Ben M. wrote:

I accidentally ran the rake update task for the Page Attachments
extension a second time. Now whenever I boot up the server I get the
following:

vendor/extensions/page_attachments/lib/geometry.rb:6: warning: already
initialized constant FLAGS
vendor/extensions/page_attachments/lib/geometry.rb:11: warning: already
initialized constant RFLAGS
vendor/extensions/page_attachments/lib/geometry.rb:28: warning: already
initialized constant RE

Is there a way to go back to the state before the update? I wouldn’t
otherwise mind, since this doesn’t seem to affect local operation, but
on Dreamhost, the server doesn’t take kindly to the messages.

Thanks in advance,

Ben

Do you have other extensions installed that use atachment_fu such as the
gallery extension?
On Mon, May 5, 2008 at 3:53 AM, Ben M. [email protected] wrote:

Radiant mailing list
Post: [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site: http://lists.radiantcms.org/mailman/listinfo/radiant


Andrea F.
http://gravityblast.com - http://nimboo.net

Do you have other extensions installed that use atachment_fu such as the
gallery extension?

Yes indeed. Could that be the cause of the conflict?

On Mon, May 5, 2008 at 1:43 PM, Ben M. [email protected] wrote:

Do you have other extensions installed that use atachment_fu such as the
gallery extension?

Yes indeed. Could that be the cause of the conflict?

Maybe. Both page_attachments and gallery have the geometry.rb file. Try
to
remove it from the second loaded extesion (maybe page_attachments).


Andrea F.
http://gravityblast.com - http://nimboo.net

I’ve also come across this warning but don’t have gallery installed…

On Mon, May 5, 2008 at 2:34 PM, Ben M. [email protected] wrote:

But, if that was the cause, then anyone using Page Attachments and
Gallery should have the error. If you have both installed, do you see
that message (“already initialized constant FLAGS”) when you start the
server?

Thanks for working with me on this one Andrea, I appreciate it!

What version of radiant, gallery and page_attachmens are you using?
Latest
for all?


Andrea F.
http://gravityblast.com - http://nimboo.net

Andrea F. wrote:

Maybe. Both page_attachments and gallery have the geometry.rb file. Try
to
remove it from the second loaded extesion (maybe page_attachments).

I moved the geometry.rb file out of the page attachments lib directory.
Upon starting the server I now receive:

** Starting Rails with production environment…
Could not load extension from file: page_attachments_extension.
#<MissingSourceFile: no such file to load – vendor/extensions/
page_attachments/lib/geometry>
** Rails loaded.

But, if that was the cause, then anyone using Page Attachments and
Gallery should have the error. If you have both installed, do you see
that message (“already initialized constant FLAGS”) when you start the
server?

Thanks for working with me on this one Andrea, I appreciate it!

Yep, all the latest.

Page Attachments 0.2
Gallery 0.7.10
Radiant 0.66

I tried uninstalling Page Attachments using:
rake radiant:extensions:page_attachments:migrate VERSION=0
RAILS_ENV=production
and deleting the directory in the extensions folder.

I then reinstalled it. Unfortunately, that didn’t work – the
initialized constants error is still there when the server starts.

Ben M. wrote:

Did some more testing, this is interesting…

I created a new Radiant project with a new database. I then
installed the Page Attachments extension (and only that extension). I
started the server.

I see the same error messages:

The “Geometry” class, which apparently has something to do with
calculating geometry strings to be passed to Imagemagick, gets loaded
twice - once by Page Attachments and once by Attachment_fu. Rails is
warning you that the constants the class contains are getting redefined-
these are just warnings, and the constants are getting redefined to the
same values either way. It’s safe to ignore them.

**

I’ve been doing a bunch of work on the Page Attachments plugin - I’ve
fixed it to not require the Geometry class if the class has already been
loaded. On my install, this has fixed the warnings.

I’ll issue a pull request and hopefully Sean will like what he sees and
this’ll make it’s way into the core. There are a few other ways to fix
it - but this seems like a safe route to me.

–DJCP

Did some more testing, this is interesting…

I created a new Radiant project with a new database. I then
installed the Page Attachments extension (and only that extension). I
started the server.

I see the same error messages:

\deleteme>ruby script/server -e production
=> Booting Mongrel (use ‘script/server webrick’ to force WEBrick)
=> Rails application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with production environment…
/deleteme/vendor/extensions/page_attachments/lib/geometry.rb:6: warning:
already initialized constant FLAGS
/deleteme/vendor/extensions/page_attachments/lib/geometry.rb:11:
warning: already initialized constant RFLAGS
/deleteme/vendor/extensions/page_attachments/lib/geometry.rb:28:
warning: already initialized constant RE
** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready. INT => stop (no restart).
** Mongrel 1.1.2 available at 0.0.0.0:3000
** Use CTRL-C to stop.

Oh - and all the “update” task does is copy some files in
RAILS_ROOT/public. You can run it a thousand times and it wouldn’t have
an impact on these warnings.

Daniel Collis-puro wrote:

I’ve been doing a bunch of work on the Page Attachments plugin - I’ve
fixed it to not require the Geometry class if the class has already been
loaded. On my install, this has fixed the warnings.

That’s all great to hear, Daniel! Thank you for your effort!

Daniel Collis-puro wrote:

I’ve been doing a bunch of work on the Page Attachments plugin - I’ve
fixed it to not require the Geometry class if the class has already been
loaded. On my install, this has fixed the warnings.

Thanks for your work on this, Daniel.

Ben M. wrote:

Daniel Collis-puro wrote:

I’ve been doing a bunch of work on the Page Attachments plugin - I’ve
fixed it to not require the Geometry class if the class has already been
loaded. On my install, this has fixed the warnings.

That’s all great to hear, Daniel! Thank you for your effort!

No prob.

Here’s the fix, BTW.

http://github.com/djcp/radiant/commit/44eb8b62406f205e72a4103eeeac6f452f89479e

–DJCP