Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Change simctl to be a class rather than set of functions (#97)
BREAKING CHANGE: All `static` functions are now moved to members of Simctl class BREAKING CHANGE: Some function names/arguments were changed to be in sync with others
- Loading branch information
1 parent
dff8357
commit abfeab8
Showing
30 changed files
with
1,604 additions
and
1,293 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import semver from 'semver'; | ||
|
||
|
||
const DEFAULT_EXEC_TIMEOUT = 10 * 60 * 1000; // ms | ||
const XCRUN_BINARY = 'xcrun'; | ||
const SIM_RUNTIME_NAME = 'com.apple.CoreSimulator.SimRuntime.'; | ||
|
||
/** | ||
* "Normalize" the version, since iOS uses 'major.minor' but the runtimes can | ||
* be 'major.minor.patch' | ||
* | ||
* @param {string} version - the string version | ||
* @return {string} The version in 'major.minor' form | ||
* @throws {Error} If the version not parseable by the `semver` package | ||
*/ | ||
function normalizeVersion (version) { | ||
const semverVersion = semver.coerce(version); | ||
if (!semverVersion) { | ||
throw new Error(`Unable to parse version '${version}'`); | ||
} | ||
return `${semverVersion.major}.${semverVersion.minor}`; | ||
} | ||
|
||
export { | ||
DEFAULT_EXEC_TIMEOUT, XCRUN_BINARY, SIM_RUNTIME_NAME, | ||
normalizeVersion, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { logger } from 'appium-support'; | ||
|
||
const log = logger.getLogger('simctl'); | ||
|
||
export default log; |
Oops, something went wrong.