firespring_dev_commands 2.3.1 → 2.3.3.pre.alpha.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: dcc3db9cef00a1d1fc8df7b3e37156e1bf4bf2c1b4e609af6b493ffe73eb8c8e
4
- data.tar.gz: cd49faeb589c8a0344351b37bfd717dd3f78a173091f651468fac148a05c00cc
3
+ metadata.gz: 1c59c7b748aeb32cdff246ebcdcc26a13d01e11beb03c27c809b3d471b97edee
4
+ data.tar.gz: 48477613a03f5440e4410d06208aa35886e3f54069c0a5f5f40dff4c3fb32441
5
5
  SHA512:
6
- metadata.gz: dfa84cbf2a6bd1d7ba4dffac839e2f8c01536f0321bd104916909283a85720038457a8cbff3acd7c4acafb38e0cdd0c1ff4c5dcf97a6f87c57bddd06ac8d9b0c
7
- data.tar.gz: de18614349ca0a9f4fdde9318f6f0bc55e66f7cdd338aeed854873a7b1edb191c2c55f72f5a99147c3a89aa6b2638de40cd01c3785cd0ae4a863f457de53783f
6
+ metadata.gz: aaaec52c9a4b8ab6eaa253cd40a3f65232e804ef5e240ec460194db7158d4dbec42baa066bf274b22c121f6b7a57cf9fc5e3b4f21391ebae8d8d76913ee1d6ff
7
+ data.tar.gz: 6734191c80e197200b0cdef1d62020013190cdf27062bbd55f51fdbcad0f50356074b7bdcffb53a683808ba92844bf531a1b5af0b8cc4c8168fae047c512707f
@@ -185,7 +185,7 @@ module Dev
185
185
  end
186
186
 
187
187
  # Checks out the given branch in all repositories with some additional formatting
188
- def checkout_all(branch)
188
+ def checkout_all(branch, default)
189
189
  @success = true
190
190
  puts
191
191
  puts "Checking out #{branch} in each repo".light_yellow if project_dirs.length > 1
@@ -194,7 +194,7 @@ module Dev
194
194
 
195
195
  repo_basename = File.basename(File.realpath(project_dir))
196
196
  puts Dev::Common.new.center_pad(repo_basename).light_green
197
- @success &= checkout(branch, dir: project_dir)
197
+ @success &= checkout(branch, default, dir: project_dir)
198
198
  puts Dev::Common.new.center_pad.light_green
199
199
  end
200
200
  puts
@@ -203,9 +203,10 @@ module Dev
203
203
  end
204
204
 
205
205
  # Checks out the given branch in the given repo
206
+ # If the given branch isn't found, falls back to default branch, then staging, then main
206
207
  # Defaults to the current directory
207
208
  # optionally raise errors
208
- def checkout(branch, dir: default_project_dir, raise_errors: false)
209
+ def checkout(branch, default, dir: default_project_dir, raise_errors: false)
209
210
  raise 'branch is required' if branch.to_s.strip.empty?
210
211
  return unless File.exist?(dir)
211
212
 
@@ -215,10 +216,11 @@ module Dev
215
216
  g = ::Git.open(dir)
216
217
  g.fetch('origin', prune: true)
217
218
 
218
- # If the branch we are checking out doesn't exist, check out either the staging branch or the main branch
219
+ # If the branch we are checking out doesn't exist,
220
+ # check out either the default branch, staging branch, or the main branch
219
221
  actual_branch = branch
220
222
  unless branch_exists?(dir, branch)
221
- actual_branch = [staging_branch, main_branch].uniq.find { |it| branch_exists?(dir, it) }
223
+ actual_branch = [default, staging_branch, main_branch].uniq.find { |it| branch_exists?(dir, it) }
222
224
  puts "Branch #{branch} not found, checking out #{actual_branch} instead".light_yellow
223
225
  end
224
226
 
@@ -31,13 +31,15 @@ module Dev
31
31
  return if exclude.include?(:checkout)
32
32
 
33
33
  desc 'Checks out a branch for each repo (alias: git:co)' \
34
- "\n\tuse BRANCH=abc123 to specify the branch of code you with to switch to (required)" \
35
- "\n\tIf the branch does not exist, the configured staging or main branch will be checked out"
34
+ "\n\tuse BRANCH=abc123 to specify the branch of code you wish to switch to (required)" \
35
+ "\n\tuse DEFAULT=abc456 to specify the branch of code to fall back to" \
36
+ "\n\tIf branch and default do not exist, the configured staging or main branch will be checked out"
36
37
  task checkout: %w(init) do
37
38
  branch = ENV['BRANCH'].to_s.strip
39
+ default = ENV['DEFAULT'].to_s.strip
38
40
  raise 'branch is required' if branch.empty?
39
41
 
40
- Dev::Git.new.checkout_all(branch)
42
+ Dev::Git.new.checkout_all(branch, default)
41
43
  end
42
44
 
43
45
  task co: %w(init checkout) do
@@ -48,7 +50,7 @@ module Dev
48
50
  [d.main_branch, d.staging_branch].uniq.each do |it|
49
51
  desc "Checks out the #{it} branch for each repo (alias: git:co:#{it})"
50
52
  task "checkout:#{it}": %w(init) do
51
- Dev::Git.new.checkout_all(it)
53
+ Dev::Git.new.checkout_all(it, '')
52
54
  end
53
55
 
54
56
  task "co:#{it}": %W(init checkout:#{it}) do
@@ -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.3.1'.freeze
9
+ VERSION = '2.3.3.pre.alpha.1'.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.3.1
4
+ version: 2.3.3.pre.alpha.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Firespring
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-12-11 00:00:00.000000000 Z
11
+ date: 2025-01-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -475,9 +475,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
475
475
  version: '3.1'
476
476
  required_rubygems_version: !ruby/object:Gem::Requirement
477
477
  requirements:
478
- - - ">="
478
+ - - ">"
479
479
  - !ruby/object:Gem::Version
480
- version: '0'
480
+ version: 1.3.1
481
481
  requirements: []
482
482
  rubygems_version: 3.4.10
483
483
  signing_key: