From 79d04d1b370f36df1cd60a4c2b78eae8f31d9576 Mon Sep 17 00:00:00 2001 From: Anton Vakhrushev Date: Sat, 20 Jun 2020 12:39:31 +0300 Subject: [PATCH] Use package.yaml instead cabal file --- .gitignore | 1 + Dockerfile | 5 ----- Makefile | 21 ++++++++++++-------- haskell-cron-matcher.cabal | 39 -------------------------------------- package.yaml | 39 ++++++++++++++++++++++++++++++++++++++ stack.yaml | 4 ++-- stack.yaml.lock | 19 +++++++++++++++++++ 7 files changed, 74 insertions(+), 54 deletions(-) delete mode 100644 Dockerfile delete mode 100644 haskell-cron-matcher.cabal create mode 100644 package.yaml create mode 100644 stack.yaml.lock diff --git a/.gitignore b/.gitignore index 2bad1d1..f7b2e80 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .local/ .stack-work/ +*.cabal *.sublime-* diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 3a7ef1a..0000000 --- a/Dockerfile +++ /dev/null @@ -1,5 +0,0 @@ -FROM fpco/stack-build:lts-13.10 - -# Code formatter -# RUN stack --system-ghc --local-bin-path=/usr/local/bin install \ -# hfmt diff --git a/Makefile b/Makefile index 5d3c8ba..e9f81e9 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,4 @@ app_name := haskell-cron-matcher -image := ${app_name}-stack container_work_dir := /app cache_dir := ${container_work_dir}/.stack-work @@ -15,23 +14,29 @@ stack := docker run \ --volume "${PWD}:${container_work_dir}" \ --env "STACK_ROOT=${cache_dir}" \ --workdir "${container_work_dir}" \ - ${image} + fpco/stack-build:lts-15.16 + +hfmt := docker run \ + --rm \ + --tty \ + --init \ + --user "${uid}:${gid}" \ + --volume "${PWD}:${container_work_dir}" \ + --workdir "${container_work_dir}" \ + anwinged/hfmt:master # Targets -.PHONY: build-docker -build-docker: - docker build --tag=${image} . - ${stack} stack --system-ghc --local-bin-path=./.local install hindent hfmt - .PHONY: build build: + mkdir -p .stack-work ${stack} stack build .PHONY: test test: + mkdir -p .stack-work ${stack} stack test .PHONY: format format: - ${stack} .local/hfmt -w app/ src/ test/ + ${hfmt} -w app/ src/ test/ diff --git a/haskell-cron-matcher.cabal b/haskell-cron-matcher.cabal deleted file mode 100644 index d68f05d..0000000 --- a/haskell-cron-matcher.cabal +++ /dev/null @@ -1,39 +0,0 @@ -name: haskell-cron-matcher -version: 0.1.0.0 -license-file: LICENSE -build-type: Simple -extra-source-files: README.md -cabal-version: >=1.10 - -library - hs-source-dirs: src - exposed-modules: Pattern, Field, Constraint, Helper - build-depends: base >= 4.7 && < 5 - , dates == 0.2.2.2 - default-language: Haskell2010 - -executable haskell-cron-matcher-exe - hs-source-dirs: app - main-is: Main.hs - ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -Werror - build-depends: base - , dates == 0.2.2.2 - , haskell-cron-matcher - default-language: Haskell2010 - -test-suite haskell-cron-matcher-test - type: exitcode-stdio-1.0 - hs-source-dirs: test - main-is: Spec.hs - other-modules: PatternSpec, FieldSpec, ConstraintSpec, HelperSpec - build-depends: base - , dates == 0.2.2.2 - , hspec - , QuickCheck - , haskell-cron-matcher - ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -Werror - default-language: Haskell2010 - -source-repository head - type: git - location: https://github.com/anwinged/haskell-cron-matcher diff --git a/package.yaml b/package.yaml new file mode 100644 index 0000000..9c9f30b --- /dev/null +++ b/package.yaml @@ -0,0 +1,39 @@ +name: haskell-cron-matcher +version: 0.1.0.0 +license: MIT +license-file: LICENSE +stability: Experimental + +extra-source-files: + - LICENSE + - README.md + - stack.yaml + +ghc-options: -Wall + +dependencies: + - base >= 4.9 && < 5 + - dates + +library: + source-dirs: src + exposed-modules: + - Pattern + - Field + - Constraint + - Helper + +executable: + main: Main.hs + source-dirs: app + dependencies: + - haskell-cron-matcher + +tests: + pure: + main: Spec.hs + source-dirs: + - test + dependencies: + - haskell-cron-matcher + - hspec diff --git a/stack.yaml b/stack.yaml index 48d2823..64690e8 100644 --- a/stack.yaml +++ b/stack.yaml @@ -15,7 +15,7 @@ # resolver: # name: custom-snapshot # location: "./custom-snapshot.yaml" -resolver: lts-12.26 +resolver: lts-14.27 # User packages to be built. # Various formats can be used as shown in the example below. @@ -41,7 +41,7 @@ packages: # Dependency packages to be pulled from upstream that are not in the resolver # (e.g., acme-missiles-0.3) extra-deps: - - dates-0.2.2.2 + - dates-0.2.3.0 # Override default flag values for local packages and extra-deps flags: {} diff --git a/stack.yaml.lock b/stack.yaml.lock new file mode 100644 index 0000000..e90935b --- /dev/null +++ b/stack.yaml.lock @@ -0,0 +1,19 @@ +# This file was autogenerated by Stack. +# You should not edit this file by hand. +# For more information, please see the documentation at: +# https://docs.haskellstack.org/en/stable/lock_files + +packages: +- completed: + hackage: dates-0.2.3.0@sha256:915a2fc85ea818542851ed54a85abe6a042e7d78f470a5a6db032768f6c6415a,2179 + pantry-tree: + size: 443 + sha256: 010c2b73848cb519ea9677eaedd03bfcd7f32735000d870e6dc763b9be15e12c + original: + hackage: dates-0.2.3.0 +snapshots: +- completed: + size: 524996 + url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/14/27.yaml + sha256: 7ea31a280c56bf36ff591a7397cc384d0dff622e7f9e4225b47d8980f019a0f0 + original: lts-14.27