Files
chromebrew/tests/help_test
SupeChicken666 91f0f2ac98 lib/package: Get rid of eval strings (#10117)
* lib/package: Cleanup functions, get rid of `eval` strings

Signed-off-by: supechicken <me@supechicken666.dev>

* Fix error

Signed-off-by: supechicken <me@supechicken666.dev>

* Fix error

Signed-off-by: supechicken <me@supechicken666.dev>

* Add comments

Signed-off-by: supechicken <me@supechicken666.dev>

* Make rubocop happy

Signed-off-by: supechicken <me@supechicken666.dev>

* Fix error

Signed-off-by: supechicken <me@supechicken666.dev>

* Simplify

Signed-off-by: supechicken <me@supechicken666.dev>

* Bump crew version

Signed-off-by: supechicken <me@supechicken666.dev>

---------

Signed-off-by: supechicken <me@supechicken666.dev>
2024-07-10 14:49:10 -05:00

35 lines
1.2 KiB
Ruby
Executable File

#!/usr/bin/env ruby
require_relative '../lib/color'
require_relative '../lib/const'
require_relative '../lib/package'
failed = nil
property_line = `grep -n "case property" ../commands/help.rb | cut -d: -f1`.to_i
help_lines = `wc -l ../commands/help.rb`.to_i
tail_lines = help_lines - property_line
help_commands = `head -#{property_line} ../commands/help.rb | grep " when '" | cut -d"'" -f2`.split("\n")
help_properties = `tail -#{tail_lines} ../commands/help.rb | grep " when '" | cut -d"'" -f2`.split("\n")
package_properties = Package.available_boolean_properties
if (CREW_COMMANDS.length - help_commands.length).positive?
puts 'Help is missing for the crew commands in commands/help.rb below:'.yellow
missing_commands = CREW_COMMANDS - help_commands
missing_commands.each do |command|
puts command.yellow
end
failed = true
end
if (package_properties.length - help_properties.length).positive?
puts 'Help is missing for the properties in commands/help.rb below:'.yellow
missing_properties = package_properties - help_properties
missing_properties.each do |property|
puts property.yellow
end
failed = true
end
if failed
puts 'Help test failed.'.lightred
else
puts 'Help test passed.'.lightgreen
end