Link for my new blog: https://git.io/vo3
As this blog grows, things have become increasingly harder to manage.
The customizations, scripts and stylesheets are everywhere, within
and outside the source
folder. The CSS stylesheets for codeblocks
and a Solarized theme were written or installed years ago. The Gist
tag in Octopress doesn’t work as well as expected. It’s hard to see
the highlighted area. Moreover, the range
and mark
in Octopress
2’s codeblock
tag never works. As the purpose of this blog is to
remind myself about the technical details of the code, the lack of
such functionalities caused me a lot of inconveniences: while writing,
after attaching the whole chuck of code, I need to specify the line
number; while reading, after viewing the line number, I have to locate
it in lines of code. In order to highlight part of the code, I’ve
created some CSS classes (e.g. UBCli
) and put it somewhere inside
sass
folder, I spent hours for test the rules and identified the
important !
ones. This custom CSS class is fine in normal text, but
it breaks in list items <li></li>
. It’s time switch to Jekyll
plugins written by full-time developers, such as
jekyll-terminal. But then I need to install a plugin.
Will it be compatible with the existing plugins/*.rb
? Instead of
spending even much more time on code written in a language that I
don’t even understand, as a non-developer and a math student, I
can choose another popular technology which is well-developped for
posting math and program code.
The structure of an Octopress 3 blog repository is cleaner than that of Octopress 2 because Octopress 3 is a Ruby gem, which can be managed by bundle. This tool and Git work together to bring about an easier new feature test on the local repository for my blog.
What’s worse: due to the change of timezone last year, Google Webmasters has found over 70 crawl errors in this blog. Despite the Jekyll update to version 3, I couldn’t resolve this issue. I’ll manually fix each erroneous link later if I’ve time.
I tried hard migrating over 350 existing post in this blog to
Octopress 3, but it’s too hard. First, jekyll build
returned a
plethora of syntax errors caused by the change in default markdown
parser (from rdiscound to kramdown with GFM enabled). Second, some of
the posts are about technologies that I’m no longer using now, so they
aren’t worth the effort. Third, I found it extremely hard to set up
the stylesheets and the Liquid templates dispersed in several separate
folders (namely, sass/, _includes/
, _templates/
, _layouts
stylesheets
, javascripts
), so that I can have the category list
and RSS back. The sources for examples and documentations for Jekyll
Liquid tags are few. I can’t even find a way to verify the
example of the include
tag on Shopify Liquid’s documentation. The
result depends on so many factors, notably the installed version of
Ruby (runtime environment and gems) and the machine’s operating system
(for Windows, the wdm
gem is needed). The whole process requires
many commands and is certainly prone to human errors. After one
week’s fruitless attempt. Being exhausted, I realised that I need to
give up some nice features in the original blog, and move to the new
one for a more manageable framework in order to save time.
In the previous post in this series, I included three Vim editor commands.
As I’ve already typed hundreds of lines of source code, I feel tired
and I often make mistakes while typing those commands despite these
two command mode mappings in my ~/.vimrc
.
1
2
3
“ Practical Vim Tip 34: Avoid cursors when rcl’g cmd from hist
cnoremap <C-p> <Up>
cnoremap <C-n> <Down>
Convert these three commands into a shell script. Since I’m using
FuzzyFinder, I assume that the current working directory
(as shown by :pwd
) is the root of the local repository for the
[Octopress] blog.
1
2
3
#!/bin/sh
sed '1,8d' $1 | kramdown > temp.html~
cat {temp,script}.html~ > tempmj.html~
~
after the file extension names .html
since I had
added *~
in my .gitignore
and I didn’t want these files
(including this shell script) to be tracked by Git.mklink
in cmd
.
(ran as admin) Other options are more complicated:
- Graphical programs: more disk space is consumed for programs
rarely used which have command line alternatives.
- Windows Power Shell: this method won’t work for Home
edition. (That’s my case.) I’m quite satisfied by the
current edition and I don’t see any reason to spend
a thousand dollar and a whole day to have it changed to Pro
version for functionalities that are too advanced for me.While I was writing this post, I used
grep -e "\[kramdown\]" %:h/*.markdown
in the current buffer in order to quickly retrieve the links to
websites to which I had previously referred. To escape the square
brackets and the search pattern, the flag -e
is added in between the
utility name and the pattern string. I tried using marks, but I had
forgotten the difference between a mark named with a small letter and
a capital letter.
Mark | Range |
---|---|
small | local |
capital | global |
Same as the background in my previous article.
I uninstalled Ruby 2.0 in the Control Panel, and then installed version 2.3.3 from RubyInstaller for Windows
Gem::InstallError: The 'RedCloth' native gem requires installed build tools.
Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
An error occurred while installing RedCloth (4.2.9), and Bundler cannot
continue.
Make sure that `gem install RedCloth -v '4.2.9'` succeeds before bundling.
The error message is similar to Joe’s gem install error. The only difference is that I was installing RedCloth 4.9.
This failure is due to the absence of a valid path to
RubyInstaller Development Kit. I tried manually adding the
path to the folder for binary executables (default to
C:\RubyDevKit\bin
) to PATH
, but it’s unsuccessful. I googled
“Please update your PATH to include build tools” and found
his question, whose third answer explained the function
of devkitvar.bat
. This batch script actually prepended the path of
two folders into PATH
. One is stated above; one is
C:\RubyDevKit\mingw\bin
. Running this batch file changes PATH
temporarily. A manual configuration in the Control Panel allowed
the system to detect DevKit, and this problem was thus
solved.
Name | Version Number |
---|---|
rake | 10.4.2 |
bundler | 1.13.7 |
Name | Version Number | With native extensions? |
---|---|---|
RedCloth | 4.2.9 | ✓ |
wdm | 0.1.0 | ✓ |
blankslate | 2.1.2.4 | ✗ |
chunky_png | 1.3.4 | ✗ |
coffee-script-source | 1.9.1 | ✗ |
colorator | 0.1 | ✗ |
execjs | 2.4.0 | ✗ |
fast-stemmer | 1.0.2 | ✓ |
ffi | 1.9.6 | ✗ |
hitimes | 1.2.2 | ✓ |
jekyll-gist | 1.1.0 | ✗ |
jekyll-paginate | 1.1.0 | ✗ |
jekyll-sitemap | 0.8.0 | ✗ |
kramdown | 1.6.0 | ✗ |
liquid | 2.6.2 | ✗ |
mercenary | 0.3.5 | ✗ |
multi_json | 1.11.0 | ✗ |
posix-spawn | 0.3.10 | ✓ |
rack | 1.6.0 | ✗ |
rb-fsevent | 0.9.4 | ✗ |
redcarpet | 3.2.2 | ✓ |
safe_yaml | 1.0.4 | ✗ |
sass | 3.4.13 | ✗ |
stringex | 1.4.0 | ✗ |
tilt | 1.4.1 | ✗ |
yajl-ruby | 1.2.1 | ✓ |
I put the error message from wdm in a popup dialog.
Owner@Owner-PC MINGW64 /c/github/vincenttam.github.io (source)
$ bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Using rake 10.4.2
Using RedCloth 4.2.9
Using blankslate 2.1.2.4
Installing hitimes 1.2.2 with native extensions
Using chunky_png 1.3.4
Installing fast-stemmer 1.0.2 with native extensions
Using coffee-script-source 1.9.1
Using execjs 2.4.0
Using colorator 0.1
Using multi_json 1.11.0
Using sass 3.4.13
Using rb-fsevent 0.9.4
Using ffi 1.9.6
Using tilt 1.4.1
Using jekyll-gist 1.1.0
Using jekyll-paginate 1.1.0
Using kramdown 1.6.0
Using liquid 2.6.2
Using mercenary 0.3.5
Installing posix-spawn 0.3.10 with native extensions
Installing yajl-ruby 1.2.1 with native extensions
Installing redcarpet 3.2.2 with native extensions
Using safe_yaml 1.0.4
Using jekyll-sitemap 0.8.0
Using rack 1.6.0
Using stringex 1.4.0
Installing wdm 0.1.0 with native extensions
Using bundler 1.13.7
Installing parslet 1.5.0
Installing timers 4.0.1
Installing classifier-reborn 2.0.3
Installing coffee-script 2.3.0
Installing compass-core 1.0.3
Installing compass-import-once 1.0.5
Installing jekyll-sass-converter 1.3.0
Installing sass-globbing 1.0.0
Installing rb-inotify 0.9.5
Installing haml 4.0.6
Installing pygments.rb 0.6.2
Installing rack-protection 1.5.3
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/wdm-0.1.0/ext/wdm
C:/Ruby23-x64/bin/ruby.exe -r ./siteconf20170109-8020-1n4s35m.rb extconf.rb
checking for main() in -lkernel32... yes
checking for windows.h... yes
checking for ruby.h... yes
checking for HAVE_RUBY_ENCODING_H... yes
creating Makefile
To see why this extension failed to compile, please check the mkmf.log which can
be found here:
current directory: C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/wdm-0.1.0/ext/wdm
make "DESTDIR=" clean
current directory: C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/wdm-0.1.0/ext/wdm
make "DESTDIR="
generating wdm_ext-x64-mingw32.def
compiling entry.c
In file included from entry.c:1:0:
wdm.h:3:0: warning: "WINVER" redefined [enabled by default]
In file included from
4-mingw32/include/crtdefs.h:10:0,
from
4-mingw32/include/stdio.h:9,
from wdm.h:1,
from entry.c:1:
4-mingw32/include/_mingw.h:248:0:
note: this is the location of the previous definition
In file included from entry.c:1:0:
wdm.h:4:0: warning: "_WIN32_WINNT" redefined [enabled by default]
<command-line>:0:0: note: this is the location of the previous definition
In file included from c:/Ruby23-x64/include/ruby-2.3.0/ruby/win32.h:41:0,
from c:/Ruby23-x64/include/ruby-2.3.0/ruby/defines.h:168,
from c:/Ruby23-x64/include/ruby-2.3.0/ruby/ruby.h:36,
from c:/Ruby23-x64/include/ruby-2.3.0/ruby.h:33,
from wdm.h:12,
from entry.c:1:
4-mingw32/include/winsock2.h:15:2:
warning: #warning Please include winsock2.h before windows.h [-Wcpp]
compiling memory.c
In file included from memory.c:1:0:
wdm.h:3:0: warning: "WINVER" redefined [enabled by default]
In file included from
4-mingw32/include/crtdefs.h:10:0,
from
4-mingw32/include/stdio.h:9,
from wdm.h:1,
from memory.c:1:
4-mingw32/include/_mingw.h:248:0:
note: this is the location of the previous definition
In file included from memory.c:1:0:
wdm.h:4:0: warning: "_WIN32_WINNT" redefined [enabled by default]
<command-line>:0:0: note: this is the location of the previous definition
In file included from c:/Ruby23-x64/include/ruby-2.3.0/ruby/win32.h:41:0,
from c:/Ruby23-x64/include/ruby-2.3.0/ruby/defines.h:168,
from c:/Ruby23-x64/include/ruby-2.3.0/ruby/ruby.h:36,
from c:/Ruby23-x64/include/ruby-2.3.0/ruby.h:33,
from wdm.h:12,
from memory.c:1:
4-mingw32/include/winsock2.h:15:2:
warning: #warning Please include winsock2.h before windows.h [-Wcpp]
compiling monitor.c
In file included from monitor.c:1:0:
wdm.h:3:0: warning: "WINVER" redefined [enabled by default]
In file included from
4-mingw32/include/crtdefs.h:10:0,
from
4-mingw32/include/stdio.h:9,
from wdm.h:1,
from monitor.c:1:
4-mingw32/include/_mingw.h:248:0:
note: this is the location of the previous definition
In file included from monitor.c:1:0:
wdm.h:4:0: warning: "_WIN32_WINNT" redefined [enabled by default]
<command-line>:0:0: note: this is the location of the previous definition
In file included from c:/Ruby23-x64/include/ruby-2.3.0/ruby/win32.h:41:0,
from c:/Ruby23-x64/include/ruby-2.3.0/ruby/defines.h:168,
from c:/Ruby23-x64/include/ruby-2.3.0/ruby/ruby.h:36,
from c:/Ruby23-x64/include/ruby-2.3.0/ruby.h:33,
from wdm.h:12,
from monitor.c:1:
4-mingw32/include/winsock2.h:15:2:
warning: #warning Please include winsock2.h before windows.h [-Wcpp]
compiling queue.c
In file included from queue.c:3:0:
wdm.h:3:0: warning: "WINVER" redefined [enabled by default]
In file included from
4-mingw32/include/vadefs.h:13:0,
from
4-mingw32/include/_mingw_stdarg.h:14,
from
4-mingw32/include/stdarg.h:140,
from
c:\rubydevkit\mingw\bin\../lib/gcc/x86_64-w64-mingw32/4.7.2/include/stdarg.h:1,
from queue.c:1:
4-mingw32/include/_mingw.h:248:0:
note: this is the location of the previous definition
In file included from queue.c:3:0:
wdm.h:4:0: warning: "_WIN32_WINNT" redefined [enabled by default]
<command-line>:0:0: note: this is the location of the previous definition
In file included from c:/Ruby23-x64/include/ruby-2.3.0/ruby/win32.h:41:0,
from c:/Ruby23-x64/include/ruby-2.3.0/ruby/defines.h:168,
from c:/Ruby23-x64/include/ruby-2.3.0/ruby/ruby.h:36,
from c:/Ruby23-x64/include/ruby-2.3.0/ruby.h:33,
from wdm.h:12,
from queue.c:3:
4-mingw32/include/winsock2.h:15:2:
warning: #warning Please include winsock2.h before windows.h [-Wcpp]
compiling rb_change.c
In file included from rb_change.c:4:0:
wdm.h:3:0: warning: "WINVER" redefined [enabled by default]
In file included from
4-mingw32/include/crtdefs.h:10:0,
from
4-mingw32/include/stdlib.h:9,
from rb_change.c:1:
4-mingw32/include/_mingw.h:248:0:
note: this is the location of the previous definition
In file included from rb_change.c:4:0:
wdm.h:4:0: warning: "_WIN32_WINNT" redefined [enabled by default]
<command-line>:0:0: note: this is the location of the previous definition
In file included from c:/Ruby23-x64/include/ruby-2.3.0/ruby/win32.h:41:0,
from c:/Ruby23-x64/include/ruby-2.3.0/ruby/defines.h:168,
from c:/Ruby23-x64/include/ruby-2.3.0/ruby/ruby.h:36,
from c:/Ruby23-x64/include/ruby-2.3.0/ruby.h:33,
from wdm.h:12,
from rb_change.c:4:
4-mingw32/include/winsock2.h:15:2:
warning: #warning Please include winsock2.h before windows.h [-Wcpp]
compiling rb_monitor.c
In file included from rb_monitor.c:1:0:
wdm.h:3:0: warning: "WINVER" redefined [enabled by default]
In file included from
4-mingw32/include/crtdefs.h:10:0,
from
4-mingw32/include/stdio.h:9,
from wdm.h:1,
from rb_monitor.c:1:
4-mingw32/include/_mingw.h:248:0:
note: this is the location of the previous definition
In file included from rb_monitor.c:1:0:
wdm.h:4:0: warning: "_WIN32_WINNT" redefined [enabled by default]
<command-line>:0:0: note: this is the location of the previous definition
In file included from c:/Ruby23-x64/include/ruby-2.3.0/ruby/win32.h:41:0,
from c:/Ruby23-x64/include/ruby-2.3.0/ruby/defines.h:168,
from c:/Ruby23-x64/include/ruby-2.3.0/ruby/ruby.h:36,
from c:/Ruby23-x64/include/ruby-2.3.0/ruby.h:33,
from wdm.h:12,
from rb_monitor.c:1:
4-mingw32/include/winsock2.h:15:2:
warning: #warning Please include winsock2.h before windows.h [-Wcpp]
rb_monitor.c: In function 'rb_monitor_run_bang':
rb_monitor.c:508:9: warning: implicit declaration of function
'rb_thread_blocking_region' [-Wimplicit-function-declaration]
compiling utils.c
In file included from utils.c:1:0:
wdm.h:3:0: warning: "WINVER" redefined [enabled by default]
In file included from
4-mingw32/include/crtdefs.h:10:0,
from
4-mingw32/include/stdio.h:9,
from wdm.h:1,
from utils.c:1:
4-mingw32/include/_mingw.h:248:0:
note: this is the location of the previous definition
In file included from utils.c:1:0:
wdm.h:4:0: warning: "_WIN32_WINNT" redefined [enabled by default]
<command-line>:0:0: note: this is the location of the previous definition
In file included from c:/Ruby23-x64/include/ruby-2.3.0/ruby/win32.h:41:0,
from c:/Ruby23-x64/include/ruby-2.3.0/ruby/defines.h:168,
from c:/Ruby23-x64/include/ruby-2.3.0/ruby/ruby.h:36,
from c:/Ruby23-x64/include/ruby-2.3.0/ruby.h:33,
from wdm.h:12,
from utils.c:1:
4-mingw32/include/winsock2.h:15:2:
warning: #warning Please include winsock2.h before windows.h [-Wcpp]
compiling wdm.c
In file included from wdm.c:1:0:
wdm.h:3:0: warning: "WINVER" redefined [enabled by default]
In file included from
4-mingw32/include/crtdefs.h:10:0,
from
4-mingw32/include/stdio.h:9,
from wdm.h:1,
from wdm.c:1:
4-mingw32/include/_mingw.h:248:0:
note: this is the location of the previous definition
In file included from wdm.c:1:0:
wdm.h:4:0: warning: "_WIN32_WINNT" redefined [enabled by default]
<command-line>:0:0: note: this is the location of the previous definition
In file included from c:/Ruby23-x64/include/ruby-2.3.0/ruby/win32.h:41:0,
from c:/Ruby23-x64/include/ruby-2.3.0/ruby/defines.h:168,
from c:/Ruby23-x64/include/ruby-2.3.0/ruby/ruby.h:36,
from c:/Ruby23-x64/include/ruby-2.3.0/ruby.h:33,
from wdm.h:12,
from wdm.c:1:
4-mingw32/include/winsock2.h:15:2:
warning: #warning Please include winsock2.h before windows.h [-Wcpp]
linking shared-object wdm_ext.so
rb_monitor.o: In function `rb_monitor_run_bang':
C:\Ruby23-x64\lib\ruby\gems\2.3.0\gems\wdm-0.1.0\ext\wdm/rb_monitor.c:508:
undefined reference to `rb_thread_blocking_region'
collect2.exe: error: ld returned 1 exit status
make: *** [wdm_ext.so] Error 1
make failed, exit code 2
Gem files will remain installed in
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/wdm-0.1.0 for inspection.
Results logged to
.out
An error occurred while installing wdm (0.1.0), and Bundler cannot continue.
Make sure that `gem install wdm -v '0.1.0'` succeeds before bundling.
From the line
wdm.h:4:0: warning: "_WIN32_WINNT" redefined [enabled by default]
I found wdm issue #18, but I failed to notice that the problem had been resolved. I later knew that from Jekyll issue #3721.
After changing the version number of wdm to 0.1.1, I could proceed further. The system output was fine.
Owner@Owner-PC MINGW64 /c/github/vincenttam.github.io (source)
$ gem install wdm -v '0.1.1'
Building native extensions. This could take a while...
Successfully installed wdm-0.1.1
Parsing documentation for wdm-0.1.1
Installing ri documentation for wdm-0.1.1
Done installing documentation for wdm after 0 seconds
1 gem installed
Owner@Owner-PC MINGW64 /c/github/vincenttam.github.io (source)
$ bundle install
Fetching gem metadata from https://rubygems.org/..........
Fetching version metadata from https://rubygems.org/..
Fetching dependency metadata from https://rubygems.org/.
Resolving dependencies...
Using rake 10.4.2
Using RedCloth 4.2.9
Using blankslate 2.1.2.4
Using hitimes 1.2.2
Using chunky_png 1.3.4
Using fast-stemmer 1.0.2
Using coffee-script-source 1.9.1
Using execjs 2.4.0
Using colorator 0.1
Using multi_json 1.11.0
Using sass 3.4.13
Using rb-fsevent 0.9.4
Using ffi 1.9.6
Using tilt 1.4.1
Using jekyll-gist 1.1.0
Using jekyll-paginate 1.1.0
Using kramdown 1.6.0
Using liquid 2.6.2
Using mercenary 0.3.5
Using posix-spawn 0.3.10
Using yajl-ruby 1.2.1
Using redcarpet 3.2.2
Using safe_yaml 1.0.4
Using jekyll-sitemap 0.8.0
Using rack 1.6.0
Using stringex 1.4.0
Using wdm 0.1.1 (was 0.1.0)
Using bundler 1.13.7
Using parslet 1.5.0
Using timers 4.0.1
Using classifier-reborn 2.0.3
Using coffee-script 2.3.0
Using compass-core 1.0.3
Using compass-import-once 1.0.5
Using jekyll-sass-converter 1.3.0
Using sass-globbing 1.0.0
Using rb-inotify 0.9.5
Using haml 4.0.6
Using pygments.rb 0.6.2
Using rack-protection 1.5.3
Installing toml 0.1.2
Installing celluloid 0.16.0
Installing jekyll-coffeescript 1.0.1
Installing compass 1.0.3
Installing sinatra 1.4.5
Installing listen 2.8.5
Installing jekyll-watch 1.2.1
Installing jekyll 2.5.3
Installing octopress-hooks 2.6.0
Installing octopress-date-format 2.0.2
Bundle complete! 14 Gemfile dependencies, 50 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
Post-install message from compass:
Compass is charityware. If you love it, please donate on our behalf at http:
//umdf.org/compass Thanks!
When I ran rake preview
, the follow line appeared.
bash: /c/Ruby23-x64/bin/rake: C:/Users/Justin/Projects/rubyinstaller/sandbox/rub
y23_mingw/bin/ruby.exe: bad interpreter: No such file or directory
I searched “rake install justin projects” on Google.
You may follow griest’s advice to have this problem
fixed. If this link were unluckily dead in the future, you might
leave a comment below after getting rid of Justin at the first line of
/c/Ruby23-x64/bin/rake
.
Octopress did work on my machine. Then I re-ran bundle install
under the local repository for my another blog, but the
same Celluloid error re-appeared. I don’t know how to
perform a celluloid downgrade to version 16.0 under that
repository. The version number for Celluloid was generated by the
system—I didn’t type it in Gemfile.lock
. As a result, I
switched to Ubuntu on Windows 10.
I’m recently enhancing the $\rm \LaTeX$ code for inline limits. For the reason of doing so, you may refer to the external link of my recent linklog Inline Limit Rendering.
In the previous post in this series written over one year ago, I have included a code block which enables deferred MathJax loading. However, I manually added this chuck of code in the HTML file generated by kramdown, which created the problem described in the next subsection A problem with Vim’s folding arised.
Firstly, save the code for loading MathJax in the previous
post in this series in a separate file ~/script.html
. Then
use the following commands within Vim in order to avoid leaving the
current buffer and to improve efficiency.
9,$w! ~/temp.mkd
!kramdown ~/temp.mkd > ~/temp.html
!cat ~/{temp,script}.html > ~/test.html
The digit 9
in the first command isn’t exact. Change it to any
line number that separates the yaml front matter from the
post content.
To know the page layout of a website, notably my blogs, on mobile devices before publishing it.
I used ifconfig
to check the IP address of my desktop where the
preview site was hosted. It’s 192.168.1.5
. When I typed in this
address followed by a colon and the port number 4000
, then the
browser said “connection timeout” after loading for a while.
I spent a day to identify the cause of the problem.
Actually, the website should be hosted at the internal IP address
shown by ifconfig
instead of localhost
. Since I switch off the
router before going to bed every day, the internal IP address for my
desktop changes daily. Therefore, one uses 0.0.0.0
to host the site
on all IP addresses that the machine possesses.
In Jekyll-Bootstrap, one may simply add host : 0.0.0.0
in
_config.yml
; in Octopress, one may find the line containing
server_port
in the middle of Rakefile
and add --host
#{listen_host}
.1
``` ruby Changes in Rakefile http://www.jmlog.com/octopress-preview-config-in-vagrant/ server_port = “4000” # port for preview server eg. localhost:4000 listen_host = “0.0.0.0” # bind to all available IPs
rackupPid = Process.spawn(“rackup –port #{server_port} –host #{listen_host}”) ```
On Ubuntu, I used UFW to open the port 4000
to all devices at home.
(The netmask of my home router has 24 bits, which is the usual
setting.)
sudo ufw allow from 192.168.1.0/24 to any port 4000:4001 proto tcp
Rakefile
which allows the specification of the host address./24
in 192.168.1.0/24
means after reading
this chapter of the guide.