Sha256: e37f879fc65495d851c1fde03769e05f730e0743aaa86196b7f7d8c1eaec4474

Contents?: true

Size: 1.62 KB

Versions: 42

Compression:

Stored size: 1.62 KB

Contents

require 'knapsack_pro'

namespace :knapsack_pro do
  task :encrypted_test_file_names, [:adapter] do |_, args|
    adapter = args[:adapter]

    adapter_class = case adapter
                    when 'rspec'
                      KnapsackPro::Adapters::RSpecAdapter
                    when 'minitest'
                      KnapsackPro::Adapters::MinitestAdapter
                    when 'test_unit'
                      KnapsackPro::Adapters::TestUnitAdapter
                    when 'cucumber'
                      KnapsackPro::Adapters::CucumberAdapter
                    when 'spinach'
                      KnapsackPro::Adapters::SpinachAdapter
                    else
                      raise('Provide adapter name like rspec, minitest, test_unit, cucumber, spinach')
                    end

    test_files =
      if adapter_class == KnapsackPro::Adapters::RSpecAdapter && KnapsackPro::Config::Env.rspec_split_by_test_examples?
        detector = KnapsackPro::TestCaseDetectors::RSpecTestExampleDetector.new
        detector.generate_json_report
        detector.test_file_example_paths
      else
        test_file_pattern = KnapsackPro::TestFilePattern.call(adapter_class)
        KnapsackPro::TestFileFinder.call(test_file_pattern)
      end

    test_file_names = []
    test_files.each do |t|
      test_file_names << {
        'path' => t['path'],
        'decrypted_path' => t['path'],
      }
    end

    encrypted_test_files = KnapsackPro::Crypto::Encryptor.new(test_file_names).call

    encrypted_test_files.each do |t|
      puts "path: #{t['decrypted_path']}"
      puts "encrypted path: #{t['path']}"
      puts
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
knapsack_pro-3.3.1 lib/tasks/encrypted_test_file_names.rake
knapsack_pro-3.3.0 lib/tasks/encrypted_test_file_names.rake
knapsack_pro-3.2.1 lib/tasks/encrypted_test_file_names.rake
knapsack_pro-3.2.0 lib/tasks/encrypted_test_file_names.rake
knapsack_pro-3.1.3 lib/tasks/encrypted_test_file_names.rake
knapsack_pro-3.1.2 lib/tasks/encrypted_test_file_names.rake
knapsack_pro-3.1.1 lib/tasks/encrypted_test_file_names.rake
knapsack_pro-3.1.0 lib/tasks/encrypted_test_file_names.rake
knapsack_pro-3.0.0 lib/tasks/encrypted_test_file_names.rake
knapsack_pro-2.18.2 lib/tasks/encrypted_test_file_names.rake
knapsack_pro-2.18.1 lib/tasks/encrypted_test_file_names.rake
knapsack_pro-2.18.0 lib/tasks/encrypted_test_file_names.rake
knapsack_pro-2.17.0 lib/tasks/encrypted_test_file_names.rake
knapsack_pro-2.16.0 lib/tasks/encrypted_test_file_names.rake
knapsack_pro-2.15.0 lib/tasks/encrypted_test_file_names.rake
knapsack_pro-2.14.0 lib/tasks/encrypted_test_file_names.rake
knapsack_pro-2.13.0 lib/tasks/encrypted_test_file_names.rake
knapsack_pro-2.12.0 lib/tasks/encrypted_test_file_names.rake
knapsack_pro-2.11.0 lib/tasks/encrypted_test_file_names.rake
knapsack_pro-2.10.1 lib/tasks/encrypted_test_file_names.rake