Posts mit dem Label setup werden angezeigt. Alle Posts anzeigen
Posts mit dem Label setup werden angezeigt. Alle Posts anzeigen

Samstag, 30. August 2008

Setting the Test, Production, Development Environment

>export RAILS_ENV=test
>export RAILS_ENV=development
>export RAILS_ENV=production


Setup New Rails Project

  1. Create a new project with: >rails name_of_project, then: >cd name_of_project
  2. Optionally if using other database than Sqlite: > rake db:create:all
  3. Install RSpec Plugin & Framework. Refer to the latest instructions.
  4. Run the RSpec generator to create framework: >ruby script/generate rspec
  5. Create latest plugin documents on local drive with: rake doc:plugins. Location of documentation is "name_of_project/doc/plugins/respec-rails/index.html. Open directly in browser with: open -a Firefox doc/plugins/rspec_on_rails/index.html. Or open index.html
  6. Install and run RSpec plugin framework if needed
  7. Create the git repository with a cd to the "name_of_project" directory and then:
>git config --global user.name "your name"
>git config --global user.email "your mail@provider"
>git config --global apply.whitespace nowarn

to check the settings see .gitconfig or: >git config --list

>git init (creates local repository and the .git directory)

create a .gitignore file and add file to ignore
*.log
database.yml
db/schema.*
.DS_Store

>git add . (add all file and contents to firstime checkin)
>git commit -m "first commit"
>git status (check the repos)

see git cheatsheet for more

Setup Rails 2.1 on Mac Leopard

A version of rails and gem is already installed on the mac so we will update and expand on this installation as follows
  1. Get and Install TextMate
  2. Get and Download MacPorts - Leopard (universal). After the download and installation, edit or add to .bash_profile file the following: export PATH="/opt/local/bin:/opt/local/sbin:$PATH" (see here for more details)
  3. Update macports from the command line terminal with: >sudo port selfupdate. NOTE: I had a problem with awk not being found during the installation. This was solved by running the installation again.
  4. Install Git and Svn integration as follows: >sudo port install git-core +doc +svn
  5. Update gems with: >sudo gem update
  6. Install Rspec gem with: > sudo gem install rspec
  7. Install Zentest with: >sudi gem install ZenTest. You don't need to install the gem if you are only using rails. Zentest enables autotesting in the background.
  8. Install Rspec TextMate bundle specifically for rails supporting development: cd to the TextMate Bundles directory, i.e. > cd ~/Library/Appliction\Support/TextMate/Bundles. Then: > git git clone git://github.com/dchelimsky/rspec-tmbundle.git RSpec.tmbundle

Donnerstag, 22. Mai 2008

Using ruby setup.rb

This is a great place to read about it

Dienstag, 20. Mai 2008

setting up svn with a rails 2.0.2 project

more or less got this from here.

Go to the directory you want to set up the rails project in.

then

useraccount> mkdir svn_setup
useraccount> cd svn_setup
useraccount> rails project_name -d mysql
useraccount> mv project_name trunk
useraccount> mkdir tags
useraccount> mkdir branches
useraccount> cd trunk
useraccount> rm -r tmp/*
useraccount> rm -r log/*
useraccount> mv config/database.yml database_example.yml
useraccount> cd ..
useraccount> svn import . url_of_svn_repository_space_on_assembla -m "initial repository import" --user name_of_assembla_user

now the project should be in the svn repository in assembla

now checkout the project from the repository in assembla to your localhost

useraccount> cd
useraccount> svn co url_of_svn_repository_space_on_assembla/trunk project_name

project_name is now what you can work on and thus you can get rid of the svn_setup folder you made earlier.

useraccount> rm -r svn_setup

now for the last bits and bobs.

useraccount> cd project_name
useraccount> cp /config/database_example.yml database.yml

useraccount> svn propset svn:ignore database.yml config/
useraccount> svn propset svn:ignore "*" log/
useraccount> svn propset svn:ignore "*" tmp/

Setting up mysql

go to the user and groups setting in the gnome system administration menu and set the mysql user password to something that makes sense for you. Then give the mysql user a shell '/bin/bash' (setting in the advanced tab of user and groups) and then close all the windows with ok to set the changes.

Then change to user mysql

useraccount>su - mysql
password:

and enter the mysql password

now you should have the bash promt:

#bash>

then enter

#bash>mysql_install_db

then

#bash>mysqld --skip-grant-tables &

then

#bash>mysql

you should get the mysql promt

mysql>UPDATE mysql.user SET Password=PASSWORD('MyNewPass') WHERE User='root';

mysql> FLUSH PRIVILEGES;

############################
############################

now open a new terminal window....

useraccount> pfexec /usr/bin/svcadm enable database/mysql:version_50

this should start the mysql database (pfexec /usr/bin/svcadm disable database/mysql:version_50 stops the database)

if you want mysql to automatically start and stop with powerup and powerdown

then do this (which i have not)

pfexec /usr/sbin/svccfg import /var/svc/manifest/application/database/mysql.xml