[Radiant] Something strange here

2010-04-01 Thread Arlen Walker
Was working with a development environment when suddenly the admin pages 
started looking funny, and I'm getting some javascript errors.

The js errors are centered around Behavior, which comes from lowpro.js, and I'm 
noticing that the admin pages aren't loading it correctly. not sure what I 
screwed up, but when I try to go back and rebuild from fresh, I'm getting 
undefined method 'locale' after logging in.

Any idea what I screwed up?


Have Fun,
Arlen

--
In God we trust, all others must supply data

___
Radiant mailing list
Post: Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
List Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Radiant: http://radiantcms.org
Extensions: http://ext.radiantcms.org


Re: [Radiant] Something strange here

2010-04-01 Thread Arlen Walker

On Apr 1, 2010, at 4:35 PM, john muhl wrote:

 On Thu, Apr 1, 2010 at 3:14 PM, Arlen Walker arlen.wal...@gmail.com wrote:
 Was working with a development environment when suddenly the admin pages 
 started looking funny, and I'm getting some javascript errors.
 
 The js errors are centered around Behavior, which comes from lowpro.js, and 
 I'm noticing that the admin pages aren't loading it correctly. not sure what 
 I screwed up, but when I try to go back and
 
 what does the error console have to say about the javascript errors?

TypeError: Result of expression 'Behavior' [undefined] is not an object.

Far as I can tell, this is because lowpro.js  is not getting loaded after 
prototype and before the rest of the js files

 
 rebuild from fresh, I'm getting undefined method 'locale' after logging in.
 
 this part sounds like you were running an edge version and then
 updated to a newer edge version and didn't run `rake db:migrate`

Yep, you and Jim both nailed this one. Usually when I do a fresh install I do 
:update before doing :bootstrap, it appears either this time I didn't or the 
updated migration isn't in bootstrap, because the migration fixed that.

I'm beginning to suspect the js errors are coming from an installation that's 
an unholy hybrid between 0.8.1 and 0.9. IIRC, it was created by the radiant-rc 
gem (there seems to be no way of having both the rc *and* the 0.8.1 gem on your 
system at the same time -- at least the radiant executable identifies itself as 
0.9 after installing radiant-rc, and I don't find the 0.8.1 executable anywhere 
on the system anymore) but I used rake radiant:freeze:edge TAG=0.8.1 to freeze 
it, so it used the current stable code. Does that sound likely as a cause?

Have Fun,
Arlen

--
In God we trust, all others must supply data

___
Radiant mailing list
Post: Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
List Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Radiant: http://radiantcms.org
Extensions: http://ext.radiantcms.org


Re: [Radiant] Reorder Extension testing issues

2010-03-30 Thread Arlen Walker
BTW, if any are curious, here's what I think I know about this (sorry, forgot 
to report back about the experiments):

rake spec or rake spec:models load *only* the base radiant db migrations 
into the test database -- they load no extension migrations at all. This means 
that if any extension modifies the base tables in its migrations, those 
migrations are not loaded during this test. The only time any extension 
migrations get loaded into the test db is under rake spec:extensions when 
they do get loaded, when the tests are run for that particular extension. (This 
may not be entirely correct, as I realized as I wrote the above I didn't have 
any integration tests in my local tree involving reorder, and those might have 
caused the reorder migrations to load.)

Since the reorder extension modifies children_find_options (replacing 
'published_at' with 'position' as the default) it breaks the tests, as the 
position column migration has not been loaded when the model tests are being 
run. If it had simply created a position column and not altered default 
behavior (merely giving you the additional option of using by=position') the 
errors would not have appeared, and my confusion would have been less.

BTW, am I right in assuming there isn't a command to test a specific extension, 
only one which tests all installed extensions at once?

Have Fun,
Arlen

--
In God we trust, all others must supply data

___
Radiant mailing list
Post: Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
List Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Radiant: http://radiantcms.org
Extensions: http://ext.radiantcms.org


Re: [Radiant] Reorder Extension testing issues (Final Solution)

2010-03-30 Thread Arlen Walker

On Mar 30, 2010, at 12:33 PM, john muhl wrote:

 On Tue, Mar 30, 2010 at 9:53 AM, Arlen Walker arlen.wal...@gmail.com wrote:
 BTW, am I right in assuming there isn't a command to test a specific 
 extension, only one which tests all installed extensions at once?
 
 rake spec:extensions EXT=ext_name

Ah, thank you.

BTW, have a solution to this issue, finally. Radiant is not updating the 
schema.rb file when extensions are migrated. After doing an extension migration 
use:

rake db:schema:dump

to update the schema.rb file.

Then the test db will be recreated properly during testing. So much simpler 
when I finally realized 'rake spec' was using schema:load and not remigrating 
everything every time. (What can I say? I've been sick so my mind has been 
slower than usual.)

Radiant needs to do a schema:dump after the extension migrations happen, but 
until then, doing it manually seems to work.

Have Fun,
Arlen

--
In God we trust, all others must supply data

___
Radiant mailing list
Post: Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
List Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Radiant: http://radiantcms.org
Extensions: http://ext.radiantcms.org


Re: [Radiant] Reorder Extension testing issues

2010-03-19 Thread Arlen Walker
On Fri, Mar 19, 2010 at 3:38 PM, Jim Gay j...@saturnflyer.com wrote:


 Don't try to fix it. If a core spec is defined to expect things in a
 default order but an extension changes the default, then those added specs
 will fail. The only way around this would be to undefine the original specs,
 but I'm not sure of a way to do that.


I'll add a +1 to Jim on that. The right way to handle this would be for the
new find method to test and and see if an order clause was passed in, and
use that clause if it was, while defaulting to position order if no other
order is specified. (If the core spec insists on another default order,
*then* it's time to address the idea of changing the core spec, as that
approach is almost guaranteed to cause issues with extensions.) I've had
lots of issues with interactions between both drag_order and reorder and
r:children tags because of that. (For some items, I want descending order by
date, for others I want a specific page order.)

I'd planned on forking reorder to do that (I'm migrating a wordpress site
with 150+ posts, and I'm sick of reordering them as I migrate them; the
current state of reorder lets the asc and desc values through, but
overrides the date_published order with position order) once I got the tests
to run sensibly. I'm having trouble with that at the moment, though.

Which means that the column doesn't exist. So it sounds to me like Anna is
 merely seeing the result of the altered behavior with a position column, but
 Arlen doesn't even have the position column.


Yep. I can run the migration and look at the test db and see the position
column, but when I run the tests, the test db gets rebuilt *without* the
position column, which I've verified. I'm still sure I'm overthinking this,
and when I find out what's wrong I'm going to feel stupid, but so far I'm
still mystified. Gonna put it down for a while and come back to it with
fresh eyes.

I haven't had a chance to really look into this, but I have seen the problem
 before and can't recall how it was fixed for me (other than running rake
 RAILS_ENV=test db:migrate:extensions)


That actually worked in one installation here, the 0.8.1 one. But it just
stares at me blankly in the edge one. I'm sure I've screwed something up,
and it's something simple. It just feels like it. (I'm liking the edge code
better than 0.8.1 at the moment, so I'll probably be using it for the
migration.)
___
Radiant mailing list
Post: Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
List Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Radiant: http://radiantcms.org
Extensions: http://ext.radiantcms.org


[Radiant] Reorder Extension testing issues

2010-03-18 Thread Arlen Walker
This is actually common to several extensions, so I'm fairly sure I screwed up 
something on my end, but it's just to obvious for me to see it.

Starting from a completely fresh installation:

1) radiant  radiant -d mysql
2) cd radiant
3) rake radiant:freeze:edge TAG=0.8.1
4) cd vendor/radiant

At this point I edit the database.yml file at 
radiant/vendor/radiant/config/database.yml

5) rake db:bootstrap  (Don't know if it matters but the last time I did this I 
chose the Roasters template)
6) rake spec:models

The last line was to verify that the installation into the directory called 
'radiant' seemed to go properly, and it does appear to have, since all tests 
passed with a deprecation warning. So now I proceed with downloading the 
reorder extension, unzipping it, renaming the resulting directory to reorder 
and dropping it in radiant/vendor/radiant/vendor/extensions (perhaps I should 
have chosen a less confusing project name, but I didn't expect to have this 
issue when I chose it). From that point:

7) rake development radiant:extensions:reorder:migrate
8) rake development radiant:extensions:reorder:update

(I'm running apache2 with Passenger, and have set the default RailsEnv to 
development.)

9) rake spec:models

and 66 of the tests that passed the first time fail this time. All of the 
failures are along the lines of:

Mysql::Error: Unknown column 'position' in 'order clause':

so it seems as if the migration that has occurred in line 7 above (verified by 
inspecting the db) never happens during the testing. The extension itself 
appears to be functioning fine in the application, as the position column is 
filled in correctly, and it does move the pages up and down, so it looks as if 
only the testing environment is failing to apply the migration for some reason.

This sort of thing is obvious enough that I'm sure I'm just missing something 
simple, but I'm hanged if I can see it.

As for variations, I've tried this with both radiant and radiant-rc, and I've 
frozen to edge and updated as well as freezing to 0.8.1, with no difference. 
Highlights from the local gem list are:

cucumber (0.6.3, 0.3.104)
cucumber-rails (0.3.0)
passenger (2.2.11, 2.2.10, 2.2.9)
radiant (0.8.1, 0.8.0)
rails (2.3.5, 2.2.2, 1.2.6)
rake (0.8.7, 0.8.3)
rspec (1.3.0, 1.2.6)
rspec-rails (1.3.2, 1.2.6)
rubygems-update (1.3.6, 1.3.5)
webrat (0.7.0, 0.4.4)
ZenTest (4.2.1)

Didn't want to post the whole list, let me know if there's another one that 
might be relevant. Ruby is 1.8.7 patchlevel 72, default install on SnowLeopard. 
(Yes, I know. I keep meaning to upgrade to 1.9.x but since this isn't a 
public-facing machine the urgency just isn't there, and I don't figure it's 
worth the hassle to upgrade to anything less than 1.9.x.)

Ideas?

Have Fun,
Arlen

--
In God we trust, all others must supply data

___
Radiant mailing list
Post: Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
List Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Radiant: http://radiantcms.org
Extensions: http://ext.radiantcms.org


Re: [Radiant] Reorder Extension testing issues

2010-03-18 Thread Arlen Walker

On Mar 18, 2010, at 5:23 PM, banane wrote:

 You have to rake migrate the test env:
 
 rake radiant:extensions:reorder:migrate RAILS_ENV=test

Yet when I do that, it says:

Missing these required gems:
  rspec-rails  ~ 1.2.6


Yet gem list rspec-rails --local shows it's installed:

*** LOCAL GEMS ***

rspec-rails (1.3.2, 1.2.6)

(The 1.3.x versions  of rspec and rspec-rails came along with the cucumber 
0.6.3 update I installed.) Even so, when I removed both versions of rspec-rails 
and reinstalled only the 1.2.6 version, the migrate happened (verified by 
inspecting the test db for the column, and the 'reorder-1' in the schema 
migrations table):

$ rake radiant:extensions:reorder:migrate RAILS_ENV=test
(in /Users/arlenwalker/Sites/radiant/vendor/radiant)
==  AddPositionToPages: migrating =
-- add_column(:pages, :position, :integer)
   - 0.3256s
-- Putting all pages in a default order...
   - 0.2469s
==  AddPositionToPages: migrated (0.5728s) 

However, it made no difference, as after rake spec:models the same 66 tests 
failed. Interestingly enough, after running the tests, the position column was 
again dropped, and the extension's migration not applied during testing. I can 
also supply the info that some other extensions that create tables for their 
own use do not have the tables created, but I figured if I can figure out 
what's wrong here, the solution will apply elsewhere.

Have Fun,
Arlen

--
In God we trust, all others must supply data

___
Radiant mailing list
Post: Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
List Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Radiant: http://radiantcms.org
Extensions: http://ext.radiantcms.org


Re: [Radiant] Reorder Extension testing issues

2010-03-18 Thread Arlen Walker

On Mar 18, 2010, at 5:23 PM, banane wrote:

 Or it might work with just a migration all together: rake db:migrate
 RAILS_ENV=test


Actually, oddly enough, a variation of this changed the results:

Instead of being at radiant/vendor/radiant when I did the migration, I dropped 
back to the project working directory itself (radiant, in this case) did the 
migration and then rake spec:models and now 20 tests failed, and none of the 
failures relate to position, and the position column remained in the test 
table. (moving back to vendor/radiant and rerunning the tests repeated the 66 
failures).

So doing the full migration gave different results from the extension migrate 
and I suspect some of them at least come from position overriding expected 
behavior (such as a couple that complained that using the 'order' attribute 
didn't change the order.

Have Fun,
Arlen

--
In God we trust, all others must supply data

___
Radiant mailing list
Post: Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
List Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Radiant: http://radiantcms.org
Extensions: http://ext.radiantcms.org


Re: [Radiant] Reorder Extension testing issues

2010-03-18 Thread Arlen Walker

On Mar 18, 2010, at 7:55 PM, banane wrote:

 This reminds me I should really go back to TDD (ducks). Ha, these
 errors you're having are familiar, but I can't remember the silver
 bullet- if there was any-that solved it. Part of me wants to say, the
 extension developers wrote their tests with one gem version, whereas
 radiant wrote theirs with another, hence the discrepancy you're
 seeing.

This has been my biggest frustration. It's very much like the Windows DLL 
Hell phenomenon. I'm really going to have to dig in to why a new version of 
RSpec (fer cryin out loud) gets in the way of a db migration!! I just get the 
feeling that if I tweak one little thing, the whole house is going to come 
down, something I thought testing was supposed to help us get away from.

Anyway, enough with the venting. I'm in the process of creating some extensions 
(one of the reasons for doing this was to figure out how to get started at that 
-- I've done a little of it but it's more cargo cult stuff than real 
development and I wanted to take apart a working extension to see how it 
ticks). The real question is how to go about setting up a development 
environment that I can use for this.

Right now my impression is that edge is better than 0.8.1, so I'm probably 
going to start moving in that direction, hoping to land on 0.9 when it's ready. 
But I keep running into dependencies on really old testing gems.

ah, well. off to bed.

Have Fun,
Arlen

--
In God we trust, all others must supply data

___
Radiant mailing list
Post: Radiant@radiantcms.org
Search: http://radiantcms.org/mailing-list/search/
List Site: http://lists.radiantcms.org/mailman/listinfo/radiant
Radiant: http://radiantcms.org
Extensions: http://ext.radiantcms.org