Package org.bladerunnerjs.model

Examples of org.bladerunnerjs.model.App


        } catch (IllegalArgumentException ex) {
           String exceptionMsg = String.format(Messages.INVALID_LIB_TYPE_MESSAGE, libraryType, StringUtils.join(SupportedLibraryType.values(), ", ") );
           throw new CommandArgumentsException(exceptionMsg, this);
        }
   
    App app = brjs.app(appName);
    if(!app.dirExists()) throw new NodeDoesNotExistException(app, this);
   
    JsLib library = app.appJsLib(libraryName);
    if (library.dirExists()) throw new NodeAlreadyExistsException(library, this);
   
    switch ( createLibraryType ) {
      case br:
        break;
View Full Code Here


 
  @Override
  protected int doCommand(JSAPResult parsedArgs) throws CommandArgumentsException, CommandOperationException {
    String appName = parsedArgs.getString("new-app-name");
    String requirePrefix = parsedArgs.getString("require-prefix");
    App app = brjs.app(appName);
   
    if(app.dirExists()) throw new NodeAlreadyExistsException(app, this);
   
    try {
      NameValidator.assertValidDirectoryName(app);
      requirePrefix = (requirePrefix == null) ? NameValidator.generateRequirePrefixFromApp(app) : requirePrefix;
     
      app.populate(requirePrefix);
      logger.println(Messages.APP_CREATED_CONSOLE_MSG, appName);
      logger.println(" " + app.dir().getPath());
     
      app.deploy();
      logger.println(Messages.APP_DEPLOYED_CONSOLE_MSG, appName);
    }
    catch(InvalidNameException e) {
      throw new CommandArgumentsException(e, this);
    }
    catch(ModelUpdateException | TemplateInstallationException e) {
      throw new CommandOperationException("Cannot create application '" + app.dir().getPath() + "'", e);
    }
    return 0;
  }
View Full Code Here

    String appZipName = parsedArgs.getString("app-zip");
    String newAppName = parsedArgs.getString("new-app-name");
    String newAppNamespace = parsedArgs.getString("new-app-require-prefix");
   
    File appZip = (new File(appZipName).exists()) ? new File(appZipName) : new File(brjs.file("sdk"), appZipName);
    App app = brjs.app(newAppName);
   
    if(!appZip.exists()) throw new CommandArgumentsException("Couldn't find zip file at '" + appZipName + "'.", this);
    if(app.dirExists()) throw new NodeAlreadyExistsException(app, this);
   
    try
    {
      NameValidator.assertValidDirectoryName(app);
      NameValidator.assertValidRootPackageName(app, newAppNamespace);
     
      NodeImporter.importAppFromZip(new ZipFile(appZip), app, newAppNamespace);
     
      app.deploy();
     
      logger.println("Successfully imported '" + new File(appZipName).getName() + "' as new application '" + newAppName + "'");
      logger.println(" " + app.dir().getAbsolutePath());
    }
    catch(InvalidDirectoryNameException | InvalidRootPackageNameException e) {
      throw new CommandArgumentsException("Failed to import application from zip '" + appZipName + "'.", e, this);
    }
    catch (Exception e)
View Full Code Here

    return loadedClasses;
  }

  public File getCompiledClassDir(BRJS brjs, File testDir) throws IOException
  {
    App app = brjs.locateAncestorNodeOfClass(testDir, App.class);
    String relativePath = RelativePathUtility.get(brjs.getFileInfoAccessor(), app.dir(), testDir);
   
    return new File(getClassesRoot(testDir), relativePath + "/test-integration/webdriver/tests");
  }
View Full Code Here

    }
  }
 
  private void createJsDocPlaceHolder(Node node) {
    if(node instanceof App) {
      App app = (App) node;
     
      try {
        JsDocCommand.copyJsDocPlaceholder( app );
      }
      catch (IOException e) {
        logger.error(Messages.IO_ERROR_WHILE_WRITING_PLACEHOLDER_DOCS_LOG_MSG, app.getName());
      }
    }
  }
View Full Code Here

      .and(logging).containsFormattedConsoleMessage(APP_DEPLOYED_CONSOLE_MSG, app.getName());
  }
 
  @Test
  public void requirePrefixIsOptional() throws Exception {
    App myApp = brjs.app("myApp");
   
    given(appJars).hasBeenCreated();
    when(brjs).runCommand("create-app", "myApp");
    then(myApp).dirExists()
      .and(myApp.appConf()).namespaceIs("myapp");
  }
View Full Code Here

    then(myApp).dirExists()
      .and(myApp.appConf()).namespaceIs("myapp");
  }
  @Test
  public void requirePrefixIsOptionalAndCorrectPrefixIsWrittenToAppConf() throws Exception {
    App myApp = brjs.app("myApp");
   
    given(appJars).hasBeenCreated();
    when(brjs).runCommand("create-app", "myApp");
    then(myApp).dirExists()
      .and(myApp).fileContentsContains("app.conf","myapp");
View Full Code Here

    if (locale.isCompleteLocale()) {
      contentPath = i18nContentPlugin.getContentPathParser().createRequest(I18nContentPlugin.LANGUAGE_AND_LOCATION_BUNDLE, locale.getLanguageCode(), locale.getCountryCode());
    } else {
      contentPath = i18nContentPlugin.getContentPathParser().createRequest(I18nContentPlugin.LANGUAGE_BUNDLE, locale.getLanguageCode());       
    }
    App app = bundleSet.getBundlableNode().app();
    String requestPath = (isDev) ? app.createDevBundleRequest(contentPath, version) : app.createProdBundleRequest(contentPath, version);
   
    writer.write("<script type=\"text/javascript\" src=\"" + requestPath + "\"></script>\n");
  }
View Full Code Here

  }
 
  @Test
  public void testGenerateAppNamespace() throws UnableToAutomaticallyGenerateAppRequirePrefixException
  {
    App app = mock(App.class);
    when(app.getName()).thenReturn("my-App");
    assertEquals("myapp", NameValidator.generateRequirePrefixFromApp(app));
  }
View Full Code Here

  }
 
  @Test
  public void testExceptionThrownIfNamespaceCantBeAutomaticallyDetirmined() throws UnableToAutomaticallyGenerateAppRequirePrefixException
  {
    App app = mock(App.class);
    when(app.getName()).thenReturn("my�App");
    exception.expectMessage( startsWith("Unable to automatically calculate app namespace") );
    NameValidator.generateRequirePrefixFromApp(app);
  }
View Full Code Here

TOP

Related Classes of org.bladerunnerjs.model.App

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.