aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.travis.yml52
-rw-r--r--compiler/app/Main.hs15
-rw-r--r--compiler/src/Compiler.hs18
-rw-r--r--design-notes.md2
-rw-r--r--example/readme.md24
-rw-r--r--example/src/DSC0001.jpg (renamed from example/src/_DSC8808-1.jpg)bin1010643 -> 1010643 bytes
-rw-r--r--example/src/DSC0001.jpg.yaml (renamed from example/src/_DSC8808-1.jpg.yaml)0
-rw-r--r--example/src/Ormont-Dessus/DSC0002.jpg (renamed from example/src/Glacier 3000/_DSC5542.jpg)bin457873 -> 457873 bytes
-rw-r--r--example/src/Ormont-Dessus/DSC0002.jpg.yaml (renamed from example/src/Glacier 3000/_DSC5542.jpg.yaml)2
-rw-r--r--example/src/Ormont-Dessus/DSC0003.jpg (renamed from example/src/Glacier 3000/_DSC5475.jpg)bin363216 -> 363216 bytes
-rw-r--r--example/src/Ormont-Dessus/DSC0003.jpg.yaml (renamed from example/src/Glacier 3000/_DSC5475.jpg.yaml)2
-rw-r--r--example/src/Ormont-Dessus/_directory.jpg (renamed from example/src/Glacier 3000/_directory.jpg)bin457873 -> 457873 bytes
-rw-r--r--example/src/Ormont-Dessus/_directory.yaml (renamed from example/src/Glacier 3000/_directory.yaml)1
-rw-r--r--viewer/src/@types/gallery.d.ts7
-rw-r--r--viewer/src/store/galleryStore.ts1
15 files changed, 80 insertions, 44 deletions
diff --git a/.travis.yml b/.travis.yml
index e9f8948..98a00fc 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,30 +2,52 @@ language: generic
2 2
3jobs: 3jobs:
4 include: 4 include:
5 - name: viewer 5 - name: release-linux
6 language: node_js 6 language: generic
7 node_js: 12 7
8 deploy:
9 provider: releases
10 edge: true
11 api_key:
12 secure: zRJV96jl3zchT88YAtT6irCXgm96qVcIokVmCHrzcAXsRHgTHQURKcdpPzFdZQnNkxwfS1akA3fW5icr+U6WZIxIe56sHYEaBg7VXR1RiGW/qNOAhSvbJGva75iUllTiELa2FL2gEb8bNhVOy3+bQr5Z7RMeHFiC4FFmbMvaQhd5ss3yR5+bqKufEuJPDpFap93XHUoczXH+lXp1v90Cia1gskHsSl+YgfGWQAc89yOxETwFOSqr3CScZGV6oJpGM2rsflN5arFS/8JqDwuemttfrt74wDdKR4Mk94tcqXqMrledUsXR1NEjWAEWW6QMj05ztZ76TkT2hKpG+WVmUTaJjNKS+RJnf4WKzv1vo2EHZuAuPvwR21NGVYTxvV4o3Zvs4YODGXiUxQgeF5LFA3jbZw9ODyloStUV7zIPqzL7qJEIehnMtkjo2JPav5ORz6B7GwVrDC4LJHn95on3/3Voo3mPeyepoz1gFoh3iovTKAc+IXQXGOhT7cATP9DAWLO/Epct7hWPCEflm+oSS4rNiVbMW/61O3yIpxgkJ/oTsixLk6LOhWNdr2hfP95nAtD+It7LSsJABmWJ0FVO9RtQC7fLmEPaoGdZIdeRk/0yig9vA78Y+q46B6LBalmZO+0V60rdLdrnggJsyt3DZKM/4Z+QUwe494NodE7hU9U=
13 draft: true
14 on:
15 repo: pacien/ldgallery
16 branch:
17 - master
18 - staging
19 overwrite: true
20 skip_cleanup: true
21 file:
22 - viewer.tar.gz
23
8 cache: 24 cache:
9 directories: 25 directories:
10 - viewer/node_modules 26 - viewer/node_modules
11 install: 27 - "$HOME/.stack"
12 - cd viewer
13 - npm install
14 script:
15 - npm run lint
16 - npm run build
17 28
18 - name: compiler
19 language: haskell
20 cache:
21 directories:
22 - $HOME/.stack
23 before_install: 29 before_install:
30 - nvm install 12
24 - mkdir -p ~/.local/bin 31 - mkdir -p ~/.local/bin
25 - export PATH=$HOME/.local/bin:$PATH 32 - export PATH=$HOME/.local/bin:$PATH
26 - travis_retry curl -L https://get.haskellstack.org/stable/linux-x86_64.tar.gz | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack' 33 - travis_retry curl -L https://get.haskellstack.org/stable/linux-x86_64.tar.gz
34 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
35
27 install: 36 install:
37 - cd viewer
38 - npm install
39 - cd ..
28 - cd compiler 40 - cd compiler
29 - stack setup --no-terminal 41 - stack setup --no-terminal
42 - cd ..
43
30 script: 44 script:
45 - cd viewer
46 - npm run lint
47 - npm run build
48 - cd ..
49 - tar -czvf viewer.tar.gz viewer/dist
50 - cp -r viewer/dist compiler/data/viewer
51 - cd compiler
31 - stack build --no-terminal 52 - stack build --no-terminal
53 - cd ..
diff --git a/compiler/app/Main.hs b/compiler/app/Main.hs
index 1229e88..404de4b 100644
--- a/compiler/app/Main.hs
+++ b/compiler/app/Main.hs
@@ -24,11 +24,11 @@ import Control.Monad (when)
24import Data.Version (showVersion) 24import Data.Version (showVersion)
25import Data.Aeson (ToJSON) 25import Data.Aeson (ToJSON)
26import System.FilePath ((</>)) 26import System.FilePath ((</>))
27import System.Directory (canonicalizePath) 27import System.Directory (canonicalizePath, listDirectory)
28import System.Console.CmdArgs 28import System.Console.CmdArgs
29 29
30import Compiler 30import Compiler
31import Files (readDirectory, copyTo) 31import Files (readDirectory, copyTo, remove)
32 32
33 33
34data ViewerConfig = ViewerConfig 34data ViewerConfig = ViewerConfig
@@ -95,12 +95,13 @@ main =
95 opts <- cmdArgs options 95 opts <- cmdArgs options
96 buildGallery opts 96 buildGallery opts
97 when (withViewer opts) $ do 97 when (withViewer opts) $ do
98 when (cleanOutput opts) $ cleanViewerDir (outputDir opts)
98 copyViewer (outputDir opts) 99 copyViewer (outputDir opts)
99 writeViewerConfig (outputDir opts </> "config.json") 100 writeViewerConfig (outputDir opts </> "config.json")
100 101
101 where 102 where
102 gallerySubdir :: String 103 gallerySubdir :: String
103 gallerySubdir = "gallery/" 104 gallerySubdir = "gallery"
104 105
105 buildGallery :: Options -> IO () 106 buildGallery :: Options -> IO ()
106 buildGallery opts = 107 buildGallery opts =
@@ -123,6 +124,12 @@ main =
123 if withViewer opts then outputBase </> gallerySubdir else outputBase 124 if withViewer opts then outputBase </> gallerySubdir else outputBase
124 where outputBase = outputDir opts 125 where outputBase = outputDir opts
125 126
127 cleanViewerDir :: FilePath -> IO ()
128 cleanViewerDir target =
129 listDirectory target
130 >>= return . filter (/= gallerySubdir)
131 >>= mapM_ remove . map (target </>)
132
126 copyViewer :: FilePath -> IO () 133 copyViewer :: FilePath -> IO ()
127 copyViewer target = 134 copyViewer target =
128 putStrLn "Copying viewer webapp" 135 putStrLn "Copying viewer webapp"
@@ -131,4 +138,4 @@ main =
131 >>= copyTo target 138 >>= copyTo target
132 139
133 writeViewerConfig :: FilePath -> IO () 140 writeViewerConfig :: FilePath -> IO ()
134 writeViewerConfig fileName = writeJSON fileName $ ViewerConfig gallerySubdir 141 writeViewerConfig fileName = writeJSON fileName $ ViewerConfig (gallerySubdir ++ "/")
diff --git a/compiler/src/Compiler.hs b/compiler/src/Compiler.hs
index 73ac8a4..2970102 100644
--- a/compiler/src/Compiler.hs
+++ b/compiler/src/Compiler.hs
@@ -22,6 +22,7 @@ module Compiler
22 ) where 22 ) where
23 23
24 24
25import GHC.Generics (Generic)
25import Control.Monad (liftM2, when) 26import Control.Monad (liftM2, when)
26import Data.List (any) 27import Data.List (any)
27import System.FilePath ((</>)) 28import System.FilePath ((</>))
@@ -33,7 +34,7 @@ import qualified Data.Aeson as JSON
33 34
34import Config 35import Config
35import Input (readInputTree) 36import Input (readInputTree)
36import Resource (buildGalleryTree, galleryCleanupResourceDir) 37import Resource (GalleryItem, buildGalleryTree, galleryCleanupResourceDir)
37import Files 38import Files
38 ( FileName 39 ( FileName
39 , FSNode(..) 40 , FSNode(..)
@@ -53,9 +54,6 @@ defaultGalleryConf = "gallery.yaml"
53indexFile :: String 54indexFile :: String
54indexFile = "index.json" 55indexFile = "index.json"
55 56
56viewerConfFile :: String
57viewerConfFile = "viewer.json"
58
59itemsDir :: String 57itemsDir :: String
60itemsDir = "items" 58itemsDir = "items"
61 59
@@ -63,6 +61,12 @@ thumbnailsDir :: String
63thumbnailsDir = "thumbnails" 61thumbnailsDir = "thumbnails"
64 62
65 63
64data GalleryIndex = GalleryIndex
65 { properties :: ViewerConfig
66 , tree :: GalleryItem
67 } deriving (Generic, Show, ToJSON)
68
69
66writeJSON :: ToJSON a => FileName -> a -> IO () 70writeJSON :: ToJSON a => FileName -> a -> IO ()
67writeJSON outputPath object = 71writeJSON outputPath object =
68 do 72 do
@@ -117,17 +121,13 @@ compileGallery configPath inputDirPath outputDirPath excludedDirs rebuildAll cle
117 resources <- galleryBuilder inputTree 121 resources <- galleryBuilder inputTree
118 122
119 when cleanOutput $ galleryCleanupResourceDir resources outputDirPath 123 when cleanOutput $ galleryCleanupResourceDir resources outputDirPath
120 writeJSON outputIndex resources 124 writeJSON (outputDirPath </> indexFile) $ GalleryIndex (viewerConfig config) resources
121 writeJSON outputViewerConf $ viewerConfig config
122 125
123 where 126 where
124 inputGalleryConf :: FilePath -> FilePath 127 inputGalleryConf :: FilePath -> FilePath
125 inputGalleryConf "" = inputDirPath </> defaultGalleryConf 128 inputGalleryConf "" = inputDirPath </> defaultGalleryConf
126 inputGalleryConf file = file 129 inputGalleryConf file = file
127 130
128 outputIndex = outputDirPath </> indexFile
129 outputViewerConf = outputDirPath </> viewerConfFile
130
131 itemProcessor config cache = 131 itemProcessor config cache =
132 itemFileProcessor 132 itemFileProcessor
133 (pictureMaxResolution config) cache 133 (pictureMaxResolution config) cache
diff --git a/design-notes.md b/design-notes.md
index d59f511..0d7b5c1 100644
--- a/design-notes.md
+++ b/design-notes.md
@@ -234,6 +234,6 @@ By default, the content is rendered in the same ordered as listed in `index.json
234 234
235Items other than directories are displayed by this view, making use of most of the screen space to render the element. 235Items other than directories are displayed by this view, making use of most of the screen space to render the element.
236 236
237This view should as well display the title, description, date, tags and other information associated to the item. Tags in particular are displayed in a grouped manner as determined in `viewer.json`. 237This view should as well display the title, description, date, tags and other information associated to the item. Tags in particular are displayed in a grouped manner as determined in `index.json`.
238 238
239It should be possible to navigate between items of the same directory as the current one through a thumbnail reel and previous/next links. 239It should be possible to navigate between items of the same directory as the current one through a thumbnail reel and previous/next links.
diff --git a/example/readme.md b/example/readme.md
index 809ae68..2c03260 100644
--- a/example/readme.md
+++ b/example/readme.md
@@ -8,16 +8,16 @@ Content
8------- 8-------
9 9
10``` 10```