Skip to content

Commit

Permalink
docs: various updates (#24)
Browse files Browse the repository at this point in the history
* docs: various updates

* ci: update workflows

* fix: update dependencies

* test: disable inspect override tests

* fix: remove inspect overrides and pass tests

* chore: update gitignore

* docs: update CHANGELOG
  • Loading branch information
hpopp authored Aug 31, 2024
1 parent c1695f6 commit 9e098ea
Show file tree
Hide file tree
Showing 10 changed files with 152 additions and 72 deletions.
59 changes: 49 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,68 @@ name: CI

on:
push:
branches: [master]
branches: ["master"]
pull_request:
branches: [master]
branches: ["master"]

jobs:
build:
name: Build and test
prettier:
name: Prettier
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
- name: Install Prettier
run: npm install --global prettier
- name: Run Prettier
run: prettier --check --no-error-on-unmatched-pattern "**/*.{json,md,yml,yaml}"
check:
name: Format/Credo
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Elixir
uses: erlef/setup-beam@v1
with:
elixir-version: "1.17.2"
otp-version: "27.0.1"
- name: Restore dependencies cache
uses: actions/cache@v3
with:
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-
- name: Install dependencies
run: mix deps.get
- name: Run formatter
run: mix format --check-formatted
- name: Run Credo
run: mix credo
test:
name: Test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Elixir
uses: erlef/setup-beam@988e02bfe678367a02564f65ca2e37726dc0268f
uses: erlef/setup-beam@v1
with:
elixir-version: "1.12.3" # Define the elixir version [required]
otp-version: "24.1" # Define the OTP version [required]
elixir-version: "1.17.2"
otp-version: "27.0.1"
- name: Restore dependencies cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: deps
key: ${{ runner.os }}-mix-${{ hashFiles('**/mix.lock') }}
restore-keys: ${{ runner.os }}-mix-
- name: Install dependencies
run: mix deps.get
- name: Run tests
env:
TERM: xterm
run: mix test
25 changes: 20 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
# The directory Mix will write compiled artifacts to.
/_build
/_build/

# If you run "mix test --cover", coverage assets end up here.
/cover
/cover/

# The directory Mix downloads your dependencies sources to.
/deps
/deps/

# Where 3rd-party dependencies like ExDoc output generated docs.
/doc
# Where third-party dependencies like ExDoc output generated docs.
/doc/

# Ignore .fetch files in case you like to edit your project deps locally.
/.fetch

# If the VM crashes, it generates a dump, let's ignore it too.
erl_crash.dump

# Also ignore archive artifacts (built via "mix archive.build").
*.ez

# Ignore package tarball (built via "mix hex.build").
scribe-*.tar

# Temporary files for e.g. tests.
/tmp/

# Ignore dialyzer files.
/priv/plts/*.plt
/priv/plts/*.plt.hash

# Misc
.iex.exs
.DS_Store
2 changes: 2 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
elixir 1.17.2-otp-27
erlang 27.0.1
24 changes: 15 additions & 9 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,33 @@

## Unreleased

**Changed**

- Bumped minimum Elixir version to 1.13.

**Removed**

- Removed `Scribe.auto_inspect/1`.
- Removed `Scribe.auto_inspect?/0`.

## v0.10.0
## v0.10.0 - 2019-05-29

- Added `:device` option to `Scribe.print/2` for printing to a specific device.
Defaults to `:stdio`

## v0.9.0
## v0.9.0 - 2019-05-04

- `NoBorder` style added.

## v0.8.2
## v0.8.2 - 2019-01-17

- Support for Elixir `v1.8`

## v0.8.1
## v0.8.1 - 2018-07-25

- Support for Elixir `v1.7`

## v0.8.0
## v0.8.0 - 2019-03-15

- `:compile_auto_inspect` and `:auto_inspect` config options, both default
to `false`.
Expand All @@ -46,23 +52,23 @@ true again.
If auto-inspect is not compiled (or disabled), `Scribe.print/2` and similar
functions will continue to work as normal.

## v0.7.0
## v0.7.0 - 2018-02-19

- Pseudographics style added.

## v0.6.0
## v0.6.0 - 2018-02-16

- Overrides Inspect protocol for `List` and `Map`. These types will now
automatically return in Scribe's table format. Disabled by default.
with `config :scribe, enable: false` in your Mix config.
- `Scribe.enable`, `Scribe.disable`, and `Scribe.enabled?` added.
- Minimum Elixir version bumped to `1.5`.

## v0.5.1
## v0.5.1 - 2018-01-06

- Bump pane dependency to v0.2.0.

## v0.5.0
## v0.5.0 - 2017-03-27

- `@behaviour Scribe.Style` implemented (See `/style` for example adapters)
- Colorized output.
Expand Down
30 changes: 15 additions & 15 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Contribution Guidelines

## Steps

1. Fork [scribe](https://github.com/codedge-llc/scribe)
2. Run your tests: `mix test`
3. Create your feature branch (`git checkout -b feat/my-new-feature`)
4. Make your changes
5. Test your changes
6. Run the formatter: `mix format`
7. Lint with credo: `mix credo`
8. Commit your changes (`git commit -m 'feat: some feature'`).
Scribe follows the [Karma-style git commit message](http://karma-runner.github.io/1.0/dev/git-commit-msg.html)
9. Push the branch (`git push origin feat/my-new-feature`)
10. Create a Pull Request
# Contributing

## Testing

Unit tests can be run with `mix test` or `mix coveralls.html`.

## Formatting

This project uses Elixir's `mix format` and [Prettier](https://prettier.io) for formatting.
Add hooks in your editor of choice to run it after a save. Be sure it respects this project's
`.formatter.exs`.

## Commits

Git commit subjects use the [Karma style](http://karma-runner.github.io/5.0/dev/git-commit-msg.html).
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2016 Codedge
Copyright (c) 2016-2024 Codedge LLC (https://www.codedge.io/)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
39 changes: 32 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
[![CI](https://github.com/codedge-llc/scribe/actions/workflows/ci.yml/badge.svg)](https://github.com/codedge-llc/scribe/actions/workflows/ci.yml)
[![Hex.pm](http://img.shields.io/hexpm/v/scribe.svg)](https://hex.pm/packages/scribe)
[![Hex.pm](http://img.shields.io/hexpm/dt/scribe.svg)](https://hex.pm/packages/scribe)

# Scribe

Pretty-print tables of Elixir structs and maps. Inspired by [hirb](https://github.com/cldwalker/hirb).
> Pretty-print tables of Elixir structs and maps. Inspired by [hirb](https://github.com/cldwalker/hirb).
[![CI](https://github.com/codedge-llc/scribe/actions/workflows/ci.yml/badge.svg)](https://github.com/codedge-llc/scribe/actions/workflows/ci.yml)
[![Version](https://img.shields.io/hexpm/v/scribe.svg)](https://hex.pm/packages/scribe)
[![Total Downloads](https://img.shields.io/hexpm/dt/scribe.svg)](https://hex.pm/packages/scribe)
[![License](https://img.shields.io/hexpm/l/scribe.svg)](https://github.com/codedge-llc/scribe/blob/master/LICENSE.md)
[![Last Updated](https://img.shields.io/github/last-commit/codedge-llc/scribe.svg)](https://github.com/codedge-llc/scribe/commits/master)
[![Documentation](https://img.shields.io/badge/documentation-gray)](https://hexdocs.pm/scribe/)

## Installation

Expand All @@ -25,7 +28,7 @@ keys of the first element.

```elixir
iex(1)> data = [%{key: "value", another_key: 123},
...(1)> [%{key: "test", another_key: :key}]
...(1)> %{key: "test", another_key: :key}]
iex(2)> Scribe.print(data)
+----------------+-------------+
| :another_key | :key |
Expand Down Expand Up @@ -228,8 +231,30 @@ iex> Scribe.print(data, style: Scribe.Style.NoBorder)
780 "2017-03-27 14:42:34.097591Z" "BF92748B4AAAF14A"
```

Set a default one in your Mix config if you like:
Set a default one in your config if you like:

```elixir
config :scribe, style: Scribe.Style.Psql
```

## Contributing

### Testing

Unit tests can be run with `mix test` or `mix coveralls.html`.

### Formatting

This project uses Elixir's `mix format` and [Prettier](https://prettier.io) for formatting.
Add hooks in your editor of choice to run it after a save. Be sure it respects this project's
`.formatter.exs`.

### Commits

Git commit subjects use the [Karma style](http://karma-runner.github.io/5.0/dev/git-commit-msg.html).

## License

Copyright (c) 2016-2024 Codedge LLC (https://www.codedge.io/)

This library is MIT licensed. See the [LICENSE](https://github.com/codedge-llc/pane/blob/master/LICENSE) for details.
1 change: 1 addition & 0 deletions lib/scribe.ex
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ defmodule Scribe do
defp fetch_keys(map) do
map
|> Map.keys()
|> Enum.sort()
|> process_headers()
end
end
12 changes: 2 additions & 10 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ defmodule Scribe.Mixfile do
[
app: :scribe,
version: @version,
elixir: "~> 1.5",
elixir: "~> 1.13",
source_url: "https://github.com/codedge-llc/scribe",
description: description(),
package: package(),
Expand All @@ -18,13 +18,6 @@ defmodule Scribe.Mixfile do
main: "readme",
extras: ["README.md"]
],
test_coverage: [tool: ExCoveralls],
preferred_cli_env: [
coveralls: :test,
"coveralls.detail": :test,
"coveralls.post": :test,
"coveralls.html": :test
],
dialyzer: [
plt_add_deps: true
]
Expand All @@ -45,7 +38,6 @@ defmodule Scribe.Mixfile do
[
{:credo, "~> 1.0", only: [:dev, :test], runtime: false},
{:dialyxir, "~> 1.0", only: [:dev], runtime: false},
{:excoveralls, "~> 0.8", only: :test},
{:ex_doc, ">= 0.0.0", only: :dev},
{:faker, "~> 0.9", only: [:dev, :test]},
{:pane, "~> 0.2"}
Expand All @@ -54,7 +46,7 @@ defmodule Scribe.Mixfile do

defp package do
[
files: ["lib", "inspect_overrides", "mix.exs", "README*", "LICENSE*"],
files: ["lib", "mix.exs", "README*", "LICENSE*"],
maintainers: ["Henry Popp"],
licenses: ["MIT"],
links: %{"GitHub" => "https://github.com/codedge-llc/scribe"}
Expand Down
Loading

0 comments on commit 9e098ea

Please sign in to comment.