Writing a (Technical) Book in an IDE

I find myself writing again more, in particular writing technical books. For this I am using a number of tools, some of which I’ve described in Writing a Ruby Related book(let) on LeanPub.

In this post I focus on the writing itself including the setup I use. When starting fresh, I use the zip file with a default content provided by LeanPub. When unzipped, the folder structure looks like this:

% tree a_potential_book
a_potential_book
├── README.md
└── manuscript
    ├── Book.txt
    ├── chapter1.txt
    ├── chapter2.txt
    ├── chapter3.txt
    └── resources
        ├── palm-trees.jpg
        └── readme.txt

2 directories, 7 files

I have used Markdown in previous books and am now using Markua (a markup format created by LeanPub). Since both are similar and many editors & IDEs identify the file type by the file name suffix, I use ‘.md’ as the suffix for the files. Also, I find renaming the files ist easier than reconfiguring editors. To do this I use rename:

% rename -g  -s .txt .md  "a_potential_book/manuscript/chapter*.txt"
% tree a_potential_book
a_potential_book
├── README.md
└── manuscript
    ├── Book.txt
    ├── chapter1.md
    ├── chapter2.md
    ├── chapter3.md
    └── resources
        ├── palm-trees.jpg
        └── readme.txt

On a Mac rename can be installed using Homebrew:

brew install rename

Now the file Book.txt needs to be updated, to also list the ‘*.md’ files:

ls *.md > Book.txt

With this set up, I import the folder into RubMine, and have a look at ‘chapter2.md’:

Example chapter 2 of the default LeanPub book
The imported default book (click to enlarge image)

Notice this line

![Palm Trees](palm-trees.jpg)

This is the Markua (and Markdown) way of to insert an image (‘palm-trees.jpg’ in this case) into the text using the cation ‘Palm Trees’. In terms of RubyMine the image file is a resource — and it would be handy to be able to open it with just a click. Here’s how to configure this in the IDE:

  1. 320Hover the mouse pointer over the folder name ‘resources’ and
  2. Open the context menu with a right click:
  3. Open the sub menu entitled ‘Mark Directory as ▸’, and click ‘Resource Root’

Now, if you CMD-click the file name in the text, the image is displayed. Nice.

For my Ruby related book, I created a sub directory within ‘resources’ named ‘code’. Any files inside that folder will now also be found by the IDE and opened, when CMD-clicked.

A Community Written Book

An Update: It‘s available on LeanPub!

The book is now available at LeanPub ➙ https://leanpub.com/softwarepeopleworkfromhome.

@MaikNog and I (@S_2K on Twitter) are preparing a community e-book, similar to Viv Richards’ (who agreed to contribute to this one. Yay!) wonderful “Around the World with 80 Software Testers“.

It’s entitled “Software People … Work From Home — Insights & Experiences From Planet Earth” and it will contain reports about life and work in these times of lockdown, personal limitation and remoteness. They are personal experiences, unfiltered authentic … and safe for work. 🙂 I would love each contribution to be easily seen as the work of a person, the human behind the words. This is intended to be a very humane collection of individual works covering one topic.

Folks have already promised to contribute material – and here’s a map marking the countries: https://drive.google.com/open?id=1riRbKTZMGdwShPZJ0f884CIbXFD2Vhli&usp=sharing

World map displaying countries with contributors to the book

If you identify as a software person and would like to contribute, we (@MaikNog and @S_2K) would like to hear (or read) from you — especially (but not exclusively!) if you’re not from one of the countries marked in that map.

All the best to you and yours — stay healthy (or a speedy recovery, should that be needed)

Update on 27th April 2020: The name changed, the map is updated and the description more precise..

Update on 10^th^ May 2020: Updated the map, now including Greece and Italy. Thank y’all!

Writing a Ruby Related book(let) on LeanPub

I wrote “Fast Feedback Using Ruby” using LeanPub. The original version was published back in 2015. Since I’m updating it to cover the most recent (at the time of this writing) Ruby 2.7 and RubyGem versions. I figured, it’s a good idea to leave a trace of my workflow and setup. 🙂

My workflow look like this:

  1. Edit Text (or image) file
  2. Save file to local disk
  3. Commit to local Git repository
  4. Push to GitHub
  5. Generate preview PDF on LeanPub using a (post push) web hook
  6. Have Leanpub automatically push files to Dropbox
  7. Have Dropbox synchronise PDF file to local folder
  8. Restart at 1
Writing workflow using LeanPub, GitHub and Dropbox

Whenever I push changes to GitHub, a new preview of the book is generated and sent to my computer. This means I get frequent and fast feedback about how the newly written text looks.

This nicely fits my working preferences and it also matches the topic of this particular book.

%d bloggers like this: