Syndication Icon
Published November 2, 2019 Updated August 25, 2020

Pragmater

  • Duration

    01:19

  • Operating System

    macOS

  • Shell

    bash

  • Terminal

    xterm

Transcript

# Hello and welcome to the Alchemists Screencasts!
# Today, we'll look at the Pragmater gem (https://www.alchemists.io/projects/pragmater).
# With the Pragmater gem installed, we can ask for help to get started:

pragmater --help

# The primary purpose of Pragmater is to insert/remove pragma comments.
# For example, let's remove pragmas from an existing project:

pragmater --remove

# Using Git diff, we can see the "# frozen_string_literal: true" pragma was removed:

gd

# These settings were applied via my global configuration:

pragmater --config --info

# Based on my global configuration, we can easily restore (insert) the changes:

pragmater --insert

# Using Git status, we can see our status is clean:

gst

# We can also insert/remove pragmas not configured globally:

pragmater --insert --comments "# encoding: UTF-8"
gd
pragmater --remove --comments "# encoding: UTF-8"
gst

# We can target specific files too:

pragmater --insert --comments "# encoding: UTF-8" --includes Gemfile
gd

# We can even run Pragmater from a different directory by specifing the relative path:

..
pragmater --remove demo --comments "# encoding: UTF-8" --includes Gemfile

# There is much more Pragmater can do so be sure to check out the README for details.

# Enjoy!
# https://www.alchemists.io
# ☿ 🜔 🜍 🜂 🜃 🜁 🜄