Module: AppMap::Depends::RakeTasks

Extended by:
RakeTasks, Rake::DSL
Included in:
RakeTasks
Defined in:
lib/appmap/depends/rake_tasks.rb

Instance Method Summary collapse

Instance Method Details

#configurationObject



17
18
19
# File 'lib/appmap/depends/rake_tasks.rb', line 17

def configuration
  AppMap.configuration
end

#define_tasksObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/appmap/depends/rake_tasks.rb', line 21

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

#depends_apiObject



13
14
15
# File 'lib/appmap/depends/rake_tasks.rb', line 13

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