Upgrade now respects moduelsPlatform values

This commit is contained in:
amorokh 2017-04-13 08:25:38 +02:00
parent ae6ef24250
commit 4c877ad339
1 changed files with 18 additions and 9 deletions

View File

@ -369,15 +369,11 @@ copyProjectClj = (interfaceName, projNameHyph) ->
devProfileTemplate = readFile "#{resources}/dev.profile" devProfileTemplate = readFile "#{resources}/dev.profile"
prodProfileTemplate = readFile "#{resources}/prod.profile" prodProfileTemplate = readFile "#{resources}/prod.profile"
devProfiles = []
prodProfiles = []
for platform in platforms
devProfiles.push devProfileTemplate.replace(platformRx, platform)
prodProfiles.push prodProfileTemplate.replace(platformRx, platform)
fs.copySync("#{resources}/project.clj", "project.clj") fs.copySync("#{resources}/project.clj", "project.clj")
deps = interfaceConf[interfaceName].deps.join("\n") deps = interfaceConf[interfaceName].deps.join("\n")
cleans = platforms.map (platform) -> "\"index.#{platform}.js\"" cleans = platforms.map (platform) -> "\"index.#{platform}.js\""
devProfiles = platforms.map (platform) -> devProfileTemplate.replace(platformRx, platform)
prodProfiles = platforms.map (platform) -> prodProfileTemplate.replace(platformRx, platform)
edit 'project.clj', [[projNameHyphRx, projNameHyph], [interfaceDepsRx, deps], [platformCleanRx, cleans.join(' ')], [devProfilesRx, devProfiles.join("\n")], [prodProfilesRx, prodProfiles.join("\n")]] edit 'project.clj', [[projNameHyphRx, projNameHyph], [interfaceDepsRx, deps], [platformCleanRx, cleans.join(' ')], [devProfilesRx, devProfiles.join("\n")], [prodProfilesRx, prodProfiles.join("\n")]]
init = (interfaceName, projName) -> init = (interfaceName, projName) ->
@ -592,9 +588,13 @@ doUpgrade = (config) ->
config.envRoots = defaultEnvRoots config.envRoots = defaultEnvRoots
unless config.platforms unless config.platforms
config.platforms = {} config.platforms =
config.platforms.ios = {"host": "localhost"} ios:
config.platforms.android = {"host": "localhost"} host: "localhost"
modules: []
android:
host: "localhost"
modules: []
if config.iosHost? if config.iosHost?
config.platforms.ios.host = config.iosHost config.platforms.ios.host = config.iosHost
@ -604,6 +604,15 @@ doUpgrade = (config) ->
config.platforms.android.host = config.androidHost config.platforms.android.host = config.androidHost
delete config.androidHost delete config.androidHost
if config.modulesPlatform?
if config.modulesPlatform.ios?
config.platforms.ios.modules = config.platforms.ios.modules.concat(config.modulesPlatform.ios)
if config.modulesPlatform.android?
config.platforms.android.modules = config.platforms.android.modules.concat(config.modulesPlatform.android)
delete config.modulesPlatform
writeConfig(config) writeConfig(config)
log 'upgraded .re-natal' log 'upgraded .re-natal'