wercker_api 0.1.10 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fbcea0114dde6a76e5f0b6ca16e92b5b28173dd6
4
- data.tar.gz: f6dc02766a548e7c3ac6eea58899471c43a3afca
3
+ metadata.gz: 05d290350d98af8642a3f5df98e546395a9232bc
4
+ data.tar.gz: 9dae9e554cdd322e0c77420142354ba987ab88fa
5
5
  SHA512:
6
- metadata.gz: e0a73f7f89379a92f556c9def31516f17e48457a9a545f242d0e885d15de5080d24683e02cdf826b10bd9c36ec7b9ac18eacea88e4e173a73462e2720d926d57
7
- data.tar.gz: 743494ca9e7ddcc5dcc5f9e5418562d83f983fef30a54770abffb9772c134d0c6e289cb9c34e487b6f1c85a36599ba3fa28333769f43d4ccbbe6f8b004532651
6
+ metadata.gz: 702c15b0c485f962c4822d12d3856d24aa5adeebe5e9d29cf20d3c764e3763025b883a899ae1972e19f92e41468e9c8185ed672d30a6fd597a85b10c41a42ec4
7
+ data.tar.gz: 323da7a204a612a3624a14f954d5eebec9c6981e42f478a62fa69e319328ceaba0fbbb28b6b759f096cf754136c51efae55ab0bb4ebe2c8f4778fba0170e59d3
data/.codeclimate.yml ADDED
@@ -0,0 +1,25 @@
1
+ ---
2
+ engines:
3
+ duplication:
4
+ enabled: true
5
+ config:
6
+ languages:
7
+ - ruby
8
+ - javascript
9
+ - python
10
+ - php
11
+ fixme:
12
+ enabled: true
13
+ rubocop:
14
+ enabled: true
15
+ ratings:
16
+ paths:
17
+ - "**.inc"
18
+ - "**.js"
19
+ - "**.jsx"
20
+ - "**.module"
21
+ - "**.php"
22
+ - "**.py"
23
+ - "**.rb"
24
+ exclude_paths:
25
+ - spec/
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source "https://rubygems.org"
1
+ source 'https://rubygems.org'
2
2
  ruby '2.4.1'
3
3
  # Specify your gem's dependencies in wercker_api.gemspec
4
4
  gemspec
data/README.md CHANGED
@@ -1,6 +1,5 @@
1
1
  [![wercker status](https://app.wercker.com/status/15fd697b0b3ff854e408a5c256e6737b/s/master "wercker status")](https://app.wercker.com/project/byKey/15fd697b0b3ff854e408a5c256e6737b)
2
- [![Code Climate](https://codeclimate.com/github/StupidCodeFactory/wercker_api/badges/gpa.svg)](https://codeclimate.com/github/codeclimate/codeclimate)
3
- [![Test Coverage](https://codeclimate.com/github/StupidCodeFactory/wercker_api/badges/coverage.svg)](https://codeclimate.com/github/codeclimate/codeclimate/coverage)
2
+
4
3
  # WerckerAPI
5
4
 
6
5
  Thin ruby wrapper around [wercker API](http://devcenter.wercker.com/docs/api)
@@ -31,6 +30,24 @@ Generate an API token and either pass it as an argument to the `WerckerAPI::Clie
31
30
 
32
31
  ```
33
32
 
33
+ # Trigger a pipeline run PipelineRunner #
34
+
35
+ ```ruby
36
+
37
+ client = WerckerAPI::Client.new(token)
38
+
39
+ # Will poll the build every 60 seconds for 5 times maximum
40
+ runner = WerckerAPI::PipelineRunner.new(client, max_attempts: 5, delay: 60)
41
+
42
+ # Blocking call that polls the pipeline and returns a WorkerAPI::Run instance or raise a WerckerAPI::PipelineRunner::Timeout
43
+ run = runner.run # => #<0x007fa4b509bcd8 WorkerAPI::Run id: '125344f34v34'...>
44
+ run.result # => 'passed'
45
+ ```
46
+
47
+ ## API Documentation
48
+
49
+ Full gem documentation on [rubydoc.info](http://www.rubydoc.info/gems/wercker_api) and API reference at [wercker.com](http://devcenter.wercker.com/docs/api)
50
+
34
51
  ## Development
35
52
 
36
53
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
3
 
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :default => :spec
6
+ task default: :spec
data/bin/console CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "wercker_api"
3
+ require 'bundler/setup'
4
+ require 'wercker_api'
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +10,5 @@ require "wercker_api"
10
10
  # require "pry"
11
11
  # Pry.start
12
12
 
13
- require "irb"
13
+ require 'irb'
14
14
  IRB.start(__FILE__)
@@ -1,6 +1,5 @@
1
1
  module WerckerAPI
2
2
  module APICollection
3
-
4
3
  def self.included(klass)
5
4
  klass.class_eval do
6
5
  include Enumerable
@@ -10,13 +9,18 @@ module WerckerAPI
10
9
  end
11
10
  end
12
11
 
13
-
14
12
  def initialize(collection = [])
15
- self.collection = collection
13
+ self.collection = collection.map { |item| item_klass.new(item) }
16
14
  end
17
15
 
18
- def each
19
- collection.each
16
+ def each(&block)
17
+ collection.each(&block)
18
+ end
19
+
20
+ private
21
+
22
+ def item_klass
23
+ @klass ||= Kernel.const_get(self.class.name.sub(/Collection$/, ''))
20
24
  end
21
25
  end
22
26
  end
@@ -1,8 +1,7 @@
1
1
  module WerckerAPI
2
2
  class Application
3
3
  class Build
4
- INDEX = -> (version, user_name, application) { "/api/#{version}/applications/#{user_name}/#{application}/builds" }
5
-
4
+ INDEX = ->(version, user_name, application) { "/api/#{version}/applications/#{user_name}/#{application}/builds" }
6
5
  end
7
6
  end
8
7
  end
@@ -1,10 +1,7 @@
1
1
  module WerckerAPI
2
2
  class Application
3
-
4
3
  class Deploy
5
- INDEX = -> (version, user_name, application) { "/api/#{version}/applications/#{user_name}/#{application}/deploys" }
4
+ INDEX = ->(version, user_name, application) { "/api/#{version}/applications/#{user_name}/#{application}/deploys" }
6
5
  end
7
-
8
6
  end
9
-
10
7
  end
@@ -60,8 +60,8 @@ module WerckerAPI
60
60
  end
61
61
 
62
62
  class Workflow
63
- INDEX = -> (version) { "/api/#{version}/workflows" }
64
- SHOW = -> (version, workflow_id) { "/api/#{version}/workflows/#{workflow_id}" }
63
+ INDEX = ->(version) { "/api/#{version}/workflows" }
64
+ SHOW = ->(version, workflow_id) { "/api/#{version}/workflows/#{workflow_id}" }
65
65
 
66
66
  include Virtus.model
67
67
 
@@ -11,8 +11,8 @@ module WerckerAPI
11
11
  end
12
12
 
13
13
  class Application
14
- INDEX = -> (version, username) { "/api/#{version}/applications/#{username}" }
15
- SHOW = -> (version, username, application) { "/api/#{version}/applications/#{username}/#{application}" }
14
+ INDEX = ->(version, username) { "/api/#{version}/applications/#{username}" }
15
+ SHOW = ->(version, username, application) { "/api/#{version}/applications/#{username}/#{application}" }
16
16
 
17
17
  include Virtus.model
18
18
  attribute :id, String
@@ -47,6 +47,5 @@ module WerckerAPI
47
47
  def allowed_actions
48
48
  allowedActions
49
49
  end
50
-
51
50
  end
52
51
  end
@@ -1,6 +1,5 @@
1
1
  module WerckerAPI
2
2
  class ApplicationCollection
3
-
4
3
  include Enumerable
5
4
 
6
5
  def initialize(collection = [])
@@ -12,6 +11,7 @@ module WerckerAPI
12
11
  end
13
12
 
14
13
  private
14
+
15
15
  attr_accessor :collection
16
16
  end
17
17
  end
@@ -1,7 +1,6 @@
1
1
  require 'net/http'
2
2
  require 'json'
3
3
  module WerckerAPI
4
-
5
4
  class WerckerAPI::Error < ArgumentError
6
5
  def initialize(response)
7
6
  json = JSON.parse(response.body)
@@ -13,7 +12,6 @@ EOM
13
12
  end
14
13
 
15
14
  class Client
16
-
17
15
  API_ENDPOINT = URI('https://app.wercker.com').freeze
18
16
 
19
17
  def initialize(token = nil, api_version = 'v3')
@@ -22,48 +20,199 @@ EOM
22
20
  self.api_version = api_version
23
21
  end
24
22
 
23
+ # List user applications
24
+ #
25
+ # List all applications owned by the user or organization.
26
+ # The result will only contain applications that the authenticated user has access to.
27
+ # If the call is made without a token, only public applications will be returned.
28
+ #
29
+ # @param user_name [String] A wercker user name
30
+ # @param params [Hash] Other params to pass as a query string to the API call
31
+ # @return [WerckerAPI::ApplicationCollection] An enumerable the yields `WerkerAPI::Application`
25
32
  def applications(user_name, params = {})
26
- request build_get_request(Application::INDEX[api_version, user_name], params), ApplicationCollection
33
+ request(
34
+ build_get_request(
35
+ Application::INDEX[api_version, user_name], params
36
+ ), ApplicationCollection
37
+ )
27
38
  end
28
39
 
40
+ # Get an application
41
+ #
42
+ # Get the details of a single application.
43
+ #
44
+ # @param user_name [String] A wercker user name
45
+ # @param application [String] An wercker application name (probably a repository name).
46
+ # @return [WerckerAPI::Application] A DAO wrapper around the API response.
29
47
  def application(user_name, application)
30
- request build_get_request(Application::SHOW[api_version, user_name, application]), Application
48
+ request(
49
+ build_get_request(
50
+ Application::SHOW[api_version, user_name, application]
51
+ ),
52
+ Application
53
+ )
31
54
  end
32
55
 
56
+ # Update an application
57
+ #
58
+ # Update a single application. Currently it is only possible to change the ignored branches for the application. The updated application will be returned.
59
+ #
60
+ # @param user_name [String] A wercker user name
61
+ # @param application [String] An wercker application name (probably a repository name).
62
+ # @params branches [Array] An array of branches you want to ignore
63
+ # @return [WerckerAPI::Application] A DAO wrapper around the API response.
33
64
  def update_application(user_name, application, branches)
34
- request build_put_request(Application::SHOW[api_version, user_name, application], { ignoredBranches: branches }), Application
65
+ request(
66
+ build_patch_request(
67
+ Application::SHOW[api_version, user_name, application], ignoredBranches: branches
68
+ ),
69
+ Application
70
+ )
35
71
  end
36
72
 
37
- def application_builds(user_name , application)
38
- request build_get_request(Application::Build::INDEX[api_version, user_name, application]), Application::BuildCollection
73
+ # List builds
74
+ #
75
+ # Retrieve all builds of an application.
76
+ #
77
+ # @param user_name [String] A wercker user name
78
+ # @param application [String] An wercker application name (probably a repository name).
79
+ # @return WerckerAPI::Application::BuildCollection An enumerable yielding WerckerAPI::Application::Build objects
80
+ def application_builds(user_name, application)
81
+ request(
82
+ build_get_request(
83
+ Application::Build::INDEX[api_version, user_name, application]
84
+ ),
85
+ Application::BuildCollection
86
+ )
39
87
  end
40
88
 
41
- def application_deploys(user_name , application)
42
- request build_get_request(Application::Deploy::INDEX[api_version, user_name, application]), Application::DeployCollection
89
+ # List deploys
90
+ #
91
+ # Retrieve all deploys of an application.
92
+ #
93
+ # @param user_name [String] A wercker user name
94
+ # @param application [String] An wercker application name (probably a repository name).
95
+ # @return WerckerAPI::Application::DeployCollection An Enumerable yielding WerckerAPI::Application::Deploy
96
+ def application_deploys(user_name, application)
97
+ request(
98
+ build_get_request(
99
+ Application::Deploy::INDEX[api_version, user_name, application]
100
+ ),
101
+ Application::DeployCollection
102
+ )
43
103
  end
44
104
 
105
+ # Get all workflows
106
+ #
107
+ # Get the last 10 workflows.
108
+ #
109
+ #
110
+ # @param application_id [String] A worker application id as returned by an API call
111
+ # @return WerckerAPI::Application::WorkflowCollection An Enumerable yeilding WerckerAPI::Application::Workflow
45
112
  def application_workflows(application_id)
46
- request build_get_request(Application::Workflow::INDEX[api_version], applicationId: application_id), Application::WorkflowCollection
113
+ request(
114
+ build_get_request(
115
+ Application::Workflow::INDEX[api_version], applicationId: application_id
116
+ ),
117
+ Application::WorkflowCollection
118
+ )
47
119
  end
48
120
 
121
+ # Get a workflow
122
+ #
123
+ # Get the details of a single workflow.
124
+ #
125
+ # Returns a workflow object, which contains a collection of runs.
126
+ # @param workflow_id [String] A wercker workflow id as returned by an API call
127
+ # @return WerckerAPI::Application::Workflow object
49
128
  def application_workflow(workflow_id)
50
- request build_get_request(Application::Workflow::SHOW[api_version, workflow_id]), Application::Workflow
129
+ request(
130
+ build_get_request(
131
+ Application::Workflow::SHOW[api_version, workflow_id]
132
+ ),
133
+ Application::Workflow
134
+ )
51
135
  end
52
136
 
53
- def runs(application_id: nil, pipeline_id: nil)
54
- params = if application_id
55
- { applicationId: application_id }
56
- elsif pipeline_id
57
- { pipelineId: pipeline_id }
58
- end
137
+ # Get all runs
138
+ #
139
+ # Get the last 20 runs for a given pipeline or application.
140
+ #
141
+ # Returns an array of run objects.
142
+ #
143
+ #
144
+ # An *application_id*:: or a *pipeline_id*:: is required!
145
+ #
146
+ # @param application_id [String] The ID of the application.
147
+ # @param pipeline_id [String]
148
+ # @param [Hash] params Other params passed as a query string to the API
149
+ # @option params [Integer] :limit Specify how many run objects should be returned. Max: 20, default: 20
150
+ # @option params [Integer] :skip Skip the first X runs. Min: 1, default: 0
151
+ # @option params [Integer] :sort Valid values: *creationDateAsc*:: or *creationDateDesc*::. Default *creationDateDesc*::
152
+ # @option params [Integer] :status Filter by status. Valid values: notstarted, *started*::, *finished*::, *running*::
153
+ # @option params [Integer] :result Filter by result. Valid values: *aborted*::, *unknown*::, *passed*::, **failed::
154
+ # @option params [Integer] :branch ilter by branch
155
+ # @option params [Integer] :pipelineId Filter by pipeline
156
+ # @option params [Integer] :commit Filter by commit hash
157
+ # @option params [Integer] :sourceRun Filter by source run
158
+ # @option params [Integer] :author Filter by Wercker username
159
+ # @return WerckerAPI::RunCollection An enumerable yielding a WerckerAPI::Run object
160
+ def runs(application_id: nil, pipeline_id: nil, params: {})
161
+ if application_id
162
+ params[:applicationId] = application_id
163
+ elsif pipeline_id
164
+ params[:pipelineId] = pipeline_id
165
+ end
59
166
  request build_get_request(Run::INDEX[api_version], params), RunCollection
60
167
  end
61
168
 
169
+ # Get a run
170
+ #
171
+ # Get the details of a single run.
172
+ #
173
+ # Returns a run object.
174
+ #
175
+ # @params run_id [String, Integer] An id as returned by an API call
176
+ # @return WerckerAPI::Run object
62
177
  def run(run_id)
63
178
  request build_get_request(Run::SHOW[api_version, run_id]), Run
64
179
  end
65
180
 
181
+ # Trigger a new run
182
+ #
183
+ # Trigger a new run for an application.
184
+ #
185
+ # Returns a run object.
186
+ #
187
+ # It is possible to add environment variables, which will be added to the run. The order of the array will be maintained, which makes it possible to use environment variables that were defined earlier. Any environment variables defined as part of the application or workflow will be overwritten, if using the same key.
188
+ #
189
+ # @param pipeline_id [String] An id as returned by an API call
190
+ # @param [Hash] params Other params to pass as in body as query string to the API call
191
+ # @option params [String] sourceRunId The *id*:: of the run that should be used as input for this run, including artifacts. This is the same as *chaining*:: a pipeline.
192
+ # @option params [String] branch The Git *branch*:: that the run should use. If not specified, the default branch will be used.
193
+ # @option params [String] commitHash The Git commit hash that the run should used. *Requires branch*:: to be set. If not specified, the latest commit is fetched
194
+ # @option params [String] message The message to use for the run. If not specified, the Git commit message is used.
195
+ # @option params [Array] envVars Environment variables which should be added to run. Contains objects with *key*:: and *value*:: properties.
196
+ # @return WerckerAPI::Run object
197
+ def trigger_run(pipeline_id, params = {})
198
+ params[:pipelineId] = pipeline_id
199
+ request build_post_request(Run::TRIGGER[api_version], params), Run
200
+ end
201
+
202
+ # Abort a run
203
+ #
204
+ # Abort an already running run instance.
205
+ #
206
+ # Returns an object.
207
+ #
208
+ # @param run_id [String] An id as returned by an API call
209
+ # @return WerckerAPI::Run object
210
+ def abort_run(run_id)
211
+ request build_put_request(Run::ABORT[api_version, run_id]), Run
212
+ end
213
+
66
214
  private
215
+
67
216
  attr_accessor :api_token, :api_version
68
217
 
69
218
  def http_client
@@ -78,7 +227,7 @@ A token is required to communicate with the API, please refer to the read me.
78
227
 
79
228
  More inforation at: http://devcenter.wercker.com/docs/api/getting-started/authentication
80
229
  EOM
81
- raise ArgumentError.new(msg)
230
+ raise ArgumentError, msg
82
231
  end
83
232
 
84
233
  def build_get_request(uri, params = {})
@@ -86,8 +235,22 @@ EOM
86
235
  authorise_request(Net::HTTP::Get.new(uri))
87
236
  end
88
237
 
89
- def build_put_request(uri, params)
90
- request = Net::HTTP::Patch.new(URI::HTTP.build(path: uri))
238
+ def build_put_request(uri, params = {})
239
+ request = Net::HTTP::Put.new(URI::HTTP.build(path: uri))
240
+ build_request_with_body(request, params)
241
+ end
242
+
243
+ def build_patch_request(uri, params)
244
+ request = Net::HTTP::Patch.new(URI::HTTP.build(path: uri))
245
+ build_request_with_body(request, params)
246
+ end
247
+
248
+ def build_post_request(uri, params)
249
+ request = Net::HTTP::Post.new(URI::HTTP.build(path: uri))
250
+ build_request_with_body(request, params)
251
+ end
252
+
253
+ def build_request_with_body(request, params)
91
254
  request.body = JSON.dump(params)
92
255
  request['Content-Type'] = 'application/json'
93
256
  authorise_request(request)
@@ -118,8 +281,7 @@ EOM
118
281
  end
119
282
 
120
283
  def handle_error(response)
121
- raise WerckerAPI::Error.new(response)
284
+ raise WerckerAPI::Error, response
122
285
  end
123
286
  end
124
-
125
287
  end
@@ -1,5 +1,4 @@
1
1
  module WerckerAPI
2
-
3
2
  class Meta
4
3
  include Virtus.model
5
4
  attribute :username, String
@@ -14,7 +13,6 @@ module WerckerAPI
14
13
  class Avatar
15
14
  include Virtus.model
16
15
  attribute :gravatar, String
17
-
18
16
  end
19
17
 
20
18
  class Owner
@@ -31,5 +29,4 @@ module WerckerAPI
31
29
  end
32
30
 
33
31
  class User < Owner; end
34
-
35
32
  end
@@ -0,0 +1,54 @@
1
+ module WerckerAPI
2
+ class PipelineRunner
3
+
4
+ class Timeout < RuntimeError
5
+ def initialize(pipeline_id, pipeline_runner)
6
+ msg = <<-EOM
7
+ Pipeline #{pipeline_id} did not finish in a timely fashion.
8
+
9
+ #{pipeline_runner.max_attempts} attempts were made with a #{pipeline_runner.delay} seconds delay between each attempts.
10
+
11
+ You either can try to:
12
+ - Increase the max attempts count.
13
+ Beware of the API rate limit, specially
14
+ if you have many applications and pipelines
15
+ under the same account.
16
+ - the delay between each attempts
17
+ - or both
18
+
19
+ Good Luck!
20
+ EOM
21
+ super(msg)
22
+ end
23
+ end
24
+
25
+ attr_accessor :delay, :max_attempts
26
+
27
+ def initialize(client, max_attempts: 20, delay: 10)
28
+ self.client = client
29
+ self.max_attempts = max_attempts
30
+ self.delay = delay
31
+ self.current_attempt = 0
32
+ end
33
+
34
+ def run(pipeline_id, trigger_run_params = {})
35
+ run = client.trigger_run pipeline_id, trigger_run_params
36
+
37
+ while %w[running notstarted].include?(run.status)
38
+ raise Timeout.new(pipeline_id, self) if max_attempt_reached?
39
+ sleep @delay
40
+ run = client.run(run.id)
41
+ @current_attempt += 1
42
+ end
43
+
44
+ run
45
+ end
46
+
47
+ private
48
+
49
+ attr_accessor :client, :current_attempt
50
+ def max_attempt_reached?
51
+ current_attempt >= max_attempts
52
+ end
53
+ end
54
+ end
@@ -1,18 +1,18 @@
1
1
  module WerckerAPI
2
2
  class Commit
3
-
4
3
  include Virtus.model
5
4
 
6
5
  attribute :_id, String
7
6
  attribute :commit, String
8
7
  attribute :message, String
9
8
  attribute :by, String
10
-
11
9
  end
12
10
 
13
11
  class Run
14
- INDEX = -> (version) { "/api/#{version}/runs" }
15
- SHOW = -> (version, run_id) { "/api/#{version}/runs/#{run_id}" }
12
+ INDEX = ->(version) { "/api/#{version}/runs" }
13
+ SHOW = ->(version, run_id) { "/api/#{version}/runs/#{run_id}" }
14
+ TRIGGER = ->(version) { "/api/#{version}/runs" }
15
+ ABORT = ->(version, run_id) { "/api/#{version}/runs/#{run_id}/abort" }
16
16
 
17
17
  include Virtus.model
18
18
 
@@ -1,3 +1,3 @@
1
1
  module WerckerAPI
2
- VERSION = "0.1.10"
2
+ VERSION = '1.0.1'.freeze
3
3
  end
data/lib/wercker_api.rb CHANGED
@@ -1,19 +1,20 @@
1
- require "virtus"
2
- require "wercker_api/version"
3
- require "wercker_api/api_collection"
4
- require "wercker_api/scm"
5
- require "wercker_api/owner"
6
- require "wercker_api/pipeline"
7
- require "wercker_api/run_collection"
8
- require "wercker_api/run"
9
- require "wercker_api/application"
10
- require "wercker_api/application_collection"
11
- require "wercker_api/application/build"
12
- require "wercker_api/application/build_collection"
13
- require "wercker_api/application/deploy"
14
- require "wercker_api/application/deploy_collection"
15
- require "wercker_api/application/workflow"
16
- require "wercker_api/application/workflow_collection"
17
- require "wercker_api/client"
1
+ require 'virtus'
2
+ require 'wercker_api/version'
3
+ require 'wercker_api/api_collection'
4
+ require 'wercker_api/scm'
5
+ require 'wercker_api/owner'
6
+ require 'wercker_api/pipeline'
7
+ require 'wercker_api/run_collection'
8
+ require 'wercker_api/run'
9
+ require 'wercker_api/application'
10
+ require 'wercker_api/application_collection'
11
+ require 'wercker_api/application/build'
12
+ require 'wercker_api/application/build_collection'
13
+ require 'wercker_api/application/deploy'
14
+ require 'wercker_api/application/deploy_collection'
15
+ require 'wercker_api/application/workflow'
16
+ require 'wercker_api/application/workflow_collection'
17
+ require 'wercker_api/client'
18
+ require 'wercker_api/pipeline_runner'
18
19
 
19
20
  module WerckerAPI; end
data/wercker.yml CHANGED
@@ -2,11 +2,6 @@ box: ruby:2.4.1
2
2
  build:
3
3
  steps:
4
4
  - bundle-install
5
- - script:
6
- name: notify CodeClimate
7
- code: |
8
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
9
- chmod +x ./cc-test-reporter
10
5
  - script:
11
6
  name: env
12
7
  code: |
@@ -14,9 +9,7 @@ build:
14
9
  - script:
15
10
  name: rspec
16
11
  code: |
17
- ./cc-test-reporter before-build
18
12
  bundle exec rspec
19
- ./cc-test-reporter after-build --exit-code $?
20
13
  deploy:
21
14
  steps:
22
15
  - bundle-install
data/wercker_api.gemspec CHANGED
@@ -1,34 +1,35 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path("../lib", __FILE__)
2
+
3
+ lib = File.expand_path('../lib', __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "wercker_api/version"
5
+ require 'wercker_api/version'
5
6
 
6
7
  Gem::Specification.new do |spec|
7
- spec.name = "wercker_api"
8
+ spec.name = 'wercker_api'
8
9
  spec.version = WerckerAPI::VERSION
9
- spec.authors = ["yann marquet"]
10
- spec.email = ["ymarquet@gmail.com"]
10
+ spec.authors = ['yann marquet']
11
+ spec.email = ['ymarquet@gmail.com']
11
12
 
12
- spec.summary = %q{interact with wercker API.}
13
- spec.description = %q{interact with wercker API, Deeper integration with wercker.}
14
- spec.homepage = "https://github.com/StupidCodeFactory/wercker_api"
15
- spec.license = "MIT"
13
+ spec.summary = 'interact with wercker API.'
14
+ spec.description = 'interact with wercker API, Deeper integration with wercker.'
15
+ spec.homepage = 'https://github.com/StupidCodeFactory/wercker_api'
16
+ spec.license = 'MIT'
16
17
 
17
18
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
19
  # to allow pushing to a single host or delete this section to allow pushing to any host.
19
20
  if spec.respond_to?(:metadata)
20
- spec.metadata["allowed_push_host"] = 'https://rubygems.org'
21
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
21
22
  else
22
- raise "RubyGems 2.0 or newer is required to protect against " \
23
- "public gem pushes."
23
+ raise 'RubyGems 2.0 or newer is required to protect against ' \
24
+ 'public gem pushes.'
24
25
  end
25
26
 
26
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
28
  f.match(%r{^(test|spec|features)/})
28
29
  end
29
- spec.bindir = "exe"
30
+ spec.bindir = 'exe'
30
31
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
- spec.require_paths = ["lib"]
32
+ spec.require_paths = ['lib']
32
33
 
33
34
  spec.add_dependency 'virtus', '~> 1.0.5'
34
35
  spec.add_development_dependency 'bundler', '~> 1.15'
@@ -41,4 +42,5 @@ Gem::Specification.new do |spec|
41
42
  spec.add_development_dependency 'byebug', '~> 9.0.6'
42
43
  spec.add_development_dependency 'awesome_print', '~> 1.8.0'
43
44
  spec.add_development_dependency 'simplecov', '~> 0.14.1'
45
+ spec.add_development_dependency 'rubocop', '~> 0.49.1'
44
46
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wercker_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - yann marquet
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-04 00:00:00.000000000 Z
11
+ date: 2017-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: virtus
@@ -164,6 +164,20 @@ dependencies:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
166
  version: 0.14.1
167
+ - !ruby/object:Gem::Dependency
168
+ name: rubocop
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - "~>"
172
+ - !ruby/object:Gem::Version
173
+ version: 0.49.1
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - "~>"
179
+ - !ruby/object:Gem::Version
180
+ version: 0.49.1
167
181
  description: interact with wercker API, Deeper integration with wercker.
168
182
  email:
169
183
  - ymarquet@gmail.com
@@ -171,6 +185,7 @@ executables: []
171
185
  extensions: []
172
186
  extra_rdoc_files: []
173
187
  files:
188
+ - ".codeclimate.yml"
174
189
  - ".gitignore"
175
190
  - ".rspec"
176
191
  - ".travis.yml"
@@ -193,6 +208,7 @@ files:
193
208
  - lib/wercker_api/client.rb
194
209
  - lib/wercker_api/owner.rb
195
210
  - lib/wercker_api/pipeline.rb
211
+ - lib/wercker_api/pipeline_runner.rb
196
212
  - lib/wercker_api/run.rb
197
213
  - lib/wercker_api/run_collection.rb
198
214
  - lib/wercker_api/scm.rb