hi 1.0.0.0 → 1.1.0.0
raw patch · 5 files changed
+19/−14 lines, 5 filesdep ~processPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: process
API changes (from Hackage documentation)
- Hi.Types: initializeGitRepository :: Option -> Bool
+ Hi.CommandLineOption: afterCommand :: CommandLineOption -> Maybe String
+ Hi.Types: afterCommands :: Option -> [String]
- Hi.CommandLineOption: CommandLineOption :: String -> Maybe String -> Maybe String -> Maybe String -> String -> Maybe String -> Maybe Bool -> CommandLineOption
+ Hi.CommandLineOption: CommandLineOption :: String -> Maybe String -> Maybe String -> Maybe String -> String -> Maybe String -> Bool -> Maybe String -> CommandLineOption
- Hi.CommandLineOption: initializeGitRepository :: CommandLineOption -> Maybe Bool
+ Hi.CommandLineOption: initializeGitRepository :: CommandLineOption -> Bool
- Hi.Types: Option :: Bool -> String -> String -> String -> String -> String -> TemplateSource -> Option
+ Hi.Types: Option :: String -> String -> String -> String -> String -> TemplateSource -> [String] -> Option
Files
- hi.cabal +2/−2
- src/Hi.hs +2/−5
- src/Hi/CommandLineOption.hs +4/−2
- src/Hi/Option.hs +9/−3
- src/Hi/Types.hs +2/−2
hi.cabal view
@@ -1,5 +1,5 @@ name: hi-version: 1.0.0.0+version: 1.1.0.0 cabal-version: >=1.8 build-type: Simple license: BSD3@@ -57,7 +57,7 @@ filepath -any, optparse-applicative >=0.10.0, parsec -any,- process -any,+ process >=1.2.0.0, split -any, template ==0.2.*, temporary >=1.2.0.3,
src/Hi.hs view
@@ -79,11 +79,8 @@ context opts x = T.pack . fromJust $ lookup (T.unpack x) opts postProcess :: Option -> IO ()-postProcess Option {initializeGitRepository, packageName} = do- when initializeGitRepository $- inDirectory packageName $- void $ system "git init && git add . && git commit -m \"Initial commit\""- return ()+postProcess Option {packageName, afterCommands} = do+ void $ inDirectory packageName $ forM_ afterCommands (void . system) -- | Drop 'RegularFile's if there is a 'TemplateFile' which has same name dropExtraRegularFiles :: Files -> Files
src/Hi/CommandLineOption.hs view
@@ -13,7 +13,8 @@ , email :: Maybe String , repository :: String , configFilePath :: Maybe String- , initializeGitRepository :: Maybe Bool+ , initializeGitRepository :: Bool+ , afterCommand :: Maybe String } deriving (Eq, Ord, Show) commandLineOption :: Parser CommandLineOption@@ -24,7 +25,8 @@ <*> optional (strOption (short 'e' <> long "email" <> help "Email address of the maintainer")) <*> strOption (short 'r' <> long "repository" <> help "Template repository" <> value defaultRepo) <*> optional (strOption (long "configuration-file" <> help "Use specified configuration file"))- <*> optional (switch (long "initialize-git-repository" <> help "Initialize with git repository"))+ <*> (switch (long "initialize-git-repository" <> help "Initialize with git repository"))+ <*> optional (strOption (long "after-command" <> help "The command to be run after generation")) defaultRepo :: String defaultRepo = "git://github.com/fujimura/hi-hspec.git"
src/Hi/Option.hs view
@@ -15,7 +15,7 @@ import Control.Applicative import Control.Monad import Data.Char (toUpper)-import Data.Maybe (fromMaybe)+import Data.Maybe (catMaybes, fromMaybe) import Data.Time.Calendar (toGregorian) import Data.Time.Clock (getCurrentTime, utctDay) @@ -25,13 +25,19 @@ year <- getCurrentYear author <- guessAuthor email <- guessEmail- return Option { initializeGitRepository = fromMaybe False $ CommandLineOption.initializeGitRepository copt- , moduleName = fromMaybe moduleName $ CommandLineOption.moduleName copt+ let mGitInit = if CommandLineOption.initializeGitRepository copt+ then Just "git init && git add . && git commit -m \"Initial commit\""+ else Nothing+ afterCommands = catMaybes [ mGitInit+ , CommandLineOption.afterCommand copt+ ]+ return Option { moduleName = fromMaybe moduleName $ CommandLineOption.moduleName copt , packageName = CommandLineOption.packageName copt , author = author , email = email , templateSource = FromRepo $ CommandLineOption.repository copt , year = year+ , afterCommands = afterCommands } where lookupConfig :: String -> IO (Maybe String)
src/Hi/Types.hs view
@@ -17,11 +17,11 @@ type Files = [File] data Option = Option- { initializeGitRepository :: Bool- , moduleName :: String+ { moduleName :: String , packageName :: String , author :: String , email :: String , year :: String , templateSource :: TemplateSource+ , afterCommands :: [String] } deriving (Eq,Ord,Show)