Mostrando postagens com marcador Rubygems. Mostrar todas as postagens
Mostrando postagens com marcador Rubygems. Mostrar todas as postagens

quarta-feira, 31 de agosto de 2011

Foreman

0



I've watched the RailsCasts #281, and Ryan Bates is talking about the Foreman gem. At the first time I did not mind for the project, this is interesting, but I don't see how it's can be useful for me. Then I go back to the project when I'm working. I open my iTerm, an tab for mongod, and tab for spork, and a tab for  guard, and another to run the generators.
After I open all this tabs, Foreman gem cames to my mind. Well, I gave to Foreman a opportunity, and I loved it.

If you think this scenario is the same of you, take a look at Foreman, and give to it a chance.
You can add the gem to your Gemfile or install it by your own hand. To work foreman only needs a file called Procfile. in this manifest file, you name your process and tell to foreman what command they should use, and above a simple Procfile for the scenario:



Very simple file, I've a process called mond, wich executes "sudo mongod" and starts the mongodb database, You'll see in the console, something like that "mongod.1 | started with pid XXX", every log from mongod will appear in the console.

To start all this process type "foreman start", Now I've only one tab running all my development processes.

Read more

terça-feira, 9 de novembro de 2010

Haml+Rails

2

Haml é uma linguagem de marcação, para renderizar templates HTML, baseada em tags e identação. Sempre gostei muito de usar o HAML nas minhas aplicações Rails 2, pela simplicidade e facilidade na criação. Você se acostuma a identar ao invés de procurar aonde a tag deve ser fechada. O Rails 3 foi modularizado para facilitar a customização. Porém a gem haml, responsável por renderizar os arquivos HAML, não possui generators embutidos para o Rails, procurando na internet encontrei o projeto rails3_haml_scaffold_generator que faz exatamente isso, mas vc precisa executar alguns passos, e eu odeio coisas repetitivas, a primeira coisa que pensei foi procurar se havia alguma gem parecida, e não encontrei.

Resolvi arregaçar as mangas, e fiz minha primeira gem, no caso eu simplesmente movi para o diretório os arquivos como se fossem um gem, e ajustei os diretórios com a ajuda do Jeweller.

O uso dessa gem é bem simples, ela nem tem reação com a gem haml, pois ela consiste somente nos generators.

Adicione ao seu Gemfile as seguintes linhas

gem haml
gem haml_rails

use o bundle install ou uso o gem install para instala-las.

depois só executar o comando

rails g haml_rails:install

ele vai editar seu application.rb e adicionar o haml como seu template engine. vc pode apagar caso prefira usar o ERB.

Por enquanto é isso..

Read more

 
Design by ThemeShift | Bloggerized by Lasantha - Free Blogger Templates | Best Web Hosting