-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from kbrw/chore/cleanup
Chore/cleanup
- Loading branch information
Showing
4 changed files
with
117 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Build and test | ||
|
||
on: | ||
push: | ||
branches: [ "master" ] | ||
pull_request: | ||
branches: [ "master" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
name: Build and test (Elixir ${{matrix.versions.elixir}}) | ||
strategy: | ||
matrix: | ||
versions: [{os: 'ubuntu-20.04', otp: '23.3.4.9', elixir: '1.13.4-otp-23'}, {os: 'ubuntu-22.04', otp: '25.3.2.9', elixir: '1.15.7-otp-25'}] | ||
runs-on: ${{matrix.versions.os}} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Set up Elixir | ||
uses: erlef/setup-beam@v1 | ||
with: | ||
elixir-version: ${{matrix.versions.elixir}} | ||
otp-version: ${{matrix.versions.otp}} | ||
|
||
# Define how to cache deps. Restores existing cache if present. | ||
- name: Cache deps | ||
id: cache-deps | ||
uses: actions/cache@v3 | ||
env: | ||
cache-name: cache-elixir-deps | ||
with: | ||
path: deps | ||
key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }} | ||
restore-keys: ${{ runner.os }}-mix-${{env.cache-name}} | ||
|
||
# Define how to cache the `_build` directory. After the first run, | ||
# this speeds up tests runs a lot. This includes not re-compiling our | ||
# project's downloaded deps every run. | ||
- name: Cache compiled build | ||
id: cache-build | ||
uses: actions/cache@v3 | ||
env: | ||
cache-name: cache-compiled-build | ||
with: | ||
path: _build | ||
key: ${{ runner.os }}-mix-${{ env.cache-name }}-${{ hashFiles('**/mix.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-mix-${{ env.cache-name }}- | ||
${{ runner.os }}-mix- | ||
- name: Install dependencies | ||
run: mix deps.get | ||
|
||
- name: Run tests | ||
run: mix test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Calibex | ||
# Calibex [![Build Status](https://github.com/kbrw/calibex/actions/workflows/.github/workflows/build-and-test.yml/badge.svg)](https://github.com/kbrw/calibex/actions/workflows/build-and-test.yml) [![Hex.pm](https://img.shields.io/hexpm/v/calibex.svg)](https://hex.pm/packages/calibex) [![Documentation](https://img.shields.io/badge/documentation-gray)](https://hexdocs.pm/calibex) ![Hex.pm License](https://img.shields.io/hexpm/l/calibex) | ||
|
||
Please read the doc at : [https://hexdocs.pm/calibex](https://hexdocs.pm/calibex) | ||
|
||
|
@@ -9,41 +9,63 @@ Simple algorithm for ICal encoding : *every ICal fields handled*. | |
|
||
## ICal Elixir bijective format | ||
|
||
The ICal elixir term is exactly a representation of the ICal file format : for instance : | ||
The ICal elixir term is an exact representation of the ICal file format. | ||
|
||
For instance : | ||
|
||
```elixir | ||
[vcalendar: [[ | ||
prodid: "-//Google Inc//Google Calendar 70.9054//EN", | ||
version: "2.0", | ||
calscale: "GREGORIAN", | ||
vevent: [[ | ||
dtstart: %DateTime{}, | ||
dtend: %DateTime{}, | ||
organizer: [cn: "My Name",value: "mailto:[email protected]"], | ||
attendee: [cutype: "INDIVIDUAL",role: "REQ-PARTICIPANT",partstat: "NEEDS-ACTION",rsvp: true, cn: "Moi", | ||
"x-num-guests": 0, value: "mailto:[email protected]"], | ||
]]]]] | ||
[ | ||
vcalendar: [ | ||
[ | ||
prodid: "-//Google Inc//Google Calendar 70.9054//EN", | ||
version: "2.0", | ||
calscale: "GREGORIAN", | ||
vevent: [ | ||
[ | ||
dtstart: %DateTime{}, | ||
dtend: %DateTime{}, | ||
organizer: [cn: "My Name", value: "mailto:[email protected]"], | ||
attendee: [ | ||
cutype: "INDIVIDUAL", | ||
role: "REQ-PARTICIPANT", | ||
partstat: "NEEDS-ACTION", | ||
rsvp: true, | ||
cn: "Moi", | ||
"x-num-guests": 0, | ||
value: "mailto:[email protected]" | ||
] | ||
] | ||
] | ||
] | ||
] | ||
] | ||
``` | ||
|
||
`Calibex.encode/1` and `Calibex.decode/1` parse and format an ICal from this | ||
terms : see functions doc to find encoding rules. | ||
[`Calibex.encode/1`](https://hexdocs.pm/calibex/Calibex.html#encode/1) | ||
and [`Calibex.decode/1`](https://hexdocs.pm/calibex/Calibex.html#decode/1) | ||
parse and format an ICal from these terms : see functions doc to find encoding | ||
rules. | ||
|
||
Using this terms make it possible to handle all types of ICal files and any | ||
fields type. But the downside of this approach is that it can be cumbersome | ||
to create and handle this tree of keyword lists. To help you in this tasks, | ||
some helpers functions are provided : | ||
some helpers functions are provided : | ||
|
||
- `Calibex.new/1` | ||
- `Calibex.new_root/1` | ||
- `Calibex.request/1` | ||
- [`Calibex.new/1`](https://hexdocs.pm/calibex/Calibex.html#decode/1) | ||
- [`Calibex.new_root/1`](https://hexdocs.pm/calibex/Calibex.html#new_root/1) | ||
- [`Calibex.request/1`](https://hexdocs.pm/calibex/Calibex.html#request/1) | ||
|
||
|
||
## Example usage : email event request generation | ||
## Example usage : email event request generation | ||
|
||
```elixir | ||
Calibex.request(dtstart: Timex.now, dtend: Timex.shift(Timex.now,hours: 1), summary: "Mon évènement", | ||
organizer: "[email protected]", attendee: "[email protected]", attendee: "[email protected]") | ||
|> Calibex.encode | ||
Calibex.request( | ||
dtstart: Timex.now(), | ||
dtend: Timex.shift(Timex.now(), hours: 1), | ||
summary: "Mon évènement", | ||
organizer: "[email protected]", | ||
attendee: "[email protected]", | ||
attendee: "[email protected]" | ||
) | ||
|> Calibex.encode() | ||
``` | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters