[ReactNative] Init script that bootstraps new Xcode project

This commit is contained in:
Alex Kotliarskyi 2015-03-20 14:02:42 -07:00
parent d56a57c956
commit 6d88898404
2 changed files with 132 additions and 0 deletions

View File

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0620"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "SampleApp.app"
BlueprintName = "SampleApp"
ReferencedContainer = "container:SampleApp.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "SampleApp.app"
BlueprintName = "SampleApp"
ReferencedContainer = "container:SampleApp.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "SampleApp.app"
BlueprintName = "SampleApp"
ReferencedContainer = "container:SampleApp.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "SampleApp.app"
BlueprintName = "SampleApp"
ReferencedContainer = "container:SampleApp.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

44
packager/init.sh Executable file
View File

@ -0,0 +1,44 @@
#!/usr/bin/env ruby
def cp(src, dest, app_name)
if File.directory?(src)
Dir.mkdir(dest) unless Dir.exists?(dest)
else
content = File.read(src)
.gsub("SampleApp", app_name)
.gsub("Examples/#{app_name}/", "")
.gsub("../../Libraries/", "node_modules/react-native/Libraries/")
.gsub("../../ReactKit/", "node_modules/react-native/ReactKit/")
File.write(dest, content)
end
end
def main(dest, app_name)
source = File.expand_path("../../Examples/SampleApp", __FILE__)
files = Dir.chdir(source) { Dir["**/*"] }
.reject { |file| file["project.xcworkspace"] || file["xcuserdata"] }
.each { |file|
new_file = file.gsub("SampleApp", app_name)
cp File.join(source, file), File.join(dest, new_file), app_name
}
end
if ARGV.count == 0
puts "Usage: #{__FILE__} <ProjectNameInCamelCase>"
puts ""
puts "This script will bootstrap new React Native app in current folder"
else
app_name = ARGV.first
dest = Dir.pwd
puts "Setting up new React Native app in #{dest}"
puts ""
main(dest, app_name)
puts "Next steps:"
puts ""
puts " Open #{app_name}.xcproject in Xcode"
puts " Hit Run button"
puts ""
end