Class: Gjp::GetSourceCommand

Inherits:
BaseCommand
  • Object
show all
Defined in:
lib/gjp/commands/get_source.rb

Instance Method Summary collapse

Methods inherited from BaseCommand

#checking_exceptions, #configure_log_level, #ensure_dry_running, #format_path, #print_generation_result, #verbose=, #very_verbose=, #very_very_verbose=

Methods included from Logging

#log

Instance Method Details

#executeObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/gjp/commands/get_source.rb', line 7

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)
      unless pom.url.empty?
        puts "Website: #{pom.url}"
      end
      unless pom.scm_connection.empty?
        puts "SCM connection: #{pom.scm_connection}"
      end
      unless pom.scm_url.empty?
        puts "SCM connection: #{pom.scm_url}"
      end
      puts "The effective POM: #{effective_pom_path}"
      puts "Google: http://google.com/#q=#{URI.encode(pom.name + " sources")}"
    end
  end
end