PI

This is the command line interface to CloudPi Cloud Application Platform

_Copyright 2010-2012, Samsung.

  1. For Users

1.1 Prerequisite: Installing Ruby and RubyGems

Currently support Ruby version v1.8.7 and v1.9.2
Installing Ruby and RubyGems on Windows and Linux computers(If you have already installed Ruby and RubyGems, then you can skip to Installing pi Steps):
Windows:

Download and install Ruby Installer for Windows from www.rubyinstaller.org. The installer already includes RubyGems. Linux: Install the full Ruby package and RubyGems: $ apt-get install ruby-full rubygems 1.2 Installing pi

$ gem install pi
$ pi version

1.3 Quick Start

To get full help for pi command line, run:
$ pi help
To get info for pi command line, run:
$ pi info
To login, run:
$ pi login
  1. For Developers

2.1 Dependency

"json_pure", "~> 1.5.1"
"highline", "~> 1.6.1"
"rest-client", ">= 1.6.1", "< 1.7.0"
"terminal-table", "~> 1.4.2"

2.2 Creating Your Own Gem

If you want to use your own pi command line based on currently pi command line, you can rewrite your own code, then create a gem. You can refer to RubyGems Manuals (http://docs.rubygems.org/read/chapter/5). Here are simple steps:
a.create a gem specification(for example, you can define my_pi.gemspec)
b.$ gem build my_pi.gemspec, after that my_pi.gem is created.
c.$ gem push my_pi-1.0.0.gem, that will instantly deploy your gem to the rubygems.org servers, and other users will be able to install it using gem install.
d.$ gem install my_pi.gem
  1. Help

    "Usage: pi [options] command [<args>] [command_options]\n" +
    "Try 'pi help [command]' or 'pi help options' for more information."
    
    Currently available pi commands are:
    
    User
      pi login [url]                               Login
      pi logout                                    Logs current user out of the system
      pi info                                      List system information
      pi user                                      Display user information
      pi targets                                   List available targets infomation
      pi password [newpassword]                    Change the password for the current user
      pi github [name]                             Bind to the github account
      pi runtimes                                  Display the supported runtimes of the system
      pi frameworks                                Display the supported frameworks of the system
      pi version                                   Display version information
      pi help [command]                            Get general help or help on a specific command
      pi help options                              Get help on available options
    
    Project
      projects                                     List created projects 
      create-project [projectname]                 Create a new project                
      delete-project [projectname]                 Delete the project             
      project-events [projectname]                 List the event info for the project
      project-tags [projectname]                   List the tags for the project
      project-commits [projectname]                List the commit log for the project
      project-apps [projectname]                   List the applications for the project
      upload [projectname]                         Upload the war package for java project
    
  2. Example

ubuntu@admin:~$ pi login URL: ‘api.staging.samsungcloud.org’? y User: wangjing Password: ******* Successfully logged into [api.staging.samsungcloud.org]

ubuntu@admin:~$ pi version pi 0.1.14

ubuntu@admin:~$ pi user

UserName: wangjing DomainName: bst RoleName: user State: Active Github Account Name: ruanzhimin Github Account Email: [email protected]

ubuntu@admin:~$ pi targets

-----------------—————————————–+ | Name | URL | -----------------—————————————–+ | us-east-staging | us-east-staging.samsungcloud.org | | ap-ne-test | ap-ne-test.samsungcloud.org | -----------------—————————————–+

ubuntu@admin:~$ pi runtimes

-------- | Name | -------- | java | | ruby18 | --------

ubuntu@admin:~$ pi frameworks

---------- | Name | ---------- | lift | | spring | | grails | | java_web | | rails3 | | sinatra | ----------

ubuntu@admin:~$ pi password New Password: **** Verify Password: **** ok

ubuntu@admin:~$ pi github Please input your name: ruanzhimin Please input your email: [email protected] Please input your password: **************** ok

ubuntu@admin:~$ pi help

Usage: pi [options] command [<args>] [command_options] Try ‘pi help [command]’ or ‘pi help options’ for more information.

Currently available pi commands are:

User
  pi login [url]                               Login
  pi logout                                    Logs current user out of the system
  pi info                                      List system information
  pi user                                      Display user information
  pi targets                                   List available targets infomation
  pi password [newpassword]                    Change the password for the current user
  pi github [name]                             Bind to the github account
  pi runtimes                                  Display the supported runtimes of the system
  pi frameworks                                Display the supported frameworks of the system
  pi version                                   Display version information
  pi help [command]                            Get general help or help on a specific command
  pi help options                              Get help on available options

Project
  projects                                     List created projects 
  create-project [projectname]                 Create a new project                
  delete-project [projectname]                 Delete the project             
  project-events [projectname]                 List the event info for the project
  project-tags [projectname]                   List the tags for the project
  project-commits [projectname]                List the commit log for the project
  project-apps [projectname]                   List the applications for the project
  upload [projectname]                         Upload the war package for java project

ubuntu@admin:~$ pi help options

Available options:

-t [TKEY]
    --trace [TKEY]
-q, --quiet
    --verbose
    --json
-v, --version
-h, --help
    --options

ubuntu@admin:~$ pi projects

-----------------———-----------———----------------------------------------------------------------------————-+ | Name | Runtime | Framework | Git Type | GitUrl | Description | -----------------———-----------———----------------------------------------------------------------------————-+ | javatest | java | spring | cloudpi | [email protected]/wangjing/javatest.git | test | | javatestgithub | java | spring | github | git://github.com/ruanzhimin/javatestgithub.git | test | | railstest | ruby18 | rails3 | cloudpi | [email protected]/wangjing/railstest.git | test | | railstestgithub | ruby18 | rails3 | github | git://github.com/ruanzhimin/railstestgithub.git | test | | tmp1 | ruby18 | rails | cloudpi | [email protected]/wangjing/tmp1.git | test | -----------------———-----------———----------------------------------------------------------------------————-+

ubuntu@admin:~$ pi create-project Project Name: javatest Project ‘javatest’ already exists. Project Name: javademogithub

Runtime============
  1. java

  2. ruby18

Select Runtime: 1 Selected Runtime: java

Frameworks============
  1. lift

  2. spring

  3. grails

  4. java_web

Select Framework: 2 Selected Framework: spring Please enter in the description: test

Repository Types============
  1. cloudpi

  2. github

Select Repository Type: 2 Selected Repository Type: github

Publish Types============
  1. public

  2. private

Select publish Type: 1 Selected publish Type: public Creating project javademogithub: OK

ubuntu@admin:~$ pi delete-project

Project Name=======
  1. javademogithub

  2. javatest

  3. javatestgithub

  4. railstest

  5. railstestgithub

  6. tmp1

Select Project: 1 Selected Project: javademogithub Deleting project [javademogithub]: OK

ubuntu@admin:~$ pi project-apps

Project Name=======
  1. javatest

  2. javatestgithub

  3. railstest

  4. railstestgithub

  5. tmp1

Select Project: 5 Selected Project: tmp1 No applications

ubuntu@admin:~$ pi project-events

Project Name=======
  1. javatest

  2. javatestgithub

  3. railstest

  4. railstestgithub

  5. tmp1

Select Project: 5 Selected Project: tmp1 No Events.

ubuntu@admin:~$ pi project-tags

Project Name=======
  1. javatest

  2. javatestgithub

  3. railstest

  4. railstestgithub

  5. tmp1

Select Project: 5 Selected Project: tmp1

-------- | Tag | -------- | v0.0.0 | --------

ubuntu@admin:~$ pi project-commits

Project Name=======
  1. javatest

  2. javatestgithub

  3. railstest

  4. railstestgithub

  5. tmp1

Select Project: 5 Selected Project: tmp1

Tag=======
  1. v0.0.0

Select Tag: 1 Selected Tag: v0.0.0 ------------------------------------------—————————-------------- | CommitId | Date | Comment | ------------------------------------------—————————-------------- | b3d90cb9d692f7a01d0043509557c54a6a8903e4 | 2012-07-03 08:50:50 +0000 | init project | ------------------------------------------—————————--------------

ubuntu@admin:~$ pi upload

Project Name=======
  1. javatmp1

  2. railstmp3

  3. testdemowj1

  4. testdemowj2

  5. tmp1

Select Project: 1 Selected Project: javatmp1 Please enter the version: test version Please enter in the description: test Please enter the path of upload war file: /home/wangjing/workspace/sample.war

Deployment path does not exist! Please enter the path of upload war file: /home/wangjing/workspace/project/sample

Please enter the path of upload war file: ? /home/wangjing/workspace/project/sample.war Uploading OK

ubuntu@admin:~$ pi logout Successfully logged out of [api.staging.samsungcloud.org]

  1. Common Exception

ubuntu@admin:~$ pi login URL: ‘api.staging.samsungcloud.org’? n URL: test.org User: wangjing Password: ******* Problem with login, Cannot access target (getaddrinfo: Name or service not known), try again or register for an account.

ubuntu@admin:~$ pi github Please input your name: ruanzhimin Please input your email: [email protected] Please input your password: ************ Error (HTTP 500): Server Error”,“errorDescription”:“Invalid github account.”

ubuntu@admin:~$ pi project-events tmp4–trace Error (HTTP 500): Server Error”,“errorDescription”:“The project is not belongs to current account.Project name : tmp4–trace”