CLI: Improved the logic to create the web configuraton file 24/16124/1
authorshingil.kang <shingil.kang@samsung.com>
Fri, 7 Feb 2014 08:20:19 +0000 (17:20 +0900)
committershingil.kang <shingil.kang@samsung.com>
Fri, 7 Feb 2014 08:24:44 +0000 (17:24 +0900)
Added config template file

Change-Id: Ic29b4579fc64291f9f585f0fcfd5e451f2ccbcb3
Signed-off-by: shingil.kang <shingil.kang@samsung.com>
build.xml
org.tizen.ncli.ide/resources/config.xml [new file with mode: 0644]
org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/CreateWebProjectCommand.java

index e132dab..68888e4 100644 (file)
--- a/build.xml
+++ b/build.xml
                        </classpath>
                </javac>
                <!-- jar: new cli -->
-               <jar basedir="${build}" destfile="${dist}/${newcli-jar}" />
+               <jar destfile="${dist}/${newcli-jar}" >
+                       <fileset dir="${build}" />
+                       <fileset dir="${newcli-project}"
+                                includes="**/resources/config.xml"/>
+               </jar>
                <!-- jar: new cli autocomplete -->
                <manifest file="MANIFEST.MF">
                        <attribute name="Main-Class" value="${newcli-autocomplete-path}/${newcli-autocomplete}"/>
@@ -68,6 +72,4 @@
                <delete dir="${build}" quiet="true"/>
                <!-- End: new cli-->
        </target>
-
-
 </project>
diff --git a/org.tizen.ncli.ide/resources/config.xml b/org.tizen.ncli.ide/resources/config.xml
new file mode 100644 (file)
index 0000000..d81de2d
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets" version="1.0.0" viewmodes="maximized">
+    <tizen:application id="${APP_ID}.${WIDGET_ID}" package="${APP_ID}" required_version="2.2"/>
+    <feature name="http://tizen.org/feature/screen.size.all"/>
+    <icon src="icon.png"/>
+    <content src="index.html"/>
+    <name>${WIDGET_ID}</name>
+</widget>
\ No newline at end of file
index 4ac6c16..bde4e88 100644 (file)
@@ -771,9 +771,7 @@ class ProjectGenUtil
 {
     protected final Logger logger = LoggerFactory.getLogger( getClass() );
 
-    private final String CONFIG_FILE = "/config/Tizen/config.xml";
-    private final String CONFIG_EXTRA_TIZEN_INFO = "    <tizen:application id=\"${APP_ID}.${WIDGET_ID}\" package=\"${APP_ID}\" required_version=\"2.2\"/>";
-    private final String CONFIG_EXTRA_NAME_INFO = "    <name>${WIDGET_ID}</name>";
+    private final String CONFIG_FILE = "/resources/config.xml";
 
     public void copyConfigFile(String destConfigPath)
     {
@@ -787,61 +785,12 @@ class ProjectGenUtil
             FileUtil.redirectStream(ips, fos);
         } catch (IOException e)
         {
-            // logger.error(e.getMessage());
+            logger.error("Error occurs while creating config.xml file", e.getMessage());
 
         } finally
         {
             IOUtil.tryClose(ips, fos);
         }
-
-        addExtraInfo2Config(destConfigPath);
-    }
-
-    public void addExtraInfo2Config(String destConfigPath)
-    {
-        OutputStreamWriter out = null;
-        Scanner scanner = null;
-
-        String newLine = System.getProperty("line.separator");
-        File destConfigFile = null;
-        File outputConfigFile = null;
-
-        try
-        {
-            scanner = new Scanner(new FileInputStream(destConfigPath));
-            out = new OutputStreamWriter(new FileOutputStream(destConfigPath + ".output"));
-
-            String line;
-            while (scanner.hasNextLine())
-            {
-                line = scanner.nextLine();
-
-                out.write(line);
-                out.write(newLine);
-
-                if (line.startsWith("<widget"))
-                {
-                    out.write(CONFIG_EXTRA_TIZEN_INFO);
-                    out.write(newLine);
-                    out.write(CONFIG_EXTRA_NAME_INFO);
-                    out.write(newLine);
-                }
-            }
-
-            destConfigFile = new File(destConfigPath);
-            outputConfigFile = new File(destConfigPath + ".output");
-        } catch (IOException e)
-        {
-            logger.error(e.getMessage());
-        } finally
-        {
-            IOUtil.tryClose(scanner, out);
-            if(null != destConfigFile)
-                destConfigFile.delete();
-            if(null != outputConfigFile)
-                outputConfigFile.renameTo(destConfigFile);
-        }
-
     }
 
     /* extract jar file and get the extracted folder path