71 (setq artifactId (elt dependency 1)) |
71 (setq artifactId (elt dependency 1)) |
72 (when (and groupId artifactId) |
72 (when (and groupId artifactId) |
73 (maven-central.versions groupId artifactId)) |
73 (maven-central.versions groupId artifactId)) |
74 )) |
74 )) |
75 |
75 |
|
76 (defun ivy.parse-dependency () |
|
77 (let ( end groupId artifactId ) |
|
78 (save-excursion |
|
79 (if (looking-at "[^>]*<dependency ") |
|
80 (progn (search-forward "<") (backward-char)) |
|
81 (search-backward "<dependency " nil t)) |
|
82 (when (re-search-forward "<dependency [^/]*/>") |
|
83 (setq end (point)) |
|
84 (search-backward "<") |
|
85 (save-restriction |
|
86 (narrow-to-region (point) end) |
|
87 (goto-char (point-min)) |
|
88 (when (re-search-forward "\\s-org\\s-*=\\s-*['\"]\\([^'\"]+\\)['\"]" nil t) |
|
89 (setq groupId (match-string 1))) |
|
90 (goto-char (point-min)) |
|
91 (when (re-search-forward "\\s-name\\s-*=\\s-*['\"]\\([^'\"]+\\)['\"]" nil t) |
|
92 (setq artifactId (match-string 1))) |
|
93 ))) |
|
94 (list groupId artifactId))) |
|
95 |
|
96 ;;;###autoload |
|
97 (defun maven-central.last-version-from-ivy () |
|
98 (interactive) |
|
99 (let (dependency groupId artifactId) |
|
100 (setq dependency (ivy.parse-dependency)) |
|
101 (setq groupId (elt dependency 0)) |
|
102 (setq artifactId (elt dependency 1)) |
|
103 (when (and groupId artifactId) |
|
104 (maven-central.last-version groupId artifactId)) |
|
105 )) |
|
106 |
|
107 ;;;###autoload |
|
108 (defun maven-central.versions-from-ivy () |
|
109 (interactive) |
|
110 (let (dependency groupId artifactId) |
|
111 (setq dependency (ivy.parse-dependency)) |
|
112 (setq groupId (elt dependency 0)) |
|
113 (setq artifactId (elt dependency 1)) |
|
114 (when (and groupId artifactId) |
|
115 (maven-central.versions groupId artifactId)) |
|
116 )) |
|
117 |
76 ;; (maven-central.last-version "junit" "junit") |
118 ;; (maven-central.last-version "junit" "junit") |
77 |
119 |
78 (provide 'maven-central) |
120 (provide 'maven-central) |
79 |
121 |
80 ;;; maven-central.el ends here |
122 ;;; maven-central.el ends here |