Skip to content

Commit ea92c3b

Browse files
committed
[CI] Prepare log file for git comsumption
1 parent f7e41ee commit ea92c3b

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

rake_tasks/doc_generator.rake

+12-4
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ namespace :docs do
4343
generate_docs(entry)
4444
end
4545
puts "Finished generating #{entries.length} files in #{Time.now.to_i - start_time} seconds"
46+
delete_first_log_line
4647
end
4748

4849
desc 'Update report'
@@ -123,7 +124,7 @@ namespace :docs do
123124
template.gsub(/\s+$/, '')
124125
end
125126

126-
def self.show_parameters(params)
127+
def show_parameters(params)
127128
param_string = []
128129
params.each do |k, v|
129130
value = (is_number?(v) || is_boolean?(v)) ? v : "'#{v}'"
@@ -132,19 +133,19 @@ namespace :docs do
132133
param_string.join(",\n\s\s")
133134
end
134135

135-
def self.show_body(body)
136+
def show_body(body)
136137
'body: ' +
137138
JSON.pretty_generate(body)
138139
.gsub(/\"([a-z_]+)\":/,'\\1: ') # Use Ruby 2 hash syntax
139140
.gsub(/"([a-z_.]+\.[a-z_]+)+":/, '"\\1" =>')
140141
.gsub('aggs', 'aggregations') # Replace 'aggs' with 'aggregations' for consistency
141142
end
142143

143-
def self.is_number?(value)
144+
def is_number?(value)
144145
Float(value) || Integer(value) rescue false
145146
end
146147

147-
def self.is_boolean?(value)
148+
def is_boolean?(value)
148149
(['false', 'true'].include? value) ||
149150
value.is_a?(TrueClass) ||
150151
value.is_a?(FalseClass)
@@ -160,6 +161,13 @@ namespace :docs do
160161
SRC
161162
end
162163
end
164+
165+
def delete_first_log_line
166+
logfile = File.expand_path(__dir__ + '/../log/200-ok.log')
167+
content = IO.readlines(logfile, chomp: true)
168+
puts content.shift
169+
File.write(logfile, content.first)
170+
end
163171
end
164172

165173
#

0 commit comments

Comments
 (0)