51 lines
1.3 KiB
Plaintext
51 lines
1.3 KiB
Plaintext
// cell update <alias> - Update a dependency to a new version
|
|
|
|
var io = use('io')
|
|
var shop = use('shop')
|
|
|
|
if (args.length < 1) {
|
|
log.console("Usage: cell update <alias> [new-version]")
|
|
log.console("Example: cell update jj_mod v0.7.0")
|
|
$_.stop()
|
|
return
|
|
}
|
|
|
|
var alias = args[0]
|
|
|
|
if (!io.exists('.cell/shop.toml')) {
|
|
log.error("No shop.toml found. Run 'cell init' first.")
|
|
$_.stop()
|
|
return
|
|
}
|
|
|
|
var config = shop.load_config()
|
|
if (!config || !config.dependencies || !config.dependencies[alias]) {
|
|
log.error("Dependency '" + alias + "' not found")
|
|
$_.stop()
|
|
return
|
|
}
|
|
|
|
var current_version = config.dependencies[alias]
|
|
log.console("Current version: " + current_version)
|
|
|
|
if (args.length > 1) {
|
|
// Update to specific version
|
|
var new_version = args[1]
|
|
|
|
// Parse the current locator to keep the host/path
|
|
var parsed = shop.parse_locator(current_version)
|
|
if (parsed) {
|
|
var new_locator = parsed.path + '@' + new_version
|
|
config.dependencies[alias] = new_locator
|
|
shop.save_config(config)
|
|
|
|
log.console("Updated " + alias + " to " + new_locator)
|
|
log.console("Run 'cell get " + new_locator + "' to fetch the new version")
|
|
}
|
|
} else {
|
|
// TODO: Check for latest version
|
|
log.console("TODO: Check for latest version of " + alias)
|
|
log.console("For now, specify version: cell update " + alias + " <version>")
|
|
}
|
|
|
|
$_.stop() |