I recently had to share specifications and models between two applications. Here’s how I did it:

  1. Create a shared/ directory in Subversion
  2. svn copy the current models there
  3. svn copy the specifications (or unit tests)
  4. svn remove the app/models and spec/ folder from your project root
  5. piston import /shared/app/models app/models
  6. piston import /shared/spec spec/

The nice thing about this technique is that you can add models to one or the other application and they won’t care about it. You have to be careful not to have name clashes though.

Example

You have one application in your repository named flow/. You are creating a new one named /bark. Here are the steps ($REPOS_ROOT is obviously your repository root):

1
2
3
4
5
6
7
8
$ svn mkdir $REPOS_ROOT/shared $REPOS_ROOT/shared/app -m "Creating shared models root"
$ svn move $REPOS_ROOT/flow/trunk/app/models $REPOS_ROOT/shared/app/models
$ svn move $REPOS_ROOT/flow/trunk/spec $REPOS_ROOT/shared/spec # or test/
$ svn checkout $REPOS_ROOT/flow/trunk
$ cd trunk
$ piston import $REPOS_ROOT/shared/app/models app/models
$ piston import $REPOS_ROOT/shared/spec spec
$ svn commit -m "Copied shared models back in using Piston"

Leave a Reply

 

Search

A picture of me

I am François Beausoleil, a Ruby on Rails coder. During the day, I work on XLsuite. At night, I am interested many things. Read my biography

Tags

(3) (1) (0) (2) (1) (1) (2) (2) (1) (2) (1) (2) (1) (2) (1) (1) (1) (1) (2) (14) (1) (1) (1) (1) (2) (1) (1) (2) (0) (1) (2) (1) (3) (1) (1) (1) (1) (1) (1) (0) (3) (2) (1) (2) (2) (1) (3) (2) (8) (8) (9) (12) (1) (1) (3) (1) (1) (1) (1) (1) (1) (2) (2) (2) (1) (1) (3) (1) (3) (1) (0) (23) (1) (1) (0) (1) (1) (1) (23) (25) (1) (1) (13) (1) (1) (2) (3) (1) (1) (4) (1) (2) (3) (0) (1) (7) (3) (1) (5) (5) (2) (2) (2) (4) (6) (7) (1) (0) (1) (1) (2) (2) (1) (4) (12) (2) (1) (2) (4) (1) (1) (1) (2) (8) (2) (3) (2) (2) (1) (3) (1) (1)

Links

Projects I work on

Categories

Archives