Sha256: c586d8029ef6170d575ae1d9e1849f32200c9e49a5cc9f563db82605f53660cb

Contents?: true

Size: 1.93 KB

Versions: 88

Compression:

Stored size: 1.93 KB

Contents

# frozen_string_literal: true

require 'rake'
require 'appmap/node_cli'
require_relative 'api'

module AppMap
  module Depends
    module RakeTasks
      extend self
      extend Rake::DSL

      def depends_api
        AppMap::Depends::API.new(Rake.verbose == true)
      end

      def configuration
        AppMap.configuration
      end

      def define_tasks
        namespace :depends do
          task :modified do
            @appmap_modified_files = depends_api.modified(appmap_dir: configuration.appmap_dir, base_dir: configuration.depends_config.base_dir)
            depends_api.report_list 'Out of date', @appmap_modified_files
          end
      
          task :test_file_report do
            @appmap_test_file_report = depends_api.inspect_test_files(appmap_dir: configuration.appmap_dir, test_file_patterns: configuration.depends_config.test_file_patterns)
            @appmap_test_file_report.report
          end

          task :run_tests do
            if @appmap_test_file_report
              @appmap_test_file_report.clean_appmaps
              @appmap_modified_files += @appmap_test_file_report.modified_files
            end
      
            if @appmap_modified_files.empty?
              warn 'AppMaps are up to date'
              next
            end
      
            start_time = Time.current
            depends_api.run_tests(@appmap_modified_files, appmap_dir: configuration.appmap_dir)

            warn "Tests succeeded - removing out of date AppMaps."
            removed = depends_api.remove_out_of_date_appmaps(start_time, appmap_dir: configuration.appmap_dir, base_dir: configuration.depends_config.base_dir)
            warn "Removed out of date AppMaps: #{removed.join(' ')}" unless removed.empty?
          end

          desc configuration.depends_config.description
          task :update => [ :modified, :test_file_report, :run_tests ] + configuration.depends_config.dependent_tasks
        end
      end
    end
  end
end

Version data entries

88 entries across 88 versions & 1 rubygems

Version Path
appmap-1.1.1 lib/appmap/depends/rake_tasks.rb
appmap-1.0.1 lib/appmap/depends/rake_tasks.rb
appmap-1.0.0 lib/appmap/depends/rake_tasks.rb
appmap-0.103.0 lib/appmap/depends/rake_tasks.rb
appmap-0.102.2 lib/appmap/depends/rake_tasks.rb
appmap-0.102.1 lib/appmap/depends/rake_tasks.rb
appmap-0.102.0 lib/appmap/depends/rake_tasks.rb
appmap-0.101.0 lib/appmap/depends/rake_tasks.rb
appmap-0.100.0 lib/appmap/depends/rake_tasks.rb
appmap-0.99.4 lib/appmap/depends/rake_tasks.rb
appmap-0.99.2 lib/appmap/depends/rake_tasks.rb
appmap-0.99.1 lib/appmap/depends/rake_tasks.rb
appmap-0.99.0 lib/appmap/depends/rake_tasks.rb
appmap-0.98.1 lib/appmap/depends/rake_tasks.rb
appmap-0.98.0 lib/appmap/depends/rake_tasks.rb
appmap-0.97.0 lib/appmap/depends/rake_tasks.rb
appmap-0.96.0 lib/appmap/depends/rake_tasks.rb
appmap-0.95.2 lib/appmap/depends/rake_tasks.rb
appmap-0.95.1 lib/appmap/depends/rake_tasks.rb
appmap-0.95.0 lib/appmap/depends/rake_tasks.rb