@@ -25,7 +25,6 @@ import System.Environment
25import System.FilePath
25import System.FilePath
26import System.IO (hIsTerminalDevice, stdout)
26import System.IO (hIsTerminalDevice, stdout)
27import System.Posix.Process (executeFile)
27import System.Posix.Process (executeFile)
28−import System.Process (callCommand)
30import Obelisk.App
29import Obelisk.App
31import Obelisk.CliApp (Severity (..), failWith, getLogLevel, newCliConfig, putLog)
30import Obelisk.CliApp (Severity (..), failWith, getLogLevel, newCliConfig, putLog)
@@ -125,14 +124,14 @@ deployCommand :: Parser DeployCommand
125deployCommand = hsubparser $ mconcat
124deployCommand = hsubparser $ mconcat
126 [ command "init" $ info deployInitCommand $ progDesc "Initialize a deployment configuration directory"
125 [ command "init" $ info deployInitCommand $ progDesc "Initialize a deployment configuration directory"
127 , command "push" $ info (pure DeployCommand_Push) mempty
126 , 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."
129 , command "update" $ info (pure DeployCommand_Update) $ progDesc "Update the deployment's src thunk to latest"
128 , command "update" $ info (pure DeployCommand_Update) $ progDesc "Update the deployment's src thunk to latest"
132−readPlatform :: String -> Maybe Platform
131+ platformP = hsubparser $ mconcat
134− "android" -> Just Android
132+ [ command "android" $ info (pure Android) mempty
135− _ -> Nothing
133+ , command "ios" $ info (pure IOS <*> strArgument (metavar "TEAMID" <> help "Your Team ID - found in the Apple developer portal")) mempty
137deployInitCommand :: Parser DeployCommand
136deployInitCommand :: Parser DeployCommand
138deployInitCommand = fmap DeployCommand_Init $ DeployInitOpts
137deployInitCommand = fmap DeployCommand_Init $ DeployInitOpts
@@ -141,13 +140,14 @@ deployInitCommand = fmap DeployCommand_Init $ DeployInitOpts
141 <*> some (strOption (long "hostname" <> metavar "HOSTNAME" <> help "hostname of the deployment target"))
140 <*> some (strOption (long "hostname" <> metavar "HOSTNAME" <> help "hostname of the deployment target"))
142 <*> strOption (long "upstream" <> value "origin" <> metavar "REMOTE" <> help "git remote to use for the src thunk" <> showDefault)
141 <*> strOption (long "upstream" <> value "origin" <> metavar "REMOTE" <> help "git remote to use for the src thunk" <> showDefault)
144−data Platform = Android
143+type TeamID = String
144+data PlatformDeployment = Android | IOS TeamID
145 deriving (Show)
145 deriving (Show)
147data DeployCommand
147data DeployCommand
148 = DeployCommand_Init DeployInitOpts
148 = DeployCommand_Init DeployInitOpts
149 | DeployCommand_Push
149 | DeployCommand_Push
150− | DeployCommand_Test Platform
150+ | DeployCommand_Test PlatformDeployment
151 | DeployCommand_Update
151 | DeployCommand_Update
152 deriving Show
152 deriving Show
@@ -290,13 +290,9 @@ ob = \case
290 hostname = _deployInitOpts_hostname deployOpts
290 hostname = _deployInitOpts_hostname deployOpts
291 deployInit thunkPtr (root </> "config") deployDir sshKeyPath hostname
291 deployInit thunkPtr (root </> "config") deployDir sshKeyPath hostname
292 DeployCommand_Push -> deployPush "."
292 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"
299 DeployCommand_Update -> deployUpdate "."
293 DeployCommand_Update -> deployUpdate "."
294+ DeployCommand_Test Android -> deployMobile "android" []
295+ DeployCommand_Test (IOS teamID) -> deployMobile "ios" [teamID]
300 ObCommand_Run -> inNixShell' $ static run
296 ObCommand_Run -> inNixShell' $ static run
301 -- inNixShell ($(mkClosure 'ghcidAction) ())
297 -- inNixShell ($(mkClosure 'ghcidAction) ())
302 ObCommand_Thunk tc -> case tc of
298 ObCommand_Thunk tc -> case tc of