circleci 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 04056867e88eb217db97d350b1eb1faf1609f475
4
+ data.tar.gz: d53e9a9219df13259dbc10968a03f961088ad077
5
+ SHA512:
6
+ metadata.gz: ab88cfa60af02d17a1f530da5a0df3803fc47045fc9243165ed6a5aedabc4fe3037a24020f3cd3a18cc39814fe59d1c3e9b6c31f8239cda840b7b0cfdd3add52
7
+ data.tar.gz: a305b3c3c00ce1e2c1d8f8c0c30e90441b2c075f735efff24e523762d465a2216a7011a5ecffa88fb9f0366cf9e414df373a4332582cf23df6be00784e086e4a
data/README.md CHANGED
@@ -2,6 +2,7 @@ circleci
2
2
  ========
3
3
 
4
4
  [![Build Status](https://travis-ci.org/mtchavez/circleci.png)](https://travis-ci.org/mtchavez/circleci)
5
+ [![endorse](http://api.coderwall.com/mtchavez/endorsecount.png)](http://coderwall.com/mtchavez)
5
6
 
6
7
  Circle CI API Wrapper
7
8
 
@@ -31,7 +32,9 @@ end
31
32
 
32
33
  ### User
33
34
 
34
- The ```/me``` endpoint provides information about the signed in user.
35
+ #### CircleCi::User.me
36
+
37
+ Provides information about the signed in user.
35
38
 
36
39
  ```ruby
37
40
  res = CircleCi::User.me
@@ -48,3 +51,286 @@ Example response
48
51
  }
49
52
  ```
50
53
 
54
+ ### Project
55
+
56
+ #### CircleCi::Project.all
57
+
58
+ List of all the repos you have access to on Github, with build information organized by branch.
59
+
60
+ ```ruby
61
+ res = CircleCi::Project.all
62
+ res.success?
63
+ res.body
64
+ ```
65
+
66
+ Example response
67
+
68
+ ```json
69
+ [ {
70
+ "vcs_url": "https://github.com/circleci/mongofinil"
71
+ "followed": true // true if you follow this project in Circle
72
+ "branches" : {
73
+ "master" : {
74
+ "pusher_logins" : [ "pbiggar", "arohner" ], // users who have pushed
75
+ "last_non_success" : { // last failed build on this branch
76
+ "pushed_at" : "2013-02-12T21:33:14Z",
77
+ "vcs_revision" : "1d231626ba1d2838e599c5c598d28e2306ad4e48",
78
+ "build_num" : 22,
79
+ "outcome" : "failed",
80
+ },
81
+ "last_success" : { // last successful build on this branch
82
+ "pushed_at" : "2012-08-09T03:59:53Z",
83
+ "vcs_revision" : "384211bbe72b2a22997116a78788117b3922d570",
84
+ "build_num" : 15,
85
+ "outcome" : "success",
86
+ },
87
+ "recent_builds" : [ { // last 5 builds, ordered by pushed_at (decreasing)
88
+ "pushed_at" : "2013-02-12T21:33:14Z",
89
+ "vcs_revision" : "1d231626ba1d2838e599c5c598d28e2306ad4e48",
90
+ "build_num" : 22,
91
+ "outcome" : "failed",
92
+ }, {
93
+ "pushed_at" : "2013-02-11T03:09:54Z",
94
+ "vcs_revision" : "0553ba86b35a97e22ead78b0d568f6a7c79b838d",
95
+ "build_num" : 21,
96
+ "outcome" : "failed",
97
+ }, ... ],
98
+ "running_builds" : [ ] // currently running builds
99
+ }
100
+ }
101
+ } ]
102
+ ```
103
+
104
+ #### CircleCi::Project.recent_builds
105
+
106
+ Build summary for each of the last 30 recent builds, ordered by build_num.
107
+
108
+ ```ruby
109
+ res = CirclCi::Project.recent_builds 'username', 'reponame'
110
+ res.success?
111
+ res.body
112
+ ```
113
+
114
+ Example response
115
+
116
+ ```json
117
+ [ {
118
+ "vcs_url" : "https://github.com/circleci/mongofinil",
119
+ "build_url" : "https://circleci.com/gh/circleci/mongofinil/22",
120
+ "build_num" : 22,
121
+ "branch" : "master",
122
+ "vcs_revision" : "1d231626ba1d2838e599c5c598d28e2306ad4e48",
123
+ "committer_name" : "Allen Rohner",
124
+ "committer_email" : "arohner@gmail.com",
125
+ "subject" : "Don't explode when the system clock shifts backwards",
126
+ "body" : "", // commit message body
127
+ "why" : "github", // short string explaining the reason we built
128
+ "dont_build" : null, // reason why we didn't build, if we didn't build
129
+ "queued_at" : "2013-02-12T21:33:30Z" // time build was queued
130
+ "start_time" : "2013-02-12T21:33:38Z", // time build started running
131
+ "stop_time" : "2013-02-12T21:34:01Z", // time build finished running
132
+ "build_time_millis" : 23505,
133
+ "lifecycle" : "finished",
134
+ "outcome" : "failed",
135
+ "status" : "failed",
136
+ "retry_of" : null, // build_num of the build this is a retry of
137
+ "previous" : { // previous build
138
+ "status" : "failed",
139
+ "build_num" : 21
140
+ } ]
141
+ ```
142
+
143
+ #### CircleCi::Project.recent_builds_branch
144
+
145
+ Build summary for each of the last 30 recent builds for a specific branch, ordered by build_num.
146
+
147
+ ```ruby
148
+ res = CirclCi::Project.recent_builds_branch 'username', 'reponame', 'branch'
149
+ res.success?
150
+ res.body
151
+ ```
152
+
153
+ Example response
154
+
155
+ ```json
156
+ [ {
157
+ "vcs_url" : "https://github.com/circleci/mongofinil",
158
+ "build_url" : "https://circleci.com/gh/circleci/mongofinil/22",
159
+ "build_num" : 22,
160
+ "branch" : "new_feature",
161
+ "vcs_revision" : "1d231626ba1d2838e599c5c598d28e2306ad4e48",
162
+ "committer_name" : "Allen Rohner",
163
+ "committer_email" : "arohner@gmail.com",
164
+ "subject" : "Don't explode when the system clock shifts backwards",
165
+ "body" : "", // commit message body
166
+ "why" : "github", // short string explaining the reason we built
167
+ "dont_build" : null, // reason why we didn't build, if we didn't build
168
+ "queued_at" : "2013-02-12T21:33:30Z" // time build was queued
169
+ "start_time" : "2013-02-12T21:33:38Z", // time build started running
170
+ "stop_time" : "2013-02-12T21:34:01Z", // time build finished running
171
+ "build_time_millis" : 23505,
172
+ "lifecycle" : "finished",
173
+ "outcome" : "failed",
174
+ "status" : "failed",
175
+ "retry_of" : null, // build_num of the build this is a retry of
176
+ "previous" : { // previous build
177
+ "status" : "failed",
178
+ "build_num" : 21
179
+ } ]
180
+ ```
181
+
182
+ #### CircleCi::Project.clear_cache
183
+
184
+ Clears the cache for a project
185
+
186
+ ```ruby
187
+ res = CircleCi::Project.clear_cache
188
+ res.body['status']
189
+ ```
190
+
191
+ Example response
192
+
193
+ ```json
194
+ {
195
+ "status" : "build caches deleted"
196
+ }
197
+ ```
198
+
199
+ ### Build
200
+
201
+ #### CircleCi::Build.get
202
+
203
+ Full details for a single build, including the output for all actions. The response includes all of the fields from the build summary.
204
+
205
+ ```ruby
206
+ res = CircleCi::Build.get 'username', 'repo', 'build #'
207
+ res.success?
208
+ res.body
209
+ ```
210
+
211
+ Example response
212
+
213
+ ```json
214
+ {
215
+ "vcs_url" : "https://github.com/circleci/mongofinil",
216
+ "build_url" : "https://circleci.com/gh/circleci/mongofinil/22",
217
+ "build_num" : 22,
218
+ "steps" : [ {
219
+ "name" : "configure the build",
220
+ "actions" : [ {
221
+ "bash_command" : null,
222
+ "run_time_millis" : 1646,
223
+ "start_time" : "2013-02-12T21:33:38Z",
224
+ "end_time" : "2013-02-12T21:33:39Z",
225
+ "name" : "configure the build",
226
+ "command" : "configure the build",
227
+ "exit_code" : null,
228
+ "out" : [ ],
229
+ "type" : "infrastructure",
230
+ "index" : 0,
231
+ "status" : "success",
232
+ } ] },
233
+ "name" : "lein2 deps",
234
+ "actions" : [ {
235
+ "bash_command" : "lein2 deps",
236
+ "run_time_millis" : 7555,
237
+ "start_time" : "2013-02-12T21:33:47Z",
238
+ "command" : "((lein2 :deps))",
239
+ "messages" : [ ],
240
+ "step" : 1,
241
+ "exit_code" : 0,
242
+ "out" : [ {
243
+ "type" : "out",
244
+ "time" : "2013-02-12T21:33:54Z",
245
+ "message" : "Retrieving org/clojure ... from clojars\r\n"
246
+ } ],
247
+ "end_time" : "2013-02-12T21:33:54Z",
248
+ "index" : 0,
249
+ "status" : "success",
250
+ "type" : "dependencies",
251
+ "source" : "inference",
252
+ "failed" : null
253
+ } ] },
254
+ "name" : "lein2 trampoline midje",
255
+ "actions" : [ {
256
+ "bash_command" : "lein2 trampoline midje",
257
+ "run_time_millis" : 2310,
258
+ "continue" : null,
259
+ "parallel" : true,
260
+ "start_time" : "2013-02-12T21:33:59Z",
261
+ "name" : "lein2 trampoline midje",
262
+ "command" : "((lein2 :trampoline :midje))",
263
+ "messages" : [ ],
264
+ "step" : 6,
265
+ "exit_code" : 1,
266
+ "out" : [ {
267
+ "type" : "out",
268
+ "time" : "2013-02-12T21:34:01Z",
269
+ "message" : "'midje' is not a task. See 'lein help'.\r\n\r\nDid you mean this?\r\n do\r\n"
270
+ }, {
271
+ "type" : "err",
272
+ "time" : "2013-02-12T21:34:01Z",
273
+ "message" : "((lein2 :trampoline :midje)) returned exit code 1"
274
+ } ],
275
+ "end_time" : "2013-02-12T21:34:01Z",
276
+ "index" : 0,
277
+ "status" : "failed",
278
+ "timedout" : null,
279
+ "infrastructure_fail" : null,
280
+ "type" : "test",
281
+ "source" : "inference",
282
+ "failed" : true
283
+ } ]
284
+ } ],
285
+ }
286
+ ```
287
+
288
+ #### CircleCi::Build.retry
289
+
290
+ Retries the build, returns a summary of the new build.
291
+
292
+ ```ruby
293
+ res = CircleCi::Build.retry 'username', 'repo', 'build #'
294
+ res.success?
295
+ res.body['status'] # 'queued'
296
+ res.body
297
+ ```
298
+
299
+ Example response
300
+
301
+ ```json
302
+ {
303
+ "vcs_url" : "https://github.com/circleci/mongofinil",
304
+ "build_url" : "https://circleci.com/gh/circleci/mongofinil/23",
305
+ "build_num" : 23,
306
+ "branch" : "master",
307
+ "vcs_revision" : "1d231626ba1d2838e599c5c598d28e2306ad4e48",
308
+ "committer_name" : "Allen Rohner",
309
+ "committer_email" : "arohner@gmail.com",
310
+ "subject" : "Don't explode when the system clock shifts backwards",
311
+ "body" : "", // commit message body
312
+ "why" : "retry", // short string explaining the reason we built
313
+ "dont_build" : null, // reason why we didn't build, if we didn't build
314
+ "queued_at" : "2013-04-12T21:33:30Z" // time build was queued
315
+ "start_time" : "2013-04-12T21:33:38Z", // time build started running
316
+ "stop_time" : "2013-04-12T21:34:01Z", // time build finished running
317
+ "build_time_millis" : 23505,
318
+ "lifecycle" : "queued",
319
+ "outcome" : null,
320
+ "status" : "queued",
321
+ "retry_of" : 22, // build_num of the build this is a retry of
322
+ "previous" : { // previous build
323
+ "status" : "failed",
324
+ "build_num" : 22
325
+ }
326
+ ```
327
+
328
+ ### Tests
329
+
330
+ Run using ```rake```
331
+
332
+ ## License
333
+
334
+ Written by Chavez
335
+
336
+ Released under the MIT License: http://www.opensource.org/licenses/mit-license.php
@@ -1,11 +1,33 @@
1
1
  module CircleCi
2
2
 
3
+ ##
4
+ #
5
+ # Class for managing builds for a project
6
+
3
7
  class Build
4
8
 
9
+ ##
10
+ #
11
+ # Get a specific build for a project
12
+ #
13
+ # @param username [String] - User or org name who owns project
14
+ # @param project [String] - Name of project
15
+ # @param build [String] - Build ID
16
+ # @return [CircleCi::Response] - Response object
17
+
5
18
  def self.get username, project, build
6
19
  CircleCi.http.get "/project/#{username}/#{project}/#{build}"
7
20
  end
8
21
 
22
+ ##
23
+ #
24
+ # Kick off a retry of a specific build
25
+ #
26
+ # @param username [String] - User or org name who owns project
27
+ # @param project [String] - Name of project
28
+ # @param build [String] - Build ID
29
+ # @return [CircleCi::Response] - Response object
30
+
9
31
  def self.retry username, project, build
10
32
  CircleCi.http.post "/project/#{username}/#{project}/#{build}/retry"
11
33
  end
@@ -1,5 +1,5 @@
1
1
  module CircleCi
2
- ##
2
+ ##
3
3
  #
4
4
  # Config class used internally.
5
5
  # Configure API calls using AlPapi.configure
@@ -1,15 +1,54 @@
1
1
  module CircleCi
2
2
 
3
+ ##
4
+ #
5
+ # Class for interacting with Projects
6
+
3
7
  class Project
4
8
 
9
+ ##
10
+ #
11
+ # Return all projects for your API key
12
+ #
13
+ # @return [CircleCi::Response] - Response object
14
+
5
15
  def self.all
6
16
  CircleCi.http.get '/projects'
7
17
  end
8
18
 
19
+ ##
20
+ #
21
+ # Get all recent builds for a specific project
22
+ #
23
+ # @param username [String] - User or org name who owns project
24
+ # @param project [String] - Name of project
25
+ # @return [CircleCi::Response] - Response object
26
+
9
27
  def self.recent_builds username, project
10
28
  CircleCi.http.get "/project/#{username}/#{project}"
11
29
  end
12
30
 
31
+ ##
32
+ #
33
+ # Get all recent builds for a specific branch of a project
34
+ #
35
+ # @param username [String] - User or org name who owns project
36
+ # @param project [String] - Name of project
37
+ # @param branch [String] - Name of branch
38
+ # @return [CircleCi::Response] - Response object
39
+
40
+ def self.recent_builds_branch username, project, branch
41
+ CircleCi.http.get "/project/#{username}/#{project}/tree/#{branch}"
42
+ end
43
+
44
+ ##
45
+ #
46
+ # Clear the build cache for a specific project
47
+ #
48
+ # @param username [String] - User or org name who owns project
49
+ # @param project [String] - Name of project
50
+ # @return [CircleCi::Response] - Response object
51
+
13
52
  def self.clear_cache username, project
14
53
  CircleCi.http.delete "/project/#{username}/#{project}/build-cache"
15
54
  end
data/lib/circleci/user.rb CHANGED
@@ -1,7 +1,17 @@
1
1
  module CircleCi
2
2
 
3
+ ##
4
+ #
5
+ # Class to access user details for a specific API key
6
+
3
7
  class User
4
8
 
9
+ ##
10
+ #
11
+ # Get user account details
12
+ #
13
+ # @return [CircleCi::Response] - Response object
14
+
5
15
  def self.me
6
16
  CircleCi.http.get '/me'
7
17
  end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: circleci
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
5
- prerelease:
4
+ version: 0.0.2
6
5
  platform: ruby
7
6
  authors:
8
7
  - Chavez
@@ -14,97 +13,85 @@ dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rest-client
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: 1.6.7
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: 1.6.7
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: hashie
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - '>='
36
32
  - !ruby/object:Gem::Version
37
33
  version: 1.2.0
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - '>='
44
39
  - !ruby/object:Gem::Version
45
40
  version: 1.2.0
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rspec
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - '>='
52
46
  - !ruby/object:Gem::Version
53
47
  version: '2.0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - '>='
60
53
  - !ruby/object:Gem::Version
61
54
  version: '2.0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: simplecov
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - '>='
68
60
  - !ruby/object:Gem::Version
69
61
  version: 0.7.1
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - '>='
76
67
  - !ruby/object:Gem::Version
77
68
  version: 0.7.1
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: vcr
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - '>='
84
74
  - !ruby/object:Gem::Version
85
75
  version: 2.2.5
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - '>='
92
81
  - !ruby/object:Gem::Version
93
82
  version: 2.2.5
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: webmock
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - '>='
100
88
  - !ruby/object:Gem::Version
101
89
  version: 1.8.11
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - '>='
108
95
  - !ruby/object:Gem::Version
109
96
  version: 1.8.11
110
97
  description: Wraps Circle CI API calls in a gem.
@@ -114,6 +101,8 @@ extensions: []
114
101
  extra_rdoc_files:
115
102
  - README.md
116
103
  files:
104
+ - README.md
105
+ - lib/circleci.rb
117
106
  - lib/circleci/build.rb
118
107
  - lib/circleci/config.rb
119
108
  - lib/circleci/http.rb
@@ -121,32 +110,29 @@ files:
121
110
  - lib/circleci/request_error.rb
122
111
  - lib/circleci/response.rb
123
112
  - lib/circleci/user.rb
124
- - lib/circleci.rb
125
- - README.md
126
113
  homepage: http://github.com/mtchavez/circleci
127
114
  licenses: []
115
+ metadata: {}
128
116
  post_install_message:
129
117
  rdoc_options:
130
118
  - --charset=UTF-8 --main=README.md
131
119
  require_paths:
132
120
  - lib
133
121
  required_ruby_version: !ruby/object:Gem::Requirement
134
- none: false
135
122
  requirements:
136
- - - ! '>='
123
+ - - '>='
137
124
  - !ruby/object:Gem::Version
138
125
  version: '0'
139
126
  required_rubygems_version: !ruby/object:Gem::Requirement
140
- none: false
141
127
  requirements:
142
- - - ! '>='
128
+ - - '>='
143
129
  - !ruby/object:Gem::Version
144
130
  version: '0'
145
131
  requirements: []
146
132
  rubyforge_project:
147
- rubygems_version: 1.8.25
133
+ rubygems_version: 2.2.1
148
134
  signing_key:
149
- specification_version: 3
135
+ specification_version: 4
150
136
  summary: Circle CI API Wrapper
151
137
  test_files: []
152
138
  has_rdoc: