Ruby Forum Radiant CMS > Update Task accidentally run twice (Page Attachments error)

Posted by Ben Morrow (benmorrow)
on 05.05.2008 03:53
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
Posted by Arik Jones (imakethings)
on 05.05.2008 07:43
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 Morrow 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
Posted by Andrea Franz (Guest)
on 05.05.2008 11:06
(Received via mailing list)
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 Morrow <morrow599@yahoo.com> wrote:

>
> Radiant mailing list
> Post:   Radiant@radiantcms.org
> Search: http://radiantcms.org/mailing-list/search/
> Site:   http://lists.radiantcms.org/mailman/listinfo/radiant
>



--
Andrea Franz
http://gravityblast.com - http://nimboo.net
Posted by Ben Morrow (benmorrow)
on 05.05.2008 13:43
> 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?
Posted by Andrea Franz (Guest)
on 05.05.2008 13:57
(Received via mailing list)
On Mon, May 5, 2008 at 1:43 PM, Ben Morrow <morrow599@yahoo.com> 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 Franz
http://gravityblast.com - http://nimboo.net
Posted by Dominic (Guest)
on 05.05.2008 14:33
(Received via mailing list)
I've also come across this warning but don't have gallery installed...
Posted by Ben Morrow (benmorrow)
on 05.05.2008 14:34
Andrea Franz 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!
Posted by Andrea Franz (Guest)
on 05.05.2008 15:12
(Received via mailing list)
On Mon, May 5, 2008 at 2:34 PM, Ben Morrow <morrow599@yahoo.com> 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 Franz
http://gravityblast.com - http://nimboo.net
Posted by Ben Morrow (benmorrow)
on 05.05.2008 16:12
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.
Posted by Ben Morrow (benmorrow)
on 05.05.2008 18:31
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.
Posted by Daniel Collis-puro (djcp)
on 07.05.2008 04:03
Ben Morrow 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
Posted by Daniel Collis-puro (djcp)
on 07.05.2008 04:05
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.
Posted by David Piehler (davidpiehler)
on 07.05.2008 16:38
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.
Posted by Ben Morrow (benmorrow)
on 07.05.2008 17:07
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!
Posted by Daniel Collis-puro (djcp)
on 07.05.2008 17:13
Ben Morrow 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