lib/makit/tasks.rb in makit-0.0.48 vs lib/makit/tasks.rb in makit-0.0.49

- old
+ new

@@ -1,60 +1,61 @@ -# frozen_string_literal: true -require "digest" -require "rake/clean" -#require "sqlite3" - -# This module provides classes for the Makit gem. -module Makit - # This class provide methods for managing persistent data for the makit gem - class Tasks - def self.run_default_commands(task_name) - Makit::LOGGER.debug("Running default commands for task: #{task_name}") - end - end -end - -desc "Remove any temporary products." -task :clean do - Makit::SHOW.task(:clean) - Makit::RUNNER.run(Makit::RUNNER.parse_command_request("git clean -dXf")) -end - -desc "Integrate changes into the git repository." -task :integrate do - Makit::SHOW.task(:integrate) - Makit::Git.integrate -end - -desc "Sync changes with the git repository." -task :sync do - Makit::SHOW.task(:sync) - Makit::Git.sync -end - -task :pull do - Makit::SHOW.task(:pull) - Makit::Git.pull -end - -desc "Format source code." -task :format do - Makit::SHOW.task(:format) - Makit::RUNNER.try("rufo .") if File.exist?("Gemfile") || File.exist?("Rakefile") -end - -desc "Update dependencies." -task :update do - Makit::SHOW.task(:update) - system("bundle update") if File.exist?("Gemfile") - # glob all *.csproj files - Dir.glob("**/*.csproj").each do |file| - "dotnet format #{file}".run - end -end - -# Register the at_exit hook for cleanup -at_exit do - #puts "at_exit in tasks.rb...." - duration = Time.now - Makit::STARTTIME - puts " completed in ".colorize(:grey) + Makit::Humanize.get_humanized_duration(duration).colorize(:green) -end +# frozen_string_literal: true +require "digest" +require "rake/clean" +#require "sqlite3" + +# This module provides classes for the Makit gem. +module Makit + # This class provide methods for managing persistent data for the makit gem + class Tasks + def self.run_default_commands(task_name) + Makit::LOGGER.debug("Running default commands for task: #{task_name}") + end + end +end + +desc "Remove any temporary products." +task :clean do + Makit::SHOW.task(:clean) + Makit::RUNNER.run(Makit::RUNNER.parse_command_request("git clean -dXf")) +end + +desc "Integrate changes into the git repository." +task :integrate do + Makit::SHOW.task(:integrate) + Makit::Git.integrate +end + +desc "Sync changes with the git repository." +task :sync do + Makit::SHOW.task(:sync) + Makit::Git.sync +end + +task :pull do + Makit::SHOW.task(:pull) + Makit::Git.pull +end + +desc "Format source code." +task :format do + Makit::SHOW.task(:format) + Makit::RUNNER.try("rufo .") if File.exist?("Gemfile") || File.exist?("Rakefile") +end + +desc "Update dependencies." +task :update do + Makit::SHOW.task(:update) + yesterday = Time.now - 24 * 60 * 60 + system("bundle update") if File.exist?("Gemfile") + # glob all *.csproj files + Dir.glob("**/*.csproj").each do |file| + "dotnet format #{file}".cache_try(yesterday) + end +end + +# Register the at_exit hook for cleanup +at_exit do + #puts "at_exit in tasks.rb...." + duration = Time.now - Makit::STARTTIME + puts " completed in ".colorize(:grey) + Makit::Humanize.get_humanized_duration(duration).colorize(:green) +end