Sha256: 9d2d63ac6384d0a2dfcc1baacffc4cd67ee23ff394a891f6041e472b297c0202

Contents?: true

Size: 1.12 KB

Versions: 7

Compression:

Stored size: 1.12 KB

Contents

# encoding: UTF-8

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

    def execute
      checking_exceptions do
        project = Tetra::Project.new(".")
        source_getter = Tetra::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 = Tetra::MavenRunner.new(project).get_effective_pom(pom)
          puts "Source jar not found in Maven. Try looking here:"
          pom = Tetra::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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
tetra-0.46.0 lib/tetra/commands/get_source.rb
tetra-0.45.0 lib/tetra/commands/get_source.rb
tetra-0.44.0 lib/tetra/commands/get_source.rb
tetra-0.43.0 lib/tetra/commands/get_source.rb
tetra-0.42.0 lib/tetra/commands/get_source.rb
tetra-0.41.0 lib/tetra/commands/get_source.rb
tetra-0.40.0 lib/tetra/commands/get_source.rb