Skip to content

Commit b09d5a0

Browse files
authored
Merge pull request #32 from alerque/tooling
2 parents 1864b2f + 3a83299 commit b09d5a0

File tree

10 files changed

+676
-557
lines changed

10 files changed

+676
-557
lines changed

.github/workflows/deploy.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Deploy
2+
3+
on:
4+
push:
5+
paths:
6+
- rockspecs/*.rockspec
7+
8+
jobs:
9+
10+
affected:
11+
runs-on: ubuntu-20.04
12+
outputs:
13+
rockspecs: '["${{ steps.changed-files.outputs.all_modified_files }}"]'
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
19+
- id: changed-files
20+
uses: tj-actions/changed-files@v17
21+
with:
22+
files: rockspecs/*.rockspec
23+
separator: '", "'
24+
25+
build:
26+
needs: affected
27+
if: ${{ needs.affected.outputs.rockspecs }}
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
# Upstream Issue: https://github.com/leafo/gh-actions-luarocks/issues/8
32+
luaVersion: ["5.4", "5.3", "5.2", "5.1"] #, "luajit", "luajit-openresty"]
33+
# Upstream Issue: https://github.com/leafo/gh-actions-luarocks/issues/8
34+
luarocksVersion: ["3.1.3"] # , "2.4.2"]
35+
rockspec: ${{ fromJSON(needs.affected.outputs.rockspecs) }}
36+
runs-on: ubuntu-20.04
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v3
40+
- name: Setup ‘lua’
41+
uses: leafo/gh-actions-lua@v8
42+
with:
43+
luaVersion: ${{ matrix.luaVersion }}
44+
- name: Setup ‘luarocks’
45+
uses: leafo/gh-actions-luarocks@v4
46+
with:
47+
luarocksVersion: ${{ matrix.luarocksVersion }}
48+
- name: Confirm rockspec builds
49+
run: |
50+
luarocks --lua-version ${{ matrix.luaVersion }} --local build -- ${{ matrix.rockspec }}
51+
52+
upload:
53+
needs: [affected, build]
54+
if: ${{ needs.affected.outputs.rockspecs && github.ref == 'refs/heads/master' && github.repository == 'alerque/fluent-lua' }}
55+
strategy:
56+
fail-fast: false
57+
matrix:
58+
rockspec: ${{ fromJSON(needs.affected.outputs.rockspecs) }}
59+
runs-on: ubuntu-20.04
60+
steps:
61+
- name: Checkout
62+
uses: actions/checkout@v3
63+
- name: Setup ‘lua’
64+
uses: leafo/gh-actions-lua@v8
65+
- name: Setup ‘luarocks’
66+
uses: leafo/gh-actions-luarocks@v4
67+
- name: Setup dependencies
68+
run: |
69+
luarocks install dkjson
70+
- run: |
71+
luarocks upload --force --api-key ${{ secrets.LUAROCKS_APIKEY }} -- ${{ matrix.rockspec }}

CHANGELOG.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org) for commit guidelines.
4+
5+
## v0.0.5
6+
7+
Cut a safe-haven release for anybody (including myself) using this in production before I move on.
8+
Looking at Git history it looks like refinements include improved PEG grammars, saner namespacing for easier project integration, better use of Penlight classing, and more advanced handling of terms.
9+
Dependencies now include cldr-lua, and tests now use CLDR compatible locales.
10+
Lua 5.4 support was also officially added.
11+
12+
## v0.0.4
13+
14+
Add support for attributes plus access to messages using idiomatic Lua (table properties).
15+
16+
## v0.0.3
17+
18+
Add support for more types including format support for TextElement, StringLiteral, NumberLiteral, and VariableReference. Variable substitutions can be done by passing a parameters table to `format()`. Internally manipulating nodes in the API is now easier with meta methods. For example merge comments with `Comment + Comment`, attach children with `Message * Comment`, etc.
19+
20+
## v0.0.2
21+
22+
Massage the AST returned by the PEG grammar so that about 1/3 of the possible types look like the reference Fluent spec. A basic Lua API is starting to take shape, modeled most closely to the Python implementation. It is possible to load and parse almost any FTL file, and possible to format any messages that are plain strings (no parameters, attributes, functions, or other jazz yet). Note there is no locale handling yet so it's only usable with separate instances per locale. Also `add_messages()` likely only works once, so cram your whole FTL resource in there for now.
23+
24+
## v0.0.1
25+
26+
Complete a PEG grammar based parser for the entire 1.0 Fluent file format spec. All the pieces are there, but it's only partially tested. It at least parses a few basic types of entries. The AST it returns is straight out of *luaebnf* and probably needs massaging to match the reference ones (via capture groups?), then it needs testing against the upstream fixtures.
27+
28+
## v0.0.0
29+
30+
Initialize project with some boiler plate Lua apparatus.
31+
32+
<!-- generated by git-cliff -->

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 Caleb Maclennan
3+
Copyright (c) 2019-2022 Caleb Maclennan
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Makefile

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ MAKEFLAGS += -j$(JOBS) -Otarget
1616
VERSION != git describe --tags --all --abbrev=7 | sed 's/-/-r/'
1717
SEMVER != git describe --tags | sed 's/^v//;s/-.*//'
1818
ROCKREV = 0
19-
TAG = v$(SEMVER)
19+
TAG ?= v$(SEMVER)
2020

2121
LUAROCKS_ARGS ?= --local --tree lua_modules
2222

@@ -51,6 +51,12 @@ rockspecs/$(PACKAGE)-%-0.rockspec: SEMVER = $*
5151
rockspecs/$(PACKAGE)-%-0.rockspec: TAG = v$*
5252
rockspecs/$(PACKAGE)-%-0.rockspec: $(PACKAGE).rockspec.in
5353
$(rockpec_template)
54+
sed -i \
55+
-e '/rockspec-format/s/3.0/1.0/' \
56+
-e '/url = "git/a\ dir = "fluent.lua",' \
57+
-e '/issues_url/d' \
58+
-e '/maintainer/d' \
59+
$@
5460

5561
$(PACKAGE)-dev-0.src.rock: $(SCM_ROCK)
5662
luarocks $(LUAROCKS_ARGS) pack $<
@@ -66,6 +72,9 @@ check:
6672
test:
6773
busted
6874

75+
CHANGELOG.md:
76+
git-cliff -p $@ -u $(if $(TAG),-t $(TAG))
77+
6978
.PHONY: force
7079
force:;
7180

README.md

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -29,32 +29,9 @@ It is possible to use this for simple string localization with basic parameter s
2929
- [ ] Localize number formatting
3030
- [ ] Functions
3131

32-
### 0.0.5
32+
## Changelog
3333

34-
Cut a safe-haven release for anybody (including myself) using this in production before I move on.
35-
Looking at Git history it looks like refinements include improved PEG grammars, saner namespacing for easier project integration, better use of Penlight classing, and more advanced handling of terms.
36-
Dependencies now include cldr-lua, and tests now use CLDR compatible locales.
37-
Lua 5.4 support was also officially added.
38-
39-
### 0.0.4
40-
41-
Add support for attributes plus access to messages using idiomatic Lua (table properties).
42-
43-
### 0.0.3
44-
45-
Added support for more types including format support for TextElement, StringLiteral, NumberLiteral, and VariableReference. Variable sutstitions can be done by passing a parameters table to `format()`. Internally manipulating nodes in the API is now easier with meta methods. For example merge comments with `Comment + Comment`, attach childred with `Message * Comment`, etc.
46-
47-
### 0.0.2
48-
49-
Massaged the AST returned by the PEG grammar so that about 1/3 of the possible types look like the reference Fluent spec. A basic Lua API is starting to take shape, modeled most closely to the Python implementation. It is possible to load and parse almost any FTL file, and possible to format any messages that are plain strings (no parameters, attributes, functions, or other jazz yet). Note there is no locale handling yet so it's only usable with separate instances per locale. Also `add_messages()` likely only works once, so cram your whole FTL resource in there for now.
50-
51-
### 0.0.1
52-
53-
Completed a PEG grammar based parser for the entire 1.0 Fluent file format spec. All the pieces are there, but it's only partially tested. It at least parses a few basic types of entries. The AST it returns is straight out of *luaebnf* and probably needs massaging to match the reference ones (via capture groups?), then it needs testing against the upstream fixtures.
54-
55-
### 0.0.0
56-
57-
Initialized project with some boiler plate Lua aparatus.
34+
Please see [CHANGELOG.md](./CHANGELOG.md).
5835

5936
## Usage
6037

cliff.toml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
[changelog]
2+
header = """
3+
# Changelog
4+
5+
All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org) for commit guidelines.\n
6+
"""
7+
body = """
8+
{% if version %}\
9+
## [{{ version }}](https://github.com/alerque/fluent-lua/releases/{{ version }}) — {{ timestamp | date(format="%Y-%m-%d") }}
10+
{% else %}\
11+
## [unreleased]
12+
{% endif %}\
13+
{% for group, commits in commits | group_by(attribute="group") %}
14+
### {{ group }}
15+
{% for commit in commits %}
16+
- {% if commit.breaking %}[**breaking**] {% endif %}{{ commit.message | upper_first }}\
17+
{% endfor %}
18+
{% endfor %}\n
19+
"""
20+
footer = """
21+
<!-- generated by git-cliff -->
22+
"""
23+
24+
[git]
25+
commit_parsers = [
26+
{ message = "^feat:", group = "Features" },
27+
{ message = "^fix:", group = "Bug Fixes" },
28+
{ message = "^docs:", skip = true },
29+
{ message = "^perf:", group = "Optimizations" },
30+
{ message = "^refactor:", skip = true },
31+
{ message = "^style:", skip = true},
32+
{ message = "^test:", skip = true},
33+
{ message = "^ci:", skip = true },
34+
{ message = "^chore:", skip = true },
35+
{ body = ".*security", group = "Security" },
36+
]
37+
filter_commits = true
38+
tag_pattern = "v[0-9]*.[0-9]*.[0-9]*"
39+
skip_tags = "v0.0.[0-5]"

fluent.rockspec.in

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ source = {
99

1010
description = {
1111
summary = "Lua implementation of Project Fluent",
12-
detailed = [[
13-
A Lua port of Project Fluent, a localization paradigm designed to unleash
14-
the entire expressive power of natural language translations.
15-
]],
12+
detailed = [[A Lua port of Project Fluent, a localization paradigm designed to unleash
13+
the entire expressive power of natural language translations.]],
1614
license = "MIT",
1715
homepage = "https://github.com/alerque/fluent-lua",
1816
issues_url = "https://github.com/alerque/fluent-lua/issues",
@@ -21,7 +19,7 @@ description = {
2119
}
2220

2321
dependencies = {
24-
"lua",
22+
"lua >= 5.1",
2523
"cldr",
2624
"luaepnf",
2725
"penlight"

0 commit comments

Comments
 (0)