firespring_dev_commands 2.1.37.pre.alpha.1 → 2.1.37.pre.alpha.2

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: 949e0ea37725fa34286ed8c9a5c4712da3de87f290df3188a2eab503efa8fc9f
4
- data.tar.gz: 6a8328a0d4286c45ef14ae1becaef4ec9799220fe65e8928ad585fb700d83a94
3
+ metadata.gz: d6c60886c07fe06093181d816b979f07cd1bcb55b14d6b86ef586c8fbc65fc43
4
+ data.tar.gz: 41c394de5005718cc264b6bc12dda1bf7a1ce5edf6e764b3dc516675e7297ca1
5
5
  SHA512:
6
- metadata.gz: f2dd84cb2b3d791a6ff5964b2beee0be31ab59fce94bce2b403b32e844a95509659a438cfc0486cff9406b340973c98feb0982849997b23962ea691f01c27b04
7
- data.tar.gz: 228848de11d5bf71e563f57a3204d390cad1b04bbf2c09e8af399a64545eba3485acc41ba918df7d00b688b87ad9605883f207852c2a4a4f2e2ac7d62880ee46
6
+ metadata.gz: d709361a1f3cfff3889f2437884aaae55014a8790bc9a17ca9a8fe1c7a7c3070dd3a47dc18879f83e04a726e18ce7ef55eee2f76edb0ccf5e4a7b33ec617b98e
7
+ data.tar.gz: 21768f2ed5b1333839e8caa356d77bd7cccf30861eeba840f50d7493d511d033aa21fbfc05dafc48443883815584776d9c1a95e55a721722dec91932aff1cea6
@@ -425,10 +425,7 @@ module Dev
425
425
  g.fetch('origin', prune: true)
426
426
  end
427
427
 
428
- def commit_status(repository:, branch:, status:, organization: 'firespring', options: {})
429
- token = ENV['GITHUB_TOKEN'].to_s.strip
430
- raise 'GITHUB_TOKEN is required' unless token
431
-
428
+ def commit_status(token:, repository:, branch:, status:, organization: 'firespring', options: {})
432
429
  # Set up the GitHub client
433
430
  client = Octokit::Client.new(access_token: token)
434
431
 
@@ -160,48 +160,57 @@ module Dev
160
160
  end
161
161
  end
162
162
 
163
+ # rubocop:disable Metrics/MethodLength
163
164
  # Create the rake task for the git commit status task.
164
165
  def create_commit_status_task!
165
166
  # Have to set a local variable to be accessible inside of the instance_eval block
166
167
  exclude = @exclude
167
-
168
168
  DEV_COMMANDS_TOP_LEVEL.instance_eval do
169
169
  namespace :git do
170
170
  return if exclude.include?(:commit_status)
171
171
 
172
- # TODO: Clean, comments and description
173
- desc 'Add status to commit' \
174
- "\n\tuse TODO"
175
-
176
- task :create_commit_status do
177
- # Key Values
178
- repository = ENV['REPOSITORY'].to_s.strip
179
- branch = ENV['BRANCH'].to_s.strip
180
- status = ENV['STATUS'].to_s.strip
181
-
182
- raise 'Repository name is required' unless repository
183
- raise 'Branch name is required' unless branch
184
- raise 'Status is required' unless status
185
-
186
- # Validate status
187
- valid_statuses = %w(error failure pending success)
188
- raise "Invalid status: #{status}. Valid statuses are: #{valid_statuses.join(', ')}" unless valid_statuses.include?(status)
189
-
190
- # Optional Values
191
- context = ENV['CONTEXT'].to_s.strip
192
- description = ENV['DESCRIPTION'].to_s.strip
193
- target_url = ENV['TARGET_URL'].to_s.strip
194
-
195
- options = {}
196
- options[:context] = context unless context.empty?
197
- options[:description] = description unless description.empty?
198
- options[:target_url] = target_url unless target_url.empty?
199
-
200
- Dev::Git.new.commit_status(repository:, branch:, status:, options:)
172
+ desc 'Add status to PR' \
173
+ "\n\tuse GITHUB_TOKEN=abc123 enables write options for the check (required)" \
174
+ "\n\tuse REPOSITORY=abc123 to specify the repository (required)" \
175
+ "\n\tuse BRANCH=abc123 to specify the branch of code (required)" \
176
+ "\n\tuse CONTEXT=abc123 names the check on the PR (optional)" \
177
+ "\n\tuse TARGET_URL={url} adds 'detail' hyperlink to check on the PR (optional)"
178
+
179
+ # Key Values
180
+ token = ENV['GITHUB_TOKEN'].to_s.strip
181
+ repository = ENV['REPOSITORY'].to_s.strip
182
+ branch = ENV['BRANCH'].to_s.strip
183
+
184
+ raise 'GITHUB_TOKEN is required' unless token
185
+ raise 'Repository name is required' unless repository
186
+ raise 'Branch name is required' unless branch
187
+
188
+ options = {}
189
+ options[:context] = ENV['CONTEXT'].to_s.strip unless ENV['CONTEXT'].to_s.strip.empty?
190
+ options[:target_url] = ENV['TARGET_URL'].to_s.strip unless ENV['TARGET_URL'].to_s.strip.empty?
191
+
192
+ namespace :commit_status do
193
+ desc 'Add status success'
194
+ task :success do
195
+ Dev::Git.new.commit_status(token:, repository:, branch:, status: 'success', options:)
196
+ end
197
+ desc 'Add status pending'
198
+ task :pending do
199
+ Dev::Git.new.commit_status(token:, repository:, branch:, status: 'pending', options:)
200
+ end
201
+ desc 'Add status error'
202
+ task :error do
203
+ Dev::Git.new.commit_status(token:, repository:, branch:, status: 'error', options:)
204
+ end
205
+ desc 'Add status failure'
206
+ task :failure do
207
+ Dev::Git.new.commit_status(token:, repository:, branch:, status: 'failure', options:)
208
+ end
201
209
  end
202
210
  end
203
211
  end
204
212
  end
213
+ # rubocop:enable Metrics/MethodLength
205
214
  end
206
215
  end
207
216
  end
@@ -6,6 +6,6 @@ module Dev
6
6
  # Use 'v.v.v.pre.alpha.v' for pre-release vesions
7
7
  # Use 'v.v.v.beta.v for beta versions
8
8
  # Use semantic versioning for any releases (https://semver.org/)
9
- VERSION = '2.1.37.pre.alpha.1'.freeze
9
+ VERSION = '2.1.37.pre.alpha.2'.freeze
10
10
  end
11
11
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: firespring_dev_commands
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.37.pre.alpha.1
4
+ version: 2.1.37.pre.alpha.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Firespring
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-04 00:00:00.000000000 Z
11
+ date: 2024-06-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport