buildkite-sdk 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +19 -21
- data/lib/buildkite/version.rb +1 -1
- data/lib/buildkite.rb +29 -2
- data/lib/schema.rb +2779 -0
- data/project.json +1 -1
- metadata +11 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3c72dcf7dec4c4b5432313e3d4034c6ed0f8551c7e60cfa474fed37e7c43a0a
|
4
|
+
data.tar.gz: b7baca741c77f49eee2c901ddcf65aa8ba412d086a0c368faa54e376b05439e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 24f0e1142a091a59af93eb295ed2b409ba0ead7f4efeec24b47e7c869facee15d9daf0858ed773041c3be38939d5763af6ba198edbb06df87dd2610488e23010
|
7
|
+
data.tar.gz: af298020ffc4c0fad958d23d25740ee37fd2c9814164a0377b060eb305dc9252ce3bb249f4dbc04648b85ae61c5194a78385a33d43a3fb0f8391fecb9be4411c
|
data/README.md
CHANGED
@@ -1,31 +1,29 @@
|
|
1
|
-
#
|
1
|
+
# buildkite-sdk
|
2
2
|
|
3
|
-
|
3
|
+
[](https://buildkite.com/buildkite/pipeline-sdk)
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
## Installation
|
8
|
-
|
9
|
-
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
|
10
|
-
|
11
|
-
Install the gem and add to the application's Gemfile by executing:
|
12
|
-
|
13
|
-
$ bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
|
14
|
-
|
15
|
-
If bundler is not being used to manage dependencies, install the gem by executing:
|
16
|
-
|
17
|
-
$ gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
|
5
|
+
A Ruby SDK for [Buildkite](https://buildkite.com)! 🪁
|
18
6
|
|
19
7
|
## Usage
|
20
8
|
|
21
|
-
|
9
|
+
Install the package:
|
10
|
+
|
11
|
+
```bash
|
12
|
+
gem install buildkite-sdk
|
13
|
+
```
|
22
14
|
|
23
|
-
|
15
|
+
Use it in your program:
|
24
16
|
|
25
|
-
|
17
|
+
```ruby
|
18
|
+
require "buildkite"
|
26
19
|
|
27
|
-
|
20
|
+
pipeline = Buildkite::Pipeline.new
|
28
21
|
|
29
|
-
|
22
|
+
pipeline.add_step(
|
23
|
+
label: "some-label",
|
24
|
+
command: "echo 'Hello, World!'"
|
25
|
+
)
|
30
26
|
|
31
|
-
|
27
|
+
puts pipeline.to_json
|
28
|
+
puts pipeline.to_yaml
|
29
|
+
```
|
data/lib/buildkite/version.rb
CHANGED
data/lib/buildkite.rb
CHANGED
@@ -10,6 +10,23 @@ module Buildkite
|
|
10
10
|
class Pipeline
|
11
11
|
def initialize
|
12
12
|
@steps = []
|
13
|
+
@agents = nil
|
14
|
+
@env = nil
|
15
|
+
@notify = nil
|
16
|
+
end
|
17
|
+
|
18
|
+
def add_agent(key, value)
|
19
|
+
@agents = {} if @agents.nil?
|
20
|
+
@agents[key] = value
|
21
|
+
end
|
22
|
+
|
23
|
+
def add_environment_variable(key, value)
|
24
|
+
@env = {} if @env.nil?
|
25
|
+
@env[key] = value
|
26
|
+
end
|
27
|
+
|
28
|
+
def add_notify(notify)
|
29
|
+
@notify = notify
|
13
30
|
end
|
14
31
|
|
15
32
|
# Adds a step to the pipeline.
|
@@ -31,12 +48,22 @@ module Buildkite
|
|
31
48
|
self
|
32
49
|
end
|
33
50
|
|
51
|
+
def build
|
52
|
+
pipeline = {
|
53
|
+
"steps" => @steps
|
54
|
+
}
|
55
|
+
pipeline["agents"] = @agents if @agents != nil
|
56
|
+
pipeline["env"] = @env if @env != nil
|
57
|
+
pipeline["notify"] = @notify if @notify != nil
|
58
|
+
return pipeline
|
59
|
+
end
|
60
|
+
|
34
61
|
def to_json(*_args)
|
35
|
-
JSON.pretty_generate(
|
62
|
+
JSON.pretty_generate(self.build, indent: " ")
|
36
63
|
end
|
37
64
|
|
38
65
|
def to_yaml
|
39
|
-
|
66
|
+
self.build.to_yaml
|
40
67
|
end
|
41
68
|
end
|
42
69
|
end
|