Ruby
Instalando gems do GitHub manualmente
Æ!!
Esse vai ser um post rápido para relatar um problema que eu tive ( e ainda estou tendo ) para instalar gems do GitHub.
Por algum motivo bizarro ( nem tanto assim, parece ser dns, mas já tentei opendns e nada ) a página http://gems.github.com não abre de maneira nenhuma, enquanto a navegação continua normal sem nenhum problema…A consequência disso é que eu não consigo colocar o source do github nas minhas configurações do Rubygems.
Tendo em vista que eu não conseguiria utilizar gem install para nenhuma gem que vinha do GitHub tive que dar um jeito de instalar manualmente.
O que fiz foi acessar a página do GitHub referente a gem que eu queria instalar, que no caso é a kitabu do fnando, pegar o link de clone e clonar:
$ git clone git://github.com/fnando/kitabu.git
Mas ae que está o lance que eu demorei para encontrar ( noob ), para uma gem ser instalada localmente ela precisa estar empacotada, e no GitHub você baixa direto o código fonte. Para empacotar:
$ gem build kitabu.gemspec
Agora sim eu tenho o arquivo kitabu-0.3.3.gem que eu posso utilizar para instalar localmente! Para instalar é só utilizar o gem install padrão informando o arquivo a ser instalado:
# gem install kitabu-0.3.3.gem
E pronto! Lá está a minha gem instalada!
Espero que isso seja útil para mais alguem que precise empacotar as suas gems.
Há braços
Encontro de numero 5 do Guru-sp
Æ!!
Nesse sábado aconteceu o quinto encontro do Guru-sp!
O encontro estava marcado para as 10 da manhã com uma seção para iniciantes e começou as 10:30 ( sempre atrasa um pouquinho né? hehe ), já com um bate papo legal coordenado pelo @rafaelrosafu após uma breve apresentação de todos os participantes.
Rails para iniciantes
Nessa primeira seção tiveram muitas conversas interessantes sobre algumas filosofias Rails, como DRY, REST, TDD, Test all the Fucking Time, Skynny Controllers and Fat Models e mais algumas outras coisas bem interessantes que fomentaram uma ótima discussão sobre quais os melhores padrões para se seguir quando se constrói uma aplicação Rails ( sim, falamos tomando como base uma aplicação Rails ), como utilizar plugins como o ResourceController ( que tem seus prós e contras ), manter seus scripts num lugar diferente da pasta scripts, que é a pasta padrão para scripts “internos” do Rails e tentar centralizar em uma pasta dentro de lib, além de usar Rake sempre que possível para essas tarefas ficarem organizadas e de fácil acesso.
Uma parada rápida para o almoço no Shopping e lá se vão mais de 20 programadores para comer a bater papo!
DataMapper
Após o almoço tivemos a palestra sobre DataMapper do @rafaelrosafu ( olha ele aí novamente! ) que explicou muito bem dando várias referências sobre o seu blog pessoal e como ele fez para utilizar o DataMapper ao invés do Active Record. O Rails é mais difícil de se sair do padrão, mas ficará mais simples de se escolher um ORM quando chegarmos ao Rails 3. Aproveitando o gancho de DataMapper eu falei um pouco de Sinatra dando alguns pitacos na condução do Rafael.
Git
Após a palestra de DataMapper passamos para uma palestra de Git com o Douglas ( qmx ), que foi muito interessante e participativa! Pegamos uma galera do grupo para fazer um scaffold e commitar no projeto para começar a ver coisas diferentes, como merges, rebases, mudanças de commit, e algumas outras coisas legais, como usar tags, procurar por um código em meio aos commits e outras coisas interessantes! =)
Levantamos a idéia de participar do Rails Rumble, aproveitando que o Diego Carrion estava conosco e comentou que a GoNow estava patrocinando 3 equipes para o evento, mas não conseguimos ter uma idéia legal para propor para o concurso.
Coding Dojo
E finalmente como ultima coisa do dia tivemos o nosso coding dojo, que era uma das coisas que eu mais estava esperando nesse econtro! O Vinicius Baggio “se ofereceu” ( com um empurrãozinho meu…hahah ) para ficar com o notebook ligado no datashow e conduzir o código. O dojo foi muito divertido com participação de todos da sala, o que sempre trazia novas idéias para fazer um código melhor e agregava conhecimento para todos. Fizemos TDD para construir umas classes simples de usuário.
Conclusão
Gostaria de agradecer ao André e o pessoal da Voice Technology por todo o apoio ao evento e ao grupo, com local, organização, fotos e mais várias outras coisas! Guys you Rock!
Infelizmente algumas pessoas não puderam aparecer, e outras apareceram por pouco tempo ( o Marcelo Castellani ), por motivos pessoais, mas espero que estejam presentes no próximo!
O evento realmente valeu a pena e aprendi muita coisa por lá, alem de conhecer muita gente interessante tambem! Agora é marcar os próximos e esperar que o grupo cada vez cresça mais e podemos fortalecer as amizades e conhecimentos!
Há braços
Começando a falar de Ruby
Æ!!
Se você já conhece Ruby, ignore esse post! A idéia do post é mostrar um pouco da linauagem Ruby para pessoas que não conhecem nada sobre ela.
Eu, claro, acho muito bizarro interessante que muita gente por aí ainda não conhece Ruby, mesmo com a grande popularização do Rails, e eu chego a ouvir coisas assim:
“Não é você que programa naquela linguagem esquisita?”
Cheguei a ouvir do meu “professor de algoritmo” ( perdeu meu respeito ):
“Gostei desse algoritmo que você fez nessa linguagem esquisita aqui”
Há muitas pessoas que já ouviram falar em algo relacionado a Ruby apenas quando leram alguma coisa na Info falando de RubyOnRails. Portanto, resolvi escrever alguns posts sobre a linguagem para passar para esse pessoal que ainda não conhece nada. Pretendo que esse seja o post introdutório de vários capítulos passando por partes interessantes da linguagem.
Então…Vamos falar de Ruby!
Ruby é uma linguagem interpretada, criada pelo japonês Yukihiro “matz” Matsumoto e liberada publicamente em 1995. Desde lá o Ruby vem aparecendo bastante no mundo de tecnologia, sendo que a partir de 2006 teve um grande boom de comentários, ainda mais com o maior aparecimento do Rails.
Uma coisa que me irrita bastante é as pessoas associarem diretamente Ruby com Rails, portanto preciso deixar isso claro…Rails não é Ruby!
Rails é um framework para desenvolvimento web que utiliza a linguagem Ruby para o tal. O Ruby tem bem mais coisas legais do que só o Rails.
Como o Ruby é uma linguagem interpretada, podemos facilmente fazer um Hello World em Ruby:
puts 'Hello World'
Isso aí! Apenas uma linha! Uma linguagem totalmente orientada a objeto e você não precisa necessáriamente criar uma classe, um método ( public static void main… ) e escrever mil comandos Hierarquicamente para escrever algo!
O interessante do Ruby é que tudo é um objeto, ou seja, se você escreve o numero 10 ele já é um objeto, tendo seus próprios métodos, como por exemplo:
10.times { puts 'Vou estudar Ruby' }
No caso acima usamos um dos métodos do 10 ( que é da Classe Fixnum ) que é o método times, que faz um loop 10 ( ou qualquer outro numero Fixnum que estivesse aqui ) vezes fazendo o que está dentro do bloco, no caso, imprimir “vou estudar Ruby”.
No Ruby você consegue modificar métodos em tempo de execução! Uma classe que não possuía nenhum método pode possuir 10 em tempo de execução bastando que seu código os inclua lá, e isso é uma coisa muito legal!
A sintaxe da linguagem foi feita para ser simples, você tem vários métodos facilitadores, inclusive com uso de “?” ( interrogação ) para alguns métodos, como por exemplo para descobrir se a variável está não retorna nada:
variavel.nil?Aqui temos uma pergunta explícita, que você olhando isso intuitivamente lhe vem duas respostas: Sim ou não ( nem me venha com talvez
),o que mostra que você olha um código Ruby e facilmente distingue muita coisa.
E tem bem mais coisas interessantes!
Tá…E por que diabos eu deveria usar Ruby
Aí que está! É aí que entram as coisas legais, como:
Rails
Agora sim você pode usar esse cara aí em cima para desenvolver aplicações bem legais usando todas as facilidades que o Ruby pode te oferecer
Shoes
Uma biblioteca bem interessante para desenvolvimento desktop multiplataforma, onde você consegue fazer muita coisa legal.
JRuby
Olha que legal, se você gosta bastante do Java, você pode rodar programas Ruby em cima da maquina virtual Java, o que é bem legal, até por que, a velocidade do JRuby, já passou a do MRI ( Matz Ruby Interpreter, ou a versão core oficial do Ruby, feita pelo Matz ).
Inclusive você pode importar várias bibliotecas do Java e tudo mais.
Iron Ruby
Você usa a plataforma .NET da Microsoft? Então procure por esse cara! Eu não tenho muito a comentar por que não uso .NET.
É claro que não existem só esses aí em cima, apenas estou citando algumas coisas legais, mas se você procura por desenvolvimento web você pode escolher Sinatra, Merb ( ainda não se fundiu com o Rails, mas isso vai acontecer na versão 3 do Rails ), ou outros.
E se você apenas pensa em desenvolver para Desktop, alem do Shoes, você pode escolher, o RubyGTK, o MacRuby ( para usuários MAC ) ou até o FXRuby!
Se você não é programador, e trabalha com administração de sistemas, por que não utilizar Ruby para automatizar as tarefas? É fácil, tem manutenção simples, vem padrão em várias distribuições Linux…Não tem desculpa!
Meu foco nesse post não é abordar a fundo nenhuma das ferramentas que eu citei acima, e sim apenas dar um overview de tudo que você pode fazer usando essa linguagem.
Puxa, gostei! Como usar?
Moleza! Está no Linux né? Se estiver usando Ubuntu só dê os comandos mágicos:
sudo apt-get install ruby irb rdocNão está no Linux? Humm…No Windows é fácil tambem, baixe o executável e instale. Não tive muito contato com um mac ainda para instalar coisas e tudo mais, mas me parece fácil.
Basta clicar aqui e pegar os arquivos necessários para a instalação!
Vixe…Instalei, e agora?
Agora é hora de brincar um pouco com a linguagem para saber como ela funciona! Eu recomendo você a entrar no IRB ( Interactive Ruby Shell ) e começar a brincar!
Para acessar o irb é aquela moleza de sempre, apenas entre no terminal e chame por irb ( acho que funciona assim no Windows tambem )!
Lá você pode tentar executar uns códigos, inclusive os poucos exemplos que eu postei aqui, é muito legal para você conhecer a linguagem, descobrir uns métodos e tudo mais.
Já estou no IRB, mas eu não sei fazer nada…
Bem, agora é partir para as cabeças!
- Eu recomendo você a começar lendo o tutorial de Ruby do TaQ que é um material bem legal para começar.
- Se seu ingles é bom ( não precisa ser fluente, mas você precisa saber ler e enteder ) eu aconselho firmemente você a participar de algum curso Core do Rubylearning.org, e lá você vai aprender bastante coisa, alem de se divertir bastante.
- Leia alguns dos livros gratuitos que estão disponíveis na web gratuitamente e em português! Eu recomendo o Aprenda a Programar e o (comovente) guia de Ruby do Why. ( obrigado pela dica Abraão )
- Participe de Grupos de usuários para aumentar seus conhecimentos e conhecer pessoas que tambem estão interessadas na linguagem e sempre estudando! Se você está em São Paulo eu recomento fortemente você a participar do GURU-SP!
- Fique de olho aqui no blog que eu pretendo começar a postar umas coisas básicas, mas não espere somente por mim e já inicie seus estudos!
Bem, com isso você já tem uma pequena base do que é o Ruby ( e sabe que o Rails é apenas um framework feito em Ruby ) e já pode começar a se divertir com ele!
Há braços
Translated Rubylearning presentation
Æ!!
As i promise, here goes my presentation!
Finally i finished to translate all the presentation! Watched the video a lot of times, pausing and playing to write all i said translating to english.
Fortunately i have a big help from my friend Victor Goff, that correct all my grammar errors and typos.
I’m posting below all i have about the presentation, slides from Slideshare, Video from Blip.tv, and a translation pasted here, but you can find the translation at Google Docs too. Enjoy!
First Words
My name is Willian Molinari as Marcelo said, I participated of 3rd Batch of Rubylearning at the beginning of the last year. Since the finish of the course I was an Assistant Teacher, and i’m a Mentor since the beginning of this year. I attempt to show to you a bit of what Rubylearning is and how does it work, what is the course idea. It is a short presentation, you will see that I’ll “run” with the content, but the presentation idea is to show you a bit of what RubyLearning courses are.
Slide1
Fist, lets start with “What is Rubylearning?” The course itself is Rubylearning.org, and Rubylearning is divided into Blog, Website and courses. Blog is where Satish post some of his interviews with Ruby community guys like Matt of Merb project or Dr. Nic. And on blog have other cool posts too. On Website Satish maintain a Ruby tutorial, a Ruby Book and post other ruby contents. And on Rubylearning.org the course happens.
Slide2
To answer the question “What is Rubyleraning.org” I was helped by the other teachers of Rubylearning. One of the good answers was made by George Thompson, this guy that you see in the large photo. After telling a funny joke, saying that Rubylearning is for everything since it will “allow you to grow wings to fly” and will “help you in the bedroom” He gives these topics to speak about. The first thing is that Rubylearning is for everyone that has an interest in Ruby, if you are a experienced professional, or just learning now, Rubylearning is here to help you. It is a framework to your first steps with Ruby, so you will not depend just from Google or online tutorials, on Rubylearning you will have more people to help you to participate and discuss your answers and so on… Rubylearning is not just for who are starting with Ruby. If you work with Ruby for a long time, you can participate to help the students that are starting, returning to the community what you received. And you can participate with other Rubylearning intermediate courses (Rubylearning doesn’t have just the Core course, we have other courses for those who already have knowledge of Ruby) And of course…Rubylearning is a place to have fun! To code for fun, to know different people of other countries, or maybe of your country, and you didn’t know that this person was programming on this language.
Slide3
Rubyleraning is based on Moodle, as you can see, the image is strange here, but the first screenshot is the screen after you sign up, and you can see all the courses that you can subscribe to, and below you can see the screen inside the course, all the material is divided by blocks, the forums and so on.
Slide4
More interesting informations about Rubylearning: We are the declared winner of shorty awards in education category. Unfortunately we couldn’t participate of ceremony in USA because only Satish can participate in the ceremony, and the price to travel from India (Satish is Indian ) to USA could not cover the costs…But anyway, we are the winners! The number of participants get over 7200 mark, and maybe now we already pass the 7500 mark, because this information is from 1 month ago, more or less. Another cool thing, more than 40% of Rubylearning participants are from Brazil, so you don’t have arguments to say: “I can’t participate, because the course have people that from other countries and i don’t speak english very well”, because always you will find a Brazillian to help you there.
Slide5
And who is the main teacher? Who is behind Rubylearning?
Slide6
Satish Talim, as i said, lives in India. He is a programmer, teacher, consultant, working on some companies at India and USA, is speaker and has more than 30 years of experience with I.T. He has these two domains: Rubylearning.org and rubylearning.com. On .org domain we have the course and on Rubylearning.com is his site. And he have a personal website domain, too.
Slide7
Ok, if Satish is behind Rubylearning, who are these guys that help on forums? So… I asked to Satish by e-mail, because I didn’t know about how he divide us. The assistant teachers are people that come from the core course and enjoyed the course, so they are invited to help, and whomever accept comes as assistant teachers of the next core course to help on foruns, answering the students that are having doubts and helping on other things. Mentors are experieced professionals that are working with I.T for a long time and more time on Rubylearning, too. They help not only on Core course, but on the other courses ( intermediate courses ) too. The Patrons, this guys are on Rubylearning since rubylearning is coming to be international, on the 2nd batch more or less, on the last months of 2007, and they have more time on rubylearning, so the way that Satish has to classify teacher is time on rubylearning.
Slide8
For who is this course appropriate? Well…Our focus is the people that already know something about programming, some other language and wants to know Ruby, and not those people that do not know how to program and want to learn on Rubylearning, This is not our focus. Our focus is to teach Ruby for who those have a notion about programming.
Slide9
How does Rubylearning work? Well…The course is slotted into weekly study material blocks. Every Saturday, Satish posts different sudy material with important notes, so you can review quickly all you already read; Some exercises, 10 or 5 exercises depending on how extensive is the material, for you to solve and post on forums, to view the answers of teachers too. For example, you have a method and you are using return to return the variable on the PHP style for example, but can be other language, so somebody replies to you saying that you don’t need to specify this return because the Ruby language returns the last statement by default, and so on… The Quiz, is for your own benefit, so you can see if you learn all the content. And the Extras! The extras take to you some good material as links to good content, a screencast related to the weekly study material, and others!
Slide10
How do quizzes work? As i said, Quiz is for your own benefit. A lot of people are questioning me about the importance of quizzes on the course participation, “if we don’t answer the quiz, are we kicked out of the course” or we don’t receive the certificate. The quiz idea is auto-validation, so after you read all the content, you will know with the quiz if you really learn all you need to learn about that content, if you got a good result with the quiz, you probably really learned this weeks content.
Slide11
Is necessary be active on Foruns? Humm…Yes! The main focus of Rubylearning is the participation of everybody, so, if you really want to get the best of the course you must to post your exercise answers, to receive from more experienced people feedback about your solution. If you don’t participate so much.. it’s okay too…You just lost the chance to learn more and more.
Slide12
This is one of the things that everybody speaks about…”Ohhh…The course is in english, from India, i will talk nonsense words, i don’t speak english, my english is bad”…Humm…My personal English, i’m a assistant teacher, is not so good, but i can communicate with others! If you can communicate with other people is good enough! You will read and understand the content and post your code on forums, if you are not comfortable to write english, you can just post your code, somebody will reply to you, you will understand the reply and it is good enough to your learning. If you can talk is really better, because you can help on discussions, but the english is not a big barrier to participate of Rubylearning.
Slide13
How is the course pace? As i said, Satish does weekly content posts on forums…Not forums…the study materials. You don’t need to follow this weekly pace, if you decide to view all the course in the last week you can, but we recommend you to follow weekly because you can talk with other people that are studying the same lesson and you have more focus on your studies making it easy to learn different things.
Slide14
What topics the course cover? Well…We cover all the Beginning with Ruby, from Ruby installation through…
Slide16
basic classes like numbers, blocks, variable scopes, constants, methods, manipulation of text files, Regular Expressions, but only the basis of Regular Expressions, how to work with RE with Ruby, working with classes, inheritance, exceptions… We can’t cover tests ( the Ruby test/Unit class)
Slide17
Other questions that are often made to me when I recommend Rubylearning couse is: “I will receive a certificate?”. The important thing on the Rubylearning course is how much you can learn with the course, the certificate is not the course focus, but…The answer is YES!Slide18
This is my certificate from 3rd Batch that i participated, really beautiful, signed by Satish, you receive in PDF, is not received in paper, but you can print and store.Slide19
As i said, Rubylearning is not made of only the Core course, we have a lot of other courses that we call the “Intermediate courses”, and is appropriate to who that already have a notion of what is Ruby core, if you know core, you can move on to these other courses.Slide20
The merb course, now merb team are joining Rails team, maybe this course will be extinct, but this is one of our courses for now. Git / GitHub is a course of one week. Git is not directly connected with ruby, but all the Ruby community are using it, so we decided to prepare a course about it. Ruby with database, using MySql and sqlite, you learn on how to use activerecord to manipulate a database from a script Ruby. FXRuby as Marcelo said in another speech. Sinatra for web development, maybe will get the Merb course place, because Merb and Rails will be one. Shoes, as Marcelo said too, for Desktop development, very interesting. Ruby and Twitter, is a course that will be released now, i don’t know when it will start, maybe april 14th or 16th, for who those already have a ruby knowledge, will be very interesting. They will show how to play with “Twitter API” and make some interesting things with it. And Rails 3, Satish promised that when Rails 3 is comming out he will create a course about it to everybody.Slide21
This is some screenshots of shoes course. The application of the screenshot on the Right was made by Satoshi, that was the main teacher of Rubylearning shoes course, and is is a clock that show all the assistant teachers and mentors timezone on the world, all teacher have a photo placed on with their timezone. I asked Satoshi to send a message to all of you, and he sent to me a message with a “Google translation” Phrase in portuguese saying “Oi todo mundo” that probably is “hello everybody”, and he says that you don’t need to care about your english because we can communicate with Ruby, and he wants to see you on Rubylearning Forums. Here you can see other screenshot of a little game that they do with shoes, each student have your own game, you can see a “questions and answers” game on the next screenshot. Very interesting and a lot of fun!Slide22
Here you have a message from Satish Talim, i asked to him to send one, and he is saying thanks to all Brazilian friends, Locaweb and Fabio Akita, that are sponsors of the course, the locaweb is a Sponsor of the core course, and saying thanks to you that are helping to spreading ruby around the world.Slide23 – Questions
My presentation idea is to be very quick, just to show to you a bit of what is Rubylearning and how you can participate, what you will learn and so on… Somebody have some question? Hugo: This courses that you show, all of them are free? Or have some paid courses too? Willian: Yes, the core course is free. The other courses you need to pay to get in, but the cost is very low, something like 5 dollars, 3 or 5 dollars, just to maintain the website, Satish put a lot of his time on Rubylearning, so he need a way to maintain all of this, and he is making it with this paid courses and some sponsors, but is not high price, just 3 or 5 dollars with paypal. Some other question? I trampled some content because i have little time? Marcelo: Lets thank Willian, no more questions now…slide23
Thanks! =)Cheers,
Rails X Django
Æ!!
Como todos sabem eu sou do mundo Ruby/Rails ( Não sou xiita mas é o que mais gosto ) e de vez em quando começo a brincar com coisas diferentes para poder formar a minha própria opinião sobre o assunto. No mes de fevereiro me surgiu um projeto bem interessante para trabalhar, pessoas legais, oportunidade legal, bem interessante! O projeto seria feito em Python/Django, e achei bem interessante a idéia de poder comparar várias coisas do Rails com o Django.
Bem…Vamos as minhas comparações:
Pontos fortes
- Como primeiro argumento, e incontestável para mim, tenho que dizer que o admin do Django é muito legal! Você consegue fazer coisas bonitinhas e funcionais com uma facilidade espantosa! Sei que no Rails podemos fazer um scaffold ( ou até usar o ActiveScaffold, mas não é tão bom ) e criar facilmente um CRUD para mexer nos dados, mas isso não é um admin pronto, é apenas uma forma fácil de se manipular os dados. Penso eu que com o Rails seja mais facil de se criar um admin personalizado, com Design próprio, mas gostei bastante da solução a curto prazo do Django.
- Achei bem interessante como podemos fazer a divisão de trabalhos com o nosso HTML(er) / JavaScript(er), por que o Django dá pouquíssima liberdade para o template com relação a código, ou seja, você define na sua view as query’s que vão ser mandadas para o template e no template ele vai usar apenas o que você pode mandar, e não vai poder consultar ou fazer maiores alterações no conteúdo, portanto, quem deve cuidar de como o conteúdo vai chegar ao template são os programadores que vão enviar os dados para quem vai fazer a integração com o layout.
Pontos fracos
- Não encontrei uma padronização / centralização para os plugins do Django…Você encontra vários modos de instalação para determinados plugins, alguns vem com setup.py, outros falam para você jogar na pasta do Python. Não tem algo centralizado como as gems do Rails ou os próprios plugins para jogar na pasta vendor/plugins, ou usar um script/plugin install …
- Não cria uma estrutura de pastas, deixando que você faça o que bem entender com a estrutura, ao invés de usar uma convenção sobre configuração.
- Talvez seja a inexperiencia, mas eu não achei legal o que tivemos que fazer com o settings, pois cada um precisava colocar uma configuração diferente de diretórios de imagens, ou algumas configurações referentes aos plugins ( filebrowser no caso ), portanto cada um tinha que ter um settings.py diferente, informando o settings.py quando vamos executar alguma coisa.
- Não me acostumei muito bem com o esquema de indentação do Python…Não que seja ruim, mas como estavamos trabalhando em sistemas operacionais diferentes de vez em quando aparecia um indentation error por causa de conversões de tabs em espaços e tal. Sei que esse argumento vai ser facilmente contestado com um: “É só configurar o seu editor de texto” ou “usa um editor de texto multiplataforma”, mas mesmo assim…A idéia da indentação é legal, mas ainda me atrapalha um pouco.
Bem, é isso! Essas foram as minhas primeiras impressões do Django, como disse, não tinha experiência com o framework e muitas coisas poderiam ser evitadas mais facilmente, ou feitas de um modo bem melhor.
Continuo gostando bastante do Rails, mas achei muito legal várias idéias do Django, e acho que tem aplicações legais dependendo do projeto que você for usar.
Há braços
Colocando sua aplicação Rails na Dreamhost
Æ!!
Estou fazendo um pequeno site em Rails e como tinha que mostrar o andamento para um colega, aproveitei para testar como seria o Deploy desse projeto na DreamHost ( mesmo sabendo que o provedor final não será lá ), e achei muito fácil de se fazer, portanto resolvi escrever um pouco sobre o processo.
Primeiramente, você precisa ter acesso SSH na sua conta. Se você ainda não tiver esse acesso apenas faça o seguinte procedimento:
- Acesse o menu Users > Manage Users
- Clique em Edit no user que você vai usar para o acesso SSH
- Marque a opção Shell account – allows SFTP/FTP plus ssh access.
A partir daí você pode acessar por SSH assim como acessava por FTP, com esse usuário e senha.
Agora que temos acesso SSH a conta, vamos colocar nossa aplicação lá! Se ela estiver no GitHub você pode fazer um clone da sua aplicação facilmente:
git@github.com:usuario/projeto-qualquer.git
Se não estiver no GitHub você pode fazer um pacote tar.gz e enviar facilmente por scp:
tar cvf app.tar.gz aplicacao-quaquer/ scp usuario@xxx.xxx.xxx.xxx:/home/local/da/applicacao app.tar.gz
*Sendo que o xxx é o endereço IP ou Nome da sua maquina na Dreamhost
Com nossa aplicaçào lá, vamos criar o nosso domínio ou sub-domínio no painel de controle da DreamHost , pelo menu domains > manage domains Geralmente seu domínio demora um pouco para começar a funcionar, mas você não precisa esperar que ele esteja totalmente funcional para que você continue o processo
O que você precisa fazer é?
- Ativar o Ruby on Rails Passenger (mod_rails)
- Apontar o Specify your web directory para o diretório public da sua aplicação
Agora que temos o nosso domínio criado e validando ( lembre-se que não é instantâneo ), podemos configurar o nosso banco de dados!
Acesse o Manage Mysql pelo menu Goodies > Manage Mysql e preencha o formulário que está logo abaixo dos bancos de dados já existente ( se houver ) para criar um novo banco.
Com o novo banco de dados criado, vamos adaptar nossa aplicação para usá-lo!
Vá no arquivo config/database.yml e altere as informações da seção production para o que foi configurado no painel..
Agora com tudo configurado, vamos rodas as nossas migrations para as configurações de produção:
RAILS_ENV=production rake db:migrateCom isso você já terá seu projeto funcionando assim que o domínio se propagar!
Foi bem mais simples do que eu pensava, como eu deixei o repositório com Git lá, basta eu fazer as alterações localmente e dar um push que já terei minha aplicação alterada lá!
É isso aí, espero que seja útil para vocês.
Há braços
Search
Recent Posts
WP Cumulus Flash tag cloud by Roy Tanck and Luke Morton requires Flash Player 9 or better.
Categories
Personal Links
Archives
- April 2012
- May 2011
- April 2011
- March 2011
- January 2011
- December 2010
- October 2010
- September 2010
- August 2010
- July 2010
- April 2010
- March 2010
- February 2010
- January 2010
- December 2009
- November 2009
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
