makit 0.0.139 → 0.0.141

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.
@@ -5,6 +5,7 @@ require_relative "configuration/project"
5
5
  require_relative "configuration/step"
6
6
  require_relative "configuration/gitlab_helper"
7
7
  require_relative "configuration/rakefile_helper"
8
+ require_relative "configuration/timeout"
8
9
 
9
10
  # Main configuration module that loads all configuration classes
10
11
  module Makit
@@ -94,16 +94,24 @@ class String
94
94
  Makit::Commands::Runner.default.execute(request)
95
95
  end
96
96
 
97
- def log
97
+ def log(log_file = nil)
98
98
  command = self
99
99
  request = Makit::Commands::Request.from_string(command)
100
100
  result = Makit::Commands::Runner.default.execute(request)
101
101
 
102
- # Log the command execution result
103
- if result.success?
104
- Makit::Logging.info("Command completed successfully: #{command}")
102
+ # If a log file is provided, write outputs to the file (maintains backward compatibility)
103
+ if log_file
104
+ FileUtils.mkdir_p(File.dirname(log_file))
105
+ File.write(log_file, "") unless File.exist?(log_file)
106
+ File.write(log_file, result.stdout, mode: "w") if result.stdout && !result.stdout.empty?
107
+ File.write(log_file, result.stderr, mode: "a") if result.stderr && !result.stderr.empty?
105
108
  else
106
- Makit::Logging.error("Command failed: #{command} (exit code: #{result.exit_code})")
109
+ # Otherwise, log to the Makit logger
110
+ if result.success?
111
+ Makit::Logging.info("Command completed successfully: #{command}")
112
+ else
113
+ Makit::Logging.error("Command failed: #{command} (exit code: #{result.exit_code})")
114
+ end
107
115
  end
108
116
 
109
117
  result
@@ -1,174 +1,174 @@
1
- # frozen_string_literal: true
2
-
3
- module Makit
4
- module Rake
5
- # Enhanced trace controller for Rake with Makit-specific debugging information
6
- #
7
- # This class provides enhanced tracing capabilities when --trace is passed to rake,
8
- # adding makit-specific debugging information to help with troubleshooting and
9
- # understanding command execution flow.
10
- #
11
- # @example Basic usage
12
- # # In Rakefile
13
- # require "makit"
14
- # Makit::Rake::TraceController.setup
15
- #
16
- # @example With environment variable
17
- # MAKIT_TRACE=true rake --trace
18
- class TraceController
19
- # Set up enhanced tracing for Rake tasks
20
- #
21
- # This method should be called early in the Rakefile to enable enhanced
22
- # tracing when --trace is passed to rake.
23
- #
24
- # @return [void]
25
- def self.setup
26
- return unless should_enhance_trace?
27
-
28
- # Set up enhanced tracing
29
- setup_enhanced_tracing
30
- Makit::Logging.debug("Enhanced trace controller activated") if defined?(Makit::Logging)
31
- end
32
-
33
- # Check if trace enhancement should be enabled
34
- #
35
- # @return [Boolean] true if trace enhancement should be enabled
36
- def self.should_enhance_trace?
37
- ENV['RAKE_TRACE'] ||
38
- ARGV.include?('--trace') ||
39
- ENV['MAKIT_TRACE'] == 'true'
40
- end
41
-
42
- # Get current trace status
43
- #
44
- # @return [Hash] trace status information
45
- def self.trace_status
46
- {
47
- rake_trace: ENV['RAKE_TRACE'],
48
- trace_flag: ARGV.include?('--trace'),
49
- makit_trace: ENV['MAKIT_TRACE'],
50
- enhanced: should_enhance_trace?
51
- }
52
- end
53
-
54
- private
55
-
56
- # Set up enhanced tracing by monkey patching Rake's trace methods
57
- #
58
- # @return [void]
59
- def self.setup_enhanced_tracing
60
- # Store the original trace method if not already stored
61
- unless ::Rake::Task.method_defined?(:makit_original_trace)
62
- ::Rake::Task.class_eval do
63
- alias_method :makit_original_trace, :trace
64
-
65
- def trace(mode, message)
66
- # Call original trace
67
- makit_original_trace(mode, message)
68
-
69
- # Add makit-specific trace info
70
- add_makit_trace_info(mode, message)
71
- end
72
-
73
- private
74
-
75
- # Add makit-specific trace information
76
- #
77
- # @param mode [Symbol] trace mode (:execute, :invoke, :prereq, etc.)
78
- # @param message [String] trace message
79
- # @return [void]
80
- def add_makit_trace_info(mode, message)
81
- case mode
82
- when :execute
83
- trace_makit_execution(message)
84
- when :invoke
85
- trace_makit_invocation(message)
86
- when :prereq
87
- trace_makit_prerequisite(message)
88
- when :syntax
89
- trace_makit_syntax(message)
90
- end
91
- end
92
-
93
- # Trace makit execution with detailed information
94
- #
95
- # @param message [String] execution message
96
- # @return [void]
97
- def trace_makit_execution(message)
98
- if makit_related?(message)
99
- puts " [MAKIT] Executing: #{message}"
100
- puts " [MAKIT] Strategy: #{get_makit_strategy_info}"
101
- puts " [MAKIT] Environment: #{ENV['MAKIT_STRATEGY'] || 'auto'}"
102
- puts " [MAKIT] Working Directory: #{Dir.pwd}"
103
- puts " [MAKIT] Timestamp: #{Time.now.iso8601}"
104
- puts " [MAKIT] Task: #{name}"
105
- end
106
- end
107
-
108
- # Trace makit invocation
109
- #
110
- # @param message [String] invocation message
111
- # @return [void]
112
- def trace_makit_invocation(message)
113
- if makit_related?(message)
114
- puts " [MAKIT] Invoking: #{message}"
115
- puts " [MAKIT] Task: #{name}"
116
- end
117
- end
118
-
119
- # Trace makit prerequisite
120
- #
121
- # @param message [String] prerequisite message
122
- # @return [void]
123
- def trace_makit_prerequisite(message)
124
- if makit_related?(message)
125
- puts " [MAKIT] Prerequisite: #{message}"
126
- puts " [MAKIT] Task: #{name}"
127
- end
128
- end
129
-
130
- # Trace makit syntax
131
- #
132
- # @param message [String] syntax message
133
- # @return [void]
134
- def trace_makit_syntax(message)
135
- if makit_related?(message)
136
- puts " [MAKIT] Syntax: #{message}"
137
- end
138
- end
139
-
140
- # Check if message is makit-related
141
- #
142
- # @param message [String] message to check
143
- # @return [Boolean] true if message is makit-related
144
- def makit_related?(message)
145
- message.downcase.include?('makit') ||
146
- message.include?('bundle') ||
147
- message.include?('gem') ||
148
- message.include?('dotnet') ||
149
- message.include?('protoc') ||
150
- message.include?('git')
151
- end
152
-
153
- # Get makit strategy information safely
154
- #
155
- # @return [String] strategy information
156
- def get_makit_strategy_info
157
- begin
158
- if defined?(Makit::Commands::Runner)
159
- runner = Makit::Commands::Runner.default
160
- info = runner.strategy_info
161
- "#{info[:type]} (#{info[:class]})"
162
- else
163
- "not available"
164
- end
165
- rescue => e
166
- "error: #{e.message}"
167
- end
168
- end
169
- end
170
- end
171
- end
172
- end
173
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Makit
4
+ module Rake
5
+ # Enhanced trace controller for Rake with Makit-specific debugging information
6
+ #
7
+ # This class provides enhanced tracing capabilities when --trace is passed to rake,
8
+ # adding makit-specific debugging information to help with troubleshooting and
9
+ # understanding command execution flow.
10
+ #
11
+ # @example Basic usage
12
+ # # In Rakefile
13
+ # require "makit"
14
+ # Makit::Rake::TraceController.setup
15
+ #
16
+ # @example With environment variable
17
+ # MAKIT_TRACE=true rake --trace
18
+ class TraceController
19
+ # Set up enhanced tracing for Rake tasks
20
+ #
21
+ # This method should be called early in the Rakefile to enable enhanced
22
+ # tracing when --trace is passed to rake.
23
+ #
24
+ # @return [void]
25
+ def self.setup
26
+ return unless should_enhance_trace?
27
+
28
+ # Set up enhanced tracing
29
+ setup_enhanced_tracing
30
+ Makit::Logging.debug("Enhanced trace controller activated") if defined?(Makit::Logging)
31
+ end
32
+
33
+ # Check if trace enhancement should be enabled
34
+ #
35
+ # @return [Boolean] true if trace enhancement should be enabled
36
+ def self.should_enhance_trace?
37
+ ENV['RAKE_TRACE'] ||
38
+ ARGV.include?('--trace') ||
39
+ ENV['MAKIT_TRACE'] == 'true'
40
+ end
41
+
42
+ # Get current trace status
43
+ #
44
+ # @return [Hash] trace status information
45
+ def self.trace_status
46
+ {
47
+ rake_trace: ENV['RAKE_TRACE'],
48
+ trace_flag: ARGV.include?('--trace'),
49
+ makit_trace: ENV['MAKIT_TRACE'],
50
+ enhanced: should_enhance_trace?
51
+ }
52
+ end
53
+
54
+ private
55
+
56
+ # Set up enhanced tracing by monkey patching Rake's trace methods
57
+ #
58
+ # @return [void]
59
+ def self.setup_enhanced_tracing
60
+ # Store the original trace method if not already stored
61
+ unless ::Rake::Task.method_defined?(:makit_original_trace)
62
+ ::Rake::Task.class_eval do
63
+ alias_method :makit_original_trace, :trace
64
+
65
+ def trace(mode, message)
66
+ # Call original trace
67
+ makit_original_trace(mode, message)
68
+
69
+ # Add makit-specific trace info
70
+ add_makit_trace_info(mode, message)
71
+ end
72
+
73
+ private
74
+
75
+ # Add makit-specific trace information
76
+ #
77
+ # @param mode [Symbol] trace mode (:execute, :invoke, :prereq, etc.)
78
+ # @param message [String] trace message
79
+ # @return [void]
80
+ def add_makit_trace_info(mode, message)
81
+ case mode
82
+ when :execute
83
+ trace_makit_execution(message)
84
+ when :invoke
85
+ trace_makit_invocation(message)
86
+ when :prereq
87
+ trace_makit_prerequisite(message)
88
+ when :syntax
89
+ trace_makit_syntax(message)
90
+ end
91
+ end
92
+
93
+ # Trace makit execution with detailed information
94
+ #
95
+ # @param message [String] execution message
96
+ # @return [void]
97
+ def trace_makit_execution(message)
98
+ if makit_related?(message)
99
+ puts " [MAKIT] Executing: #{message}"
100
+ puts " [MAKIT] Strategy: #{get_makit_strategy_info}"
101
+ puts " [MAKIT] Environment: #{ENV['MAKIT_STRATEGY'] || 'auto'}"
102
+ puts " [MAKIT] Working Directory: #{Dir.pwd}"
103
+ puts " [MAKIT] Timestamp: #{Time.now.iso8601}"
104
+ puts " [MAKIT] Task: #{name}"
105
+ end
106
+ end
107
+
108
+ # Trace makit invocation
109
+ #
110
+ # @param message [String] invocation message
111
+ # @return [void]
112
+ def trace_makit_invocation(message)
113
+ if makit_related?(message)
114
+ puts " [MAKIT] Invoking: #{message}"
115
+ puts " [MAKIT] Task: #{name}"
116
+ end
117
+ end
118
+
119
+ # Trace makit prerequisite
120
+ #
121
+ # @param message [String] prerequisite message
122
+ # @return [void]
123
+ def trace_makit_prerequisite(message)
124
+ if makit_related?(message)
125
+ puts " [MAKIT] Prerequisite: #{message}"
126
+ puts " [MAKIT] Task: #{name}"
127
+ end
128
+ end
129
+
130
+ # Trace makit syntax
131
+ #
132
+ # @param message [String] syntax message
133
+ # @return [void]
134
+ def trace_makit_syntax(message)
135
+ if makit_related?(message)
136
+ puts " [MAKIT] Syntax: #{message}"
137
+ end
138
+ end
139
+
140
+ # Check if message is makit-related
141
+ #
142
+ # @param message [String] message to check
143
+ # @return [Boolean] true if message is makit-related
144
+ def makit_related?(message)
145
+ message.downcase.include?('makit') ||
146
+ message.include?('bundle') ||
147
+ message.include?('gem') ||
148
+ message.include?('dotnet') ||
149
+ message.include?('protoc') ||
150
+ message.include?('git')
151
+ end
152
+
153
+ # Get makit strategy information safely
154
+ #
155
+ # @return [String] strategy information
156
+ def get_makit_strategy_info
157
+ begin
158
+ if defined?(Makit::Commands::Runner)
159
+ runner = Makit::Commands::Runner.default
160
+ info = runner.strategy_info
161
+ "#{info[:type]} (#{info[:class]})"
162
+ else
163
+ "not available"
164
+ end
165
+ rescue => e
166
+ "error: #{e.message}"
167
+ end
168
+ end
169
+ end
170
+ end
171
+ end
172
+ end
173
+ end
174
174
  end
@@ -83,7 +83,7 @@ module Makit
83
83
 
84
84
  def self.update_test_step(project)
85
85
  test_commands = []
86
- test_commands << "dotnet test tests/#{project.name}/#{project.name}.Tests.csproj"
86
+ test_commands << "dotnet test tests/#{project.name}.Tests/#{project.name}.Tests.csproj"
87
87
  steps = project.steps
88
88
  if steps.any? { |step| step.name == "test" }
89
89
  test_step = steps.find { |step| step.name == "test" }
data/lib/makit/version.rb CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Makit
4
4
  # Static version for now to avoid circular dependency issues
5
- VERSION = "0.0.139"
5
+ VERSION = "0.0.141"
6
6
 
7
7
  # Version management utilities for various file formats
8
8
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: makit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.139
4
+ version: 0.0.141
5
5
  platform: ruby
6
6
  authors:
7
7
  - Your Name
@@ -233,6 +233,7 @@ files:
233
233
  - lib/makit/configuration/project.rb
234
234
  - lib/makit/configuration/rakefile_helper.rb
235
235
  - lib/makit/configuration/step.rb
236
+ - lib/makit/configuration/timeout.rb
236
237
  - lib/makit/content/default_gitignore.rb
237
238
  - lib/makit/content/default_gitignore.txt
238
239
  - lib/makit/content/default_rakefile.rb
@@ -354,7 +355,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
354
355
  - !ruby/object:Gem::Version
355
356
  version: '0'
356
357
  requirements: []
357
- rubygems_version: 3.6.9
358
+ rubygems_version: 3.7.0
358
359
  specification_version: 4
359
360
  summary: A Ruby gem
360
361
  test_files: []