bonchi 0.5.0 → 0.6.0.rc1
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 +4 -4
- data/lib/bonchi/cli.rb +6 -3
- data/lib/bonchi/setup.rb +16 -7
- data/lib/bonchi/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 410601a43918eb8c38d9f2f433d921970853d926b38395710ab08472f00b28b5
|
|
4
|
+
data.tar.gz: 60cbc29372827892d97a7af57274cf84f5d3c157a5267f320508bb712076da6e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 58210c5b2e4d21d0782d19afb4f1eac8abfafb6eb5226282475c17612248c2446272a780201754128d626e1111cb9a158723e0d9b6fbbc66dac4d11cc2395e3b
|
|
7
|
+
data.tar.gz: d0ab19b5878c65d66b71d298962858b1696171cdca96671638a00e7710c0ae970dfcff2223d8eb5285d3b5c3d10acb5634e296daba69d889b27b4bd7c0f51a84
|
data/lib/bonchi/cli.rb
CHANGED
|
@@ -19,9 +19,11 @@ module Bonchi
|
|
|
19
19
|
(e.g. main). If a worktree for BRANCH already exists, switches to it instead.
|
|
20
20
|
|
|
21
21
|
When a .worktree.yml exists in the main worktree, setup runs automatically
|
|
22
|
-
(copy files, allocate ports, run pre_setup and setup commands).
|
|
22
|
+
(copy files, allocate ports, run pre_setup and setup commands).
|
|
23
|
+
Skip with --no-setup, or use --upto STEP to run only up to a specific step.
|
|
23
24
|
DESC
|
|
24
25
|
option :setup, type: :boolean, default: true, desc: "Run setup after creating worktree"
|
|
26
|
+
option :upto, type: :string, desc: "Run setup steps up to and including STEP (copy, link, ports, replace, pre_setup, setup)"
|
|
25
27
|
def create(branch, base = nil)
|
|
26
28
|
base ||= Git.default_base_branch
|
|
27
29
|
path = Git.worktree_dir(branch)
|
|
@@ -40,7 +42,7 @@ module Bonchi
|
|
|
40
42
|
|
|
41
43
|
if options[:setup] && Config.from_main_worktree
|
|
42
44
|
puts ""
|
|
43
|
-
Setup.new(worktree: path).run
|
|
45
|
+
Setup.new(worktree: path).run(upto: options[:upto])
|
|
44
46
|
end
|
|
45
47
|
end
|
|
46
48
|
|
|
@@ -115,8 +117,9 @@ module Bonchi
|
|
|
115
117
|
end
|
|
116
118
|
|
|
117
119
|
desc "setup [-- ARGS...]", "Run setup in current worktree (ports, copy, pre_setup, setup cmd)"
|
|
120
|
+
option :upto, type: :string, desc: "Run steps up to and including STEP (copy, link, ports, replace, pre_setup, setup)"
|
|
118
121
|
def setup(*args)
|
|
119
|
-
Setup.new.run(args)
|
|
122
|
+
Setup.new.run(args, upto: options[:upto])
|
|
120
123
|
end
|
|
121
124
|
|
|
122
125
|
desc "list", "List all worktrees"
|
data/lib/bonchi/setup.rb
CHANGED
|
@@ -10,7 +10,13 @@ module Bonchi
|
|
|
10
10
|
@main_worktree = Git.main_worktree
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
STEPS = %w[copy link ports replace pre_setup setup].freeze
|
|
14
|
+
|
|
15
|
+
def run(args = [], upto: nil)
|
|
16
|
+
if upto && !STEPS.include?(upto)
|
|
17
|
+
abort "#{color(:red)}Error:#{reset} unknown step '#{upto}'. Valid steps: #{STEPS.join(", ")}"
|
|
18
|
+
end
|
|
19
|
+
|
|
14
20
|
if @worktree == @main_worktree
|
|
15
21
|
abort "#{color(:red)}Error:#{reset} already in the main worktree"
|
|
16
22
|
end
|
|
@@ -18,6 +24,9 @@ module Bonchi
|
|
|
18
24
|
config = Config.from_main_worktree
|
|
19
25
|
abort "#{color(:red)}Error:#{reset} .worktree.yml not found in main worktree" unless config
|
|
20
26
|
|
|
27
|
+
last_step = upto || STEPS.last
|
|
28
|
+
run_steps = STEPS[0..STEPS.index(last_step)]
|
|
29
|
+
|
|
21
30
|
ENV["WORKTREE_MAIN"] = @main_worktree
|
|
22
31
|
ENV["WORKTREE_LINKED"] = @worktree
|
|
23
32
|
ENV["WORKTREE_BRANCH"] = Git.current_branch(@worktree)
|
|
@@ -26,8 +35,8 @@ module Bonchi
|
|
|
26
35
|
|
|
27
36
|
puts "Setting up worktree from: #{@main_worktree}"
|
|
28
37
|
|
|
29
|
-
copy_files(config.copy)
|
|
30
|
-
link_files(config.link)
|
|
38
|
+
copy_files(config.copy) if run_steps.include?("copy")
|
|
39
|
+
link_files(config.link) if run_steps.include?("link")
|
|
31
40
|
|
|
32
41
|
# Prefer linked worktree's .worktree.yml if it was copied or already exists
|
|
33
42
|
linked_config = Config.from_worktree(@worktree)
|
|
@@ -36,10 +45,10 @@ module Bonchi
|
|
|
36
45
|
config = linked_config
|
|
37
46
|
end
|
|
38
47
|
|
|
39
|
-
allocate_ports(config.ports) if config.ports.any?
|
|
40
|
-
replace_in_files(config.replace) if config.replace.any?
|
|
41
|
-
run_pre_setup(config.pre_setup)
|
|
42
|
-
exec_setup(config.setup, args)
|
|
48
|
+
allocate_ports(config.ports) if run_steps.include?("ports") && config.ports.any?
|
|
49
|
+
replace_in_files(config.replace) if run_steps.include?("replace") && config.replace.any?
|
|
50
|
+
run_pre_setup(config.pre_setup) if run_steps.include?("pre_setup")
|
|
51
|
+
exec_setup(config.setup, args) if run_steps.include?("setup")
|
|
43
52
|
end
|
|
44
53
|
|
|
45
54
|
private
|
data/lib/bonchi/version.rb
CHANGED