Fossil SCM for beginners (II): Rails 7

Robert Guiscard
2 min readDec 8, 2021

--

Rails 7 RC1 is just released and it would be interesting to manage rails project with fossil. After install rails:

gem install rails --pre

Create a new Rails application

rails new locomotive --database=postgresql --javascript=esbuild

Then edit config/database.yml and set up database

rails db:setup
rails db:migrate

Start rails with rails server and you should be able to access the default page.

Let’s manage this rails project with fossil. First, we need to create a fossil repository, which is a SQLite3 file:

# under rails project directory,
# create local reponsitory outside project directory
fossil new ../locomotive.fossil

Then create a local working directory like this:

fossil open ../locomotive.fossil

Similar to .gitignore, we can ignore certain files from fossil. Create a file named .fossil-settings/ignore-globand put in the files to ignore. Fossil has its glob pattern.

.bundlelog/*
tmp/*
tmp/pids/*storage/*
tmp/storage/*
public/assetsconfig/master.keyapp/assets/builds/*node_modules

Note the comment is not allowed in Fossil. For empty directory, there is another settings called empty-dirs:

log/
tmp/
tmp/pids/storage/
tmp/storage/
app/assets/builds/

Then we can commit it by fossil commit -m 'init'.

By default, fossil will not include hidden files (files with dot prefix) into repository. We can manully do so like this:

fossil add .fossil-settings

Now, local settings will be in the repository after committing.

We can check out the repository to another working directory like this

mkdir new_dir
cd new_dir
fossil open ../locomotive.fossil
fossil update # if empty directories are not created automatically

update honors the “autosync” option and does a “soft” switch, merging any local changes into the target version, whereas checkout does not automatically sync and does a “hard” switch, overwriting local changes if told to do so.

Fossil users tend to use update than checkout .

Now you can upload this local repository to a remote one and sync with it. Once you obtain the url of remote repository, use

fossil sync url_to_remote_repository

When you commit to local repository, it will automatically sync to the remote one.

Now, you have a working environment of Rails with Fossil SCM.

--

--

No responses yet