howzit 2.1.32 → 2.1.33

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 816754b14a92ca32bab9ae753a03926d0163e2af860164032b7d1fdfff58f716
4
- data.tar.gz: 32fb6fee068779ba312051bd2613c8d47e24777760ecce28da796f2c35899fdd
3
+ metadata.gz: '08e8aa05598a4c02e555d78a4a12b9f7a0b767fe5fcb41c585f31d3db46ef5b1'
4
+ data.tar.gz: aabd6174f5693146e9995b28b86638a0992e541ad8bad7c943d1f72379bdc775
5
5
  SHA512:
6
- metadata.gz: 2741d38466727329dc19755f910acc88a67068b66c1665256365fecffd31ed64a9d0040b97f26140444676a74bec53b1e33c96048dd9b7044b8aecafa0e3a845
7
- data.tar.gz: fbe6e5aa03de0eadbc3d4af7a34d67b0a1628d0926dbf0d908ab9ae8f49b31236b5b6d89d5433ef88785e0d78a9066a969ad7a757b5c81e33f7ada0a923bbc24
6
+ metadata.gz: f9effb24928673466f2cadb59f93f2cac8b3df0154a982f754159b3537a4c92d995914429dd34f1831dc5e9a33d98a33af83518ace340f5b3b223a04f5c740de
7
+ data.tar.gz: 40aa8c9f70d76d7668fa211b9ca0fa3a694cd63ad56324d11eff5129ed0e746d777fad30b92c0dfa276f2bdf41281dbefb79d51f0cf616a4e2b3fc3571848918
data/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ ### 2.1.33
2
+
3
+ 2026-01-06 08:08
4
+
5
+ #### IMPROVED
6
+
7
+ - Variables set via set_var in run blocks are now properly substituted in all task types: fenced code blocks, @run directive actions, @copy directive actions, and @after block content, enabling dynamic script execution and messaging based on variables set in earlier tasks
8
+ - Directive#to_task now merges parent named_args with existing named_arguments instead of overwriting, preserving variables set by scripts via set_var helper functions across sequential task execution
9
+
10
+ #### FIXED
11
+
12
+ - Fix variables set via set_var in run blocks not being substituted in subsequent fenced code block (```run) actions by moving variable substitution to execution time instead of task creation time
13
+ - Fix @after blocks only displaying first two lines by wrapping each line individually to preserve multiline structure including empty lines and numbered lists
14
+ - Fix @after blocks not displaying when no tasks are executed in sequential processing mode by ensuring they display regardless of task execution results
15
+
1
16
  ### 2.1.32
2
17
 
3
18
  2026-01-06 05:21
@@ -85,18 +85,30 @@ module Howzit
85
85
  task_data[:log_level] = current_log_level if current_log_level && !task_data[:log_level]
86
86
 
87
87
  # Set named_arguments before processing titles for variable substitution
88
- Howzit.named_arguments = parent.named_args
88
+ # Merge with existing named_arguments to preserve variables set by scripts
89
+ Howzit.named_arguments ||= {}
90
+ Howzit.named_arguments.merge!(parent.named_args) if parent.named_args
89
91
 
90
92
  case task_type
91
93
  when :block
92
- # Block tasks are already properly formatted
94
+ # Block tasks need title rendering
95
+ # Note: Action substitution happens at execution time in Task#run_block
96
+ # so variables from previous run blocks are available
97
+ title = task_data[:title]
98
+ title = title.render_arguments if title && !title.empty?
99
+ task_data[:title] = title
100
+ # Don't substitute variables in action here - do it at execution time
93
101
  task_data[:parent] = parent
94
102
  Howzit::Task.new(task_data, optional: @optional, default: @default)
95
103
  when :run
96
- # Run tasks need title rendering (similar to define_task_args)
104
+ # Run tasks need title and action rendering (similar to define_task_args)
97
105
  title = task_data[:title]
98
106
  title = title.render_arguments if title && !title.empty?
99
107
  task_data[:title] = title
108
+ # Apply variable substitution to action
109
+ action = task_data[:action]
110
+ action = action.render_arguments if action && !action.empty?
111
+ task_data[:action] = action
100
112
  task_data[:parent] = parent
101
113
  Howzit::Task.new(task_data, optional: @optional, default: @default)
102
114
  when :copy
@@ -104,7 +116,10 @@ module Howzit
104
116
  title = task_data[:title]
105
117
  title = title.render_arguments if title && !title.empty?
106
118
  task_data[:title] = title
107
- task_data[:action] = Shellwords.escape(task_data[:action])
119
+ # Apply variable substitution to action before escaping
120
+ action = task_data[:action]
121
+ action = action.render_arguments if action && !action.empty?
122
+ task_data[:action] = Shellwords.escape(action)
108
123
  task_data[:parent] = parent
109
124
  Howzit::Task.new(task_data, optional: @optional, default: @default)
110
125
  when :open
@@ -34,7 +34,7 @@ module Howzit
34
34
  def ensure_support_dir
35
35
  dir = support_dir
36
36
  legacy_dir = File.expand_path(LEGACY_SUPPORT_DIR)
37
- new_root = File.expand_path(File.join(SUPPORT_DIR, '..'))
37
+ File.expand_path(File.join(SUPPORT_DIR, '..'))
38
38
 
39
39
  # If legacy files exist, always offer to migrate them before proceeding.
40
40
  # Use early_init=false here since config is already loaded by the time we reach this point
@@ -71,15 +71,14 @@ module Howzit
71
71
  ##
72
72
  def migrate_legacy_support(early_init: false)
73
73
  legacy_dir = File.expand_path(LEGACY_SUPPORT_DIR)
74
- new_root = File.expand_path(File.join(SUPPORT_DIR, '..'))
74
+ new_root = File.expand_path(File.join(SUPPORT_DIR, '..'))
75
75
 
76
76
  unless File.directory?(legacy_dir)
77
- if early_init
78
- return
79
- else
80
- Howzit.console.info "No legacy Howzit directory found at #{legacy_dir}; nothing to migrate."
81
- return
82
- end
77
+ return if early_init
78
+
79
+ Howzit.console.info "No legacy Howzit directory found at #{legacy_dir}; nothing to migrate."
80
+ return
81
+
83
82
  end
84
83
 
85
84
  prompt = "Migrate Howzit files from #{legacy_dir} to #{new_root}? This will overwrite files in the new location with legacy versions, " \
@@ -87,7 +86,7 @@ module Howzit
87
86
 
88
87
  if early_init
89
88
  unless simple_yn_prompt(prompt, default: true)
90
- $stderr.puts 'Migration cancelled; no changes made.'
89
+ warn 'Migration cancelled; no changes made.'
91
90
  return
92
91
  end
93
92
  else
@@ -117,7 +116,7 @@ module Howzit
117
116
 
118
117
  FileUtils.rm_rf(legacy_dir)
119
118
  if early_init
120
- $stderr.puts "Migrated Howzit files from #{legacy_dir} to #{new_root}."
119
+ warn "Migrated Howzit files from #{legacy_dir} to #{new_root}."
121
120
  else
122
121
  Howzit.console.info "Migrated Howzit files from #{legacy_dir} to #{new_root}."
123
122
  end
data/lib/howzit/task.rb CHANGED
@@ -62,6 +62,9 @@ module Howzit
62
62
  def run_block
63
63
  Howzit.console.info "#{@prefix}{bg}Running block {bw}#{@title}{x}".c if Howzit.options[:log_level] < 2
64
64
  block = @action
65
+ # Apply variable substitution to block content at execution time
66
+ # (variables from previous run blocks are now available)
67
+ block = block.render_arguments if block && !block.empty?
65
68
  script = Tempfile.new('howzit_script')
66
69
  comm_file = ScriptComm.setup
67
70
  old_log_level = apply_log_level
data/lib/howzit/topic.rb CHANGED
@@ -141,7 +141,10 @@ module Howzit
141
141
 
142
142
  unless @postreqs.empty?
143
143
  begin
144
- puts TTY::Box.frame("{bw}#{@postreqs.join("\n\n").wrap(cols - 4)}{x}".c, width: cols)
144
+ # Apply variable substitution to postreqs content, then wrap each line individually to preserve structure
145
+ postreqs_content = @postreqs.join("\n\n").render_arguments
146
+ wrapped_content = postreqs_content.split(/\n/).map { |line| line.wrap(cols - 4) }.join("\n")
147
+ puts TTY::Box.frame("{bw}#{wrapped_content}{x}".c, width: cols)
145
148
  rescue Errno::EPIPE
146
149
  # Pipe closed, ignore
147
150
  end
@@ -859,21 +862,25 @@ module Howzit
859
862
  re_evaluate_conditionals(conditional_state, directive_index - 1, context)
860
863
  end
861
864
 
862
- total = "{bw}#{@results[:total]}{by} #{@results[:total] == 1 ? 'task' : 'tasks'}".c
863
- errors = "{bw}#{@results[:errors]}{by} #{@results[:errors] == 1 ? 'error' : 'errors'}".c
864
- @results[:message] += if @results[:errors].zero?
865
- "{bg}\u{2713} {by}Ran #{total}{x}".c
866
- elsif Howzit.options[:force]
867
- "{br}\u{2715} {by}Completed #{total} with #{errors}{x}".c
868
- else
869
- "{br}\u{2715} {by}Ran #{total}, terminated due to error{x}".c
870
- end
871
-
872
- output.push(@results[:message]) if Howzit.options[:log_level] < 2 && !nested && !Howzit.options[:run]
865
+ if @results[:total].positive?
866
+ total = "{bw}#{@results[:total]}{by} #{@results[:total] == 1 ? 'task' : 'tasks'}".c
867
+ errors = "{bw}#{@results[:errors]}{by} #{@results[:errors] == 1 ? 'error' : 'errors'}".c
868
+ @results[:message] += if @results[:errors].zero?
869
+ "{bg}\u{2713} {by}Ran #{total}{x}".c
870
+ elsif Howzit.options[:force]
871
+ "{br}\u{2715} {by}Completed #{total} with #{errors}{x}".c
872
+ else
873
+ "{br}\u{2715} {by}Ran #{total}, terminated due to error{x}".c
874
+ end
875
+ output.push(@results[:message]) if Howzit.options[:log_level] < 2 && !nested && !Howzit.options[:run]
876
+ end
873
877
 
874
878
  unless @postreqs.empty?
875
879
  begin
876
- puts TTY::Box.frame("{bw}#{@postreqs.join("\n\n").wrap(cols - 4)}{x}".c, width: cols)
880
+ # Apply variable substitution to postreqs content, then wrap each line individually to preserve structure
881
+ postreqs_content = @postreqs.join("\n\n").render_arguments
882
+ wrapped_content = postreqs_content.split(/\n/).map { |line| line.wrap(cols - 4) }.join("\n")
883
+ puts TTY::Box.frame("{bw}#{wrapped_content}{x}".c, width: cols)
877
884
  rescue Errno::EPIPE
878
885
  # Pipe closed, ignore
879
886
  end
@@ -3,5 +3,5 @@
3
3
  # Primary module for this gem.
4
4
  module Howzit
5
5
  # Current Howzit version.
6
- VERSION = '2.1.32'
6
+ VERSION = '2.1.33'
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: howzit
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.32
4
+ version: 2.1.33
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brett Terpstra