rondabot 1.0.2 → 1.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 950eb5a191650e0e0b1935b34bdf5eb251d908df604b8225f6c8c2cd06e264f7
4
- data.tar.gz: 9f36e7afbc04fe8a3ecf64a4f4671b4fdb0eadceffb2848fed1c2a62b609cd3f
3
+ metadata.gz: 7060042f4e01c4351ce8340453878ac2ee4345f6277d59c7ae839de0031102fc
4
+ data.tar.gz: 79d433c2353e98a3f854fb1cdde1607aaa258ce5a5ace31d10c360249f5922e2
5
5
  SHA512:
6
- metadata.gz: 0a32928624a26886eab26cb81c64ee2a7a29b759a486ff92047e424e36fc997d2355ddc38fc90a7ccdc74bdcd8e056c17fd51416a769e296d01b30e8a2358010
7
- data.tar.gz: d0cfc6c44c3ec5b06880e65fda10a37389649239806a3ce03dd1dba5a0801e057fff9d97ff5d4d6b91d64237559eee041e0c5bb7a9a3bbd8e9a2a0c7d0130da1
6
+ metadata.gz: 83c42081bc808dc8ac66f8246d6996e702ae08b0d243acf287675c48c855d22ea0e0e852ec30544ab5743bc050d85b89af8ca640ab96c27817c6c80b2978f1ff
7
+ data.tar.gz: 8518d0512f2a4e2b200c2cd6fbdd096d1557917c8ae4eb86d745b2a30e80374dce9eef083f2b3c12f1cfc5ff699a0b49aada25c129c24cb38f7c4c4753040988
data/README.md CHANGED
@@ -20,7 +20,7 @@ To get started let's create our Gemfile:
20
20
  ```ruby
21
21
  source "https://rubygems.org"
22
22
 
23
- gem "rondabot", "~> 1.0.1"
23
+ gem "rondabot", "~> 1.0.3"
24
24
  gem "dependabot-omnibus", "~> 0.111.5"
25
25
  ```
26
26
 
@@ -41,7 +41,6 @@ core = Rondabot::Core.new(
41
41
  # ...
42
42
  )
43
43
 
44
- # start bot
45
44
  core.start()
46
45
  ```
47
46
 
@@ -53,7 +52,8 @@ core.start()
53
52
  | **organization** | Name of your organization on azure devops |
54
53
  | **project** | Name of your project on azure devops |
55
54
  | **repository** | Name of your project to using for clone and create pull requests |
56
- | **access_token** | A git credentials to clone e create pull requests |
55
+ | **hostname** | Only Gitlab. Your server hostname on premise. Default `gitlab.com` |
56
+ | **access_token** | A git credentials to clone e create pull requests. On **gitlab** is a personal access token generated in your portal |
57
57
  | **feed_id** | Your feed id npm/yarn on azure devops. Go to Azure Devops, your project _Artifacts_ > _Connect to feed_ > _npm_ and then you can find feed id in the url looks like `https://pkgs.dev.azure.com/your organization name/you feed id to be right here/_packaging/npm-packages/npm/registry/` |
58
58
  | **github_token** | Allows passing in a GitHub access token so that the API rate limiting is not exceeded. When the repository's visibility is public, the `github_token` must be an access token with read access to the public repositories. When repository visibility is private, the `github_token` must be an access token with full control of private repositories. |
59
59
 
@@ -70,7 +70,7 @@ core = Rondabot::Core.new(
70
70
  organization: "Akatsuki",
71
71
  project: "Digital%20Channel",
72
72
  repository: "akatsuki-website",
73
- access_token: "cm9uZGluZWxsaW1vcmFpcwcm9uZGFib3Q"
73
+ access_token: "cm9uZGluZWxsaW1vcmFpcwcm9uZGFib3Q",
74
74
  feed_id: "11db190-e3b1872-1e6e6e-c97f2dd-49253",
75
75
  github_token: "11db190e3b18721e6e6ec97f2dd49253"
76
76
  )
@@ -99,6 +99,23 @@ core = Rondabot::Core.new(
99
99
  core.start()
100
100
  ```
101
101
 
102
+ ### GitLab
103
+
104
+ ```ruby
105
+ require "dependabot/omnibus"
106
+ require "rondabot"
107
+
108
+ core = Rondabot::Core.new(
109
+ provider: "gitlab",
110
+ hostname: "https://gitlab.devops.akatsuki.com",
111
+ repository: "akatsuki/software/mobile/myproject",
112
+ access_token: "F1nZ827g8GsAd1rKx1A8r",
113
+ github_token: "11db190e3b18721e6e6ec97f2dd49253"
114
+ )
115
+
116
+ core.start()
117
+ ```
118
+
102
119
  # License
103
120
 
104
121
  MIT.
@@ -35,9 +35,7 @@ module Rondabot
35
35
  end
36
36
 
37
37
  def repository_uri
38
- if @repository.nil?
39
- raise ArgumentError.new("'repository' param is missing!")
40
- end
38
+ super()
41
39
 
42
40
  if @project.nil?
43
41
  raise ArgumentError.new("'project' param is missing!")
@@ -10,8 +10,7 @@ module Rondabot
10
10
  when 'azure'
11
11
  @source_control = Rondabot::Azure.new(params)
12
12
  when 'gitlab'
13
- # @source_control = Rondabot::GitLab.new(params)
14
- raise ArgumentError.new("gitlab available soon :)")
13
+ @source_control = Rondabot::GitLab.new(params)
15
14
  when 'github'
16
15
  @source_control = Rondabot::GitHub.new(params)
17
16
  else
@@ -23,6 +22,8 @@ module Rondabot
23
22
  package_manager = "npm_and_yarn"
24
23
  source = Dependabot::Source.new(
25
24
  provider: @provider,
25
+ hostname: @source_control.hostname,
26
+ api_endpoint: @source_control.api_endpoint,
26
27
  repo: @source_control.repository_uri
27
28
  )
28
29
 
@@ -4,13 +4,6 @@ module Rondabot
4
4
  super(params)
5
5
  end
6
6
 
7
- def repository_uri
8
- if @repository.nil?
9
- raise ArgumentError.new("'repository' param is missing!")
10
- end
11
- return @repository
12
- end
13
-
14
7
  def create_pull_request params
15
8
  pull_request = super(params)
16
9
 
@@ -2,10 +2,36 @@ module Rondabot
2
2
  class GitLab < SourceControl
3
3
  def initialize params
4
4
  super(params)
5
+ if params[:hostname].nil?
6
+ raise ArgumentError.new("'hostname' param is missing!")
7
+ end
8
+
9
+ if params[:access_token].nil?
10
+ raise ArgumentError.new("'access_token' param is missing!")
11
+ end
12
+
13
+ @hostname = params[:hostname] || "https://gitlab.com"
14
+ @credentials << {
15
+ "type" => "git_source",
16
+ "host" => @hostname,
17
+ "username" => "x-access-token",
18
+ "password" => params[:access_token]
19
+ }
20
+ end
21
+
22
+ def hostname
23
+ return @hostname
5
24
  end
6
25
 
7
- def repository_uri
8
- raise "not implemented"
26
+ def api_endpoint
27
+ return "#{@hostname}/api/v4"
28
+ end
29
+
30
+ def create_pull_request params
31
+ pull_request = super(params)
32
+
33
+ # fix gitlab PR feedback
34
+ puts "PR submitted"
9
35
  end
10
36
  end
11
37
  end
@@ -27,7 +27,10 @@ module Rondabot
27
27
  end
28
28
 
29
29
  def repository_uri
30
- raise "this method cannot be called directly, do override!"
30
+ if @repository.nil?
31
+ raise ArgumentError.new("'repository' param is missing!")
32
+ end
33
+ return @repository
31
34
  end
32
35
 
33
36
  def clone source
@@ -50,6 +53,14 @@ module Rondabot
50
53
 
51
54
  return pr_creator.create
52
55
  end
56
+
57
+ def hostname
58
+ nil
59
+ end
60
+
61
+ def api_endpoint
62
+ nil
63
+ end
53
64
  end
54
65
  end
55
66
 
@@ -1,5 +1,5 @@
1
1
  module Rondabot
2
- VERSION = '1.0.2'
2
+ VERSION = '1.0.3'
3
3
  autoload :Option, File.join(File.dirname(__FILE__), 'module/Option')
4
4
  autoload :Core, File.join(File.dirname(__FILE__), 'module/Core')
5
5
  autoload :Version, File.join(File.dirname(__FILE__), 'module/Version')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rondabot
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rondinelli Morais
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-16 00:00:00.000000000 Z
11
+ date: 2020-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake