<commit_before># encoding: UTF-8

module Gjp
  # gjp get-source
  class GetSourceCommand < Gjp::BaseCommand
    parameter "POM", "a pom file path or URI"

    def execute
      checking_exceptions do
        project = Gjp::Project.new(".")
        source_getter = Gjp::SourceGetter.new

        puts "Attempting to find source through Maven..."
        if source_getter.get_maven_source_jar(project, pom)
          puts "Source jar found and added to Maven repository."
        else
          effective_pom_path = Gjp::MavenRunner.new(project).get_effective_pom(pom)
          puts "Source jar not found in Maven. Try looking here:"
          pom = Gjp::Pom.new(effective_pom_path)
          puts "Website: #{pom.url}" unless pom.url.empty?
          puts "SCM connection: #{pom.scm_connection}" unless pom.scm_connection.empty?
          puts "SCM connection: #{pom.scm_url}" unless pom.scm_url.empty?
          puts "The effective POM: #{effective_pom_path}"
          puts "Google: http://google.com/#q=#{URI.encode(pom.name + " sources")}"
        end
      end
    end
  end
end<commit_msg>Bugfix: use artifact name for Google searches when name is not in pom<commit_after># encoding: UTF-8

module Gjp
  # gjp get-source
  class GetSourceCommand < Gjp::BaseCommand
    parameter "POM", "a pom file path or URI"

    def execute
      checking_exceptions do
        project = Gjp::Project.new(".")
        source_getter = Gjp::SourceGetter.new

        puts "Attempting to find source through Maven..."
        if source_getter.get_maven_source_jar(project, pom)
          puts "Source jar found and added to Maven repository."
        else
          effective_pom_path = Gjp::MavenRunner.new(project).get_effective_pom(pom)
          puts "Source jar not found in Maven. Try looking here:"
          pom = Gjp::Pom.new(effective_pom_path)
          puts "Website: #{pom.url}" unless pom.url.empty?
          puts "SCM connection: #{pom.scm_connection}" unless pom.scm_connection.empty?
          puts "SCM connection: #{pom.scm_url}" unless pom.scm_url.empty?
          puts "The effective POM: #{effective_pom_path}"
          name = !pom.name.empty? ? pom.name : pom.artifact_id
          puts "Google: http://google.com/#q=#{URI.encode("#{name} sources")}"
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.10542299349240782, 'fraction_numerical': 0.0008676789587852494, 'mean_word_length': 2.677830940988836, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7125043', 'n_tokens_mistral': 740, 'n_tokens_neox': 729, 'n_words': 197}