-
Notifications
You must be signed in to change notification settings - Fork 2
/
ojo.groovy
49 lines (41 loc) · 1.8 KB
/
ojo.groovy
1
2
3
4
5
6
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import groovy.swing.SwingBuilder
import java.awt.BorderLayout as BL
import java.awt.event.KeyEvent
import java.awt.event.KeyListener
//@authored by Itamar Berman-Eshel
//A simple tool to check if a path in the oss-snapshot-local repository on oss.jfrog.org exists and which properties it contains
//Run this by executing 'groovy ojo.groovy'
def swing = new SwingBuilder()
def panel = {
swing.panel() {
label("Please enter the desired path")
}
}
swing.edt {
//def user = "your user name (if needed)
//def password = "your password (if needed)"
def baseURL = "http://oss.jfrog.org/artifactory/api/storage/oss-snapshot-local/"
frame(title: 'OJO path checker', size: [800, 200], show: true,defaultCloseOperation:javax.swing.WindowConstants.EXIT_ON_CLOSE) {
borderLayout()
def input = textField(columns:10, actionPerformed: {}, constraints:BL.NORTH)
def output = label(text: '', preferredSize: [100, 100], constraints: BL.SOUTH)
def checkPath = button(text:'Check Path', actionPerformed: {def path = "curl ${baseURL}${input.text}".execute().text; println path; output.text = "<html>Searching OJO for path: ${input.text}<br><br>${path}<html>"}, constraints:BL.WEST)
def checkProps = button(text:'Check properties', actionPerformed: {def props = "curl ${baseURL}${input.text}?properties".execute().text; println props; output.text="<html>Searching OJO for properties on path: ${input.text}<br><br>${props}<html>"}, constraints:BL.EAST)
input.addKeyListener(new KeyListener(){
@Override
public void keyPressed(KeyEvent e){
if(e.getKeyCode() == KeyEvent.VK_ENTER){
e.consume()
checkPath.doClick();
}
}
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyReleased(KeyEvent e) {
}
})
widget(panel())
}
}