Rakefile in makit-0.0.0 vs Rakefile in makit-0.0.1

- old
+ new

@@ -51,10 +51,12 @@ puts " rakefile is " + "#{Rake.application.rakefile}".colorize(:green) `ruby -r minitest/autorun test/test_makit.rb -- --fail-fast > artifacts/test_makit.log 2>&1` "ruby -r minitest/autorun test/test_makit.rb -- --fail-fast".run #"bundle exec rake".run + + raise "artifacts/test_makit.log not found" unless File.exist? "artifacts/test_makit.log" end desc "test the examples" task :test_examples do start_time = Time.now @@ -97,23 +99,23 @@ puts " copying gem to [ONEDRIVE]/code/artifacts/rubygems".colorize(:green) FileUtils.cp("makit-#{Makit::VERSION}.gem", File.join(Makit::Directories::ONEDRIVE, "code", "artifacts", "rubygems")) end end -task :publish => [:build,:test, :integrate] do +task :publish => [:build, :test, :integrate] do puts ":publish".colorize(:blue) gem = "makit-#{Makit::VERSION}.gem" puts "gem file #{gem} does not exist" unless File.exist?(gem) - gem_list_text =`gem list --remote makit`# Raykit::Command::new("gem list --remote makit").run.output + gem_list_text = `gem list --remote makit` # Raykit::Command::new("gem list --remote makit").run.output if gem_list_text.include?("makit") "gem list --remote makit".run - latest_published_version ='' - makit_list= `gem list --remote makit`.gsub(" ruby", "").strip - if(makit_list.length > 0) + latest_published_version = "" + makit_list = `gem list --remote makit`.gsub(" ruby", "").strip + if (makit_list.length > 0) # check if scan is empty - if(makit_list.scan(/makit \(([\d.]+)\)/).empty?) + if (makit_list.scan(/makit \(([\d.]+)\)/).empty?) latest_published_version = "" else latest_published_version = makit_list.scan(/makit \(([\d.]+)\)/).last.first end end @@ -127,11 +129,10 @@ else puts " unable to list Makit::VERSION from --remote, internet may not be available" end end - task :info do puts ":info".colorize(:blue) # collect all tasks that have been defined in the Rakefile and display them #puts " tasks defined in the Rakefile" @@ -182,9 +183,18 @@ # Register the at_exit hook for cleanup at_exit do puts "Performing cleanup..." # Add your cleanup code here # For example, close files, remove temporary files, etc. - json_filename = File.join(Makit::Directories::PROJECT_ROOT, ".makit.project.json") - puts "Saving project state to #{json_filename}" - Makit::PROJECT.save_as(json_filename) + #json_filename = File.join(Makit::Directories::PROJECT_ROOT, ".makit.project.json") + #puts "Saving project state to #{json_filename}" + #Makit::PROJECT.save_as(json_filename) + + # display the 5 slowest commands + puts " slowest commands" + Makit::RUNNER.commands.sort_by { |command| (command.duration.seconds + (command.duration.nanos / 1_000_000_000.0)) }.reverse.first(5).each do |command| + # Convert to float representation + duration_in_float = command.duration.seconds + (command.duration.nanos / 1_000_000_000.0) + #puts " #{command.name} took #{duration_in_float} seconds" + puts " " + Makit::CommandRunner.get_command_summary(command) + " (#{command.duration.seconds} seconds)".colorize(:cyan) + end end