firespring_dev_commands 2.3.1 → 2.3.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: dcc3db9cef00a1d1fc8df7b3e37156e1bf4bf2c1b4e609af6b493ffe73eb8c8e
4
- data.tar.gz: cd49faeb589c8a0344351b37bfd717dd3f78a173091f651468fac148a05c00cc
3
+ metadata.gz: '0649c081bc238700de0be77cfc4741fe6c3fd4eb5f02e3aa3ceaba82e0bd69c9'
4
+ data.tar.gz: cdbac96b5493439811afa9b11e03156d6980b81b8db83aec3e7cc27cf697cdd0
5
5
  SHA512:
6
- metadata.gz: dfa84cbf2a6bd1d7ba4dffac839e2f8c01536f0321bd104916909283a85720038457a8cbff3acd7c4acafb38e0cdd0c1ff4c5dcf97a6f87c57bddd06ac8d9b0c
7
- data.tar.gz: de18614349ca0a9f4fdde9318f6f0bc55e66f7cdd338aeed854873a7b1edb191c2c55f72f5a99147c3a89aa6b2638de40cd01c3785cd0ae4a863f457de53783f
6
+ metadata.gz: 671bbd36642608a0068af882e56a15897acdf8150bcd0d92086ed9ab09fc73641366bcfd534db7a7552f513bca11666113ad5e1b33337585f287535fd60887b5
7
+ data.tar.gz: f95cae18a8681a4c19586a3a7b40f3ec5e92a873672a23458c31bbe9e28cd1d0aaa83b4028a7b6a46b7d587b8dd74274eb303ecb9e30174ae2c513507d828522
@@ -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
@@ -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.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.3.1
4
+ version: 2.3.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-12-11 00:00:00.000000000 Z
11
+ date: 2024-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport