Create A Project For Fdt Fast

18 January 2010

I made a terminal script for creating new FDT projects. I use it when I want to test something or create a prototype.

Screen Shot 2010 01 18 At 18.18.23  650x321

The code can be found on the post detail page.

#!/bin/sh
 
# ------------------------------
# -  FDT stub project creator  - 
# -  Jankees van Woezik, 2010  -
# -   http://blog.base42.nl    -
# -      januari 11, 2010      -
# ------------------------------
 
if [ $# -ne 1 ]
then
	echo ""
	echo "Problem, missing path"
	echo "Usage: ./create_project.sh <path> "
	echo ""
else
	echo ""
	echo "What's the name of the project:"
	read project_name
	echo ""	
	echo "creating folder: $1"
 
	#####
	# Create project folder
	#####
 
	mkdir $1	
 
	#####
	# Create AS3_ClassPath
	#####
 
	echo "creating file: $1/.as3_classpath"
 
	echo "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>
<AS3Classpath>
    <AS3Classpath generateProblems=\"false\" type=\"lib\" useAsSharedCode=\"false\">playerglobal.swc</AS3Classpath>
    <AS3Classpath generateProblems=\"false\" type=\"lib\" useAsSharedCode=\"false\">flex.swc</AS3Classpath>
    <AS3Classpath generateProblems=\"false\" type=\"lib\" useAsSharedCode=\"false\">framework.swc</AS3Classpath>
    <AS3Classpath generateProblems=\"false\" type=\"lib\" useAsSharedCode=\"false\">rpc.swc</AS3Classpath>
    <AS3Classpath generateProblems=\"false\" type=\"lib\" useAsSharedCode=\"false\">utilities.swc</AS3Classpath>
    <AS3Classpath generateProblems=\"true\" type=\"source\" useAsSharedCode=\"false\">source</AS3Classpath>
    <AS3Classpath generateProblems=\"false\" type=\"source\" useAsSharedCode=\"false\">inlet42</AS3Classpath>
</AS3Classpath>" > $1/.as3_classpath
 
	#####
	# Create .project
	#####
 
	echo "creating file: $1/.project"
 
	echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<projectDescription>
	<name>$project_name</name>
	<comment></comment>
	<projects>
	</projects>
	<buildSpec>
		<buildCommand>
			<name>com.powerflasher.fdt.core.FlashBuilder</name>
			<arguments>
			</arguments>
		</buildCommand>
	</buildSpec>
	<natures>
		<nature>com.powerflasher.fdt.core.FlashNature</nature>
	</natures>
	<linkedResources>
		<link>
			<name>flex.swc</name>
			<type>1</type>
			<locationURI>Flex_3_SDK_0/frameworks/libs/flex.swc</locationURI>
		</link>
		<link>
			<name>framework.swc</name>
			<type>1</type>
			<locationURI>Flex_3_SDK_0/frameworks/libs/framework.swc</locationURI>
		</link>
		<link>
			<name>playerglobal.swc</name>
			<type>1</type>
			<locationURI>Flex_3_SDK_0/frameworks/libs/player/9/playerglobal.swc</locationURI>
		</link>
		<link>
			<name>rpc.swc</name>
			<type>1</type>
			<locationURI>Flex_3_SDK_0/frameworks/libs/rpc.swc</locationURI>
		</link>
		<link>
			<name>utilities.swc</name>
			<type>1</type>
			<locationURI>Flex_3_SDK_0/frameworks/libs/utilities.swc</locationURI>
		</link>
	</linkedResources>
</projectDescription>" > $1/.project
 
	#####
	# Create .settings folder
	#####
 
	echo "creating folder: $1/.settings"
 
	mkdir $1/.settings
 
	#####
	# Create settings files
	#####
 
	echo "creating file: $1/.settings/com.powerflasher.fdt.core.prefs"
 
	echo "#Sun Jan 10 22:13:28 CET 2010
com.powerflasher.fdt.core.Language=AS3
com.powerflasher.fdt.core.LanguageType=Flex_3_SDK_0
eclipse.preferences.version=1" > $1/.settings/com.powerflasher.fdt.core.prefs
 
	echo "creating file: $1/.settings/org.eclipse.core.resources.prefs"
 
	echo "#Sun Jan 10 22:13:28 CET 2010
eclipse.preferences.version=1
encoding/<project>=UTF-8" > $1/.settings/org.eclipse.core.resources.prefs
 
	#####
	# Create source folder
	#####
 
	echo "creating folder: $1/source"	
 
	mkdir $1/source
 
	#####
	# Create Main.as
	#####
 
	echo "creating file: $1/source/Main.as"
 
	echo "package {
	import flash.display.Sprite;
 
	/**
	 *	@author Jankees.van.Woezik [jankees at base42 dot nl] 
	 */
	public class Main extends Sprite {
 
		public function Main() {
		}
	}
}" > $1/source/Main.as
 
	#####
	# Create builders folder
	#####
 
	echo "creating folder: $1/builders"
 
	mkdir $1/builders
 
	#####
	# Create builder for Main.as
	#####
 
	echo "creating file: $1/builders/Main.launch"
 
	echo "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>
<launchConfiguration type=\"com.powerflasher.fdt.ui.MxmlcGroup\">
<stringAttribute key=\"APP_ARGUMENTS\" value=\"\"/>
<stringAttribute key=\"ARGUMENTS\" value=\"-default-size 800 600 -default-frame-rate 31 -default-background-color 0xFFFFFF -library-path {flexSDK}/frameworks/locale/en_US\"/>
<stringAttribute key=\"FLEX_SDK_NAME\" value=\"Flex_3_SDK_0\"/>
<booleanAttribute key=\"KILL_PREVIUOS_VIEWER\" value=\"false\"/>
<stringAttribute key=\"MAIN_CLASS\" value=\"source/Main.as\"/>
<stringAttribute key=\"OUTPUT\" value=\"bin/main.swf\"/>
<booleanAttribute key=\"PASS_CP\" value=\"true\"/>
<booleanAttribute key=\"PASS_MAIN_CLASS\" value=\"true\"/>
<booleanAttribute key=\"PASS_SWCS\" value=\"true\"/>
<intAttribute key=\"PLAYER_HEIGHT\" value=\"600\"/>
<intAttribute key=\"PLAYER_WIDTH\" value=\"800\"/>
<stringAttribute key=\"POST_COMPILE_ANT\" value=\"\"/>
<stringAttribute key=\"PRE_COMPILE_ANT\" value=\"\"/>
<stringAttribute key=\"PROJECT_NAME\" value=\"$project_name\"/>
<stringAttribute key=\"PUBLISHER_ID\" value=\"\"/>
<booleanAttribute key=\"START_SWF_ENABLED\" value=\"true\"/>
<stringAttribute key=\"START_SWF_LOCATION\" value=\"bin/main.swf\"/>
<stringAttribute key=\"START_SWF_WITH\" value=\"External SWF Viewer\"/>
<booleanAttribute key=\"USE_GLOBAL_FCSH_LOCATION\" value=\"true\"/>
<listAttribute key=\"org.eclipse.debug.core.MAPPED_RESOURCE_PATHS\">
<listEntry value=\"/$project_name\"/>
</listAttribute>
<listAttribute key=\"org.eclipse.debug.core.MAPPED_RESOURCE_TYPES\">
<listEntry value=\"4\"/>
</listAttribute>
<listAttribute key=\"org.eclipse.debug.ui.favoriteGroups\">
<listEntry value=\"org.eclipse.debug.ui.launchGroup.debug\"/>
<listEntry value=\"org.eclipse.debug.ui.launchGroup.run\"/>
</listAttribute>
<stringAttribute key=\"process_factory_id\" value=\"com.powerflasher.fdt.ui.launch.fcsh.ProcessFactory\"/>
</launchConfiguration>" > $1/builders/Main.launch
 
	echo ""
	echo "All done, the project is created and ready to be imported in FDT"
	echo ""
 
fi