2012-06-20

PHP gallery Ruby port part 1

Yesterday I told about rack-legacy. I started new project https://github.com/samitheberber/galleria and will write the progress in here.

I had old PHP application with my own "framework". My route dispatching wasn't bullet proof, so I needed to patch it a little. Patching was few oneliners in few places to get all edge cases to work. At first I used rack-rewrite to direct all requests to PHP. Initial step is completed.

Next I created public directory and moved assets there. Then I rewrote assets rewrite rule and application was back in action. It was time to get sinatra in use. To do so I had to change my generic rewrite rule to specify each route I had in use. If rewrite rule matches, PHP will handle it and if not, sinatra will do the rest. After that is was possible to remove public rewrite rule and let sinatra provide public directory functionality.

Next I need to replace rewrite routes one by one with sinatra routes. At first I replace my json "API", because it doesn't need any UI writing and I can create application core parts, like models. The progress will be visible in GitHub and I will provide url for the result when I get it deploy ready :)

No comments:

Post a Comment