;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 512 ;; QUESTION SECTION: ;pptr.dev. IN A
;; ANSWER SECTION: pptr.dev. 3599 IN A 185.199.108.153 pptr.dev. 3599 IN A 185.199.109.153 pptr.dev. 3599 IN A 185.199.110.153 pptr.dev. 3599 IN A 185.199.111.153
puma-dev[1] is a tool to manage rack apps in development with puma.
If you need the following features, you have to use puma-dev instead of pow:
Websockets or ActionCable in Rails 5
Zero-config HTTPs support to your development environment.
Installation
Remove your pow first $ curl get.pow.cx/uninstall.sh | sh
Install via Homebrew: brew install puma/puma/puma-dev
sudo puma-dev -setup to configure DNS settings as root.
Run puma-dev -install to configure puma-dev and run it in the background on ports both 80 and 443. This step requires root permission again to install certificates for HTTPs.
Pro tips
Just move or rename your old ~/.pow directory to ~/.puma-dev
Run puma-dev link in the rack app directory then it will generate the link automatically
Use both ActiveRecord and Mongoid in a Rails project is easy. Add mongoid in Gemfile:
1
gem 'mongoid', '~> 6.1.0'
then bundle install
However, the mongoid gem would change your default ORM adapter from ActiveRecord to Mongoid:
If you’re not sure which default adapter is you can try: rails g model and check the output message
1 2 3 4 5 6 7 8
Usage: rails generate model NAME [field[:type][:index] field[:type][:index]] [options]
Options: [--skip-namespace], [--no-skip-namespace] # Skip namespace (affects only isolated applications) [--force-plural], [--no-force-plural] # Forces the use of the given model name -o, --orm=NAME # ORM to be invoked # Default: mongoid
So if you wanna generate a new model inherited from ActiveRecord:
1
rails g model Manager --orm=active_record
Notice: it’s active_record instead of activerecord
Try to hexo deploy to deploy it to your repository.
Notice that GitHub Pages will build and serve website from one of the branch such as gh-pages or master. So you have to set source in repository settings.
Use HTTPS
Cloudflare provides free SSL to secure your website, all you have to do is:
Visit Crypto section in your domain name dashboard
In the first panel SSL, turn it on. The option should be “Flexible” or “Full”
Make sure your domain name is fully managed by Cloudflare
In CircleCI, add your project and let it try to build your website.
Remember to sync submodule if you use submodule to clone a theme into your repository.
You can use something like html-proofer to validate the HTML and find out dead links. However I choose to echo "Passed".
You have to generate a pair of SSH key and add it to CircleCI SSH Permission so that CircleCI will be able to access to your GitHub repository for both read and write.
Once the settings are done, the publishing process will be much easier: create a new post and commit it into your repository.
1 { # in the first line /^---/ { # if it starts with --- :a # jump label for looping N # fetch the next line, append to pattern space /\n---/! ba; # if the result does not contain \n--- (that is, if the last # fetched line does not begin with ---), go back to :a d # then delete the whole thing. } } # otherwise drop off the end here and do the default (print # the line)
Furthermore, if you wanna keep some useful metadata in front matter like post title in blogging system, you can do so:
1 2 3
title=$(grep '^title\:\(.*\)$' $1 | sed -e 's/title\:\s//g') sed -i -e "/---/a # `echo $title`" $1 sed -i '1 { /^---/ { :a N; /\n---/! ba; d} }' $1
Here is a workaround to insert $title in each --- then remove YAML Front Matter.