pull_request_ai 0.1.0 → 0.1.1

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: 747534e2b7a4327fb3a3eb986df97000e737072500f1e70839b2d61c5edeaf57
4
- data.tar.gz: 2647f3525b95e48a268a05ded206e5a644e6a6e10494680af11f398dd9f4173d
3
+ metadata.gz: 4fe8a3b4b780f8437d9f4937570f40494d0e9f925dfb7a16f6dbb16917a60766
4
+ data.tar.gz: 75bf13c5258ee2618747b26a0edd211a1194c28df15c03b6b2ea271b9f22e2b8
5
5
  SHA512:
6
- metadata.gz: c918aa851b69ba5b5f079bcc75ad308132083e3a83638786063917022dc1d6cc919c69524422d64b173f4e378b923d771a3a79d6c8caa7e392f6139325f95bf8
7
- data.tar.gz: 6afa49e24926c1895088fb60704b6e5008239b1e2214e4900cbc3e313f8a4490561a5925915c357cd173196c3f09e4650286f5bfd504573f2af43abd8966a667
6
+ metadata.gz: 0c4719245d1e53039b74c6190168d4a58c29defa2e4caded24a817e652db1321e51758cc18dc467e9d392bd170990fda1650d4e2a2642f081cf624153bf530bd
7
+ data.tar.gz: 4b4b8c5e1d22df7d99d3a2982e6686b36ef90075ab23c1edc1ca1f5037a2cc8a80ebc09b6abb72dd5f5252e22cd6ffcc5a2f96e487b88ceee59f3a609b5b6506
@@ -81,8 +81,8 @@ requestDescriptionButton.onclick = () => {
81
81
  else {
82
82
  enableSubmission(data);
83
83
  }
84
- }).catch(errorMsg => {
85
- window.showNotification({ message: errorMsg, theme: "error" });
84
+ }).catch(error => {
85
+ window.showNotification({ message: error.message, theme: "error" });
86
86
  });
87
87
  }
88
88
 
@@ -102,8 +102,8 @@ createPullRequestButton.onclick = () => {
102
102
  jsonPost('/rrtools/pull_request_ai/create', data).then(data => {
103
103
  hideSpinner();
104
104
  processData(data, "Pull Request created successfully.");
105
- }).catch(errorMsg => {
106
- window.showNotification({ message: errorMsg, theme: "error" });
105
+ }).catch(error => {
106
+ window.showNotification({ message: error.message, theme: "error" });
107
107
  });
108
108
  }
109
109
 
@@ -114,8 +114,8 @@ updatePullRequestButton.onclick = () => {
114
114
  jsonPost('/rrtools/pull_request_ai/update', data).then(data => {
115
115
  hideSpinner();
116
116
  processData(data, "Pull Request updated successfully.");
117
- }).catch(errorMsg => {
118
- window.showNotification({ message: errorMsg, theme: "error" });
117
+ }).catch(error => {
118
+ window.showNotification({ message: error.message, theme: "error" });
119
119
  });
120
120
  }
121
121
 
@@ -7,10 +7,13 @@ module PullRequestAi
7
7
  def new
8
8
  @types = [['Feature', :feature], ['Release', :release], ['HotFix', :hotfix]]
9
9
 
10
+ @misconfigured = PullRequestAi.openai_api_key.nil? || PullRequestAi.openai_api_key.empty?
11
+ @error_message = 'Missing the OpenAI API Key.' if @misconfigured
12
+
10
13
  client.destination_branches.fmap do |branches|
11
- @branches = branches
14
+ @branches = branches
12
15
  end.or do |error|
13
- @error_message = error.description
16
+ @error_message ||= error.description
14
17
  end
15
18
  end
16
19
 
@@ -9,7 +9,7 @@
9
9
  </div>
10
10
  </div>
11
11
 
12
- <div id='prepare-container' class=<%= 'hide' if @error_message %>>
12
+ <div id='prepare-container' class=<%= 'hide' if @error_message || @misconfigured %>>
13
13
  <div class='flex'>
14
14
  <div class='mr-10 fw'>
15
15
  <%= label_tag :branch_title, 'Destination Branch*' %>
@@ -27,8 +27,62 @@
27
27
  </div>
28
28
  </div>
29
29
 
30
+ <div class=<%= 'hide' unless @misconfigured %>>
31
+ <h3>Configuration guide</h3>
32
+ <p class='mt-10 w-760'>To configure this Rails Engine you can <strong>just</strong> set some specific Environment Variables or you can use the Rails Engine initializer class.</p>
33
+ <p class='mt-10 w-760'>The minimum requirement that allows this Rails Engine to ask chatGPT Pull Request descriptions based on Git respository changes is the <a href="https://platform.openai.com/account/usage" rel="nofollow">OpenAI Key</a>.</p>
34
+ <p class='mt-20 w-760'>Using <strong>only</strong> Environment Variable you need to set:</p>
35
+ <ul class='mt-10'>
36
+ <li><a href="https://platform.openai.com/account/usage" rel="nofollow">OPENAI_API_KEY</a></li>
37
+ </ul>
38
+ <p class='mt-20'>OR, if you choose to use the initializer:</p>
39
+ <div class='mt-10'>
40
+ <pre>
41
+ <span>PullRequestAi.configure do |config|</span>
42
+ <span> config.openai_api_key = 'YOUR_OPENAI_API_KEY'</span>
43
+ <span>end</span>
44
+ </pre>
45
+ </div>
46
+
47
+ <h3 class='mt-40'>Integrations</h3>
48
+ <p class='mt-10 w-760'>To enable direct creation or updating of Pull Requests this Rails Engine can integrate with GitHub or Bitbucket.</p>
49
+ <p class='mt-10 w-760'>For GitHub you need to provide a <a href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token">GitHub Access Token</a>.
50
+ And for Bitbucket you need to provide a <a href="https://bitbucket.org/account/settings/app-passwords/" rel="nofollow">Bitbucket App Password</a> and your Bitbucket Username.</p>
51
+
52
+ <h4 class='mt-40'>GitHub Configuration</h4>
53
+ <p class='mt-10 w-760'>Using <strong>only</strong> Environment Variable you need to set:</p>
54
+ <ul class='mt-10'>
55
+ <li><a href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token" rel="nofollow">GITHUB_ACCESS_TOKEN</a></li>
56
+ </ul>
57
+ <p class='mt-20'>OR, if you choose to use the initializer:</p>
58
+ <div class='mt-10'>
59
+ <pre>
60
+ <span>PullRequestAi.configure do |config|</span>
61
+ <span> config.github_access_token = 'YOUR_GITHUB_ACCESS_TOKEN'</span>
62
+ <span>end</span>
63
+ </pre>
64
+ </div>
65
+
66
+ <h4 class='mt-40'>Bitbucket Configuration</h4>
67
+ <p class='mt-10 w-760'>Using <strong>only</strong> Environment Variable you need to set:</p>
68
+ <ul class='mt-10'>
69
+ <li><a href="https://bitbucket.org/account/settings/app-passwords/" rel="nofollow">BITBUCKET_APP_PASSWORD</a></li>
70
+ <li><a href="https://bitbucket.org/account/settings/" rel="nofollow">BITBUCKET_USERNAME</a></li>
71
+ </ul>
72
+ <p class='mt-20'>OR, if you choose to use the initializer:</p>
73
+ <div class='mt-10'>
74
+ <pre>
75
+ <span>PullRequestAi.configure do |config|</span>
76
+ <span> config.bitbucket_app_password = 'YOUR_BITBUCKET_APP_PASSWORD'</span>
77
+ <span> config.bitbucket_username = 'YOUR_BITBUCKET_USERNAME'</span>
78
+ <span>end</span>
79
+ </pre>
80
+ </div>
81
+
82
+ </div>
83
+
30
84
  <div class='flex'>
31
- <%= button_tag 'Reload', { id: 'reload-btn', class: "mt-20#{@error_message ? '' : ' hide'}" } %>
85
+ <%= button_tag 'Reload', { id: 'reload-btn', class: "mt-20#{@error_message && !@misconfigured ? '' : ' hide'}" } %>
32
86
  <%= button_tag 'Request Description', { id: 'request-description-btn', class: "mt-20#{@error_message ? ' hide' : ''}" } %>
33
87
  </div>
34
88
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PullRequestAi
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pull_request_ai
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Runtime Revolution
@@ -14,72 +14,72 @@ dependencies:
14
14
  name: dry-monads
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.6'
19
+ version: 1.6.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '1.6'
26
+ version: 1.6.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: git_clone_url
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '2.0'
33
+ version: 2.0.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '2.0'
40
+ version: 2.0.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: httparty
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '0.21'
47
+ version: 0.21.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '0.21'
54
+ version: 0.21.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rack-attack
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
- version: '6.6'
61
+ version: 6.6.0
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
- version: '6.6'
68
+ version: 6.6.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rails
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
- version: '6.1'
75
+ version: 6.1.4
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
- version: '6.1'
82
+ version: 6.1.4
83
83
  description: Rails Engine that provides pull requests descriptions generated by ChatGPT.
84
84
  email:
85
85
  - info@runtime-revolution.com