Skip to content

Commit a43623c

Browse files
authored
Merge pull request #6 from tmattio/master
Upstream v3.ocaml.org fork
2 parents 1422c16 + 637fdab commit a43623c

37 files changed

+846
-9441
lines changed

.github/workflows/ci.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build-and-test:
11+
strategy:
12+
fail-fast: false
13+
14+
matrix:
15+
os:
16+
- macos-latest
17+
- ubuntu-latest
18+
- windows-latest
19+
20+
ocaml-compiler:
21+
- 4.12.x
22+
23+
runs-on: ${{ matrix.os }}
24+
25+
steps:
26+
27+
- name: Checkout code
28+
uses: actions/checkout@v2
29+
30+
- name: Use OCaml ${{ matrix.ocaml-compiler }}
31+
uses: ocaml/setup-ocaml@v2
32+
with:
33+
ocaml-compiler: ${{ matrix.ocaml-compiler }}
34+
dune-cache: ${{ matrix.os != 'macos-latest' }}
35+
36+
- name: Install ocamlformat
37+
run: opam install ocamlformat.0.18.0
38+
if: ${{ matrix.os == 'ubuntu-latest' }}
39+
40+
- name: Install opam packages
41+
run: opam install . --with-test
42+
43+
- name: Check formatting
44+
run: make fmt
45+
if: ${{ matrix.os == 'ubuntu-latest' && always() }}
46+
47+
- name: Run build
48+
run: make build
49+
50+
- name: Run the unit tests
51+
run: make test
52+
timeout-minutes: 1

.gitignore

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
*.native
2-
_build
3-
*~
4-
*.swp
5-
setup.data
6-
setup.log
7-
index.html
1+
# Dune generated files
2+
_build/
3+
*.install
4+
5+
# Merlin configuring file for Vim and Emacs
6+
.merlin
7+
8+
# Local OPAM switch
9+
_opam/

.merlin

Lines changed: 0 additions & 10 deletions
This file was deleted.

.ocamlformat

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
version = 0.20.1
2+
profile = conventional
3+
parse-docstrings = true
4+
wrap-comments = true

LICENSE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1111
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1212
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1313
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14-

Makefile

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,43 @@
1-
# OASIS_START
2-
# DO NOT EDIT (digest: a3c674b4239234cbbe53afe090018954)
3-
4-
SETUP = ocaml setup.ml
5-
6-
build: setup.data
7-
$(SETUP) -build $(BUILDFLAGS)
8-
9-
doc: setup.data build
10-
$(SETUP) -doc $(DOCFLAGS)
11-
12-
test: setup.data build
13-
$(SETUP) -test $(TESTFLAGS)
1+
.DEFAULT_GOAL := all
142

3+
.PHONY: all
154
all:
16-
$(SETUP) -all $(ALLFLAGS)
5+
opam exec -- dune build --root . @install
176

18-
install: setup.data
19-
$(SETUP) -install $(INSTALLFLAGS)
7+
.PHONY: deps
8+
deps: ## Install development dependencies
9+
opam install -y dune-release ocamlformat utop ocaml-lsp-server
10+
opam install --deps-only --with-test --with-doc -y .
2011

21-
uninstall: setup.data
22-
$(SETUP) -uninstall $(UNINSTALLFLAGS)
12+
.PHONY: create_switch
13+
create_switch: ## Create an opam switch without any dependency
14+
opam switch create . --no-install -y
2315

24-
reinstall: setup.data
25-
$(SETUP) -reinstall $(REINSTALLFLAGS)
16+
.PHONY: switch
17+
switch: ## Create an opam switch and install development dependencies
18+
opam install . --deps-only --with-doc --with-test
19+
opam install -y dune-release ocamlformat utop ocaml-lsp-server
2620

27-
clean:
28-
$(SETUP) -clean $(CLEANFLAGS)
21+
.PHONY: build
22+
build: ## Build the project, including non installable libraries and executables
23+
opam exec -- dune build --root .
2924

30-
distclean:
31-
$(SETUP) -distclean $(DISTCLEANFLAGS)
25+
.PHONY: test
26+
test: ## Run the unit tests
27+
opam exec -- dune runtest --root .
3228

33-
setup.data:
34-
$(SETUP) -configure $(CONFIGUREFLAGS)
29+
.PHONY: clean
30+
clean: ## Clean build artifacts and other generated files
31+
opam exec -- dune clean --root .
3532

36-
configure:
37-
$(SETUP) -configure $(CONFIGUREFLAGS)
33+
.PHONY: doc
34+
doc: ## Generate odoc documentation
35+
opam exec -- dune build --root . @doc
3836

39-
.PHONY: build doc test all install uninstall reinstall clean distclean configure
37+
.PHONY: fmt
38+
fmt: ## Format the codebase with ocamlformat
39+
opam exec -- dune build --root . --auto-promote @fmt
4040

41-
# OASIS_STOP
41+
.PHONY: watch
42+
watch: ## Watch for the filesystem and rebuild on every change
43+
opam exec -- dune build --root . --watch

README.md

Lines changed: 54 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,58 @@
11
# River
22

3-
A library for aggregating RSS2 and Atom feeds in OCaml.
3+
[![Actions Status](https://github.com/tmattio/river/workflows/CI/badge.svg)](https://github.com/tmattio/river/actions)
44

5-
Features:
5+
RSS2 and Atom feed aggregator for OCaml
66

7-
* Performs deduplication.
8-
* Supports pagination and generating well-formed html prefix snippets.
9-
* Support for generating aggregate feeds.
10-
* Sorts the posts from most recent to oldest.
11-
* Depends on ocamlnet for html parsing.
7+
8+
## Features
9+
10+
- Performs deduplication.
11+
- Supports pagination and generating well-formed html prefix snippets.
12+
- Support for generating aggregate feeds.
13+
- Sorts the posts from most recent to oldest.
14+
- Depends on ocamlnet for html parsing.
15+
16+
## Installation
17+
18+
```bash
19+
opam install river
20+
```
21+
22+
## Usage
23+
24+
Here's an example program that aggregates the feeds from different sources:
25+
26+
```ocaml
27+
let sources =
28+
River.
29+
[
30+
{ name = "KC Sivaramakrishnan"; url = "http://kcsrk.info/atom-ocaml.xml" };
31+
{
32+
name = "Amir Chaudhry";
33+
url = "http://amirchaudhry.com/tags/ocamllabs-atom.xml";
34+
};
35+
]
36+
37+
let () =
38+
let feeds = List.map River.fetch sources in
39+
let posts = River.posts feeds in
40+
let entries = River.create_atom_entries posts in
41+
let feed =
42+
let authors = [ Syndic.Atom.author "OCaml Blog" ] in
43+
let id = Uri.of_string "https://ocaml.org/atom.xml" in
44+
let links = [ Syndic.Atom.link ~rel:Self id ] in
45+
let title : Syndic.Atom.text_construct =
46+
Text "OCaml Blog: Read the latest OCaml news from the community."
47+
in
48+
let updated = Ptime.of_float_s (Unix.gettimeofday ()) |> Option.get in
49+
Syndic.Atom.feed ~authors ~links ~id ~title ~updated entries
50+
in
51+
let out_channel = open_out "example/atom.xml" in
52+
Syndic.Atom.output feed (`Channel out_channel);
53+
close_out out_channel
54+
```
55+
56+
## Contributing
57+
58+
Take a look at our [Contributing Guide](CONTRIBUTING.md).

_oasis

Lines changed: 0 additions & 35 deletions
This file was deleted.

_tags

Lines changed: 0 additions & 44 deletions
This file was deleted.

configure

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)