unofficial_buildkite_client 0.1.0 → 0.2.0

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
  SHA256:
3
- metadata.gz: 46138fea6beff276a6d3a7068364c97ad27e5249805201c24d5594ac97e4f04c
4
- data.tar.gz: 15bf7b5bee8aa97bd298ea017f99e5ee1323c4c357bbbbc8b2a8e1c72e8a9f66
3
+ metadata.gz: e1eab2d031f95c42c45fc7149996f43fc4a5ff6cee28a7779631111b8d630dc1
4
+ data.tar.gz: 353b2d2efd6ac97758ab9e9f58a07f43a485290a055062856eb747a31ddbcc1c
5
5
  SHA512:
6
- metadata.gz: 1ecb6591cdabffabd41a05b54f2e4d4bd4530c951a18929d3a64911d6ba78808282972d96332021874c7787010087ed7b82e27fb5905867a3bb6b0fd6d3f4139
7
- data.tar.gz: 18411ee2a1a57a5cbc117f28d57ae02c55b23d0f33000b64d17fd8d36312393d501c56e531cea4dcd679417512f5580c68cf5c3a3b691e7887f09cfb1903d958
6
+ metadata.gz: fd1d3d74f746ad947732724cbd2fb412a6c863d59d448d53d7403d5147c29cde7ca1afa491ad259b3c8eb2c111c3764cbdf00a6dd69cb4c927bd35c8c88d04e3
7
+ data.tar.gz: c559174659e79cfa1f2350970552029fdbb62a597d833f8c7c755be81eba7407d860a79d9be33d1573ae21e4e5bada7d115148d91c437b307539d3d475294ca3
data/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # 0.2.0
2
+
3
+ - Client#initialize accepts logger option
4
+
5
+ # 0.1.0
6
+
7
+ - First release
data/Dockerfile ADDED
@@ -0,0 +1,14 @@
1
+ ARG ruby_version
2
+ FROM ruby:${ruby_version}
3
+
4
+ ENV BUNDLE_JOBS=4 BUNDLE_PATH=/vendor/bundle LANG=C.UTF-8 LC_ALL=C.UTF-8
5
+
6
+ RUN apt-get update && apt-get install -y less git
7
+
8
+ RUN useradd --create-home --user-group --uid 1000 app
9
+ RUN mkdir -p /app/tmp /vendor/bundle/$RUBY_VERSION
10
+ RUN chown -R app /app /vendor
11
+
12
+ WORKDIR /app
13
+
14
+ USER app
@@ -0,0 +1,21 @@
1
+ version: "3.7"
2
+ services:
3
+ app: &app
4
+ build:
5
+ context: .
6
+ args:
7
+ ruby_version: 2.6.3
8
+ volumes:
9
+ - .:/app:cached
10
+ - vendor:/vendor
11
+ - home:/home/app
12
+ - $HOME/.gitconfig:/home/app/.gitconfig:ro
13
+ - $HOME/.ssh:/home/app/.ssh:ro
14
+ - $HOME/.gem:/home/app/.gem
15
+ - $HOME/.netrc:/home/app/.netrc
16
+ tty: true
17
+ stdin_open: true
18
+ env_file: app.env
19
+ volumes:
20
+ vendor:
21
+ home:
@@ -1,26 +1,15 @@
1
1
  require "unofficial_buildkite_client/version"
2
2
  require "unofficial_buildkite_client/json_api_client"
3
+ require "logger"
3
4
 
4
5
  class UnofficialBuildkiteClient
5
6
  class Error < StandardError; end
6
7
 
7
- class << self
8
- def logger=(logger)
9
- @logger = logger
10
- end
11
-
12
- def logger
13
- @logger
14
- end
15
- end
16
-
17
- self.logger = Logger.new(STDERR)
18
-
19
8
  GRAPHQL_ENDPOINT = "https://graphql.buildkite.com/v1"
20
9
  INTERNAL_API_HOST = "https://buildkite.com"
21
10
 
22
- def initialize(access_token: ENV["BUILDKITE_ACCESS_TOKEN"], org_slug: nil, pipeline_slug: nil)
23
- @client = JsonApiClient.new(authorization_header: "Bearer #{access_token}")
11
+ def initialize(access_token: ENV["BUILDKITE_ACCESS_TOKEN"], org_slug: nil, pipeline_slug: nil, logger: Logger.new(STDERR))
12
+ @client = JsonApiClient.new(authorization_header: "Bearer #{access_token}", logger: logger)
24
13
  @org_slug = org_slug
25
14
  @pipeline_slug = pipeline_slug
26
15
  end
@@ -1,12 +1,12 @@
1
1
  require "net/https"
2
2
  require "uri"
3
3
  require "json"
4
- require "logger"
5
4
 
6
5
  class UnofficialBuildkiteClient
7
6
  class JsonApiClient
8
- def initialize(authorization_header: nil)
7
+ def initialize(authorization_header: nil, logger:)
9
8
  @authorization_header = authorization_header
9
+ @logger = logger
10
10
  end
11
11
 
12
12
  def request(method, url, params: nil)
@@ -39,6 +39,8 @@ class UnofficialBuildkiteClient
39
39
 
40
40
  private
41
41
 
42
+ attr_reader :logger
43
+
42
44
  def json_headers
43
45
  h = {
44
46
  "Content-Type" => "application/json",
@@ -47,9 +49,5 @@ class UnofficialBuildkiteClient
47
49
  h.merge!("Authorization" => @authorization_header)
48
50
  h
49
51
  end
50
-
51
- def logger
52
- UnofficialBuildkiteClient.logger
53
- end
54
52
  end
55
53
  end
@@ -1,3 +1,3 @@
1
1
  class UnofficialBuildkiteClient
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unofficial_buildkite_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fumiaki MATSUSHIMA
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-05-01 00:00:00.000000000 Z
11
+ date: 2019-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -46,7 +46,9 @@ extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
48
  - ".gitignore"
49
+ - CHANGELOG.md
49
50
  - CODE_OF_CONDUCT.md
51
+ - Dockerfile
50
52
  - Gemfile
51
53
  - Gemfile.lock
52
54
  - LICENSE.txt
@@ -54,6 +56,7 @@ files:
54
56
  - Rakefile
55
57
  - bin/console
56
58
  - bin/setup
59
+ - docker-compose.yml
57
60
  - lib/unofficial_buildkite_client.rb
58
61
  - lib/unofficial_buildkite_client/json_api_client.rb
59
62
  - lib/unofficial_buildkite_client/version.rb