@@ -25,7 +25,6 @@ import System.Environment
2525import System.FilePath
2626import System.IO (hIsTerminalDevice, stdout)
2727import System.Posix.Process (executeFile)
28−import System.Process (callCommand)
2928
3029import Obelisk.App
3130import Obelisk.CliApp (Severity (..), failWith, getLogLevel, newCliConfig, putLog)
@@ -125,14 +124,14 @@ deployCommand :: Parser DeployCommand
125124deployCommand = hsubparser $ mconcat
126125 [ command "init" $ info deployInitCommand $ progDesc "Initialize a deployment configuration directory"
127126 , command "push" $ info (pure DeployCommand_Push) mempty
128− , command "test" $ info (DeployCommand_Test <$> argument (maybeReader readPlatform) (completeWith ["android"])) $ progDesc "Test your obelisk project from a mobile platform. [Only android supported]"
127+ , command "test" $ info (DeployCommand_Test <$> platformP) $ progDesc "Test your obelisk project from a mobile platform."
129128 , command "update" $ info (pure DeployCommand_Update) $ progDesc "Update the deployment's src thunk to latest"
130129 ]
131−
132−readPlatform :: String -> Maybe Platform
133−readPlatform = \case
134− "android" -> Just Android
135− _ -> Nothing
130+ where
131+ platformP = hsubparser $ mconcat
132+ [ command "android" $ info (pure Android) mempty
133+ , command "ios" $ info (pure IOS <*> strArgument (metavar "TEAMID" <> help "Your Team ID - found in the Apple developer portal")) mempty
134+ ]
136135
137136deployInitCommand :: Parser DeployCommand
138137deployInitCommand = fmap DeployCommand_Init $ DeployInitOpts
@@ -141,13 +140,14 @@ deployInitCommand = fmap DeployCommand_Init $ DeployInitOpts
141140 <*> some (strOption (long "hostname" <> metavar "HOSTNAME" <> help "hostname of the deployment target"))
142141 <*> strOption (long "upstream" <> value "origin" <> metavar "REMOTE" <> help "git remote to use for the src thunk" <> showDefault)
143142
144−data Platform = Android
143+type TeamID = String
144+data PlatformDeployment = Android | IOS TeamID
145145 deriving (Show)
146146
147147data DeployCommand
148148 = DeployCommand_Init DeployInitOpts
149149 | DeployCommand_Push
150− | DeployCommand_Test Platform
150+ | DeployCommand_Test PlatformDeployment
151151 | DeployCommand_Update
152152 deriving Show
153153
@@ -290,13 +290,9 @@ ob = \case
290290 hostname = _deployInitOpts_hostname deployOpts
291291 deployInit thunkPtr (root </> "config") deployDir sshKeyPath hostname
292292 DeployCommand_Push -> deployPush "."
293− DeployCommand_Test Android -> withProjectRoot "." $ \root -> do
294− let srcDir = root </> "src"
295− exists <- liftIO $ doesDirectoryExist srcDir
296− unless exists $ failWith "ob test should be run inside of a deploy directory"
297− result <- nixBuildAttrWithCache srcDir "android.frontend"
298− liftIO $ callCommand $ result </> "bin" </> "deploy"
299293 DeployCommand_Update -> deployUpdate "."
294+ DeployCommand_Test Android -> deployMobile "android" []
295+ DeployCommand_Test (IOS teamID) -> deployMobile "ios" [teamID]
300296 ObCommand_Run -> inNixShell' $ static run
301297 -- inNixShell ($(mkClosure 'ghcidAction) ())
302298 ObCommand_Thunk tc -> case tc of