droneio 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +5 -0
- data/LICENSE +201 -0
- data/README.md +60 -0
- data/bin/guard +16 -0
- data/bin/rake +16 -0
- data/bin/rspec +16 -0
- data/bin/rubocop +16 -0
- data/lib/drone.rb +83 -0
- data/lib/drone/client.rb +23 -0
- data/lib/drone/models/build.rb +111 -0
- data/lib/drone/models/build_representer.rb +136 -0
- data/lib/drone/models/key.rb +35 -0
- data/lib/drone/models/key_representer.rb +34 -0
- data/lib/drone/models/netrc.rb +39 -0
- data/lib/drone/models/netrc_representer.rb +38 -0
- data/lib/drone/models/payload.rb +55 -0
- data/lib/drone/models/payload_representer.rb +54 -0
- data/lib/drone/models/repo.rb +87 -0
- data/lib/drone/models/repo_representer.rb +94 -0
- data/lib/drone/models/system.rb +47 -0
- data/lib/drone/models/system_representer.rb +48 -0
- data/lib/drone/models/workspace.rb +43 -0
- data/lib/drone/models/workspace_representer.rb +46 -0
- data/lib/drone/plugin.rb +55 -0
- data/lib/drone/version.rb +37 -0
- data/lib/droneio.rb +17 -0
- data/spec/drone/client_spec.rb +21 -0
- data/spec/drone/plugin_spec.rb +100 -0
- data/spec/fixtures/data.sql +4 -0
- data/spec/spec_helper.rb +47 -0
- data/spec/support/helper_methods.rb +28 -0
- metadata +263 -0
@@ -0,0 +1,37 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2016 Drone.io Developers
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
module Drone
|
18
|
+
#
|
19
|
+
# Current version of the Ruby client
|
20
|
+
#
|
21
|
+
class Version
|
22
|
+
MAJOR = 1
|
23
|
+
MINOR = 0
|
24
|
+
PATCH = 0
|
25
|
+
|
26
|
+
PRE = nil
|
27
|
+
|
28
|
+
class << self
|
29
|
+
# Return the current version
|
30
|
+
#
|
31
|
+
# @return [String] the current version of the implementation
|
32
|
+
def to_s
|
33
|
+
[MAJOR, MINOR, PATCH, PRE].compact.join(".")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
data/lib/droneio.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2016 Drone.io Developers
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require_relative "drone"
|
@@ -0,0 +1,21 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2016 Drone.io Developers
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require_relative "../spec_helper"
|
18
|
+
|
19
|
+
describe Drone::Client do
|
20
|
+
subject { ::Drone::Client }
|
21
|
+
end
|
@@ -0,0 +1,100 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2016 Drone.io Developers
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require "spec_helper"
|
18
|
+
require "stringio"
|
19
|
+
|
20
|
+
describe Drone::Plugin do
|
21
|
+
subject { ::Drone::Plugin }
|
22
|
+
|
23
|
+
before do
|
24
|
+
$stdout = StringIO.new
|
25
|
+
$stderr = StringIO.new
|
26
|
+
end
|
27
|
+
|
28
|
+
after do
|
29
|
+
$stdout = STDOUT
|
30
|
+
$stderr = STDERR
|
31
|
+
end
|
32
|
+
|
33
|
+
let(:valid_input) do
|
34
|
+
"{\"vargs\": {\"name\": \"johndoe\"}}"
|
35
|
+
end
|
36
|
+
|
37
|
+
let(:invalid_input) do
|
38
|
+
"{\"vargs\": {}"
|
39
|
+
end
|
40
|
+
|
41
|
+
context "with valid input" do
|
42
|
+
it "returns a plugin" do
|
43
|
+
instance = subject.new(
|
44
|
+
valid_input
|
45
|
+
)
|
46
|
+
|
47
|
+
expect(
|
48
|
+
instance
|
49
|
+
).to(
|
50
|
+
be_a(
|
51
|
+
Drone::Plugin
|
52
|
+
)
|
53
|
+
)
|
54
|
+
end
|
55
|
+
|
56
|
+
it "returns a payload" do
|
57
|
+
instance = subject.new(
|
58
|
+
valid_input
|
59
|
+
).parse
|
60
|
+
|
61
|
+
expect(
|
62
|
+
instance
|
63
|
+
).to(
|
64
|
+
be_a(
|
65
|
+
Drone::Payload
|
66
|
+
)
|
67
|
+
)
|
68
|
+
end
|
69
|
+
|
70
|
+
context "passed a block" do
|
71
|
+
it "returns a payload" do
|
72
|
+
subject.new(valid_input) do |p|
|
73
|
+
$stdout.puts "name: #{p.vargs.name}"
|
74
|
+
end
|
75
|
+
|
76
|
+
expect(
|
77
|
+
$stdout.string
|
78
|
+
).to(
|
79
|
+
match(
|
80
|
+
"name: johndoe"
|
81
|
+
)
|
82
|
+
)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
context "with broken input" do
|
88
|
+
it "raises an exception" do
|
89
|
+
expect do
|
90
|
+
subject.new(
|
91
|
+
invalid_input
|
92
|
+
).parse
|
93
|
+
end.to(
|
94
|
+
raise_error(
|
95
|
+
Drone::InvalidJsonError
|
96
|
+
)
|
97
|
+
)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2016 Drone.io Developers
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require "simplecov"
|
18
|
+
require "simplecov-lcov"
|
19
|
+
|
20
|
+
SimpleCov::Formatter::LcovFormatter.tap do |config|
|
21
|
+
config.report_with_single_file = true
|
22
|
+
end
|
23
|
+
|
24
|
+
SimpleCov.start do
|
25
|
+
add_filter "/spec"
|
26
|
+
add_filter "/gems"
|
27
|
+
|
28
|
+
formatter SimpleCov::Formatter::MultiFormatter.new [
|
29
|
+
SimpleCov::Formatter::HTMLFormatter,
|
30
|
+
SimpleCov::Formatter::LcovFormatter
|
31
|
+
]
|
32
|
+
end
|
33
|
+
|
34
|
+
require "drone"
|
35
|
+
require "rspec"
|
36
|
+
require "webmock/rspec"
|
37
|
+
|
38
|
+
Dir[File.expand_path("../support/**/*.rb", __FILE__)].each do |f|
|
39
|
+
require f
|
40
|
+
end
|
41
|
+
|
42
|
+
RSpec.configure do |config|
|
43
|
+
config.mock_with :rspec
|
44
|
+
config.order = "random"
|
45
|
+
|
46
|
+
config.include HelperMethods
|
47
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2016 Drone.io Developers
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
module HelperMethods
|
18
|
+
def fixture_path(file)
|
19
|
+
Pathname.new(
|
20
|
+
File.expand_path(
|
21
|
+
"../../fixtures",
|
22
|
+
__FILE__
|
23
|
+
)
|
24
|
+
).join(
|
25
|
+
file
|
26
|
+
)
|
27
|
+
end
|
28
|
+
end
|
metadata
ADDED
@@ -0,0 +1,263 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: droneio
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Thomas Boerger
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-02-18 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: yard
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: webmock
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simplecov
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: simplecov-lcov
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: virtus
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 1.0.5
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 1.0.5
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: httparty
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 0.13.7
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 0.13.7
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: hashie
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 3.4.3
|
160
|
+
type: :runtime
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 3.4.3
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: representable
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 3.0.0
|
174
|
+
type: :runtime
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 3.0.0
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: multi_json
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: 1.11.2
|
188
|
+
type: :runtime
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: 1.11.2
|
195
|
+
description: |2
|
196
|
+
DroneCI client and plugin helper
|
197
|
+
email:
|
198
|
+
- thomas@webhippie.de
|
199
|
+
executables: []
|
200
|
+
extensions: []
|
201
|
+
extra_rdoc_files: []
|
202
|
+
files:
|
203
|
+
- CHANGELOG.md
|
204
|
+
- LICENSE
|
205
|
+
- README.md
|
206
|
+
- bin/guard
|
207
|
+
- bin/rake
|
208
|
+
- bin/rspec
|
209
|
+
- bin/rubocop
|
210
|
+
- lib/drone.rb
|
211
|
+
- lib/drone/client.rb
|
212
|
+
- lib/drone/models/build.rb
|
213
|
+
- lib/drone/models/build_representer.rb
|
214
|
+
- lib/drone/models/key.rb
|
215
|
+
- lib/drone/models/key_representer.rb
|
216
|
+
- lib/drone/models/netrc.rb
|
217
|
+
- lib/drone/models/netrc_representer.rb
|
218
|
+
- lib/drone/models/payload.rb
|
219
|
+
- lib/drone/models/payload_representer.rb
|
220
|
+
- lib/drone/models/repo.rb
|
221
|
+
- lib/drone/models/repo_representer.rb
|
222
|
+
- lib/drone/models/system.rb
|
223
|
+
- lib/drone/models/system_representer.rb
|
224
|
+
- lib/drone/models/workspace.rb
|
225
|
+
- lib/drone/models/workspace_representer.rb
|
226
|
+
- lib/drone/plugin.rb
|
227
|
+
- lib/drone/version.rb
|
228
|
+
- lib/droneio.rb
|
229
|
+
- spec/drone/client_spec.rb
|
230
|
+
- spec/drone/plugin_spec.rb
|
231
|
+
- spec/fixtures/data.sql
|
232
|
+
- spec/spec_helper.rb
|
233
|
+
- spec/support/helper_methods.rb
|
234
|
+
homepage: https://github.com/drone/drone-ruby
|
235
|
+
licenses:
|
236
|
+
- Apache-2.0
|
237
|
+
metadata: {}
|
238
|
+
post_install_message:
|
239
|
+
rdoc_options: []
|
240
|
+
require_paths:
|
241
|
+
- lib
|
242
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
243
|
+
requirements:
|
244
|
+
- - ">="
|
245
|
+
- !ruby/object:Gem::Version
|
246
|
+
version: 1.9.3
|
247
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
248
|
+
requirements:
|
249
|
+
- - ">="
|
250
|
+
- !ruby/object:Gem::Version
|
251
|
+
version: '0'
|
252
|
+
requirements: []
|
253
|
+
rubyforge_project:
|
254
|
+
rubygems_version: 2.4.5.1
|
255
|
+
signing_key:
|
256
|
+
specification_version: 4
|
257
|
+
summary: DroneCI client and plugin helper
|
258
|
+
test_files:
|
259
|
+
- spec/drone/plugin_spec.rb
|
260
|
+
- spec/drone/client_spec.rb
|
261
|
+
- spec/support/helper_methods.rb
|
262
|
+
- spec/fixtures/data.sql
|
263
|
+
- spec/spec_helper.rb
|