summoner 1.0.5 → 1.0.6
raw patch · 18 files changed
+63/−46 lines, 18 filesdep +reludedep −universum
Dependencies added: relude
Dependencies removed: universum
Files
- CHANGELOG.md +7/−0
- README.md +4/−3
- app/Main.hs +1/−1
- src/Summoner/Ansi.hs +1/−1
- src/Summoner/CLI.hs +17/−9
- src/Summoner/Config.hs +1/−1
- src/Summoner/Default.hs +1/−1
- src/Summoner/License.hs +1/−1
- src/Summoner/Process.hs +2/−2
- src/Summoner/Project.hs +2/−2
- src/Summoner/ProjectData.hs +2/−2
- src/Summoner/Question.hs +2/−2
- src/Summoner/Template.hs +1/−1
- src/Summoner/Text.hs +1/−1
- src/Summoner/Tree.hs +1/−1
- src/Summoner/Validation.hs +13/−13
- summoner.cabal +5/−4
- test/Test/DecisionSpec.hs +1/−1
CHANGELOG.md view
@@ -1,5 +1,12 @@ # Summoner +1.0.6+=====++* Use `relude` instead of `universum`+* [#105](https://github.com/kowainik/summoner/issues/105):+ Add `--ignore-config` option.+ 1.0.5 =====
README.md view
@@ -118,7 +118,7 @@ See the basic usage syntax below (you can check it out with `summon --help` command): ```-summon PROJECT_NAME [--cabal] [--stack]+summon PROJECT_NAME [--cabal] [--stack] [--ignore-config] [with [OPTIONS]] [without [OPTIONS]] [-f|--file FILENAME] [--prelude-package PACKAGE_NAME] [--prelude-module MODULE_NAME]@@ -126,6 +126,7 @@ Available global options: -h, --help Show this help text -v, --version Show summoner's version+ --ignore-config Ignore configuration file --cabal Cabal support for the project --stack Stack support for the project -f, --file FILENAME Path to the toml file with configurations. If not@@ -162,9 +163,9 @@ For example, ```- summon newProject with -letgcspw without -b --prelude-package universum --prelude-module Universum+ summon newProject with -letgcspw without -b --prelude-package relude --prelude-module Relude ```-will create fully functional project which uses custom prelude `universum`, contains+will create fully functional project which uses custom prelude `relude`, contains library, executable file, tests, [build script](#build-script) and create private repository on [github](https://github.com) integrated with `Travis-CI`, `AppVeyor-CI`, but benchmarks won't be attached to this one.
app/Main.hs view
@@ -1,6 +1,6 @@ module Main where -import Universum+import Relude import System.IO (hSetEncoding, utf8)
src/Summoner/Ansi.hs view
@@ -18,7 +18,7 @@ , skipMessage ) where -import Universum+import Relude import System.Console.ANSI (Color (..), ColorIntensity (Vivid), ConsoleIntensity (BoldIntensity), ConsoleLayer (Foreground), SGR (..), setSGR)
src/Summoner/CLI.hs view
@@ -8,13 +8,13 @@ ( summon ) where -import Universum+import Relude import Data.Version (showVersion) import NeatInterpolation (text) import Options.Applicative (Parser, ParserInfo, command, execParser, flag, fullDesc, help, helper, info, infoFooter, infoHeader, infoOption, long, metavar, optional,- progDesc, short, strArgument, strOption, subparser)+ progDesc, short, strArgument, strOption, subparser, switch) import Options.Applicative.Help.Chunk (stringChunk) import System.Directory (doesFileExist) @@ -36,9 +36,9 @@ -- | Run 'hs-init' with cli options runWithOptions :: InitOpts -> IO ()-runWithOptions (InitOpts projectName maybeFile cliConfig) = do+runWithOptions InitOpts{..} = do -- read config from file- fileConfig <- readFileConfig maybeFile+ fileConfig <- readFileConfig ignoreFile maybeFile -- union all possible configs let unionConfig = defaultConfig <> fileConfig <> cliConfig@@ -56,8 +56,8 @@ -- print result beautyPrint [bold, setColor Green] "\nJob's done\n" -readFileConfig :: Maybe FilePath -> IO PartialConfig-readFileConfig maybeFile = do+readFileConfig :: Bool -> Maybe FilePath -> IO PartialConfig+readFileConfig ignoreFile maybeFile = if ignoreFile then pure mempty else do (isDefault, file) <- case maybeFile of Nothing -> (True,) <$> defaultConfigFile Just x -> pure (False, x)@@ -76,8 +76,12 @@ exitFailure -- | Initial parsed options from cli-data InitOpts = InitOpts Text (Maybe FilePath) PartialConfig- -- ^ Includes the project name, config from the CLI and possible file where custom congifs are.+data InitOpts = InitOpts+ { projectName :: Text -- ^ project name+ , ignoreFile :: Bool -- ^ ignore all config files if 'True'+ , maybeFile :: Maybe FilePath -- ^ file with custom configuration+ , cliConfig :: PartialConfig -- ^ config gathered during CLI+ } targetsP :: Decision -> Parser PartialConfig targetsP d = do@@ -168,6 +172,9 @@ , command "without" $ info (helper <*> targetsP Nop) (progDesc "Specify options to disable") ] +ignoreFileP :: Parser Bool+ignoreFileP = switch $ long "ignore-config" <> help "Ignore configuration file"+ fileP :: Parser FilePath fileP = strOption $ long "file"@@ -200,6 +207,7 @@ optsP :: Parser InitOpts optsP = do projectName <- strArgument (metavar "PROJECT_NAME")+ ignoreFile <- ignoreFileP cabal <- cabalP stack <- stackP with <- optional withP@@ -208,7 +216,7 @@ preludePack <- optional preludePackP preludeMod <- optional preludeModP - pure $ InitOpts projectName file+ pure $ InitOpts projectName ignoreFile file $ (maybeToMonoid $ with <> without) { cPrelude = Last $ Prelude <$> preludePack <*> preludeMod , cCabal = cabal
src/Summoner/Config.hs view
@@ -23,7 +23,7 @@ , loadFileConfig ) where -import Universum hiding (Key)+import Relude import Control.Exception (throwIO) import Data.List (lookup)
src/Summoner/Default.hs view
@@ -8,7 +8,7 @@ , endLine ) where -import Universum+import Relude import Data.Time (getCurrentTime, toGregorian, utctDay) import System.Directory (getHomeDirectory)
src/Summoner/License.hs view
@@ -5,7 +5,7 @@ , githubLicenseQueryNames ) where -import Universum+import Relude import Data.Aeson (FromJSON (..), withObject, (.:))
src/Summoner/Process.hs view
@@ -8,9 +8,9 @@ ( deleteFile ) where -import Universum+import Relude -import Control.Exception (displayException)+import Control.Exception (catch, displayException) import System.Directory (removeFile, setCurrentDirectory) import System.Process (callProcess)
src/Summoner/Project.hs view
@@ -6,7 +6,7 @@ ( generateProject ) where -import Universum+import Relude import Data.Aeson (decodeStrict) import Data.ByteString.Char8 (pack)@@ -28,7 +28,7 @@ import Summoner.Text (intercalateMap, packageToModule) import Summoner.Tree (showTree, traverseTree) -import qualified Universum.Unsafe as Unsafe+import qualified Relude.Unsafe as Unsafe decisionToBool :: Decision -> Text -> IO Bool decisionToBool decision target = case decision of
src/Summoner/ProjectData.hs view
@@ -16,7 +16,7 @@ , yesOrNo ) where -import Universum+import Relude import Generics.Deriving.Monoid (GMonoid (..)) import Generics.Deriving.Semigroup (GSemigroup (..))@@ -106,7 +106,7 @@ latestLts Ghc801 = "7.24" latestLts Ghc802 = "9.21" latestLts Ghc822 = "11.17"-latestLts Ghc843 = "12.0"+latestLts Ghc843 = "12.2" baseNopreludeVer :: GhcVer -> Text baseNopreludeVer Ghc7103 = "4.8.0.2"
src/Summoner/Question.hs view
@@ -19,7 +19,7 @@ , falseMessage ) where -import Universum+import Relude import System.Directory (doesPathExist, getCurrentDirectory) import System.FilePath ((</>))@@ -31,7 +31,7 @@ import qualified Data.Text as T import qualified Data.Text.IO as T-import qualified Universum.Unsafe as Unsafe+import qualified Relude.Unsafe as Unsafe ---------------------------------------------------------------------------- -- IO Questioning
src/Summoner/Template.hs view
@@ -8,7 +8,7 @@ ( createStackTemplate ) where -import Universum+import Relude import Data.List (delete) import NeatInterpolation (text)
src/Summoner/Text.hs view
@@ -4,7 +4,7 @@ , headToUpper ) where -import Universum+import Relude import qualified Data.Char as C import qualified Data.Text as T
src/Summoner/Tree.hs view
@@ -6,7 +6,7 @@ , showTree ) where -import Universum+import Relude import System.Directory (createDirectoryIfMissing, withCurrentDirectory)
src/Summoner/Validation.hs view
@@ -2,28 +2,28 @@ ( Validation (..) ) where -import Universum+import Relude -- | 'Validation' is 'Either' with a Left that is a 'Monoid' data Validation e a- = Failure e- | Success a- deriving (Eq, Ord, Show)+ = Failure e+ | Success a+ deriving (Eq, Ord, Show) instance Functor (Validation e) where fmap _ (Failure e) = Failure e fmap f (Success a) = Success (f a) instance Semigroup e => Semigroup (Validation e a) where- Failure e1 <> Failure e2 = Failure (e1 <> e2)- Failure _ <> Success a2 = Success a2- Success a1 <> Failure _ = Success a1- Success a1 <> Success _ = Success a1+ Failure e1 <> Failure e2 = Failure (e1 <> e2)+ Failure _ <> Success a2 = Success a2+ Success a1 <> Failure _ = Success a1+ Success a1 <> Success _ = Success a1 instance Semigroup e => Applicative (Validation e) where- pure = Success+ pure = Success - Failure e1 <*> Failure e2 = Failure (e1 <> e2)- Failure e1 <*> Success _ = Failure e1- Success _ <*> Failure e2 = Failure e2- Success f <*> Success a = Success (f a)+ Failure e1 <*> Failure e2 = Failure (e1 <> e2)+ Failure e1 <*> Success _ = Failure e1+ Success _ <*> Failure e2 = Failure e2+ Success f <*> Success a = Success (f a)
summoner.cabal view
@@ -1,5 +1,5 @@ name: summoner-version: 1.0.5+version: 1.0.6 synopsis: Tool for creating completely configured production Haskell projects. description: Tool for creating completely configured production Haskell projects. See README.md for details.@@ -57,7 +57,7 @@ , text , time , tomland ^>= 0.3- , universum >= 1.2.0+ , relude default-extensions: DeriveGeneric GeneralizedNewtypeDeriving@@ -74,8 +74,8 @@ main-is: Main.hs ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N build-depends: base+ , relude , summoner- , universum default-language: Haskell2010 test-suite summoner-test@@ -88,10 +88,11 @@ build-tool-depends: tasty-discover:tasty-discover build-depends: base , hedgehog+ , relude , tasty , tasty-hedgehog , summoner- , universum+ default-extensions: NoImplicitPrelude ghc-options: -Wall -threaded -rtsopts -with-rtsopts=-N default-language: Haskell2010
test/Test/DecisionSpec.hs view
@@ -1,6 +1,6 @@ module Test.DecisionSpec where -import Universum+import Relude import Hedgehog (MonadGen, forAll, property, (===)) import Test.Tasty (TestTree)