I am willing to change the dsl (in a backward compatible way). The
following dsl is supported in a branch:
https://github.com/abril/tokamak/pull/1
I can adapt it to this other one, which I believe is the most
straightforward one:
https://gist.github.com/847327
What do you think? In the least one, there is no extra variables or
methods such as collections/members/member. It is the common
ruby code with each's to iterate on collections.
Just gimme a green sign and I can finish this implementation so you can try it.
Using this dsl, the answer to (3) is:
1.
projects {
each(@projects) do |project|
link "self", url_for(project)
end
}
2.
project {
id @project.id
name @project.name
tasks {
each(@project.tasks) do |t|
link "self", url_for(t)
end
}
# just a variation to show you how to do it
link "collaborators", url_for([@project, @project.collaborators])
}
Regards
Guilherme Silveira
Caelum | Ensino e Inovação
http://www.caelum.com.br/
Today me and Erich spent some time implementing it, we got half way
though it (xml!).
https://github.com/caelum/tokamak/tree/dsl
What is currently does:
- supports almost everything on xml, except the namespace (just add
support, should not be hard)
So its missing:
- support Json
- support namespace on xml
Can you help me supporting the namespace on xml or replicating the xml
tests with the new dsl on the json_spec and implementing it? I believe
its just a matter of changing the members method on the json file.
After that I can fix the hook.
Its fully backwards compatible and I also applied the other branches.
Let me know what you can do and we can do the rest here.
Regards
Guilherme Silveira
Caelum | Ensino e Inovação
http://www.caelum.com.br/
With the help from Paniz and Anderson we were able to finish the DSL.
https://github.com/caelum/tokamak/tree/dsl
Now its all about ruby enumerations + block invocations:
product {
link :self, product_url(prod)
id prod.id
name prod.name
price prod.price
}
Let me know if you like it!
Regards
Guilherme Silveira
Caelum | Ensino e Inovação
http://www.caelum.com.br/
Let me know if the dependencies work fine... you will have to grab it
from the branches. I will work onputting them on master during the
weekend too,should be easy.
Regards
Guilherme Silveira
Caelum | Ensino e Inovação
http://www.caelum.com.br/