Search in sources :

Example 1 with ReporterAdapter

use of aQute.libg.reporter.ReporterAdapter in project bnd by bndtools.

the class bnd method _bash.

@Description("Generate autocompletion file for bash")
public void _bash(Options options) throws Exception {
    File tmp = File.createTempFile("bnd-completion", ".tmp");
    tmp.deleteOnExit();
    try {
        IO.copy(getClass().getResource("bnd-completion.bash"), tmp);
        Sed sed = new Sed(tmp);
        sed.setBackup(false);
        Reporter r = new ReporterAdapter();
        CommandLine c = new CommandLine(r);
        Map<String, Method> commands = c.getCommands(this);
        StringBuilder sb = new StringBuilder();
        for (String commandName : commands.keySet()) {
            sb.append(" " + commandName);
        }
        sb.append(" help");
        sed.replace("%listCommands%", sb.toString().substring(1));
        sed.doIt();
        IO.copy(tmp, out);
    } finally {
        IO.delete(tmp);
    }
}
Also used : CommandLine(aQute.lib.getopt.CommandLine) Sed(aQute.libg.sed.Sed) ReporterAdapter(aQute.libg.reporter.ReporterAdapter) Reporter(aQute.service.reporter.Reporter) Method(java.lang.reflect.Method) File(java.io.File) Description(aQute.lib.getopt.Description)

Example 2 with ReporterAdapter

use of aQute.libg.reporter.ReporterAdapter in project bnd by bndtools.

the class JPMTest method testVM.

public void testVM() throws Exception {
    File tmp = new File("tmp");
    IO.delete(tmp);
    tmp.mkdirs();
    File home = new File(tmp, "home");
    File bin = new File(tmp, "bin");
    System.setProperty("jpm.intest", "true");
    JustAnotherPackageManager jpm = new JustAnotherPackageManager(new ReporterAdapter(), null, home, bin);
    SortedSet<JVM> vms = jpm.getVMs();
    assertNotNull(vms);
    assertTrue(vms.size() >= 1);
    System.out.println(vms);
    File f = IO.getFile("~/jdk1.8");
    if (f.isDirectory()) {
        JVM jvm = jpm.addVm(f);
        assertNotNull(jvm);
    }
}
Also used : JVM(aQute.jpm.lib.JVM) JustAnotherPackageManager(aQute.jpm.lib.JustAnotherPackageManager) ReporterAdapter(aQute.libg.reporter.ReporterAdapter) File(java.io.File)

Example 3 with ReporterAdapter

use of aQute.libg.reporter.ReporterAdapter in project bnd by bndtools.

the class Platform method parseCompletion.

public void parseCompletion(Object target, File f) throws Exception {
    IO.copy(getClass().getResource("unix/jpm-completion.bash"), f);
    Sed sed = new Sed(f);
    sed.setBackup(false);
    Reporter r = new ReporterAdapter();
    CommandLine c = new CommandLine(r);
    Map<String, Method> commands = c.getCommands(target);
    StringBuilder sb = new StringBuilder();
    for (String commandName : commands.keySet()) {
        sb.append(" " + commandName);
    }
    sb.append(" help");
    sed.replace("%listJpmCommands%", sb.toString().substring(1));
    sed.doIt();
}
Also used : CommandLine(aQute.lib.getopt.CommandLine) Sed(aQute.libg.sed.Sed) ReporterAdapter(aQute.libg.reporter.ReporterAdapter) Reporter(aQute.service.reporter.Reporter) Method(java.lang.reflect.Method)

Example 4 with ReporterAdapter

use of aQute.libg.reporter.ReporterAdapter in project bnd by bndtools.

the class UTF8PropertiesTest method testEmptyKey.

public void testEmptyKey() throws IOException {
    UTF8Properties p = new UTF8Properties();
    ReporterAdapter ra = new ReporterAdapter();
    p.load(//
    "	-runvm: \n" + "#\"-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=1044\"", null, ra);
    assertEquals("", p.get("-runvm"));
    assertEquals(1, p.size());
}
Also used : ReporterAdapter(aQute.libg.reporter.ReporterAdapter)

Example 5 with ReporterAdapter

use of aQute.libg.reporter.ReporterAdapter in project bnd by bndtools.

the class UTF8PropertiesTest method testNewlineCr.

public void testNewlineCr() throws IOException {
    UTF8Properties p = new UTF8Properties();
    ReporterAdapter ra = new ReporterAdapter();
    p.load("a=2\n\rb=3\n\r", null, ra);
    assertEquals("2", p.get("a"));
    assertEquals("3", p.get("b"));
    assertEquals(2, p.size());
}
Also used : ReporterAdapter(aQute.libg.reporter.ReporterAdapter)

Aggregations

ReporterAdapter (aQute.libg.reporter.ReporterAdapter)15 File (java.io.File)4 Reporter (aQute.service.reporter.Reporter)3 Baseline (aQute.bnd.differ.Baseline)2 DiffPluginImpl (aQute.bnd.differ.DiffPluginImpl)2 CommandLine (aQute.lib.getopt.CommandLine)2 Sed (aQute.libg.sed.Sed)2 Method (java.lang.reflect.Method)2 ProjectBuilder (aQute.bnd.build.ProjectBuilder)1 BundleInfo (aQute.bnd.differ.Baseline.BundleInfo)1 Info (aQute.bnd.differ.Baseline.Info)1 Builder (aQute.bnd.osgi.Builder)1 Jar (aQute.bnd.osgi.Jar)1 JVM (aQute.jpm.lib.JVM)1 JustAnotherPackageManager (aQute.jpm.lib.JustAnotherPackageManager)1 Description (aQute.lib.getopt.Description)1 PersistentMap (aQute.lib.persistentmap.PersistentMap)1 Location (aQute.service.reporter.Report.Location)1 IOException (java.io.IOException)1 StringReader (java.io.StringReader)1