Skip to content

Commit

Permalink
Merge pull request #88 from anuragsoni/switch-to-opam-2
Browse files Browse the repository at this point in the history
Pre-requisite for a new release
  • Loading branch information
rgrinberg authored Nov 29, 2018
2 parents 5bcd276 + 86a2869 commit d7006c4
Show file tree
Hide file tree
Showing 16 changed files with 118 additions and 106 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,5 @@ examples/static_serve_override
examples/uppercase_middleware
lib_test/routes
*.merlin
*.install
*.install
_opam
37 changes: 27 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
language: c
sudo: false
install: wget https://raw.githubusercontent.com/ocaml/ocaml-ci-scripts/master/.travis-docker.sh
script: bash -ex .travis-docker.sh
services:
- docker
install: wget https://raw.githubusercontent.com/ocaml/ocaml-travisci-skeleton/master/.travis-docker.sh
script: bash -ex ./.travis-docker.sh
- docker
env:
global:
- EXTRA_REMOTES="https://github.com/mirage/mirage-dev.git"
- PINS="opium_kernel:. opium:."
matrix:
- PACKAGE="opium_kernel" DISTRO="ubuntu-16.04" OCAML_VERSION="4.04.2"
- PACKAGE="opium" DISTRO="ubuntu-16.04" OCAML_VERSION="4.04.2"
- PACKAGE="opium_kernel" DISTRO="alpine" OCAML_VERSION="4.03.0"
- PACKAGE="opium" DISTRO="alpine" OCAML_VERSION="4.03.0"
- PACKAGE="opium_kernel" DISTRO="debian-unstable" OCAML_VERSION="4.03.0"
- PACKAGE="opium" DISTRO="debian-unstable" OCAML_VERSION="4.03.0"
- PACKAGE="opium_kernel" DISTRO="ubuntu-18.04" OCAML_VERSION="4.04"
- PACKAGE="opium" DISTRO="ubuntu-18.04" OCAML_VERSION="4.04"
- PACKAGE="opium_kernel" DISTRO="ubuntu-18.04" OCAML_VERSION="4.05"
- PACKAGE="opium" DISTRO="ubuntu-18.04" OCAML_VERSION="4.05"
- PACKAGE="opium_kernel" DISTRO="ubuntu-18.04" OCAML_VERSION="4.06"
- PACKAGE="opium" DISTRO="ubuntu-18.04" OCAML_VERSION="4.06"
- PACKAGE="opium_kernel" DISTRO="ubuntu-18.04" OCAML_VERSION="4.07"
- PACKAGE="opium" DISTRO="ubuntu-18.04" OCAML_VERSION="4.07"
- PACKAGE="opium_kernel" DISTRO="ubuntu-16.04" OCAML_VERSION="4.04"
- PACKAGE="opium" DISTRO="ubuntu-16.04" OCAML_VERSION="4.04"
- PACKAGE="opium_kernel" DISTRO="ubuntu-16.04" OCAML_VERSION="4.05"
- PACKAGE="opium" DISTRO="ubuntu-16.04" OCAML_VERSION="4.05"
- PACKAGE="opium_kernel" DISTRO="ubuntu-16.04" OCAML_VERSION="4.06"
- PACKAGE="opium" DISTRO="ubuntu-16.04" OCAML_VERSION="4.06"
- PACKAGE="opium_kernel" DISTRO="ubuntu-16.04" OCAML_VERSION="4.07"
- PACKAGE="opium" DISTRO="ubuntu-16.04" OCAML_VERSION="4.07"
- PACKAGE="opium_kernel" DISTRO="alpine" OCAML_VERSION="4.04"
- PACKAGE="opium" DISTRO="alpine" OCAML_VERSION="4.04"
- PACKAGE="opium_kernel" DISTRO="alpine" OCAML_VERSION="4.05"
- PACKAGE="opium" DISTRO="alpine" OCAML_VERSION="4.05"
- PACKAGE="opium_kernel" DISTRO="alpine" OCAML_VERSION="4.06"
- PACKAGE="opium" DISTRO="alpine" OCAML_VERSION="4.06"
- PACKAGE="opium_kernel" DISTRO="alpine" OCAML_VERSION="4.07"
- PACKAGE="opium" DISTRO="alpine" OCAML_VERSION="4.07"
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
.DEFAULT_GOAL: all

JBUILDER ?= jbuilder
JBUILDER ?= dune

all:
@$(JBUILDER) build --dev @install @DEFAULT
@$(JBUILDER) build @install @DEFAULT

check:
@$(JBUILDER) runtest --dev
@$(JBUILDER) runtest

test: check

Expand All @@ -19,4 +19,4 @@ clean:
.PHONY: all clean check test

all-supported-ocaml-versions:
$(JBUILDER) runtest --dev --workspace jbuild-workspace.dev
$(JBUILDER) runtest --workspace dune-workspace.dev
2 changes: 2 additions & 0 deletions dune-project
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
(lang dune 1.5)
(name opium)
6 changes: 6 additions & 0 deletions dune-workspace.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(lang dune 1.5)

;; This file is used by `make all-supported-ocaml-versions`
(context (opam (switch 4.04.2)))
(context (opam (switch 4.05.0)))
(context (opam (switch 4.06.0)))
15 changes: 15 additions & 0 deletions examples/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
(executables
(libraries re ezjsonm opium)
(preprocess
(pps ppx_sexp_conv)
)
(flags
(:standard -safe-string)
)
(names auth_middleware exit_hook_example hello_world_basic hello_world_html hello_world middleware_ua read_json_body sample static_serve_override uppercase_middleware)
)

(alias
(name DEFAULT)
(deps auth_middleware.exe exit_hook_example.exe hello_world_basic.exe hello_world_html.exe hello_world.exe middleware_ua.exe read_json_body.exe sample.exe static_serve_override.exe uppercase_middleware.exe)
)
31 changes: 0 additions & 31 deletions examples/jbuild

This file was deleted.

8 changes: 8 additions & 0 deletions lib_test/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(test
(name routes)
(libraries alcotest opium)
(package opium)
(flags
(:standard -safe-string)
)
)
12 changes: 0 additions & 12 deletions lib_test/jbuild

This file was deleted.

29 changes: 18 additions & 11 deletions opium.opam
Original file line number Diff line number Diff line change
@@ -1,33 +1,40 @@
opam-version: "1.2"
opam-version: "2.0"
maintainer: "[email protected]"
authors: ["Rudi Grinberg"]
license: "MIT"

homepage: "https://github.com/rgrinberg/opium"
bug-reports: "https://github.com/rgrinberg/opium/issues"
dev-repo: "https://github.com/rgrinberg/opium.git"
dev-repo: "git+https://github.com/rgrinberg/opium.git"
synopsis: "Sinatra like web toolkit based on Lwt + Cohttp"
description: """
Opium is a minimalistic library for quickly binding functions to http routes. Its features include (but not limited to):

Middleware system for app independent components
A simple router for matching urls and parsing parameters
Request/Response pretty printing for easier debugging
"""

build: [
["jbuilder" "subst" "-n" name] {pinned}
["jbuilder" "build" "-p" name "-j" jobs]
["dune" "subst"] {pinned}
["dune" "build" "-p" name "-j" jobs]
["dune" "runtest" "-p" name "-j" jobs] {with-test}
]
build-test: [["jbuilder" "runtest" "-p" name "-j" jobs]]

depends: [
"jbuilder" {build}
"ocaml" {>= "4.04.1"}
"dune" {build}
"opium_kernel"
"cohttp-lwt-unix" {>= "0.99.0"}
"base-unix"
"lwt"
"lwt_log"
"logs"
"cmdliner"
"ppx_fields_conv" {>= "v0.9.0"}
"ppx_sexp_conv" {>= "v0.9.0"}
"re" {>= "1.3.0"}
"magic-mime"
"stringext"
"alcotest" {test}
"cow" {test & >= "0.10.0"}
"alcotest" {with-test}
"cow" {with-test & >= "0.10.0"}
]

available: [ocaml-version >= "4.02.3"]
4 changes: 3 additions & 1 deletion opium/debug.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ open Opium_kernel.Rock

let exn_ e = Logs.err (fun f -> f "%s" (Printexc.to_string e))

let log_src = Logs.Src.create "opium.server"

let format_error req _exn = Printf.sprintf "
<html>
<body>
Expand All @@ -24,6 +26,6 @@ let trace =
let filter handler req =
handler req >|= fun response ->
let code = response |> Response.code |> Cohttp.Code.code_of_status in
Lwt_log.ign_debug_f "Responded with %d" code;
Logs.debug ~src:log_src (fun m -> m "Responded with %d" code);
response
in Middleware.create ~name:"Trace" ~filter
10 changes: 10 additions & 0 deletions opium/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
(library
(public_name opium)
(flags
(:standard -safe-string)
)
(preprocess
(pps ppx_sexp_conv ppx_fields_conv)
)
(libraries opium_kernel cmdliner cohttp-lwt-unix magic-mime logs stringext)
)
15 changes: 0 additions & 15 deletions opium/jbuild

This file was deleted.

23 changes: 13 additions & 10 deletions opium_kernel.opam
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
opam-version: "1.2"
opam-version: "2.0"
maintainer: "[email protected]"
authors: ["Rudi Grinberg"]
license: "MIT"

homepage: "https://github.com/rgrinberg/opium"
bug-reports: "https://github.com/rgrinberg/opium/issues"
dev-repo: "https://github.com/rgrinberg/opium.git"
dev-repo: "git+https://github.com/rgrinberg/opium.git"
synopsis: "Sinatra like web toolkit based on Lwt + Cohttp"
description: """
Opium_kernel is the Unix indpendent core of Opium. Useful for extremely portable environments such as mirage.
"""

build: [
["jbuilder" "subst" "-n" name] {pinned}
["jbuilder" "build" "-p" name "-j" jobs]
["dune" "subst"] {pinned}
["dune" "build" "-p" name "-j" jobs]
["dune" "runtest" "-p" name "-j" jobs] {with-test}
]
build-test: [["jbuilder" "runtest" "-p" name "-j" jobs]]

depends: [
"jbuilder" {build}
"ocaml" {>= "4.04.1"}
"dune" {build}
"hmap"
"cohttp" {>= "0.99.0"}
"cohttp-lwt" {>= "0.99.0"}
Expand All @@ -26,8 +31,6 @@ depends: [
"ppx_fields_conv" {>= "v0.9.0"}
"ppx_sexp_conv" {>= "v0.9.0"}
"re" {>= "1.3.0"}
"alcotest" {test}
"cow" {test & >= "0.10.0"}
"alcotest" {with-test}
"cow" {with-test & >= "0.10.0"}
]

available: [ocaml-version >= "4.02.3"]
10 changes: 10 additions & 0 deletions opium_kernel/dune
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
(library
(public_name opium_kernel)
(flags
(:standard -safe-string)
)
(preprocess
(pps ppx_sexp_conv ppx_fields_conv)
)
(libraries hmap cohttp-lwt ezjsonm)
)
11 changes: 0 additions & 11 deletions opium_kernel/jbuild

This file was deleted.

0 comments on commit d7006c4

Please sign in to comment.