Importing A New Rails Project

THL Toolbox > Developers' Zone > Git for THL Rails Apps > Importing a New Rails Project

Importing a New Rails Project

Contributor(s): Andres Montano

  • If the project comes from another svn repository, fetch from SVN without .svn hidden files through export:
  • If the project comes from another git repository you should probably just include that as a submodule. There are rare examples where you would want put it in another repository without forking. Converting a folder from vendor/plugins into a its own project would be one of those rare occasions. First you have to clone original project, then you can extract files without the .git metadata running:
git archive master | tar -x -C /path/to/another/folder
  • For applications, delete plugin folder for plugins hosted at github, to later add as submodules:
rm -rf acts_as_tree
  • Turn export into git repos:
cd authenticated_system
git init

If the git repos is for an application, hide tmp files, logs and db configuration. The sample commands use textmate (mate). If you use other editors (vi, etc) replace accordingly:

  • mate .gitignore

.DS_Store
*.tmproj
config/database.yml
config/environments/quandu_*.rb
doc/plugins/*
public/javascripts/tiny_mce/
  • mate tmp/.gitignore

**/*
*
  • mate log/.gitignore

*.log

Save and run the following commands to ensure vendor folder is added to the repos:

touch vendor/.gitignore

If the git repos is for a plugin, hide mac files (if you are working on a mac)

  • mate .gitignore

.DS_Store
  • Do initial staging and committing to local repository:
git add .
git commit -m "Initial commit"
  • Add plugins as git submodules:
git submodule add git://github.com/thl/authenticated_system.git vendor/plugins/authenticated_system

After adding all plugins then you need to commit to local repository:

git commit -m "Adding plugins as submodules."
  • Request that github repository be created under thl, by simply sending an e-mail to me, amontano@virginia.edu. I would create repos and make you a collaborator.
  • Push local git repos to github:
git remote add origin git@github.com:thl/authenticated_system.git
git push origin master
  • Tag initial version
git tag v1.0.0
git push origin --tags

Provided for unrestricted use by the external link: Tibetan and Himalayan Library