Commit 2287c063 authored by Dario Pinto's avatar Dario Pinto
Browse files

remove Authors' Homepage, review and fix articles

parent 85e15654
......@@ -219,9 +219,6 @@ let links_to_home_pages =
<h5>
<a href="/blog">Home!</a>
</h5>
<h5>
<a href="/blog/authors">All authors here!</a>
</h5>
<h5>
<a href="/blog/category">All categories here!</a>
</h5>
......@@ -298,8 +295,10 @@ let specific_article_header title authors (year, month, day) category tags =
Tags: %a
</div>
</div>
<br />
<hr class="featurette-divider"/>
|}
<br />
|}
title
(Format.pp_print_list
~pp_sep:(fun fmt () -> Format.fprintf fmt ", ")
......@@ -361,23 +360,6 @@ let category_home =
"article" ) ) )
categories_count
(** [authors_home] This is the home page of all available authors on the Blog,
along with number of articles for a given author *)
let authors_home =
Format.asprintf {|<h1 id="page-title">Blog Authors</h1>%s%a@.|}
links_to_home_pages
(Format.pp_print_list
~pp_sep:(fun fmt () -> Format.fprintf fmt "<br /> ")
(fun fmt (author, count) ->
Format.fprintf fmt
{|<h3><a href="/blog/authors/%s">%s</a> (%d %s)</h3>|}
(normalize_url author) author count
( if count > 1 then
"articles"
else
"article" ) ) )
authors_count
(** [home_page] this is the home page for the blog, articles appear as excerpts
from most recent to oldest *)
let home_page =
......
......@@ -7,6 +7,10 @@ body {
font-size: 18px;
}
p img {
max-width: 45em;
}
.quote blockquote {
background-color: #ECDDCE;
}
......
......@@ -22,21 +22,18 @@ The Makefile has two targets:
If your install directories are not the default ones, you should modify the Makefile. After installing, you can test it with the standard OCaml top-level:
```
\# ocaml <br>
Objective Caml version 3.11.2
`Objective Caml version 3.11.2`
\# let s = ref “”;; <br>
```Ocaml
# let s = ref “”;;
val s : string ref = {contents = “”}
\# s := String.create 20_000_000;; <br>
# s := String.create 20_000_000;;
– : unit = ()
```
Now you can enjoy big values in all your strings and arrays in bytecode. You will need to relink all your custom binaries. If you are interested in the native version of the longval compiler, you can [contact](mailto:contact@ocamlpro.com) us.
......@@ -10,7 +10,7 @@ has helped bring together much of the open-source code in the OCaml community
under a single umbrella, making it easier to discover, depend on, and maintain
OCaml applications and libraries. We have seen steady growth in the number
of new packages, updates to existing code, and a diverse group of contributors.
<img src="img/graph_opam1.2_packages.png"/>
<img src="assets/img/graph_opam1.2_packages.png"/>
OPAM has turned out to be more than just another package manager. It is also
increasingly central to the demanding workflow of industrial OCaml development,
......@@ -107,7 +107,7 @@ can initialize a fresh, modern version of OCaml on older systems without needing
to be packaged there.
On CentOS 6 for example:
```
```shell-session
cd /etc/yum.repos.d/
wget http://download.opensuse.org/repositories/home:ocaml/CentOS_6/home:ocaml.repo
yum install opam
......@@ -131,7 +131,7 @@ In particular, a clear and meaningful explanation is extracted from the solver
whenever you are attempting an impossible action (unavailable package,
conflicts, etc.):
```
```shell-session
$ opam install mirage-www=0.3.0
The following dependencies couldn't be met:
- mirage-www -> cstruct < 0.6.0
......@@ -156,35 +156,35 @@ manual page for the below features.
* More expressive queries based on dependencies.
```
$ opam list --depends-on cow --rec
# Available packages recursively depending on cow.0.10.0 for 4.01.0:
cowabloga 0.0.7 Simple static blogging support.
iocaml 0.4.4 A webserver for iocaml-kernel and iocamljs-kernel.
mirage-www 1.2.0 Mirage website (written in Mirage)
opam2web 1.3.1 (pinned) A tool to generate a website from an OPAM repository
opium 0.9.1 Sinatra like web toolkit based on Async + Cohttp
stone 0.3.2 Simple static website generator, useful for a portfolio or documentation pages
```
```shell-session
$ opam list --depends-on cow --rec
# Available packages recursively depending on cow.0.10.0 for 4.01.0:
cowabloga 0.0.7 Simple static blogging support.
iocaml 0.4.4 A webserver for iocaml-kernel and iocamljs-kernel.
mirage-www 1.2.0 Mirage website (written in Mirage)
opam2web 1.3.1 (pinned) A tool to generate a website from an OPAM repository
opium 0.9.1 Sinatra like web toolkit based on Async + Cohttp
stone 0.3.2 Simple static website generator, useful for a portfolio or documentation pages
```
* Check on existing `opam` files to base new packages from.
```
$ opam show cow --raw
opam-version: "1"
name: "cow"
version: "0.10.0"
[...]
```
```shell-session
$ opam show cow --raw
opam-version: "1"
name: "cow"
version: "0.10.0"
[...]
```
* Clone the source code for any OPAM package to modify or browse the interfaces.
```
$ opam source cow
Downloading archive of cow.0.10.0...
[...]
$ cd cow.0.10.0
```
```shell-session
$ opam source cow
Downloading archive of cow.0.10.0...
[...]
$ cd cow.0.10.0
```
We've also improved the general speed of the tool to cope with the much bigger
size of the central repository, which will be of importance for people building
......@@ -197,7 +197,7 @@ newer releases of OPAM directly from OPAM if you choose so.
Packaging new libraries has been made as straight-forward as possible.
Here is a quick overview, you may also want to check the [OPAM 1.2 pinning][opam-1-2-pin] post.
```
```shell-session
opam pin add <name> <sourcedir>
```
......@@ -214,7 +214,7 @@ The package description format has also been extended with some new fields:
Packagers can limit dependencies in scope by adding one
of the keywords `build`, `test` or `doc` in front of their constraints:
```
```shell-session
depends: [
"ocamlfind" {build & >= 1.4.0}
"ounit" {test}
......@@ -232,13 +232,13 @@ constraints from the `depopts:` field: their meaning was [unclear][opam200] and
The `conflicts` field is used to indicate versions of the optional dependencies
that are incompatible with your package to remove all ambiguity:
```
```shell-session
depopts: [ "async" {>= "109.15.00"} & "async_ssl" {>= "111.06.00"} ]
```
becomes:
```
```shell-session
depopts: [ "async" "async_ssl" ]
conflicts: [ "async" {< "109.15.00"}
"async_ssl" {< "111.06.00"} ]
......
......@@ -4,7 +4,7 @@ date=2014-08-19
category=Tooling
tags=opam
<img src="img/picture_camel-pin.jpg"></img>
<img src="assets/img/picture_camel_pin.jpg"></img>
Most package managers support some _pin_ functionality to ensure that a given
package remains at a particular version without being upgraded.
......@@ -78,7 +78,7 @@ looking up the documentation, it also helps getting consistent package
definitions, reduces errors, and promotes filling in optional but recommended
fields (homepage, etc.).
```
```shell-session
opam-version: "1.2"
name: "ocp-reloc"
version: "0.1"
......@@ -110,7 +110,7 @@ Errors in /home/lg/.opam/4.01.0/overlay/ocp-reloc/opam, retry editing ? [Y/n]
You probably want to try your brand new package right away, so
OPAM's default action is to try and install it (unless you specified `-n`):
```
```shell-session
ocp-reloc needs to be installed.
The following actions will be performed:
- install cmdliner.0.9.5 [required by ocp-reloc]
......@@ -141,7 +141,7 @@ project even if you're not releasing anything yet. OPAM takes care of this
by prompting you to save the `opam` file back to your source tree, where
you can commit it directly into your code repository.
```
```shell-session
cd ocp-reloc
git add opam
git commit -m 'Add OPAM metadata'
......@@ -160,7 +160,7 @@ If another developer wants to pick up `ocp-reloc`, they can directly use
your existing metadata by cloning a copy of your repository and issuing their
own pin.
```
```shell-session
git clone git://github.com/OCamlPro/ocp-reloc.git
opam pin add ocp-reloc/
```
......@@ -177,7 +177,7 @@ functionality is also of great help in handling existing packages, whether you
need to quickly hack into them or are just curious. Let's consider how to
modify the [`omd` Markdown library][omd-www].
```
```shell-session
opam source omd --pin
cd omd.0.9.7
...patch...
......
......@@ -16,7 +16,7 @@ As explained in the [previous post][pin], adding an `opam` file at the
root of your project now lets you pin development versions of your
project directly. It's very easy to create a default template with OPAM 1.2:
```
```shell-session
$ opam pin add <my-project-name> . --edit
[... follow the instructions ...]
```
......@@ -30,7 +30,7 @@ If you want to run tests, you can also mark test-only dependencies with the
`{test}` constraint, and add a `build-test` field. For instance, if you use
`oasis` and `ounit`, you can use something like:
```
```shell-session
build: [
["./configure" "--prefix=%{prefix}%" "--%{ounit:enable}%-tests"]
[make]
......@@ -52,11 +52,6 @@ environment variable in your local setup.
## Installing the Travis CI scripts
<img style="float:right; padding: 5px"
src="https://travis-ci.com/img/travis-mascot-200px.png"
width="200px">
</img>
[Travis CI][travis] is a free service that enables continuous testing on your
GitHub projects. It uses Ubuntu containers and runs the tests for at most 50
minutes per test run.
......@@ -73,7 +68,7 @@ To use Travis CI with your OCaml project, you can follow the instructions on
test (supported values for `<VERSION>` are `3.12`, `4.00`,
`4.01` and `4.02`) add the line:
```
```shell-session
env:
- OCAML_VERSION=<VERSION>
```
......@@ -96,7 +91,7 @@ instance, to test `cohttp` first with `lwt`, then with `async` and
finally with both `lwt` and `async` (but only on the `4.01` compiler)
you should write:
```
```shell-session
env:
- OCAML_VERSION=latest DEPOPTS=lwt
- OCAML_VERSION=latest DEPOPTS=async
......
......@@ -295,7 +295,7 @@ The repository format is changed by the addition of:
Here is an example:
```
```shell-session
repository root /
|--packages/
| |--pkgname/
......@@ -330,7 +330,8 @@ previously-defined keys, and `algo` may be "rsa" and keys encoded in PEM format,
with further options available later.
For example, the `keys/root` file will have the format:
```
```shell-session
date=2015-06-04T13:53:00Z
root-keys: [ [ "keyid" "{expire-date}" "algo" "key" ] ]
snapshot-keys: [ [ "keyid" "algo" "key" ] ]
......@@ -347,7 +348,7 @@ Date is in the ISO 8601 standard with 0 UTC offset, as suggested in TUF.
`/packages/pkgname/delegation` delegates ownership on versions of package
`pkgname`. The file contains version constraints associated with keyids, _e.g._:
```
```shell-session
name: pkgname
delegates: [
"thomas@gazagnaire.org"
......@@ -383,7 +384,7 @@ together with their file sizes in bytes and one or more hashes, prefixed by thei
kind, and a field `archive:` containing the same details for the upstream
archive. For example:
```
```shell-session
name: pkgname
version: pkgversion
package-files: [
......
......@@ -87,11 +87,15 @@ and package formats are not compatible. Indeed, the move of the compilers to
standard packages implies some conversions, and updates to the relationships
between packages and their compiler. For example, package constraints like
available: [ ocaml-version >= "4.02" ]
```shell-session
available: [ ocaml-version >= "4.02" ]
```
are now written as normal package dependencies:
depends: [ "ocaml" {>= "4.02"} ]
```shell-session
depends: [ "ocaml" {>= "4.02"} ]
```
To make the transition easier,
- upgrade of a custom repository is simply a matter of running `opam-admin
......@@ -138,12 +142,16 @@ Packages for opam 2.0 are already in the opam repository, so if you have a
working opam installation of opam (at least 1.2.1), you can bootstrap as easily
as:
opam install opam-devel
```shell-session
opam install opam-devel
```
This doesn't install the new opam to your PATH within the current opam root for
obvious reasons, so you can manually install it as e.g. "opam2" using:
sudo cp $(opam config var "opam-devel:lib")/opam /usr/local/bin/opam2
```shell-session
sudo cp $(opam config var "opam-devel:lib")/opam /usr/local/bin/opam2
```
You can otherwise install as usual:
- Using pre-built binaries (available for OSX and Linux x86, x86_64, armhf) and
......
......@@ -13,7 +13,7 @@ tags=opam
We are pleased to announce that the beta release of opam 2.0 is now live! You
can try it already, bootstrapping from a working 1.2 opam installation, with:
```
```shell-session
opam update; opam install opam-devel
```
......@@ -63,7 +63,7 @@ Some users have been using the alpha for the past months without problems, but
you may want to keep your opam 1.2 installation intact until the release is out.
An easy way to do this is with an alias:
```
```shell-session
alias opam2="OPAMROOT=~/.opam2 path/to/opam-2-binary"
```
......
......@@ -39,7 +39,7 @@ chains for your package.
If building the project directly is preferred, adding `--deps-only` is a good
way to get the dependencies ready for the project:
```
```shell-session
opam build --deps-only
eval $(opam config env)
./configure; make; etc.
......@@ -59,7 +59,7 @@ The installation of the packages happens as usual to the prefix corresponding to
the switch used (`<project-root>/_opam/` for a local switch). But it is
possible, with `--install-prefix`, to further install the package to the system:
```
```shell-session
opam build --install-prefix ~/local
```
......@@ -75,7 +75,7 @@ programs, assuming they are relocatable, and not for libraries.
The user can pre-select the repositories to use on the creation of the local
switch with:
```
```shell-session
opam build --repositories <repos>
```
......
......@@ -25,7 +25,6 @@ sort them or associate them with a given project.
> You can also select a specific switch for a single command, with
>
> opam install foo --switch other
>
> or even for a single shell session, with
>
> eval $(opam env --switch other)
......@@ -48,8 +47,10 @@ env)` to make the environment up-to-date before running `make`.
The interface simply overloads the `switch-name` arguments, wherever they were
present, allowing directory names instead. So for example:
cd ~/src/project
opam switch create ./
```shell-session
cd ~/src/project
opam switch create ./
```
will create a local switch in the directory `~/src/project`. Then, it is for
example equivalent to run `opam list` from that directory, or `opam list
......
......@@ -20,13 +20,17 @@ Consistently with what was done with local switches, it was decided, where meani
For example, the following command is now allowed, and I believe it will be extra convenient to many:
opam install . --deps-only
```shell-session
opam install . --deps-only
```
What this does is find `opam` (or `<pkgname>.opam`) files in the current directory (`.`), resolve their installations, and install all required packages. That should be the single step before running the source build by hand.
The following is a little bit more complex:
opam install .
```shell-session
opam install .
```
This also retrieves the packages defined at `.`, __pins them__ to the current source (using version-control if present), and installs them. Note that subsequent runs actually synchronise the pinnings, so that packages removed or renamed in the source tree are tracked properly (_i.e._ removed ones are unpinned, new ones pinned, the other ones upgraded as necessary).
......@@ -40,7 +44,9 @@ This all, of course, works well with a local switch at `./`, but the two feature
This relies on installed files tracking, but was actually independent from the other `opam build` features. It is now simply a new option to `opam install`:
opam install foo --destdir ~/local/
```shell-session
opam install foo --destdir ~/local/
```
will install `foo` normally (if it isn't installed already) and copy all its installed files, following the same hierarchy, into `~/local`. `opam remove --destdir` is also supported, to remove these files.
......
......@@ -11,10 +11,12 @@ This blog will cover yet another aspect of the improvements opam 2.0 has over op
Opam 1.2 already has an advanced way of specifying package dependencies, using formulas on packages and versions, with the following syntax:
```shell-session
depends: [
"foo" {>= "3.0" & < "4.0~"}
( "bar" | "baz" {>= "1.0"} )
]
```
meaning that the package being defined depends on both package `foo`, within the `3.x` series, and one of `bar` or `baz`, the latter with version at least `1.0`. See [here](https://opam.ocaml.org/doc/Manual.html#PackageFormulas) for a complete documentation.
......@@ -35,15 +37,19 @@ Note also that, since the compilers are now packages, the required OCaml version
This makes it trivial to add, for example, a condition on the OS to a given dependency, using the built-in variable `os`:
depends: [ "foo" {>= "3.0" & < "4.0~" & os = "linux"} ]
```shell-session
depends: [ "foo" {>= "3.0" & < "4.0~" & os = "linux"} ]
```
here, `foo` is simply not needed if the OS isn't Linux. We could also be more specific about other OSes using more complex formulas:
```shell-session
depends: [
"foo" { "1.0+linux" & os = "linux" |
"1.0+osx" & os = "darwin" }
"bar" { os != "osx" & os != "darwin" }
]
```
Meaning that Linux and OSX require `foo`, respectively versions `1.0+linux` and `1.0+osx`, while other systems require `bar`, any version.
......@@ -60,7 +66,7 @@ Use `opam config list` for a list of pre-defined variables. Note that the `with-
For example, the `datakit.0.9.0` package has:
```
```shell-session
depends: [
...
"datakit-server" {>= "0.9.0"}
......@@ -72,7 +78,7 @@ depends: [
When running `opam install datakit.0.9.0`, the `with-test` variable is set to `false`, and the `datakit-client`, `datakit-github` and `alcotest` dependencies are filtered out: they won't be required. With `opam install datakit.0.9.0 --with-test`, the `with-test` variable is true (for that package only, tests on packages not listed on the command-line are not enabled!). In this case, the dependencies resolve to:
```
```shell-session
depends: [
...
"datakit-server" {>= "0.9.0"}
......@@ -89,16 +95,21 @@ It is also possible to use variables, not only as conditions, but to compute the
This is useful, for example, to define a family of packages, which are released together with the same version number: instead of having to update the dependencies of each package to match the common version at each release, you can leverage the `version` package-variable to mean "that other package, at the same version as current package". For example, `foo-client` could have the following:
depends: [ "foo-core" {= version} ]
```shell-session
depends: [ "foo-core" {= version} ]
```
It is even possible to use variable interpolations within versions, _e.g._ specifying an os-specific version differently than above:
depends: [ "foo" {= "1.0+%{os}%"} ]
```shell-session
depends: [ "foo" {= "1.0+%{os}%"} ]
```
this will expand the `os` variable, resolving to `1.0+linux`, `1.0+darwin`, etc.
Getting back to our `datakit` example, we could leverage this and rewrite it to the more generic:
```
```shell-session
depends: [
...
"datakit-server" {>= version}
......@@ -111,7 +122,8 @@ depends: [
Since the `datakit-*` packages follow the same versioning, this avoids having to rewrite the opam file on every new version, with a risk of error each time.
As a side note, these variables are consistent with what is now used in the [`build:`](http://opam.ocaml.org/doc/2.0/Manual.html#opamfield-build) field, and the [`build-test:`](http://opam.ocaml.org/doc/2.0/Manual.html#opamfield-build-test) field is now deprecated. So this other part of the same `datakit` opam file:
```
```shell-session
build:
["ocaml" "pkg/pkg.ml" "build" "--pinned" "%{pinned}%" "--tests" "false"]
build-test: [
......@@ -120,7 +132,8 @@ build-test: [
]
```
would now be preferably written as:
```
```shell-session
build: ["ocaml" "pkg/pkg.ml" "build" "--pinned" "%{pinned}%" "--tests" "%{with-test}%"]
run-test: ["ocaml" "pkg/pkg.ml" "test"]
```
......
......@@ -23,7 +23,7 @@ command, if run from the source tree of a given project, creates a local switch
where it will restore a precise installation, including explicit versions of all
packages and pinnings:
```
```shell-session
opam switch create ./ --locked
```
......@@ -62,21 +62,21 @@ There are three main ways to get the update:
will also make backups if you migrate from 1.x, and has an option to revert
back:
```
sh <(curl -sL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh)
```
```shell-session
sh <(curl -sL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh)
```
This uses the binaries from https://github.com/ocaml/opam/releases/tag/2.0.0-beta5
This uses the binaries from https://github.com/ocaml/opam/releases/tag/2.0.0-beta5
2. Another option is to compile from source, using an existing opam
installation. Simply run:
```
opam update; opam install opam-devel
```
```shell-session
opam update; opam install opam-devel
```
and follow the instructions (you will need to copy the compiled binary to
your PATH).
and follow the instructions (you will need to copy the compiled binary to
your PATH).
3. Compiling by hand from the
[inclusive source archive](https://github.com/ocaml/opam/releases/download/2.0.0-beta5/opam-full-2.0.0-beta5.tar.gz),
......
......@@ -14,19 +14,19 @@ You are invited to read the [beta5 announcement](https://opam.ocaml.org/blog/opa
1. From binaries: run
```
sh <(curl -sL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh)
```
```shell-session
sh <(curl -sL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh)