Making awestruct more developer friendly

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Making awestruct more developer friendly

ge0ffrey
Awestruct 0.4.8 is sometimes a bit misleading:

1) When I write an error in my _layouts/base.html.haml, then "awestruct -d" will silently serve the previous version from the _site folder. It can take a while before I see what happened. I'd rather see a page that renders "Compilation failed".

2) When I build my site with "awestruct --profile production" and there are any errors in my source files, it doesn't fail-fast. For example if I use the ruby method relativeeeee() instead of relative() it just presume that method returned an empty String (which leads to broken links). Is there a way to enable -strict mode to fail-fast on these problems?

Wdyt?
Reply | Threaded
Open this post in threaded view
|

Re: Making awestruct more developer friendly

LightGuard
Administrator
Is it the same with HEAD?


On Tue, Mar 12, 2013 at 10:06 AM, ge0ffrey <[hidden email]> wrote:
Awestruct 0.4.8 is sometimes a bit misleading:

1) When I write an error in my _layouts/base.html.haml, then "awestruct -d"
will silently serve the previous version from the _site folder. It can take
a while before I see what happened. I'd rather see a page that renders
"Compilation failed".

2) When I build my site with "awestruct --profile production" and there are
any errors in my source files, it doesn't fail-fast. For example if I use
the ruby method relativeeeee() instead of relative() it just presume that
method returned an empty String (which leads to broken links). Is there a
way to enable -strict mode to fail-fast on these problems?

Wdyt?



--
View this message in context: http://talk-archive.awestruct.org/Making-awestruct-more-developer-friendly-tp168.html
Sent from the Awestruct Talk mailing list archive at Nabble.com.

---------------------------------------------------------------------
Archives: http://talk-archive.awestruct.org/
To unsubscribe, e-mail: [hidden email]




--
Reply | Threaded
Open this post in threaded view
|

Re: Making awestruct more developer friendly

mojavelinux
In reply to this post by ge0ffrey
Geoffrey,

Thanks for the feedback.

This issue here is two-fold. First, we had turned down the logging to console way down because it was mostly superfluous info. However, in some cases, we pulled back too far. Rendering errors were one of those places. The exception handling block around rendering wasn't very good anyway, so I fixed it and made sure the right information is propagated.


The other issue has to do with how data is dereferences. The context object that is available when rendering a template is an AStruct. The way this type works is that it automatically tries to resolve any unknown method (method missing) as a property. If the property is missing, it assumes that means that it isn't set and the value should be nil.

In your case, you are calling a method, which clearly can either exist or not...there is no gray area. I propose that if a method is called with arguments, and the method doesn't exist, that we at least warn, or perhaps raise an exception. I have the warn bit in the patch.

Unfortunately, Ruby does not provide a way (to my knowledge) to distinguish between a method call with no arguments and a property reference (which may also be a method with no arguments). For instance:

.hello
.hello()

method_missing sees those as the same, :hello.

That is just something we have to deal with.

Btw, if you want to get massive amounts of output, use the -w flag and then check .awestruct/debug.log.

Note that fine tuning of the logging is still a work in progress*.

-Dan

* speaking of which, Jason, backtraces are printed out as arrays in the debug.log. Could you switch that to a .join("\n") so they are readable?

On Tue, Mar 12, 2013 at 10:06 AM, ge0ffrey <[hidden email]> wrote:
Awestruct 0.4.8 is sometimes a bit misleading:

1) When I write an error in my _layouts/base.html.haml, then "awestruct -d"
will silently serve the previous version from the _site folder. It can take
a while before I see what happened. I'd rather see a page that renders
"Compilation failed".

2) When I build my site with "awestruct --profile production" and there are
any errors in my source files, it doesn't fail-fast. For example if I use
the ruby method relativeeeee() instead of relative() it just presume that
method returned an empty String (which leads to broken links). Is there a
way to enable -strict mode to fail-fast on these problems?

Wdyt?



--
View this message in context: http://talk-archive.awestruct.org/Making-awestruct-more-developer-friendly-tp168.html
Sent from the Awestruct Talk mailing list archive at Nabble.com.

---------------------------------------------------------------------
Archives: http://talk-archive.awestruct.org/
To unsubscribe, e-mail: [hidden email]




--
Dan Allen
Principal Software Engineer, Red Hat | Author of Seam in Action
Registered Linux User #231597

Reply | Threaded
Open this post in threaded view
|

Re: Making awestruct more developer friendly

ge0ffrey
In reply to this post by LightGuard
Jason Porter wrote
Is it the same with HEAD?
Yes, still an issue. Tested with awestruct build from master source yesterday.

If use awestruct -d and go to http://localhost:4242 to visit the index page which renders "hello world":
I see the page rendering "hello world".
If I change it to "goodbye world" and hit refresh in my browser,
I see the page rendering "goodbye world"
If I then change it to "hello universe" and add a haml error (for example write "%p foo" and on the next line "bar") and git refresh in my browser,
I see the page rendering "goodbye world".
It should be showing a "compilation error" page, similar to how a 404 looks like.
Reply | Threaded
Open this post in threaded view
|

Re: Making awestruct more developer friendly

LightGuard
Administrator

I wonder how difficult it would be to create a page that contains the backtrace and as much info as possible about the error, similar to what facelets in development mode. That seems like a good way to do it. Thoughts? Of course we'd still need a message on stderr


Sent from Mailbox for iPhone


On Fri, Apr 5, 2013 at 7:32 AM, ge0ffrey <[hidden email]> wrote:

Jason Porter wrote
> Is it the same with HEAD?

Yes, still an issue. Tested with awestruct build from master source
yesterday.

If use awestruct -d and go to http://localhost:4242 to visit the index page
which renders "hello world":
I see the page rendering "hello world".
If I change it to "goodbye world" and hit refresh in my browser,
I see the page rendering "goodbye world"
If I then change it to "hello universe" and add a haml error (for example
write "%p foo" and on the next line "bar") and git refresh in my browser,
I see the page rendering "goodbye world".
It should be showing a "compilation error" page, similar to how a 404 looks
like.



--
View this message in context: http://talk-archive.awestruct.org/Making-awestruct-more-developer-friendly-tp168p228.html
Sent from the Awestruct Talk mailing list archive at Nabble.com.

---------------------------------------------------------------------
Archives: http://talk-archive.awestruct.org/
To unsubscribe, e-mail: [hidden email]


Reply | Threaded
Open this post in threaded view
|

Re: Making awestruct more developer friendly

ge0ffrey
Jason Porter wrote
I wonder how difficult it would be to create a page that contains the backtrace and as much info as possible about the error, similar to what facelets in development mode. That seems like a good way to do it. Thoughts? Of course we'd still need a message on stderr
+1 Exactly what I was thinking from a user's perspective :)
Reply | Threaded
Open this post in threaded view
|

Re: Making awestruct more developer friendly

bobmcwhirter
Administrator
This should be pretty easily done.

When rendering, if we catch an exception, just render a failsafe template with the stack.

        -Bob


On Apr 5, 2013, at 10:10 AM, ge0ffrey <[hidden email]> wrote:

> Jason Porter wrote
>> I wonder how difficult it would be to create a page that contains the
>> backtrace and as much info as possible about the error, similar to what
>> facelets in development mode. That seems like a good way to do it.
>> Thoughts? Of course we'd still need a message on stderr
>
> +1 Exactly what I was thinking from a user's perspective :)
>
>
>
> --
> View this message in context: http://talk-archive.awestruct.org/Making-awestruct-more-developer-friendly-tp168p230.html
> Sent from the Awestruct Talk mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> Archives: http://talk-archive.awestruct.org/
> To unsubscribe, e-mail: [hidden email]
>


---------------------------------------------------------------------
Archives: http://talk-archive.awestruct.org/
To unsubscribe, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Making awestruct more developer friendly

LightGuard
Administrator
Mind opening a ticket so we cant track it (asking no one in particular)?


On Fri, Apr 5, 2013 at 8:36 AM, Bob McWhirter <[hidden email]> wrote:
This should be pretty easily done.

When rendering, if we catch an exception, just render a failsafe template with the stack.

        -Bob


On Apr 5, 2013, at 10:10 AM, ge0ffrey <[hidden email]> wrote:

> Jason Porter wrote
>> I wonder how difficult it would be to create a page that contains the
>> backtrace and as much info as possible about the error, similar to what
>> facelets in development mode. That seems like a good way to do it.
>> Thoughts? Of course we'd still need a message on stderr
>
> +1 Exactly what I was thinking from a user's perspective :)
>
>
>
> --
> View this message in context: http://talk-archive.awestruct.org/Making-awestruct-more-developer-friendly-tp168p230.html
> Sent from the Awestruct Talk mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> Archives: http://talk-archive.awestruct.org/
> To unsubscribe, e-mail: [hidden email]
>


---------------------------------------------------------------------
Archives: http://talk-archive.awestruct.org/
To unsubscribe, e-mail: [hidden email]




--