]> source.dussan.org Git - sonar-scanner-cli.git/commitdiff
Fix display help and remove work dir log
authorDuarte Meneses <duarte.meneses@sonarsource.com>
Wed, 9 Sep 2015 14:50:36 +0000 (16:50 +0200)
committerDuarte Meneses <duarte.meneses@sonarsource.com>
Wed, 9 Sep 2015 14:50:36 +0000 (16:50 +0200)
sonar-runner-api/src/main/java/org/sonar/runner/api/Dirs.java
sonar-runner-cli/src/main/java/org/sonar/runner/cli/Cli.java
sonar-runner-cli/src/main/java/org/sonar/runner/cli/Main.java
sonar-runner-cli/src/test/java/org/sonar/runner/cli/CliTest.java

index a2b0bd3063e79be9091f331f10510044f1ebeedd..dc39e96173d030fad765e89f3ad038c1d83eb5ff 100644 (file)
@@ -63,7 +63,7 @@ class Dirs {
       }
     }
     p.setProperty(RunnerProperties.WORK_DIR, workDirPath.normalize().toString());
-    logger.info("Work directory: " + workDirPath.normalize().toString());
+    logger.debug("Work directory: " + workDirPath.normalize().toString());
   }
 
   /**
index 8a346072e60d92959ab2b9241133c0401559a4d8..d0a350e7f2ecd0f0d69e8d01d562ed365491f63b 100644 (file)
@@ -28,12 +28,12 @@ class Cli {
   private boolean displayVersionOnly = false;
   private boolean displayStackTrace = false;
   private boolean interactive = false;
-  private Properties props = new Properties();
-  private final Exit exit;
-  private Logs logger;
+  private final Properties props = new Properties();
+  private final Shutdown shutdown;
+  private final Logs logger;
 
-  public Cli(Exit exit, Logs logger) {
-    this.exit = exit;
+  public Cli(Shutdown shutdown, Logs logger) {
+    this.shutdown = shutdown;
     this.logger = logger;
   }
 
@@ -147,6 +147,6 @@ class Cli {
     logger.info(" -v,--version          Display version information");
     logger.info(" -X,--debug            Produce execution debug output");
     logger.info(" -i,--interactive      Run interactively");
-    exit.exit(Exit.SUCCESS);
+    shutdown.exit(Exit.SUCCESS);
   }
 }
index 0229cc9435b91f21131baef4095a523d9facb53d..71488b3cf536c0b4ba703ede520fc115a364142d 100644 (file)
@@ -60,7 +60,7 @@ public class Main {
     Exit exit = new Exit();
     Shutdown shutdown = new Shutdown(exit);
     Logs logs = new Logs();
-    Cli cli = new Cli(exit, logs).parse(args);
+    Cli cli = new Cli(shutdown, logs).parse(args);
     cli.verify();
     Main main = new Main(shutdown, cli, new Conf(cli, logs), new RunnerFactory(logs), logs);
     main.execute();
index d343561691cf5319a4582e1bdca1d313c2cc723e..b8f6901b38b860dadd48493f290208568ebbfbf0 100644 (file)
@@ -30,9 +30,9 @@ import org.sonar.runner.cli.Exit;
 import static org.fest.assertions.Assertions.assertThat;
 
 public class CliTest {
-  Exit exit = mock(Exit.class);
+  Shutdown shutdown = mock(Shutdown.class);
   Logs logs = new Logs();
-  Cli cli = new Cli(exit, logs);
+  Cli cli = new Cli(shutdown, logs);
 
   @Test
   public void should_parse_empty_arguments() {
@@ -45,31 +45,31 @@ public class CliTest {
 
   @Test
   public void should_extract_properties() {
-    cli.parse(new String[]{"-D", "foo=bar", "--define", "hello=world", "-Dboolean"});
+    cli.parse(new String[] {"-D", "foo=bar", "--define", "hello=world", "-Dboolean"});
     assertThat(cli.properties().get("foo")).isEqualTo("bar");
     assertThat(cli.properties().get("hello")).isEqualTo("world");
     assertThat(cli.properties().get("boolean")).isEqualTo("true");
   }
-  
+
   @Test
   public void dont_allow_interactive_fork() {
-    cli.parse(new String[]{"-i", "-DsonarRunner.mode=fork"});
+    cli.parse(new String[] {"-i", "-DsonarRunner.mode=fork"});
     cli.verify();
-    verify(exit).exit(Exit.SUCCESS);
+    verify(shutdown).exit(Exit.SUCCESS);
   }
 
   @Test
   public void should_parse_optional_task() {
-    cli.parse(new String[]{"-D", "foo=bar"});
+    cli.parse(new String[] {"-D", "foo=bar"});
     assertThat(cli.properties().get("sonar.task")).isNull();
 
-    cli.parse(new String[]{"views", "-D", "foo=bar"});
+    cli.parse(new String[] {"views", "-D", "foo=bar"});
     assertThat(cli.properties().get("sonar.task")).isEqualTo("views");
   }
 
   @Test
   public void should_enable_debug_mode() {
-    cli.parse(new String[]{"-X"});
+    cli.parse(new String[] {"-X"});
     assertThat(cli.isDebugMode()).isTrue();
     assertThat(cli.isDisplayStackTrace()).isTrue();
     assertThat(cli.properties().get("sonar.verbose")).isEqualTo("true");
@@ -77,7 +77,7 @@ public class CliTest {
 
   @Test
   public void should_enable_stacktrace_log() {
-    cli.parse(new String[]{"-e"});
+    cli.parse(new String[] {"-e"});
     assertThat(cli.isDebugMode()).isFalse();
     assertThat(cli.isDisplayStackTrace()).isTrue();
     assertThat(cli.properties().get("sonar.verbose")).isNull();