Ruby on Rails on Linode Problem

I tried setting up Ruby on Rails on Debian 10 on Linode.

I used Linode’s Ruby on Rails on Debian 9 guide cuz I didn’t see a Debian 10 guide. I got pretty far but I am stuck.

Link: https://linode.com/docs/development/ror/ruby-on-rails-apache-debian/

Everything went fine until the “Configure Apache to Work with Passenger” section, particular the section where it says:

sudo passenger-config about ruby-command
Note
Make sure that Passenger reports the version of Ruby that you installed with RVM. Normally RVM uses paths similar to ~/.rvm/wrappers/ruby-X.X.X/ruby.

Upon running rvm current, my ruby version reports as ruby-2.6.3, but Passenger seems to be using ruby 2.5.5p157

When I run sudo passenger-config about ruby-command I also get the following error:

Traceback (most recent call last):
2: from /usr/bin/passenger-config:27:in <main>'
1: from /home/admin/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in
require'
/home/admin/.rvm/rubies/ruby-2.6.3/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- phusion_passenger (LoadError)

i googled the error and tried various suggestions for commands to run but nothing has worked so far.

A Ruby Script to Go From Raw Source of Emails to Something I Can Put On My Blog

I wanted to take an email from Apple Mail and paste it to my blog.

If I copy/paste from the normal email, I lose the &gt; marks you need for proper quoting in Markdown.

Ah but there’s the option to view the Raw Source of an email in Apple Mail (Opt-Cmd-U).

But if you paste from that you get something like this:

British=E2=80=94again, really English=E2=80=94society remained defined =
by a national culture that Orwell would have recognized. In that year, =
however, Tony Blair=E2=80=99s just-elected first Labour government =
launched a demographic=E2=80=94and, concomitantly, a =
cultural=E2=80=94revolution, a revolution that historians and =
commentators of all political stripes now recognize as by far Blair=E2=80=99=
s most historically significant legacy.

ewww what are those =E2=80=blahblahs 🙁

Turns out Raw emails are encoded in Quoted-Printable. Ok cool, so how do we deal with that?

First we will need a gem.

Let’s go!

gem install clipboard
gem install mail

Clipboard lets you easily interact with Mac clipboard, and Mail has a thing that lets us decode Quoted-Printable text to normal text.

The workflow is: I view Raw Source on an email I wanna paste, and select the body of the email, and copy it into the clipboard. Then I run the following script:

and now I have the plain text of my email with the appropriate &gt; marks. Nice!

However, this would be a lot better if I could set this up as a system wide service I could summon with a shortcut key….but I’m not sure if its possible to use an environment besides the system default Ruby to set such a service up in Automator.

Justin Makes a Ruby Program Part 2

Elliot Temple replied to my last post with several good comments and I wanted to address them.

Elliot Temple’s comments have a yellow background:

I would write:

You’re mutating state for no reason and making it longer.

Great suggestion, thanks!

For sanitizing, shouldn’t you keep div and span tags? I’ve used those for formatting sometimes (offhand I know some blockquotes use divs). Also shouldn’t you allow hr tags? I use those.

All good suggestions, thanks. I don’t really have a good understanding of HTML and CSS yet so I’m not good at judging things like what’s important to include in a sanitize list. I was mostly judging by noting that the output files looked good enough, but the hr tag in particular helps with a problem I’d noticed on some of the pages so thanks for pointing that out.

The <hr> tag was not agreeable to the Upmark gem, so I added the following to handle that issue

Also shouldn’t you convert h1 and h2 tags similar to the h3?

Yeah it doesn’t hurt to do them all!

Elliot also suggested I handle the RegEx for header tags by just doing substitution instead of using a block. This is what I came up with for the header issue with Elliot’s help. (my syntax highlighter isn’t handling
#{} well so ignore the highlighting on this code snippet):

And I don’t understand why the sanitizer doesn’t have b, i, u, em, strong on the list.

Fixed thanks.

Thanks for your help Elliot!

With regards to code in blog comments, Markdown has been activated in the comments, and it plays nicely with my syntax highlighting plugin! (I’m using Crayon if anyone is curious)

Inline code syntax is `back-ticks like this`

and which produces code styled like this

and for blocks of code

```

its a fence of three backticks around your code like this

```