Browse Source

Add the --version flag, update dependencies

tags/v0.2.0.0
Peter J. Jones 4 years ago
parent
commit
d3fb9cca5f
7 changed files with 25 additions and 90 deletions
  1. 1
    0
      .gitignore
  2. 2
    1
      TODO.org
  3. 0
    71
      default.nix
  4. 0
    13
      shell.nix
  5. 16
    2
      src/Vimeta/UI/CommandLine.hs
  6. 1
    1
      vendor/themoviedb
  7. 5
    2
      vimeta.cabal

+ 1
- 0
.gitignore View File

@@ -2,3 +2,4 @@
/.cabal-sandbox/
/.deps.mk
/cabal.sandbox.config
/default.nix

+ 2
- 1
TODO.org View File

@@ -1,6 +1,7 @@
* Milestone: Release 0.2.0.0
** TODO Add support for --version
** TODO Cache TMDB.Configuration
** DONE Add support for --version
CLOSED: [2015-07-21 Tue 21:00]
** DONE Search for FIXME and undefined and remove
CLOSED: [2015-05-20 Wed 16:30]
** DONE "a search term is required" shouldn't be used twice

+ 0
- 71
default.nix View File

@@ -1,71 +0,0 @@
{ stdenv, haskellPackages }:

let
env = haskellPackages.ghcWithPackages (p: with p; [
# Tools:
cabal-install
hlint

# Libraries:
aeson
ansi-terminal
base
binary
bytestring
colour
containers
either
exceptions
haskeline
http-client
http-client-tls
http-types
mtl
network
network-uri
old-locale
optparse-applicative
parsec
process
temporary
terminfo-hs
text
text-binary
time
time-locale-compat
transformers
unix
xdg-basedir
yaml
]);

in stdenv.mkDerivation rec {
name = "vimeta";
src = ./src;

buildInputs = [ env ];

buildPhase = ''
( HOME="$(mktemp -d)" # For cabal-install.
if [ ! -d .cabal-sandbox ]; then
cabal sandbox init
cabal sandbox add-source vendor/themoviedb
cabal sandbox add-source vendor/byline
cabal install --only-dependencies
fi

cabal configure -fmaintainer
cabal build || exit 1
) && hlint src
'';

installPhase = ''
'';

shellHook = ''
export NIX_GHC="${env}/bin/ghc"
export NIX_GHCPKG="${env}/bin/ghc-pkg"
export NIX_GHC_DOCDIR="${env}/share/doc/ghc/html"
export NIX_GHC_LIBDIR=$( $NIX_GHC --print-libdir )
'';
}

+ 0
- 13
shell.nix View File

@@ -1,13 +0,0 @@
{ pkgs ? (import <nixpkgs> {})
, ghc ? "7.8.4" # Allow overriding the GHC version.

# Logic to pick the correct version of haskellPackages:
, haskellPackages ? if ghc == "7.8.4"
then pkgs.haskell.packages.ghc784
else pkgs.haskell.packages.ghc7101
}:

(import ./default.nix) {
stdenv = pkgs.stdenv;
haskellPackages = haskellPackages;
}

+ 16
- 2
src/Vimeta/UI/CommandLine.hs View File

@@ -14,6 +14,7 @@ module Vimeta.UI.CommandLine (run) where

--------------------------------------------------------------------------------
import Data.Monoid
import Data.Version (showVersion)
import Options.Applicative
import System.Exit

@@ -22,6 +23,10 @@ import qualified Vimeta.UI.CommandLine.Config as Config
import qualified Vimeta.UI.CommandLine.Movie as Movie
import qualified Vimeta.UI.CommandLine.TV as TV

--------------------------------------------------------------------------------
-- Cabal generated source files:
import Paths_vimeta (version)

--------------------------------------------------------------------------------
-- The following is a kludge to avoid the "redundant import" warning
-- when using GHC >= 7.10.x. This should be removed after we decide
@@ -29,14 +34,22 @@ import qualified Vimeta.UI.CommandLine.TV as TV
import Prelude

--------------------------------------------------------------------------------
data Command = CmdConfig Config.Options
data Command = CmdVersion
| CmdConfig Config.Options
| CmdMovie Movie.Options
| CmdTV TV.Options

--------------------------------------------------------------------------------
optionsParser :: Parser Command
optionsParser = subparser $ mconcat [config, movie, tv]
optionsParser = verbose <|> commands
where
verbose =
flag' CmdVersion
(long "version" <> help "Print version and exit")

commands =
subparser $ mconcat [config, movie, tv]

config =
command "config"
(info (CmdConfig <$> Config.optionsParser) (progDesc configDesc))
@@ -64,6 +77,7 @@ run = do
options <- execParser $ info (optionsParser <**> helper) idm

case options of
CmdVersion -> putStrLn (showVersion version)
CmdConfig o -> Config.run o
CmdMovie o -> Movie.run o
CmdTV o -> TV.run o

+ 1
- 1
vendor/themoviedb

@@ -1 +1 @@
Subproject commit b7eb08ff75a1dfca5b90a4f57fde077e93d14435
Subproject commit 6b7bcc6996d40698d0be7b8bbaf812b1b1a24fda

+ 5
- 2
vimeta.cabal View File

@@ -58,6 +58,9 @@ library
Vimeta.UI.Term.Movie
Vimeta.UI.Term.TV

other-modules:
Paths_vimeta

hs-source-dirs: src
default-language: Haskell2010
ghc-options: -Wall -fwarn-incomplete-uni-patterns
@@ -66,13 +69,13 @@ library
if flag(maintainer)
ghc-options: -Werror

build-depends: aeson >= 0.8 && < 0.9
build-depends: aeson >= 0.8 && < 0.10
, base >= 4.6 && < 5.0
, byline >= 0.1 && < 0.3
, bytestring >= 0.10 && < 0.11
, containers >= 0.5 && < 0.6
, directory >= 1.2 && < 1.3
, either >= 4.3 && < 4.4
, either >= 4.3 && < 4.5
, filepath >= 1.3 && < 1.5
, http-client >= 0.4 && < 0.5
, http-client-tls >= 0.2.2 && < 0.3

Loading…
Cancel
Save