mirror of
https://github.com/status-im/re-natal.git
synced 2025-02-04 16:53:25 +00:00
formatting tweaks
This commit is contained in:
parent
0a5fecca0e
commit
513857dd49
44
main.coffee
44
main.coffee
@ -39,34 +39,34 @@ init = (projName) ->
|
||||
projNameUs = projName.replace(camelRx, '$1_$2').toLowerCase()
|
||||
|
||||
try
|
||||
log "Creating #{ projName }", 'bgMagenta'
|
||||
log "Creating #{projName}", 'bgMagenta'
|
||||
log ''
|
||||
|
||||
if fs.existsSync projNameHyph
|
||||
throw new Error "Directory #{ projNameHyph } already exists"
|
||||
throw new Error "Directory #{projNameHyph} already exists"
|
||||
|
||||
execSync 'type lein'
|
||||
execSync 'type pod'
|
||||
podVersion = execSync('pod --version').toString().trim()
|
||||
unless semver.satisfies podVersion, ">=#{ podMinVersion }"
|
||||
unless semver.satisfies podVersion, ">=#{podMinVersion}"
|
||||
throw new Error """
|
||||
Natal requires CocoaPods #{ podMinVersion } or higher (you have #{ podVersion }).
|
||||
Natal requires CocoaPods #{podMinVersion} or higher (you have #{podVersion}).
|
||||
Run [sudo] gem update cocoapods and try again.
|
||||
"""
|
||||
|
||||
log 'Creating Leiningen project'
|
||||
execSync "lein new #{ projNameHyph }"
|
||||
execSync "lein new #{projNameHyph}"
|
||||
|
||||
log 'Updating Leiningen project'
|
||||
process.chdir projNameHyph
|
||||
execSync "cp #{ resources }project.clj project.clj"
|
||||
execSync "cp #{resources}project.clj project.clj"
|
||||
editSync 'project.clj', [[projNameHyphRx, projNameHyph]]
|
||||
corePath = "src/#{ projNameUs }/core.clj"
|
||||
corePath = "src/#{projNameUs}/core.clj"
|
||||
fs.unlinkSync corePath
|
||||
corePath += 's'
|
||||
execSync "cp #{ resources }core.cljs #{ corePath }"
|
||||
execSync "cp #{resources}core.cljs #{corePath}"
|
||||
editSync corePath, [[projNameHyphRx, projNameHyph], [projNameRx, projName]]
|
||||
execSync "cp #{ resources }ambly.sh start.sh"
|
||||
execSync "cp #{resources}ambly.sh start.sh"
|
||||
editSync 'start.sh', [[projNameUnderRx, projNameUs]]
|
||||
|
||||
log 'Compiling ClojureScript'
|
||||
@ -92,13 +92,13 @@ init = (projName) ->
|
||||
|
||||
log 'Installing Pod dependencies'
|
||||
process.chdir 'iOS'
|
||||
execSync "cp #{ resources }Podfile ."
|
||||
execSync "cp #{resources}Podfile ."
|
||||
execSync 'pod install', stdio: 'ignore'
|
||||
|
||||
log 'Updating Xcode project'
|
||||
for ext in ['m', 'h']
|
||||
path = "#{ projName }/AppDelegate.#{ ext }"
|
||||
execSync "cp #{ resources }AppDelegate.#{ ext } #{ path }"
|
||||
path = "#{projName}/AppDelegate.#{ext}"
|
||||
execSync "cp #{resources}AppDelegate.#{ext} #{path}"
|
||||
editSync path, [[projNameRx, projName], [projNameHyphRx, projNameHyph]]
|
||||
|
||||
uuid1 = crypto
|
||||
@ -112,7 +112,7 @@ init = (projName) ->
|
||||
uuid2 = uuid2.join ''
|
||||
|
||||
editSync \
|
||||
"#{ projName }.xcodeproj/project.pbxproj",
|
||||
"#{projName}.xcodeproj/project.pbxproj",
|
||||
[
|
||||
[
|
||||
/OTHER_LDFLAGS = "-ObjC";/g
|
||||
@ -120,35 +120,37 @@ init = (projName) ->
|
||||
]
|
||||
[
|
||||
/\/\* End PBXBuildFile section \*\//
|
||||
"\t\t#{ uuid2 } /* out in Resources */ =
|
||||
{isa = PBXBuildFile; fileRef = #{ uuid1 } /* out */; };
|
||||
"\t\t#{uuid2} /* out in Resources */ =
|
||||
{isa = PBXBuildFile; fileRef = #{uuid1} /* out */; };
|
||||
\n/* End PBXBuildFile section */"
|
||||
]
|
||||
[
|
||||
/\/\* End PBXFileReference section \*\//
|
||||
"\t\t#{ uuid1 } /* out */ = {isa = PBXFileReference; lastKnownFileType
|
||||
"\t\t#{uuid1} /* out */ = {isa = PBXFileReference; lastKnownFileType
|
||||
= folder; name = out; path = ../../../target/out;
|
||||
sourceTree = \"<group>\"; };\n/* End PBXFileReference section */"
|
||||
]
|
||||
[
|
||||
/main.jsbundle \*\/\,/
|
||||
"main.jsbundle */,\n\t\t\t\t#{ uuid1 } /* out */,"
|
||||
"main.jsbundle */,\n\t\t\t\t#{uuid1} /* out */,"
|
||||
]
|
||||
[
|
||||
/\/\* LaunchScreen.xib in Resources \*\/\,/
|
||||
"/* LaunchScreen.xib in Resources */,
|
||||
\n\t\t\t\t#{ uuid2 } /* out in Resources */,"
|
||||
\n\t\t\t\t#{uuid2} /* out in Resources */,"
|
||||
]
|
||||
]
|
||||
|
||||
execSync "open #{ projName }.xcworkspace"
|
||||
process.chdir '../..'
|
||||
openXcode projName
|
||||
|
||||
log '\nWhen Xcode appears, click the play button to run the app on the simulator.', 'yellow'
|
||||
log 'Then run the following for an interactive workflow:', 'yellow'
|
||||
log "cd #{ projNameHyph }", 'inverse'
|
||||
log "cd #{projNameHyph}", 'inverse'
|
||||
log './start.sh', 'inverse'
|
||||
log 'First, choose the correct device (Probably [1]).', 'yellow'
|
||||
log 'At the REPL prompt type this:', 'yellow'
|
||||
log "(in-ns '#{ projNameHyph }.core)", 'inverse'
|
||||
log "(in-ns '#{projNameHyph}.core)", 'inverse'
|
||||
log 'Changes you make via the REPL or by changing your .cljs files should appear live.', 'yellow'
|
||||
log 'Try this command as an example:', 'yellow'
|
||||
log '(swap! app-state assoc :text "Hello Native World")', 'inverse'
|
||||
|
Loading…
x
Reference in New Issue
Block a user