Rushdie
BANNED
- Feb 2, 2009
- 1,373
- 1,725
setting up github and heroku and creating a sample app. In the soon to come tutorial i will show how to create a very cool website with twitter's bootstrap
im using linux
you need ruby and rails set up you can see my former thread here: http://www.blackhatworld.com/blackhat-seo/general-programming-chat/389741-setting-up-ruby-rails-environment-ubuntu-mac.html
let's set up a directory in our home directory
app can by any name that you give to your app. also it doesnt really matter. rails created your application's directory structure with generic MVC stuff.
you are in your application's directory
run this to install dependencies:
let's take a look at the Gemfile. your apps dependencies are there. for now we will use sqlite3. add this:
this fixes javascript runtime errors in rails 3.1.3 for me on ubuntu
fetches gems for your app
if you have any errors, install the needed stuff like
you might need to do
remember im using the newest versions here some things might not be compatible, you will figure it out later.
when you see this:
we're good to go
run
visit the ip echoed(for me http://0.0.0.0:3000/), a sample app is working
you can find some useful links there:
you can code anything using this info
if you encounter any errors along the way it's probably dependencies stuff; google it and you will be fine.
dont try to install binary ruby/rails packages like apt-get install ruby-1.9.2 its much much simpler but it will be a misery later on. not to mention if you will want to use various ruby versions or stuff like jruby for some projects. RVM for the win.
create free accounts at http://heroku.com and http://github.com. if you wish to have private github repositories, you got to pay a small monthly fee.
it just an empty app we will push it to github and heroku and afterwards i will show you how to create a cool website
edit .gitignore in your app's directory
change it to this:
yeah gitignore like a boss, we dont want to have BS in our version control
do this for every app until you know better
go to github, create a new repository
https://github.com/repositories/new
https://github.com/account/ssh
add another public key and post the key you just generated there
the key is the whole content of the file located in /home/$user/.ssh/id_rsa.pub
test it and input yes:
go here:
https://github.com/account/admin
copy the api key and do:
got to your app's directory
we got a local repo
this should list our files:
commit version locally:
ok back to the github screen after creation of the new repository. copy something like this and paste in the terminal:
push the files to github:
damn we did it.
something like this should happen:
go to your github and find the app. the files are there
now we will push this repository to heroku and put the app online.
our sample app is online.
my sample app is here:
http://morning-light-3493.heroku.com
cheers
im using linux
you need ruby and rails set up you can see my former thread here: http://www.blackhatworld.com/blackhat-seo/general-programming-chat/389741-setting-up-ruby-rails-environment-ubuntu-mac.html
let's set up a directory in our home directory
Code:
mkdir rails
cd rails
rails new app
app can by any name that you give to your app. also it doesnt really matter. rails created your application's directory structure with generic MVC stuff.
Code:
cd app
you are in your application's directory
run this to install dependencies:
Code:
sudo apt-get install g++
gem install execjs
gem install therubyracer
let's take a look at the Gemfile. your apps dependencies are there. for now we will use sqlite3. add this:
Code:
gem 'execjs'
gem 'therubyracer'
Code:
bundle install
if you have any errors, install the needed stuff like
Code:
gem install sqlite3
Code:
sudo apt-get install libsqlite3-dev
remember im using the newest versions here some things might not be compatible, you will figure it out later.
when you see this:
Code:
Your bundle is complete!
run
Code:
rails server
visit the ip echoed(for me http://0.0.0.0:3000/), a sample app is working
you can find some useful links there:
Code:
Rails Guides
Rails API
Ruby core
Ruby standard library
if you encounter any errors along the way it's probably dependencies stuff; google it and you will be fine.
dont try to install binary ruby/rails packages like apt-get install ruby-1.9.2 its much much simpler but it will be a misery later on. not to mention if you will want to use various ruby versions or stuff like jruby for some projects. RVM for the win.
create free accounts at http://heroku.com and http://github.com. if you wish to have private github repositories, you got to pay a small monthly fee.
it just an empty app we will push it to github and heroku and afterwards i will show you how to create a cool website
edit .gitignore in your app's directory
change it to this:
Code:
*.rbc
*.sassc
.sass-cache
capybara-*.html
.rspec
/.bundle
/vendor/bundle
/log/*
/tmp/*
/db/*.sqlite3
/public/system/*
/coverage/
/spec/tmp/*
**.orig
rerun.txt
pickle-email-*.html
.bundle
db/*.sqlite3*
log/*.log
*.log
/tmp/
doc/
*.swp
*~
.project
.DS_Store
yeah gitignore like a boss, we dont want to have BS in our version control
do this for every app until you know better
go to github, create a new repository
https://github.com/repositories/new
Code:
git config --global user.name "[I]githubnickname[/I]"
git config --global user.email [I][email protected][/I]
Code:
ssh-keygen -t rsa -C [I]"[email protected][/I]"
https://github.com/account/ssh
add another public key and post the key you just generated there
the key is the whole content of the file located in /home/$user/.ssh/id_rsa.pub
test it and input yes:
Code:
ssh -T [email protected]
go here:
https://github.com/account/admin
copy the api key and do:
Code:
git config --global github.user uSeRnAmE
git config --global github.token 4s4s4s4sAPICODE2ejh3g123jhg21jh3g12
got to your app's directory
Code:
git init
git add .
we got a local repo
this should list our files:
Code:
git status
commit version locally:
Code:
git commit -m "ver 1"
ok back to the github screen after creation of the new repository. copy something like this and paste in the terminal:
Code:
git remote add origin [email protected]:uSeRnAmE/nAmE.git
push the files to github:
Code:
git push -u origin master
something like this should happen:
Code:
"Counting objects: 63, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (48/48), done.
[...]"
go to your github and find the app. the files are there
now we will push this repository to heroku and put the app online.
Code:
sudo apt-get install libreadline-dev
Code:
gem install heroku
cd ~/.rvm/src/ruby-YOUR-VER/ext/readline
ruby extconf.rb
make
make install
heroku keys:add
heroku create
Code:
git push heroku master
my sample app is here:
http://morning-light-3493.heroku.com
cheers
Last edited: