From c1f1e91fa9d838ab7f21c9ce28016ffaa3e66c38 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Wed, 17 Dec 2014 11:36:00 +0200 Subject: [PATCH] Scaffolding update --- yesod-bin/ChangeLog.md | 8 +++++ yesod-bin/hsfiles/mongo.hsfiles | 35 ++++++++++++------ yesod-bin/hsfiles/mysql.hsfiles | 37 +++++++++++++------ yesod-bin/hsfiles/postgres-fay.hsfiles | 49 +++++++++++++++++--------- yesod-bin/hsfiles/postgres.hsfiles | 37 +++++++++++++------ yesod-bin/hsfiles/simple.hsfiles | 42 +++++++++++++++------- yesod-bin/hsfiles/sqlite.hsfiles | 37 +++++++++++++------ yesod-bin/yesod-bin.cabal | 2 +- 8 files changed, 173 insertions(+), 74 deletions(-) diff --git a/yesod-bin/ChangeLog.md b/yesod-bin/ChangeLog.md index c2c85508..e1b086cb 100644 --- a/yesod-bin/ChangeLog.md +++ b/yesod-bin/ChangeLog.md @@ -1,3 +1,11 @@ +## 1.4.2 + +Scaffolding updates: + +* Import.NoFoundation +* Explanation of static files in Settings.StaticFiles +* Explanation of environment variables in settings.yml + ## 1.4.1.2 No args passed in keter.yml diff --git a/yesod-bin/hsfiles/mongo.hsfiles b/yesod-bin/hsfiles/mongo.hsfiles index 18b8e118..06c42d5a 100644 --- a/yesod-bin/hsfiles/mongo.hsfiles +++ b/yesod-bin/hsfiles/mongo.hsfiles @@ -148,14 +148,10 @@ appMain = do {-# START_FILE Foundation.hs #-} module Foundation where -import ClassyPrelude.Yesod import Database.Persist.MongoDB hiding (master) -import Model -import Settings -import Settings.StaticFiles +import Import.NoFoundation import Text.Hamlet (hamletFile) import Text.Jasmine (minifym) -import Yesod.Auth import Yesod.Auth.BrowserId (authBrowserId) import Yesod.Core.Types (Logger) import Yesod.Default.Util (addStaticContentExternal) @@ -368,8 +364,15 @@ module Import ( module Import ) where -import ClassyPrelude.Yesod as Import import Foundation as Import +import Import.NoFoundation as Import + +{-# START_FILE Import/NoFoundation.hs #-} +module Import.NoFoundation + ( module Import + ) where + +import ClassyPrelude.Yesod as Import import Model as Import import Settings as Import import Settings.StaticFiles as Import @@ -411,6 +414,7 @@ library exposed-modules: Application Foundation Import + Import.NoFoundation Model Settings Settings.StaticFiles @@ -664,10 +668,18 @@ module Settings.StaticFiles where import Settings (appStaticDir, compileTimeAppSettings) import Yesod.Static (staticFiles) --- | This generates easy references to files in the static directory at compile time, --- giving you compile-time verification that referenced files exist. --- Warning: any files added to your static directory during run-time can't be --- accessed this way. You'll have to use their FilePath or URL to access them. +-- This generates easy references to files in the static directory at compile time, +-- giving you compile-time verification that referenced files exist. +-- Warning: any files added to your static directory during run-time can't be +-- accessed this way. You'll have to use their FilePath or URL to access them. +-- +-- For example, to refer to @static/js/script.js@ via an identifier, you'd use: +-- +-- js_script_js +-- +-- If the identifier is not available, you may use: +-- +-- StaticFile ["js", "script.js"] [] staticFiles (appStaticDir compileTimeAppSettings) {-# START_FILE app/DevelMain.hs #-} @@ -869,6 +881,9 @@ User-agent: * / HomeR GET POST {-# START_FILE config/settings.yml #-} +# Values formatted like "_env:ENV_VAR_NAME:default_value" can be overridden by the specified environment variable. +# See https://github.com/yesodweb/yesod/wiki/Configuration#overriding-configuration-values-with-environment-variables + static-dir: "_env:STATIC_DIR:static" host: "_env:HOST:*4" # any IPv4 host port: "_env:PORT:3000" diff --git a/yesod-bin/hsfiles/mysql.hsfiles b/yesod-bin/hsfiles/mysql.hsfiles index 09e8a885..8ca1f8e2 100644 --- a/yesod-bin/hsfiles/mysql.hsfiles +++ b/yesod-bin/hsfiles/mysql.hsfiles @@ -164,17 +164,13 @@ appMain = do {-# START_FILE Foundation.hs #-} module Foundation where -import ClassyPrelude.Yesod +import Import.NoFoundation import Database.Persist.Sql (ConnectionPool, runSqlPool) -import Model -import Settings -import Settings.StaticFiles import Text.Hamlet (hamletFile) import Text.Jasmine (minifym) -import Yesod.Auth import Yesod.Auth.BrowserId (authBrowserId) -import Yesod.Core.Types (Logger) import Yesod.Default.Util (addStaticContentExternal) +import Yesod.Core.Types (Logger) -- | The foundation datatype for your application. This can be a good place to -- keep settings and values requiring initialization before your application @@ -383,8 +379,15 @@ module Import ( module Import ) where -import ClassyPrelude.Yesod as Import import Foundation as Import +import Import.NoFoundation as Import + +{-# START_FILE Import/NoFoundation.hs #-} +module Import.NoFoundation + ( module Import + ) where + +import ClassyPrelude.Yesod as Import import Model as Import import Settings as Import import Settings.StaticFiles as Import @@ -423,6 +426,7 @@ library exposed-modules: Application Foundation Import + Import.NoFoundation Model Settings Settings.StaticFiles @@ -676,10 +680,18 @@ module Settings.StaticFiles where import Settings (appStaticDir, compileTimeAppSettings) import Yesod.Static (staticFiles) --- | This generates easy references to files in the static directory at compile time, --- giving you compile-time verification that referenced files exist. --- Warning: any files added to your static directory during run-time can't be --- accessed this way. You'll have to use their FilePath or URL to access them. +-- This generates easy references to files in the static directory at compile time, +-- giving you compile-time verification that referenced files exist. +-- Warning: any files added to your static directory during run-time can't be +-- accessed this way. You'll have to use their FilePath or URL to access them. +-- +-- For example, to refer to @static/js/script.js@ via an identifier, you'd use: +-- +-- js_script_js +-- +-- If the identifier is not available, you may use: +-- +-- StaticFile ["js", "script.js"] [] staticFiles (appStaticDir compileTimeAppSettings) {-# START_FILE app/DevelMain.hs #-} @@ -881,6 +893,9 @@ User-agent: * / HomeR GET POST {-# START_FILE config/settings.yml #-} +# Values formatted like "_env:ENV_VAR_NAME:default_value" can be overridden by the specified environment variable. +# See https://github.com/yesodweb/yesod/wiki/Configuration#overriding-configuration-values-with-environment-variables + static-dir: "_env:STATIC_DIR:static" host: "_env:HOST:*4" # any IPv4 host port: "_env:PORT:3000" diff --git a/yesod-bin/hsfiles/postgres-fay.hsfiles b/yesod-bin/hsfiles/postgres-fay.hsfiles index 39e9748a..171d7ae0 100644 --- a/yesod-bin/hsfiles/postgres-fay.hsfiles +++ b/yesod-bin/hsfiles/postgres-fay.hsfiles @@ -170,13 +170,9 @@ appMain = do {-# START_FILE Foundation.hs #-} module Foundation where -import ClassyPrelude.Yesod import Database.Persist.Sql (ConnectionPool, runSqlPool) -import Model -import Settings -import Settings.StaticFiles +import Import.NoFoundation import Text.Hamlet (hamletFile) -import Yesod.Auth import Yesod.Auth.BrowserId (authBrowserId) import Yesod.Core.Types (Logger) import Yesod.Default.Util (addStaticContentExternal) @@ -417,21 +413,28 @@ module Import ( module Import ) where -import ClassyPrelude.Yesod as Import import Foundation as Import +import Import.NoFoundation as Import import Language.Haskell.TH.Syntax (Exp (ConE)) -import Model as Import -import Settings as Import -import Settings.StaticFiles as Import -import SharedTypes as Import -import Yesod.Auth as Import -import Yesod.Core.Types as Import (loggerSet) -import Yesod.Default.Config2 as Import import Yesod.Fay (FayFile) fayFile :: FayFile fayFile = fayFile' (ConE 'StaticR) +{-# START_FILE Import/NoFoundation.hs #-} +module Import.NoFoundation + ( module Import + ) where + +import ClassyPrelude.Yesod as Import +import Model as Import +import Settings as Import +import Settings.StaticFiles as Import +import SharedTypes as Import +import Yesod.Auth as Import +import Yesod.Core.Types as Import (loggerSet) +import Yesod.Default.Config2 as Import + {-# START_FILE Model.hs #-} module Model where @@ -464,6 +467,7 @@ library exposed-modules: Application Foundation Import + Import.NoFoundation Model Settings Settings.StaticFiles @@ -736,10 +740,18 @@ module Settings.StaticFiles where import Settings (appStaticDir, compileTimeAppSettings) import Yesod.Static (staticFiles) --- | This generates easy references to files in the static directory at compile time, --- giving you compile-time verification that referenced files exist. --- Warning: any files added to your static directory during run-time can't be --- accessed this way. You'll have to use their FilePath or URL to access them. +-- This generates easy references to files in the static directory at compile time, +-- giving you compile-time verification that referenced files exist. +-- Warning: any files added to your static directory during run-time can't be +-- accessed this way. You'll have to use their FilePath or URL to access them. +-- +-- For example, to refer to @static/js/script.js@ via an identifier, you'd use: +-- +-- js_script_js +-- +-- If the identifier is not available, you may use: +-- +-- StaticFile ["js", "script.js"] [] staticFiles (appStaticDir compileTimeAppSettings) {-# START_FILE app/DevelMain.hs #-} @@ -942,6 +954,9 @@ User-agent: * / HomeR GET POST {-# START_FILE config/settings.yml #-} +# Values formatted like "_env:ENV_VAR_NAME:default_value" can be overridden by the specified environment variable. +# See https://github.com/yesodweb/yesod/wiki/Configuration#overriding-configuration-values-with-environment-variables + static-dir: "_env:STATIC_DIR:static" host: "_env:HOST:*4" # any IPv4 host port: "_env:PORT:3000" diff --git a/yesod-bin/hsfiles/postgres.hsfiles b/yesod-bin/hsfiles/postgres.hsfiles index 4756cc59..3d758d34 100644 --- a/yesod-bin/hsfiles/postgres.hsfiles +++ b/yesod-bin/hsfiles/postgres.hsfiles @@ -164,17 +164,13 @@ appMain = do {-# START_FILE Foundation.hs #-} module Foundation where -import ClassyPrelude.Yesod +import Import.NoFoundation import Database.Persist.Sql (ConnectionPool, runSqlPool) -import Model -import Settings -import Settings.StaticFiles import Text.Hamlet (hamletFile) import Text.Jasmine (minifym) -import Yesod.Auth import Yesod.Auth.BrowserId (authBrowserId) -import Yesod.Core.Types (Logger) import Yesod.Default.Util (addStaticContentExternal) +import Yesod.Core.Types (Logger) -- | The foundation datatype for your application. This can be a good place to -- keep settings and values requiring initialization before your application @@ -383,8 +379,15 @@ module Import ( module Import ) where -import ClassyPrelude.Yesod as Import import Foundation as Import +import Import.NoFoundation as Import + +{-# START_FILE Import/NoFoundation.hs #-} +module Import.NoFoundation + ( module Import + ) where + +import ClassyPrelude.Yesod as Import import Model as Import import Settings as Import import Settings.StaticFiles as Import @@ -423,6 +426,7 @@ library exposed-modules: Application Foundation Import + Import.NoFoundation Model Settings Settings.StaticFiles @@ -676,10 +680,18 @@ module Settings.StaticFiles where import Settings (appStaticDir, compileTimeAppSettings) import Yesod.Static (staticFiles) --- | This generates easy references to files in the static directory at compile time, --- giving you compile-time verification that referenced files exist. --- Warning: any files added to your static directory during run-time can't be --- accessed this way. You'll have to use their FilePath or URL to access them. +-- This generates easy references to files in the static directory at compile time, +-- giving you compile-time verification that referenced files exist. +-- Warning: any files added to your static directory during run-time can't be +-- accessed this way. You'll have to use their FilePath or URL to access them. +-- +-- For example, to refer to @static/js/script.js@ via an identifier, you'd use: +-- +-- js_script_js +-- +-- If the identifier is not available, you may use: +-- +-- StaticFile ["js", "script.js"] [] staticFiles (appStaticDir compileTimeAppSettings) {-# START_FILE app/DevelMain.hs #-} @@ -881,6 +893,9 @@ User-agent: * / HomeR GET POST {-# START_FILE config/settings.yml #-} +# Values formatted like "_env:ENV_VAR_NAME:default_value" can be overridden by the specified environment variable. +# See https://github.com/yesodweb/yesod/wiki/Configuration#overriding-configuration-values-with-environment-variables + static-dir: "_env:STATIC_DIR:static" host: "_env:HOST:*4" # any IPv4 host port: "_env:PORT:3000" diff --git a/yesod-bin/hsfiles/simple.hsfiles b/yesod-bin/hsfiles/simple.hsfiles index be07b4c2..17cfdb8d 100644 --- a/yesod-bin/hsfiles/simple.hsfiles +++ b/yesod-bin/hsfiles/simple.hsfiles @@ -145,13 +145,11 @@ appMain = do {-# START_FILE Foundation.hs #-} module Foundation where -import ClassyPrelude.Yesod -import Settings -import Settings.StaticFiles -import Text.Hamlet (hamletFile) -import Text.Jasmine (minifym) -import Yesod.Core.Types (Logger) -import Yesod.Default.Util (addStaticContentExternal) +import Import.NoFoundation +import Text.Hamlet (hamletFile) +import Text.Jasmine (minifym) +import Yesod.Core.Types (Logger) +import Yesod.Default.Util (addStaticContentExternal) -- | The foundation datatype for your application. This can be a good place to -- keep settings and values requiring initialization before your application @@ -319,8 +317,15 @@ module Import ( module Import ) where -import ClassyPrelude.Yesod as Import import Foundation as Import +import Import.NoFoundation as Import + +{-# START_FILE Import/NoFoundation.hs #-} +module Import.NoFoundation + ( module Import + ) where + +import ClassyPrelude.Yesod as Import import Settings as Import import Settings.StaticFiles as Import import Yesod.Core.Types as Import (loggerSet) @@ -344,6 +349,7 @@ library exposed-modules: Application Foundation Import + Import.NoFoundation Settings Settings.StaticFiles Handler.Common @@ -375,7 +381,6 @@ library build-depends: base >= 4 && < 5 , yesod >= 1.4.1 && < 1.5 , yesod-core >= 1.4.0 && < 1.5 - , yesod-auth >= 1.4.0 && < 1.5 , yesod-static >= 1.4.0.3 && < 1.5 , yesod-form >= 1.4.0 && < 1.5 , classy-prelude >= 0.10.2 @@ -584,10 +589,18 @@ module Settings.StaticFiles where import Settings (appStaticDir, compileTimeAppSettings) import Yesod.Static (staticFiles) --- | This generates easy references to files in the static directory at compile time, --- giving you compile-time verification that referenced files exist. --- Warning: any files added to your static directory during run-time can't be --- accessed this way. You'll have to use their FilePath or URL to access them. +-- This generates easy references to files in the static directory at compile time, +-- giving you compile-time verification that referenced files exist. +-- Warning: any files added to your static directory during run-time can't be +-- accessed this way. You'll have to use their FilePath or URL to access them. +-- +-- For example, to refer to @static/js/script.js@ via an identifier, you'd use: +-- +-- js_script_js +-- +-- If the identifier is not available, you may use: +-- +-- StaticFile ["js", "script.js"] [] staticFiles (appStaticDir compileTimeAppSettings) {-# START_FILE app/DevelMain.hs #-} @@ -774,6 +787,9 @@ User-agent: * / HomeR GET POST {-# START_FILE config/settings.yml #-} +# Values formatted like "_env:ENV_VAR_NAME:default_value" can be overridden by the specified environment variable. +# See https://github.com/yesodweb/yesod/wiki/Configuration#overriding-configuration-values-with-environment-variables + static-dir: "_env:STATIC_DIR:static" host: "_env:HOST:*4" # any IPv4 host port: "_env:PORT:3000" diff --git a/yesod-bin/hsfiles/sqlite.hsfiles b/yesod-bin/hsfiles/sqlite.hsfiles index 6f2ed32a..87b61db5 100644 --- a/yesod-bin/hsfiles/sqlite.hsfiles +++ b/yesod-bin/hsfiles/sqlite.hsfiles @@ -164,17 +164,13 @@ appMain = do {-# START_FILE Foundation.hs #-} module Foundation where -import ClassyPrelude.Yesod +import Import.NoFoundation import Database.Persist.Sql (ConnectionPool, runSqlPool) -import Model -import Settings -import Settings.StaticFiles import Text.Hamlet (hamletFile) import Text.Jasmine (minifym) -import Yesod.Auth import Yesod.Auth.BrowserId (authBrowserId) -import Yesod.Core.Types (Logger) import Yesod.Default.Util (addStaticContentExternal) +import Yesod.Core.Types (Logger) -- | The foundation datatype for your application. This can be a good place to -- keep settings and values requiring initialization before your application @@ -383,8 +379,15 @@ module Import ( module Import ) where -import ClassyPrelude.Yesod as Import import Foundation as Import +import Import.NoFoundation as Import + +{-# START_FILE Import/NoFoundation.hs #-} +module Import.NoFoundation + ( module Import + ) where + +import ClassyPrelude.Yesod as Import import Model as Import import Settings as Import import Settings.StaticFiles as Import @@ -423,6 +426,7 @@ library exposed-modules: Application Foundation Import + Import.NoFoundation Model Settings Settings.StaticFiles @@ -676,10 +680,18 @@ module Settings.StaticFiles where import Settings (appStaticDir, compileTimeAppSettings) import Yesod.Static (staticFiles) --- | This generates easy references to files in the static directory at compile time, --- giving you compile-time verification that referenced files exist. --- Warning: any files added to your static directory during run-time can't be --- accessed this way. You'll have to use their FilePath or URL to access them. +-- This generates easy references to files in the static directory at compile time, +-- giving you compile-time verification that referenced files exist. +-- Warning: any files added to your static directory during run-time can't be +-- accessed this way. You'll have to use their FilePath or URL to access them. +-- +-- For example, to refer to @static/js/script.js@ via an identifier, you'd use: +-- +-- js_script_js +-- +-- If the identifier is not available, you may use: +-- +-- StaticFile ["js", "script.js"] [] staticFiles (appStaticDir compileTimeAppSettings) {-# START_FILE app/DevelMain.hs #-} @@ -881,6 +893,9 @@ User-agent: * / HomeR GET POST {-# START_FILE config/settings.yml #-} +# Values formatted like "_env:ENV_VAR_NAME:default_value" can be overridden by the specified environment variable. +# See https://github.com/yesodweb/yesod/wiki/Configuration#overriding-configuration-values-with-environment-variables + static-dir: "_env:STATIC_DIR:static" host: "_env:HOST:*4" # any IPv4 host port: "_env:PORT:3000" diff --git a/yesod-bin/yesod-bin.cabal b/yesod-bin/yesod-bin.cabal index 979f9993..165062f2 100644 --- a/yesod-bin/yesod-bin.cabal +++ b/yesod-bin/yesod-bin.cabal @@ -1,5 +1,5 @@ name: yesod-bin -version: 1.4.1.2 +version: 1.4.2 license: MIT license-file: LICENSE author: Michael Snoyman