This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#generate a wrapper script for a textmate_ruby - you can call it whatever you like but | |
#textmate_ruby is clear | |
rvm wrapper ruby-1.9.2@rails3 textmate | |
# this will generate a textmate_ruby command for you | |
# problem with the above is, it's not going use your project specific gemset and ruby | |
# to do that, edit the file and change the contents to what's below |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Please excuse the naming of things, this is a on the fly contrived example | |
curl -i -H "Content-Type: application/json" -H "Accept: application/json" | |
-X POST -d '{"a_request":{"thing_ids":[1,2,3,4]}}' http://localhost:3000/a_requests | |
produces.... | |
Started POST "/a_requests" for 127.0.0.1 at 2011-06-16 11:53:21 -0400 | |
Processing by ARequests#create as JSON |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#I want to create many of a thing in one shot where thing is an activerecord class with | |
#validations. I can use the following where a listofthings is a vanilla ruby class. on | |
#valid? this class calls all the contained object's valid? method. and a naive save that | |
#calls save on each of the contained activerecord objects. There's some syntatic sugar, | |
#methods that hide the underlying list. This is minimal code for explanation. | |
#My thing is an activerecord class | |
#ListOfMyThings is a vanilla ruby class | |
#thing to note for form helpers to work you need | |
# _attributes=(attributes) method defined. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#------ application layout | |
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script> | |
<script type="text/javascript" src="http://code.google.com/apis/gears/gears_init.js"></script> | |
<%= javascript_include_tag "jquery", "jquery-ui","rails" %> | |
<%= javascript_include_tag "application" %> | |
..... | |
<script type="text/javascript"> | |
<%= yield(:javascript)%> | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set :application, 'myapp' | |
set :repository, "[email protected]:me/myapp.git" | |
set :deploy_to, "/var/www/rails/#{application}" | |
set :rake, 'rake' | |
# This change was done enable the ability to deploy a branch to | |
# staging using the parameters on the command line. | |
# to deploy mobile, $> cap -S branchto=mobile staging deploy | |
# to deploy master by default, $> cap staging deploy | |
begin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
client: knife cookbook upload apache2 # will upload to opscode servers | |
server: chef-client # to pull changes from opscode servers |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Rails 3 box setup - on centos | |
Note, the $ indicates a command prompt on your terminal | |
----- Firewall ----- | |
make sure you can install packages through yum, have access to github.com: http, git (port 9418), ssh and https | |
Make sure the following ports are accessible to you: http, https and ssh | |
------- System packages ------------- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I generate all my page caching in public/cache directory. The following apache rewrite rules check cache before hitting the rails app | |
<VirtualHost *:80> | |
RewriteEngine On | |
RewriteCond %{THE_REQUEST} ^(GET|HEAD) | |
RewriteCond %{REQUEST_URI} ^/([^.]+)$ | |
RewriteCond %{DOCUMENT_ROOT}/cache/%1.html -f | |
RewriteRule ^/[^.]+$ /cache/%1.html [QSA,L] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rails new playing_around -d mysql -T -J | |
# edit rmvrc file | |
# rvm use ruby-1.9.2@playing_around --create | |
gem install bundler | |
#add at least the following gems for cucumber and rspec testing. nifty generators are kinda cool too | |
#group :test, :development do | |
# gem 'cucumber-rails' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Following this article: | |
http://blog.phusion.nl/2010/09/21/phusion-passenger-running-multiple-ruby-versions/ | |
This is a system level rvm install | |
rvm use 1.9.1 | |
gem install passenger --pre | |
cd /webapps/fries.com | |
passenger start -a 127.0.0.1 -p 3000 -d |
NewerOlder