Examples of GitHubClient


Examples of org.eclipse.egit.github.core.client.GitHubClient

    String password="";
   
    SketchCode[] theSketches;
    String[] theSketchesContent;
   
    GitHubClient client;
      GistService service;
      GistFile[] file;
      String[] filename;
      Gist gist = new Gist();
      Map<String,GistFile> mp=new HashMap<String, GistFile>();
   
    theSketches=editor.getSketch().getCode();
    theSketchesContent = new String[theSketches.length];
    file=new GistFile[theSketches.length];
    filename = new String[theSketches.length];
    int indexOfUsername=-1;
    boolean makePrivate=false;
   
    for(int j =0; j<theSketches.length; j++){
      file[j]=new GistFile();
      if(theSketches[j]==editor.getSketch().getCurrentCode()){//so you don't need to save
        theSketchesContent[j]=editor.getText();
      }else{
        theSketchesContent[j]=theSketches[j].getProgram();
      }
          if(theSketches[j].getExtension()=="ino" || theSketches[j].getExtension()=="pde"){
            indexOfUsername=theSketchesContent[j].indexOf("USE_GITHUB_USERNAME=");
            makePrivate=theSketchesContent[j].contains("MAKE_PRIVATE_ON_GITHUB");
           
            if(indexOfUsername!=-1){//if the user specifies a username in the code comments
            username=theSketchesContent[j].substring(indexOfUsername+20);
              username=username.substring(0,username.indexOf('\n')).trim();
              if(table.containsKey(username)){
                password=(String) table.get(username);
              }else{
                System.out.println("No entry found for specified username in gistCredentials.txt, check spelling and try again");
                return;
              }
          }else{ //defaults to first entry in gistCredentials.txt
              username=table.keySet().toArray()[0].toString(); //first entry
              password=(String) table.get(table.keySet().toArray()[0]);
          }
          }
    }
   
    System.out.println("Sending source to "+username+"'s github account...");
 
    client = new GitHubClient().setCredentials(username, password);
    service = new GistService(client);
     
    try{
        List<Gist> gists = service.getGists(username);
        Boolean foundMatchingGist=false;
View Full Code Here

Examples of org.eclipse.egit.github.core.client.GitHubClient

    Iterator iterator = table.keySet().iterator();
    while (iterator.hasNext()) {
      Object key = (String) iterator.next();
      String username=(String) key;
      if (!username.equals(correctUsername)){
        GitHubClient client;
          GistService service;
          Gist gist = new Gist();
       
        String password=(String) table.get(key);
       
        client = new GitHubClient().setCredentials(username, password);
          service = new GistService(client);
       
        try{
              List<Gist> gists = service.getGists(username);
              //Boolean foundMatchingGist=false;
View Full Code Here

Examples of org.eclipse.egit.github.core.client.GitHubClient

 
     
      private boolean retrieveFromGitHub(String serialNumber, String username, String password) {
       
       
        GitHubClient client = new GitHubClient().setCredentials(username, password);
        GistService service = new GistService(client);
       
        try{
          List<Gist> gists = service.getGists(username);
          Boolean foundMatchingGist=false;
View Full Code Here

Examples of org.eclipse.egit.github.core.client.GitHubClient

        // The githubclient prefers to connect to 'github.com' using the api domain, unlike github enterprise
        // which can connect fine using its domain, so for github.com use empty constructor
        if ( githubURL.getHost().equalsIgnoreCase( "github.com" ) )
        {
            this.client = new GitHubClient();
        }
        else
        {
            this.client = new GitHubClient( githubURL.getHost(), githubPort, githubScheme );
        }

        this.githubIssueURL = project.getIssueManagement().getUrl();
        if ( !this.githubIssueURL.endsWith( "/" ) )
        {
View Full Code Here

Examples of org.eclipse.egit.github.core.client.GitHubClient

   * @throws Exception
   */
  @Test
  public void validUserNameAndPassword() throws Exception {
    TestMojo mojo = new TestMojo();
    GitHubClient client = mojo.createClient(null, "a", "b", null, null,
        null, null);
    assertNotNull(client);
    assertEquals("a", mojo.user.get());
    assertEquals("b", mojo.password.get());
    assertNull(mojo.token.get());
View Full Code Here

Examples of org.eclipse.egit.github.core.client.GitHubClient

   * @throws Exception
   */
  @Test
  public void validOAuth2Token() throws Exception {
    TestMojo mojo = new TestMojo();
    GitHubClient client = mojo.createClient(null, null, null, "token",
        null, null, null);
    assertNotNull(client);
    assertNull(mojo.user.get());
    assertNull(mojo.password.get());
    assertEquals(mojo.token.get(), "token");
View Full Code Here

Examples of org.eclipse.egit.github.core.client.GitHubClient

   * @throws Exception
   */
  @Test
  public void validOAuth2TokenWithUsername() throws Exception {
    TestMojo mojo = new TestMojo();
    GitHubClient client = mojo.createClient(null, "a", null, "token", null,
        null, null);
    assertNotNull(client);
    assertNull(mojo.user.get());
    assertNull(mojo.password.get());
    assertEquals(mojo.token.get(), "token");
View Full Code Here

Examples of org.eclipse.egit.github.core.client.GitHubClient

    Server server = new Server();
    server.setId("server");
    server.setUsername("a");
    server.setPassword("b");
    settings.addServer(server);
    GitHubClient client = mojo.createClient(null, null, null, null,
        "server", settings, null);
    assertNotNull(client);
    assertEquals("a", mojo.user.get());
    assertEquals("b", mojo.password.get());
    assertNull(mojo.token.get());
View Full Code Here

Examples of org.eclipse.egit.github.core.client.GitHubClient

    Settings settings = new Settings();
    Server server = new Server();
    server.setId("server");
    server.setPassword("b");
    settings.addServer(server);
    GitHubClient client = mojo.createClient(null, null, null, null,
        "server", settings, null);
    assertNotNull(client);
    assertNull(mojo.user.get());
    assertNull(mojo.password.get());
    assertEquals("b", mojo.token.get());
View Full Code Here

Examples of org.eclipse.egit.github.core.client.GitHubClient

      catch ( ContextException ce )
      {
        ce.printStackTrace( System.err );
      }

      return new GitHubClient() {
        public GitHubClient setCredentials(String user, String password) {
          TestMojo.this.user.set(user);
          TestMojo.this.password.set(password);
          return super.setCredentials(user, password);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.