import java.io.IOException;
import org.kohsuke.args4j.Option;
-import org.kohsuke.args4j.spi.StringOptionHandler;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-//import org.tizen.ncli.ide.subcommands.CreateNativeProjectCommand;
+import org.tizen.ncli.ide.messages.TizenCLIMessages;
+import org.tizen.ncli.ide.subcommands.CreateProjectCommandData;
import org.tizen.ncli.ide.subcommands.CreateWebProjectCommand;
/**
- * @author Harry Hyeongseok Heo{@literal <hyeongseok.heo@samsung.com>} (S-core)
+ * @author Shingil Kang{@literal <shingil.kang@samsung.com>} (S-core)
*/
public class CreateWebProjectCLI extends AbstractCLI
{
- private Logger logger = LoggerFactory.getLogger(getClass());
-
@Option(name = "-t", aliases = { "--type" }, usage = "Specify template name")
private String templateName;
@Override
public void execute()
{
- logger.info("Template Name:{}", templateName);
+ log.info("Template Name:{}", templateName);
CreateWebProjectCommand webCommand = new CreateWebProjectCommand();
webCommand.setOutputName(outputDirectory.getCanonicalPath() + File.separatorChar + webCommand.getProjectName());
} catch (IOException e)
{
- logger.error(e.getMessage());
+ log.error(TizenCLIMessages.CR_CANNOT_CREATE_OUTDIR);
}
- webCommand.runCommand();
+ CreateProjectCommandData data = webCommand.runCommand();
- System.out.println("Creating web project succeeded!");
+ progressLog.info("project Location : {}",data.getOutputName());
+ progressLog.info("Creating web project succeeded!");
}
}
+/*
+ * IDE
+ *
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Shingil Kang <shingil.kang@samsung.com>
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>
+ * Kangho Kim <kh5325.kim@samsung.com>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ */
package org.tizen.ncli.ide.subcommands;
import java.io.File;
import org.tizen.nativecpp.wizards.TemplateTizenCppNewWizard;
import org.tizen.nativecpp.wizards.build.ExpressProjectGenerator;
-public class CreateNativeProjectCommand extends AbstractSubCommand<CreateProjectCommandData>
+public class CreateNativeProjectCommand extends AbstractSubCommand<CreateNativeProjectCommandData>
{
private CreateNativeProjectCommandData data = new CreateNativeProjectCommandData();
*/
@Override
- protected CreateProjectCommandData call()
+ protected CreateNativeProjectCommandData call()
{
progressLog.info("-----------------------------------------------------");
progressLog.info("Starting Tizen project creation:");
// copy native project template and generate .cproject and .project file
copyNativeProjectTemplate();
- return null;
+ return data;
}
public void copyNativeProjectTemplate()
TizenTemplateEngine.createProject(template, new WebCLIProjectGenerator());
} catch (TizenProcessFailureException e)
{
- log.error("Template is not created", e.getMessage());
+ log.error("Template is not created\n{}", e.getMessage());
}
}
}
} catch (IOException e)
{
- log.error("not crate build file", e.getMessage());
+ log.error("not crate build file\n{}", e.getMessage());
}
new File(tempDescriptionPath).delete();
}
public void setBuildConfigMap(String projectType)
{
String tempPath = pg.extractBuiltinJarFiles("templates" + File.separator + "Executables");
+ if(tempPath == null){
+ log.error("No jar folder!");
+ return;
+ }
+
tempPath = tempPath.substring(0, tempPath.lastIndexOf(File.separator));
cProjectTemplatePath = tempPath.substring(0, tempPath.lastIndexOf(File.separator));
}
} catch (Exception e)
{
+ log.error("Error occurred during reading app/shared/static teamplate!\n{}",e.getMessage());
}
}
*/
package org.tizen.ncli.ide.subcommands;
-import static org.tizen.web.common.WebConstant.ATTR_WIDGET_URI;
import static org.tizen.web.common.WebConstant.WIDGET_BASE_IDENTIFIER;
import java.io.File;
import javax.xml.bind.Marshaller;
import javax.xml.bind.Unmarshaller;
-import org.kohsuke.args4j.Option;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.tizen.common.Factory;
import org.tizen.common.core.application.InstallPathConfig;
import org.tizen.common.core.application.ProfileInfo;
-import org.tizen.common.core.application.TizenProjectDescription;
import org.tizen.common.core.application.tproject.ObjectFactory;
import org.tizen.common.core.application.tproject.Platform;
import org.tizen.common.core.application.tproject.Platforms;
import org.tizen.common.core.application.tproject.Tproject;
-import org.tizen.common.core.command.ExecutionContext;
-import org.tizen.common.core.command.Prompter;
-import org.tizen.common.core.command.policy.PolicyRegistry;
-import org.tizen.common.file.FileHandler;
-import org.tizen.common.file.StandardFileHandler;
-import org.tizen.common.util.EFSUtil;
import org.tizen.common.util.FileUtil;
import org.tizen.common.util.FreeMarkerUtil;
import org.tizen.common.util.IOUtil;
-import org.tizen.common.util.ObjectUtil;
-import org.tizen.common.util.PluginUtil;
-import org.tizen.common.util.ProjectUtil;
-import org.tizen.ncli.ide.config.ConfigConstant;
-import org.tizen.ncli.ide.shell.TizenAppType;
+import org.tizen.ncli.ide.messages.TizenCLIMessages;
import org.tizen.web.apptemplate.model.LibraryElement;
import org.tizen.web.apptemplate.model.OptionElement;
import org.tizen.web.apptemplate.model.OptionGroup;
import org.tizen.web.apptemplate.model.Options;
import org.tizen.web.apptemplate.model.SupportLibraries;
-import org.tizen.web.apptemplate.model.SupportLibrary;
import org.tizen.web.apptemplate.model.TizenTemplateKindsOfLibraries;
import org.tizen.web.common.WebConstant;
-import org.tizen.web.config.schema.model.Widget;
import org.tizen.web.model.TizenAppTemplate;
import org.tizen.web.model.TizenModelFactory;
import org.tizen.web.project.configuration.ConfigurationException;
-import org.tizen.web.project.configuration.ConfiguratorFactory;
import org.tizen.web.project.configuration.ITizenConfigurator;
-import org.tizen.web.project.configuration.TizenConfiguratorImpl;
import org.tizen.web.project.wizard.model.TizenTemplateLibrariesPool;
import org.tizen.web.project.wizard.model.TizenTemplateLibraryGroup;
-import org.tizen.web.project.wizard.operation.LibraryCopyOperation;
-import org.tizen.web.project.wizard.operation.OptionProcessOperation;
-import org.tizen.web.project.wizard.operation.TemplateCopyOperation;
import org.tizen.web.project.wizard.operation.LibraryCopyOperation.TizenWebUIFWType;
-import org.tizen.web.project.wizard.ui.commandbar.WebProjectCreator;
import freemarker.template.Configuration;
FileUtil.copyRecursively(projectPath, destDir, true, resourceFilter);
} catch (IOException e)
{
- // TODO Auto-generated catch block
- log.error(e.getMessage());
+ log.error(TizenCLIMessages.CR_CANNOT_COPY_PROJECT);
}
}
{
// unmarshal app template.
tizenAppTemplate = TizenModelFactory.unmarshalAppTemplate(configFile);
- } catch (FileNotFoundException e2)
+ } catch (FileNotFoundException e)
{
- // TODO Auto-generated catch block
- log.error(e2.getMessage());
+ log.error("not found template file\n{}", e.getMessage());
}
// get options
Options options = tizenAppTemplate.getOptions();
if(options == null){
+ log.error("not get options");
return;
}
// copy libraries
for (TizenTemplateLibraryGroup group : groupList)
{
- /*
- * if ( isSampleGroup( template ) ) {
- * group.setSelectedMinifiedWithDependsUpdate( true ); }
- */
if (group.getSelectedElement().getKindsOfLibrary() == TizenTemplateKindsOfLibraries.TIZENWEBUIFW)
{
copyTizenWebUIFWLibrary(group);
File source = new File(libraryPath);
if (!source.exists())
{
- String errorMsg = "Cannot find template library resource : " + libraryPath; // TODO
- // :
- // externalize
+ log.error("Cannot find template library resource : {}", libraryPath);
}
// create target directory
File source = new File(libraryPath);
if (!source.exists() || !source.isDirectory())
{
- String errorMsg = "Cannot find template library resource directory : " + libraryPath;
+ log.error("Cannot find template library resource folder: {}", libraryPath);
}
// decide target directory
FileUtil.copyRecursively(libraryPath, destDir, true);
} catch (IOException e)
{
- // TODO Auto-generated catch block
- log.error(e.getMessage());
+ log.error(TizenCLIMessages.CR_CANNOT_COPY_PROJECT);
}
}
FreeMarkerUtil.generateDocument(root, cfg, templateFile.getName(), originalFilePath);
} catch (IOException e)
{
- log.error("not found file", e.getMessage());
+ log.error("not found file\n{}", e.getMessage());
} catch (freemarker.template.TemplateException e)
{
- log.error("Fail to generate HTML files.", e.getMessage());
+ log.error("Fail to generate HTML files.\n{}", e.getMessage());
} finally
{
templateFile.delete();
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, Boolean.TRUE);
marshaller.marshal(tProject, file);
} catch (JAXBException e) {
- log.error("cannot marshal", e);
+ log.error("cannot marshal \n{}", e.getMessage());
}
}