Class: Gjp::GetPomCommand

Inherits:
BaseCommand show all
Defined in:
lib/gjp/commands/get_pom.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
# File 'lib/gjp/commands/get_pom.rb', line 7

def execute
  checking_exceptions do
    project = Gjp::Project.new(".")
    pom_getter = Gjp::PomGetter.new

    path, status = pom_getter.get_pom(name)
    if path
      text_status = (
        if status == :found_in_jar
          "was inside the jar"
        elsif status == :found_via_sha1
          "found by sha1 search from search.maven.org"
        elsif status == :found_via_heuristic
          "found by heuristic search from search.maven.org"
        end
      )

      puts "#{format_path(path, project)} written, #{text_status}"
    else
      puts "#{name}'s pom not found. Try:"
      puts "http://google.com/#q=#{URI.encode(pom_getter.cleanup_name(name) + " pom")}"
    end
  end
end