droneio 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,111 @@
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 "virtus"
18
+
19
+ module Drone
20
+ #
21
+ # Represent `build` JSON as a model
22
+ #
23
+ class Build
24
+ # Workaround to include virtus without YARD warning
25
+ send :include, Virtus.model
26
+
27
+ # @!attribute id
28
+ # @return [Integer] the ID of the build
29
+ attribute :id, Integer
30
+
31
+ # @!attribute number
32
+ # @return [Integer] the number of the build
33
+ attribute :number, Integer
34
+
35
+ # @!attribute event
36
+ # @return [String] the event of the build
37
+ attribute :event, String
38
+
39
+ # @!attribute status
40
+ # @return [String] the status of the build
41
+ attribute :status, String
42
+
43
+ # @!attribute deploy_to
44
+ # @return [String] the target of the deploy
45
+ attribute :deploy_to, String
46
+
47
+ # @!attribute commit
48
+ # @return [String] the commit hash of the build
49
+ attribute :commit, String
50
+
51
+ # @!attribute branch
52
+ # @return [String] the branch of the build
53
+ attribute :branch, String
54
+
55
+ # @!attribute ref
56
+ # @return [String] the reference of the build
57
+ attribute :ref, String
58
+
59
+ # @!attribute refspec
60
+ # @return [String] the reference spec of the build
61
+ attribute :refspec, String
62
+
63
+ # @!attribute remote
64
+ # @return [String] the remote name of the build
65
+ attribute :remote, String
66
+
67
+ # @!attribute title
68
+ # @return [String] the title of the build
69
+ attribute :title, String
70
+
71
+ # @!attribute message
72
+ # @return [String] the commit message of the build
73
+ attribute :message, String
74
+
75
+ # @!attribute link
76
+ # @return [String] the link to the current build
77
+ attribute :link, String
78
+
79
+ # @!attribute author
80
+ # @return [String] the commit author
81
+ attribute :author, String
82
+
83
+ # @!attribute author_avatar
84
+ # @return [String] the link to author avatar
85
+ attribute :author_avatar, String
86
+
87
+ # @!attribute author_email
88
+ # @return [String] the email of the author
89
+ attribute :author_email, String
90
+
91
+ # @!attribute timestamp
92
+ # @return [Time] the timestamp of the build
93
+ attribute :timestamp, Time
94
+
95
+ # @!attribute enqueued_at
96
+ # @return [Time] the time when the build have been enqueued
97
+ attribute :enqueued_at, Time
98
+
99
+ # @!attribute created_at
100
+ # @return [Time] the time when the build have been created
101
+ attribute :created_at, Time
102
+
103
+ # @!attribute started_at
104
+ # @return [Time] the time when the build have been started
105
+ attribute :started_at, Time
106
+
107
+ # @!attribute finished_at
108
+ # @return [Time] the time when the build have been finished
109
+ attribute :finished_at, Time
110
+ end
111
+ end
@@ -0,0 +1,136 @@
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 "representable/json"
18
+
19
+ module Drone
20
+ #
21
+ # Transform `build` JSON payload
22
+ #
23
+ class BuildRepresenter < Representable::Decorator
24
+ include Representable::JSON
25
+
26
+ # @!attribute id
27
+ # @return [Integer] the ID of the build
28
+ property :id
29
+
30
+ # @!attribute number
31
+ # @return [Integer] the number of the build
32
+ property :number
33
+
34
+ # @!attribute event
35
+ # @return [String] the event of the build
36
+ property :event
37
+
38
+ # @!attribute status
39
+ # @return [String] the status of the build
40
+ property :status
41
+
42
+ # @!attribute deploy_to
43
+ # @return [String] the target of the deploy
44
+ property :deploy_to
45
+
46
+ # @!attribute commit
47
+ # @return [String] the commit hash of the build
48
+ property :commit
49
+
50
+ # @!attribute branch
51
+ # @return [String] the branch of the build
52
+ property :branch
53
+
54
+ # @!attribute ref
55
+ # @return [String] the reference of the build
56
+ property :ref
57
+
58
+ # @!attribute refspec
59
+ # @return [String] the reference spec of the build
60
+ property :refspec
61
+
62
+ # @!attribute remote
63
+ # @return [String] the remote name of the build
64
+ property :remote
65
+
66
+ # @!attribute title
67
+ # @return [String] the title of the build
68
+ property :title
69
+
70
+ # @!attribute message
71
+ # @return [String] the commit message of the build
72
+ property :message
73
+
74
+ # @!attribute link
75
+ # @return [String] the link to the current build
76
+ property :link,
77
+ as: :link_url
78
+
79
+ # @!attribute author
80
+ # @return [String] the commit author
81
+ property :author
82
+
83
+ # @!attribute author_avatar
84
+ # @return [String] the link to author avatar
85
+ property :author_avatar
86
+
87
+ # @!attribute author_email
88
+ # @return [String] the email of the author
89
+ property :author_email
90
+
91
+ # @!attribute timestamp
92
+ # @return [Time] the timestamp of the build
93
+ property :timestamp,
94
+ setter: lambda { |options| # rubocop:disable Style/BlockDelimiters
95
+ options[:represented].timestamp = Time.at(
96
+ options[:fragment]
97
+ ).utc
98
+ }
99
+
100
+ # @!attribute enqueued_at
101
+ # @return [Time] the time when the build have been enqueued
102
+ property :enqueued_at,
103
+ setter: lambda { |options| # rubocop:disable Style/BlockDelimiters
104
+ options[:represented].enqueued_at = Time.at(
105
+ options[:fragment]
106
+ ).utc
107
+ }
108
+
109
+ # @!attribute created_at
110
+ # @return [Time] the time when the build have been created
111
+ property :created_at,
112
+ setter: lambda { |options| # rubocop:disable Style/BlockDelimiters
113
+ options[:represented].created_at = Time.at(
114
+ options[:fragment]
115
+ ).utc
116
+ }
117
+
118
+ # @!attribute started_at
119
+ # @return [Time] the time when the build have been started
120
+ property :started_at,
121
+ setter: lambda { |options| # rubocop:disable Style/BlockDelimiters
122
+ options[:represented].started_at = Time.at(
123
+ options[:fragment]
124
+ ).utc
125
+ }
126
+
127
+ # @!attribute finished_at
128
+ # @return [Time] the time when the build have been finished
129
+ property :finished_at,
130
+ setter: lambda { |options| # rubocop:disable Style/BlockDelimiters
131
+ options[:represented].finished_at = Time.at(
132
+ options[:fragment]
133
+ ).utc
134
+ }
135
+ end
136
+ end
@@ -0,0 +1,35 @@
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 "virtus"
18
+
19
+ module Drone
20
+ #
21
+ # Represent `key` JSON as a model
22
+ #
23
+ class Key
24
+ # Workaround to include virtus without YARD warning
25
+ send :include, Virtus.model
26
+
27
+ # @!attribute public
28
+ # @return [String] the public SSH key
29
+ attribute :public, String
30
+
31
+ # @!attribute private
32
+ # @return [String] the private SSH key
33
+ attribute :private, String
34
+ end
35
+ end
@@ -0,0 +1,34 @@
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 "representable/json"
18
+
19
+ module Drone
20
+ #
21
+ # Transform `key` JSON payload
22
+ #
23
+ class KeyRepresenter < Representable::Decorator
24
+ include Representable::JSON
25
+
26
+ # @!attribute public
27
+ # @return [String] the public SSH key
28
+ property :public
29
+
30
+ # @!attribute private
31
+ # @return [String] the private SSH key
32
+ property :private
33
+ end
34
+ end
@@ -0,0 +1,39 @@
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 "virtus"
18
+
19
+ module Drone
20
+ #
21
+ # Represent `netrc` JSON as a model
22
+ #
23
+ class Netrc
24
+ # Workaround to include virtus without YARD warning
25
+ send :include, Virtus.model
26
+
27
+ # @!attribute machine
28
+ # @return [String] the host for the netrc
29
+ attribute :machine, String
30
+
31
+ # @!attribute login
32
+ # @return [String] the username for the netrc
33
+ attribute :login, String
34
+
35
+ # @!attribute password
36
+ # @return [String] the password for the netrc
37
+ attribute :password, String
38
+ end
39
+ end
@@ -0,0 +1,38 @@
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 "representable/json"
18
+
19
+ module Drone
20
+ #
21
+ # Transform `netrc` JSON payload
22
+ #
23
+ class NetrcRepresenter < Representable::Decorator
24
+ include Representable::JSON
25
+
26
+ # @!attribute machine
27
+ # @return [String] the host for the netrc
28
+ property :machine
29
+
30
+ # @!attribute login
31
+ # @return [String] the username for the netrc
32
+ property :login
33
+
34
+ # @!attribute password
35
+ # @return [String] the password for the netrc
36
+ property :password
37
+ end
38
+ end
@@ -0,0 +1,55 @@
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 "hashie"
18
+ require "virtus"
19
+
20
+ module Drone
21
+ #
22
+ # Represent toplevel JSON as a model
23
+ #
24
+ class Payload
25
+ # Workaround to include virtus without YARD warning
26
+ send :include, Virtus.model
27
+
28
+ # @!attribute repo
29
+ # @return [Drone::Repo] the repo configuration
30
+ attribute :repo, Repo
31
+
32
+ # @!attribute system
33
+ # @return [Drone::System] the system configuration
34
+ attribute :system, System
35
+
36
+ # @!attribute build
37
+ # @return [Drone::Build] the build configuration
38
+ attribute :build, Build
39
+
40
+ # @!attribute workspace
41
+ # @return [Drone::Workspace] the workspace configuration
42
+ attribute :workspace, Workspace
43
+
44
+ # @!attribute vargs
45
+ # @return [Hash] the plugin specific payload
46
+ attribute :vargs, Hash
47
+
48
+ # @return [Hashie::Mash] the plugin specific payload
49
+ def vargs
50
+ Hashie::Mash.new(
51
+ super
52
+ )
53
+ end
54
+ end
55
+ end