pi 0.1.13

Sign up to get free protection for your applications and to get access to all the features.
data/README ADDED
@@ -0,0 +1,402 @@
1
+ PI
2
+
3
+ This is the command line interface to CloudPi Cloud Application Platform
4
+
5
+ _Copyright 2010-2012, Samsung.
6
+
7
+ 1. For Users
8
+
9
+ 1.1 Prerequisite: Installing Ruby and RubyGems
10
+
11
+ Currently support Ruby version v1.8.7 and v1.9.2
12
+ 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):
13
+ Windows:
14
+ Download and install Ruby Installer for Windows from http://www.rubyinstaller.org. The installer already includes RubyGems.
15
+ Linux:
16
+ Install the full Ruby package and RubyGems:
17
+ $ apt-get install ruby-full rubygems
18
+
19
+ 1.2 Installing pi
20
+
21
+ $ gem install pi
22
+ $ pi version
23
+
24
+ 1.3 Quick Start
25
+
26
+ To get full help for pi command line, run:
27
+ $ pi help
28
+ To get info for pi command line, run:
29
+ $ pi info
30
+ To login, run:
31
+ $ pi login
32
+
33
+ 2. For Developers
34
+
35
+ 2.1 Dependency
36
+
37
+ "json_pure", "~> 1.5.1"
38
+ "highline", "~> 1.6.1"
39
+ "rest-client", ">= 1.6.1", "< 1.7.0"
40
+ "terminal-table", "~> 1.4.2"
41
+
42
+ 2.2 Creating Your Own Gem
43
+
44
+ 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:
45
+ a.create a gem specification(for example, you can define my_pi.gemspec)
46
+ b.$ gem build my_pi.gemspec, after that my_pi.gem is created.
47
+ 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.
48
+ d.$ gem install my_pi.gem
49
+
50
+ 3. Help
51
+
52
+ "Usage: pi [options] command [<args>] [command_options]\n" +
53
+ "Try 'pi help [command]' or 'pi help options' for more information."
54
+
55
+ Currently available pi commands are:
56
+
57
+ User
58
+ pi login [url] Login
59
+ pi logout Logs current user out of the system
60
+ pi info List system information
61
+ pi user Display user information
62
+ pi targets List available targets infomation
63
+ pi password [newpassword] Change the password for the current user
64
+ pi github [name] Bind to the github account
65
+ pi runtimes Display the supported runtimes of the system
66
+ pi frameworks Display the supported frameworks of the system
67
+ pi version Display version information
68
+ pi help [command] Get general help or help on a specific command
69
+ pi help options Get help on available options
70
+
71
+ Project
72
+ projects List created projects
73
+ create-project [projectname] Create a new project
74
+ delete-project [projectname] Delete the project
75
+ project-events [projectname] List the event info for the project
76
+ project-tags [projectname] List the tags for the project
77
+ project-commits [projectname] List the commit log for the project
78
+ project-apps [projectname] List the applications for the project
79
+ upload [projectname] Upload the war package for java project
80
+
81
+ 4. Example
82
+
83
+ wangjing@wangjing-samsung-Desktop-System:~/git/pi/bin$ ./pi login
84
+ URL: 'http://api.staging.samsungcloud.org'? y
85
+ User: wangjing
86
+ Password: *******
87
+ Successfully logged into [http://api.staging.samsungcloud.org]
88
+
89
+ wangjing@wangjing-samsung-Desktop-System:~/git/pi/bin$ ./pi info
90
+
91
+ Name: api
92
+ Description: CloudPi API Component
93
+ Build: continuously-20120709034655
94
+ Version: coulibiac-f85849
95
+
96
+ wangjing@wangjing-samsung-Desktop-System:~/git/pi/bin$ ./pi user
97
+
98
+ UserName: wangjing
99
+ DomainName: bst
100
+ RoleName: user
101
+ State: Active
102
+ Github Account Name: null
103
+ Github Account Email: null
104
+
105
+ wangjing@wangjing-samsung-Desktop-System:~/git/pi/bin$ ./pi targets
106
+
107
+ +-----------------+-----------------------------------------+
108
+ | Name | URL |
109
+ +-----------------+-----------------------------------------+
110
+ | us-east-staging | http://us-east-staging.samsungcloud.org |
111
+ | ap-ne-test | http://ap-ne-test.samsungcloud.org |
112
+ +-----------------+-----------------------------------------+
113
+
114
+ wangjing@wangjing-samsung-Desktop-System:~/git/pi/bin$ ./pi password
115
+ New Password: ****
116
+ Verify Password: ****
117
+ ok
118
+
119
+ wangjing@wangjing-samsung-Desktop-System:~/git/pi/bin$ ./pi github
120
+ Please input your name: ruanzhimin
121
+ Please input your email: ruanzhimin@gmail.com
122
+ Please input your password: ****************
123
+ ok
124
+
125
+ wangjing@wangjing-samsung-Desktop-System:~/git/pi/bin$ ./pi user
126
+
127
+ UserName: wangjing
128
+ DomainName: bst
129
+ RoleName: user
130
+ State: Active
131
+ Github Account Name: ruanzhimin
132
+ Github Account Email: ruanzhimin@gmail.com
133
+
134
+ wangjing@wangjing-samsung-Desktop-System:~/git/pi/bin$ ./pi runtimes
135
+
136
+ +--------+
137
+ | Name |
138
+ +--------+
139
+ | java |
140
+ | ruby18 |
141
+ +--------+
142
+
143
+ wangjing@wangjing-samsung-Desktop-System:~/git/pi/bin$ ./pi runtimes --json
144
+ [
145
+ "java",
146
+ "ruby18"
147
+ ]
148
+
149
+ wangjing@wangjing-samsung-Desktop-System:~/git/pi/bin$ ./pi runtimes --trace
150
+ >>>
151
+ REQUEST: get http://api.staging.samsungcloud.org/info/runtimes
152
+ RESPONSE_HEADERS:
153
+ set_cookie : PLAY_FLASH=;Expires=Mon, 9-Jul-12 09:16:40 GMT;Path=/PLAY_ERRORS=;Expires=Mon, 9-Jul-12 09:16:40 GMT;Path=/PLAY_SESSION=;Expires=M
154
+ on, 9-Jul-12 09:16:40 GMT;Path=/
155
+ cache_control : no-cache
156
+ connection : keep-alive
157
+ server : Play! Framework;1.2.3;prod
158
+ content_length : 17
159
+ content_type : application/json
160
+ RESPONSE: [200]
161
+ [
162
+ "java",
163
+ "ruby18"
164
+ ]
165
+ <<<
166
+
167
+ +--------+
168
+ | Name |
169
+ +--------+
170
+ | java |
171
+ | ruby18 |
172
+ +--------+
173
+
174
+ wangjing@wangjing-samsung-Desktop-System:~/git/pi/bin$ ./pi frameworks
175
+
176
+ +----------+
177
+ | Name |
178
+ +----------+
179
+ | lift |
180
+ | spring |
181
+ | grails |
182
+ | java_web |
183
+ | rails3 |
184
+ | sinatra |
185
+ +----------+
186
+
187
+ wangjing@wangjing-samsung-Desktop-System:~/git/pi/bin$ ./pi version
188
+ pi 0.1.13 Coulibiac
189
+
190
+ wangjing@wangjing-samsung-Desktop-System:~/git/pi/bin$ ./pi v
191
+ pi 0.1.13 Coulibiac
192
+
193
+ wangjing@wangjing-samsung-Desktop-System:~/git/pi/bin$ ./pi -v
194
+ pi 0.1.13 Coulibiac
195
+
196
+ wangjing@wangjing-samsung-Desktop-System:~/git/pi/bin$ ./pi --version
197
+ pi 0.1.13 Coulibiac
198
+
199
+ wangjing@wangjing-samsung-Desktop-System:~/git/pi/bin$ ./pi help
200
+
201
+ Usage: pi [options] command [<args>] [command_options]
202
+ Try 'pi help [command]' or 'pi help options' for more information.
203
+
204
+ Currently available pi commands are:
205
+
206
+ User
207
+ pi login [url] Login
208
+ pi logout Logs current user out of the system
209
+ pi info List system information
210
+ pi user Display user information
211
+ pi targets List available targets infomation
212
+ pi password [newpassword] Change the password for the current user
213
+ pi github [name] Bind to the github account
214
+ pi runtimes Display the supported runtimes of the system
215
+ pi frameworks Display the supported frameworks of the system
216
+ pi version Display version information
217
+ pi help [command] Get general help or help on a specific command
218
+ pi help options Get help on available options
219
+
220
+ Project
221
+ projects List created projects
222
+ create-project [projectname] Create a new project
223
+ delete-project [projectname] Delete the project
224
+ project-events [projectname] List the event info for the project
225
+ project-tags [projectname] List the tags for the project
226
+ project-commits [projectname] List the commit log for the project
227
+ project-apps [projectname] List the applications for the project
228
+ upload [projectname] Upload the war package for java project
229
+
230
+ wangjing@wangjing-samsung-Desktop-System:~/git/pi/bin$ ./pi help options
231
+
232
+ Available options:
233
+
234
+ -t [TKEY]
235
+ --trace [TKEY]
236
+ -q, --quiet
237
+ --verbose
238
+ --json
239
+ -v, --version
240
+ -h, --help
241
+ --options
242
+
243
+ wangjing@wangjing-samsung-Desktop-System:~/git/pi/bin$ ./pi projects
244
+
245
+ +-------------+---------+-----------+-----------------------------------------------------------------------+-------------+
246
+ | Name | Runtime | Framework | GitUrl | Description |
247
+ +-------------+---------+-----------+-----------------------------------------------------------------------+-------------+
248
+ | javatmp1 | Java | Spring | http://wangjing@git-staging.samsungcloud.org/wangjing/javatmp1.git | test |
249
+ | railstmp3 | Ruby | Rails | http://wangjing@git-staging.samsungcloud.org/wangjing/railstmp3.git | test |
250
+ | testdemowj1 | Ruby | Rails3 | http://wangjing@git-staging.samsungcloud.org/wangjing/testdemowj1.git | test |
251
+ | testdemowj2 | JVM | Spring | http://wangjing@git-staging.samsungcloud.org/wangjing/testdemowj2.git | test |
252
+ | tmp1 | ruby18 | rails | http://wangjing@git-staging.samsungcloud.org/wangjing/tmp1.git | test |
253
+ +-------------+---------+-----------+-----------------------------------------------------------------------+-------------+
254
+
255
+ wangjing@wangjing-samsung-Desktop-System:~/git/pi/bin$ ./pi create-project
256
+ Project Name: javatmp1
257
+ Project 'javatmp1' already exists.
258
+ Project Name: javademo
259
+ =============Runtime============
260
+ 1. java
261
+ 2. ruby18
262
+ Select Runtime: 1
263
+ Selected Runtime: java
264
+ =============Frameworks============
265
+ 1. lift
266
+ 2. spring
267
+ 3. grails
268
+ 4. java_web
269
+ Select Framework: 2
270
+ Selected Framework: spring
271
+ Please enter in the description: test
272
+ Creating project javademo: OK
273
+
274
+ wangjing@wangjing-samsung-Desktop-System:~/git/pi/bin$ ./pi projects
275
+
276
+ +-------------+---------+-----------+-----------------------------------------------------------------------+-------------+
277
+ | Name | Runtime | Framework | GitUrl | Description |
278
+ +-------------+---------+-----------+-----------------------------------------------------------------------+-------------+
279
+ | javademo | java | spring | http://wangjing@git-staging.samsungcloud.org/wangjing/javademo.git | test |
280
+ | javatmp1 | Java | Spring | http://wangjing@git-staging.samsungcloud.org/wangjing/javatmp1.git | test |
281
+ | railstmp3 | Ruby | Rails | http://wangjing@git-staging.samsungcloud.org/wangjing/railstmp3.git | test |
282
+ | testdemowj1 | Ruby | Rails3 | http://wangjing@git-staging.samsungcloud.org/wangjing/testdemowj1.git | test |
283
+ | testdemowj2 | JVM | Spring | http://wangjing@git-staging.samsungcloud.org/wangjing/testdemowj2.git | test |
284
+ | tmp1 | ruby18 | rails | http://wangjing@git-staging.samsungcloud.org/wangjing/tmp1.git | test |
285
+ +-------------+---------+-----------+-----------------------------------------------------------------------+-------------+
286
+
287
+ wangjing@wangjing-samsung-Desktop-System:~/git/pi/bin$ ./pi delete-project
288
+ =============Project Name=======
289
+ 1. javademo
290
+ 2. javatmp1
291
+ 3. railstmp3
292
+ 4. testdemowj1
293
+ 5. testdemowj2
294
+ 6. tmp1
295
+ Select Project: 1
296
+ Selected Project: javademo
297
+ Deleting project [javademo]: OK
298
+
299
+ wangjing@wangjing-samsung-Desktop-System:~/git/pi/bin$ ./pi projects
300
+
301
+ +-------------+---------+-----------+-----------------------------------------------------------------------+-------------+
302
+ | Name | Runtime | Framework | GitUrl | Description |
303
+ +-------------+---------+-----------+-----------------------------------------------------------------------+-------------+
304
+ | javatmp1 | Java | Spring | http://wangjing@git-staging.samsungcloud.org/wangjing/javatmp1.git | test |
305
+ | railstmp3 | Ruby | Rails | http://wangjing@git-staging.samsungcloud.org/wangjing/railstmp3.git | test |
306
+ | testdemowj1 | Ruby | Rails3 | http://wangjing@git-staging.samsungcloud.org/wangjing/testdemowj1.git | test |
307
+ | testdemowj2 | JVM | Spring | http://wangjing@git-staging.samsungcloud.org/wangjing/testdemowj2.git | test |
308
+ | tmp1 | ruby18 | rails | http://wangjing@git-staging.samsungcloud.org/wangjing/tmp1.git | test |
309
+ +-------------+---------+-----------+-----------------------------------------------------------------------+-------------+
310
+
311
+ wangjing@wangjing-samsung-Desktop-System:~/git/pi/bin$ ./pi project-apps
312
+ =============Project Name=======
313
+ 1. javatmp1
314
+ 2. railstmp3
315
+ 3. testdemowj1
316
+ 4. testdemowj2
317
+ 5. tmp1
318
+ Select Project: 5
319
+ Selected Project: tmp1
320
+ No applications
321
+
322
+ wangjing@wangjing-samsung-Desktop-System:~/git/pi/bin$ ./pi project-events
323
+ =============Project Name=======
324
+ 1. javatmp1
325
+ 2. railstmp3
326
+ 3. testdemowj1
327
+ 4. testdemowj2
328
+ 5. tmp1
329
+ Select Project: 5
330
+ Selected Project: tmp1
331
+ No Events.
332
+
333
+ wangjing@wangjing-samsung-Desktop-System:~/git/pi/bin$ ./pi project-tags
334
+ =============Project Name=======
335
+ 1. javatmp1
336
+ 2. railstmp3
337
+ 3. testdemowj1
338
+ 4. testdemowj2
339
+ 5. tmp1
340
+ Select Project: 5
341
+ Selected Project: tmp1
342
+
343
+ +--------+
344
+ | Tag |
345
+ +--------+
346
+ | v0.0.0 |
347
+ +--------+
348
+
349
+ wangjing@wangjing-samsung-Desktop-System:~/git/pi/bin$ ./pi project-commits
350
+ =============Project Name=======
351
+ 1. javatmp1
352
+ 2. railstmp3
353
+ 3. testdemowj1
354
+ 4. testdemowj2
355
+ 5. tmp1
356
+ Select Project: 5
357
+ Selected Project: tmp1
358
+
359
+ =============Tag=======
360
+ 1. v0.0.0
361
+ Select Tag: 1
362
+ Selected Tag: v0.0.0
363
+ +------------------------------------------+---------------------------+--------------+
364
+ | CommitId | Date | Comment |
365
+ +------------------------------------------+---------------------------+--------------+
366
+ | b3d90cb9d692f7a01d0043509557c54a6a8903e4 | 2012-07-03 08:50:50 +0000 | init project |
367
+ +------------------------------------------+---------------------------+--------------+
368
+
369
+ wangjing@wangjing-samsung-Desktop-System:~/git/pi/bin$ ./pi upload
370
+ =============Project Name=======
371
+ 1. javatmp1
372
+ 2. railstmp3
373
+ 3. testdemowj1
374
+ 4. testdemowj2
375
+ 5. tmp1
376
+ Select Project: 1
377
+ Selected Project: javatmp1
378
+ Please enter in the description: test
379
+ Please enter the version: test version
380
+ Please enter the path of upload war file: /home/wangjing/workspace/sample.war
381
+ Deployment path does not exist!
382
+ Please enter the path of upload war file: /home/wangjing/workspace/project/sample
383
+ Please enter the path of upload war file:
384
+ ? /home/wangjing/workspace/project/sample.war
385
+ Uploading OK
386
+
387
+ wangjing@wangjing-samsung-Desktop-System:~/git/pi/bin$ ./pi logout
388
+ Successfully logged out of [http://api.staging.samsungcloud.org]
389
+
390
+ 5. Common Exception
391
+
392
+ wangjing@wangjing-samsung-Desktop-System:~/git/pi/bin$ ./pi login
393
+ URL: 'http://api.staging.samsungcloud.org'? n
394
+ URL: http://test.org
395
+ User: wangjing
396
+ Password: *******
397
+ Problem with login, Cannot access target (getaddrinfo: Name or service not known), try again or register for an account.
398
+
399
+ wangjing@wangjing-samsung-Desktop-System:~/git/pi/bin$ ./pi project-events tmp4--trace
400
+ Error (HTTP 500): {"httpCode":500,"errorCode":3004,"httpDescription":"Internal Server Error","errorDescription":"The project is
401
+ not belongs to current account.Project name : tmp4--trace"}
402
+
data/Rakefile ADDED
@@ -0,0 +1,17 @@
1
+ require 'rake'
2
+ require 'spec/rake/spectask'
3
+
4
+ desc "Run specs"
5
+ task :spec do
6
+ sh('bundle install')
7
+ Spec::Rake::SpecTask.new('spec') do |t|
8
+ t.spec_opts = %w(-fs -c)
9
+ t.spec_files = FileList['spec/**/*_spec.rb']
10
+ end
11
+ end
12
+
13
+ desc "Synonym for spec"
14
+ task :test => :spec
15
+ desc "Synonym for spec"
16
+ task :tests => :spec
17
+ task :default => :spec
data/bin/pi ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require File.expand_path('../../lib/cli', __FILE__)
4
+
5
+ PI::Cli::Runner.run(ARGV.dup)
6
+
data/lib/cli.rb ADDED
@@ -0,0 +1,25 @@
1
+
2
+ ROOT = File.expand_path(File.dirname(__FILE__))
3
+
4
+ module PI
5
+
6
+ autoload :Client, "#{ROOT}/pi/client"
7
+
8
+ module Cli
9
+
10
+ autoload :Config, "#{ROOT}/cli/config"
11
+ autoload :Runner, "#{ROOT}/cli/runner"
12
+
13
+ module Command
14
+ autoload :Base, "#{ROOT}/cli/commands/base"
15
+ autoload :Projects, "#{ROOT}/cli/commands/projects"
16
+ autoload :Misc, "#{ROOT}/cli/commands/misc"
17
+ autoload :User, "#{ROOT}/cli/commands/user"
18
+ end
19
+
20
+ end
21
+ end
22
+
23
+ require "#{ROOT}/cli/version"
24
+ require "#{ROOT}/cli/core_ext"
25
+ require "#{ROOT}/cli/errors"