Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LPD-49671 Automatically refresh releases.json on 'blade init' #349

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/src/main/java/com/liferay/blade/cli/BladeCLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ public void run(String[] args) throws Exception {

}

if (ArrayUtil.contains(args, "--refresh-releases")) {
if (ArrayUtil.contains(args, "init") || ArrayUtil.contains(args, "--refresh-releases")) {
System.out.println("Checking for new releases...");

ReleaseUtil.initialize(0);
Expand Down
18 changes: 18 additions & 0 deletions cli/src/test/java/com/liferay/blade/cli/BladeCliTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ public void setUp() throws Exception {
_extensionsDir = temporaryFolder.newFolder(".blade", "extensions");
}

@Test
public void testBladeInitRefreshReleases() throws Exception {
BladeTestResults results = TestUtil.runBlade(_rootDir, _extensionsDir, "init", "--list");

String output = results.getOutput();

Assert.assertTrue(output, output.contains("Checking for new releases"));
}

@Test
public void testBladePrintUpdateIfAvailable() throws Exception {
BladeTestResults results = TestUtil.runBlade(_rootDir, _extensionsDir, "update", "--check");
Expand All @@ -39,6 +48,15 @@ public void testBladePrintUpdateIfAvailable() throws Exception {
Assert.assertFalse("Current jar should be the latest version", updateAvailable);
}

@Test
public void testBladeRefreshReleasesFlag() throws Exception {
BladeTestResults results = TestUtil.runBlade(_rootDir, _extensionsDir, "help", "--refresh-releases");

String output = results.getOutput();

Assert.assertTrue(output, output.contains("Checking for new releases"));
}

@Rule
public TemporaryFolder temporaryFolder = new TemporaryFolder();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ public void testInitCommandListPromoted() throws Exception {
}
}

String firstLine = lines.get(0);
String firstLine = lines.get(1);

ReleaseEntry releaseEntry = ReleaseUtil.getReleaseEntry(firstLine);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,9 @@ public void testGetSampleWithGradleWrapperExisting() throws Exception {

String output = bladeTestResults.getOutput();

Assert.assertTrue(output, (output == null) || output.isEmpty());
output = output.trim();

Assert.assertEquals("Checking for new releases...", output);

String[] samplesArgs = {"samples", "-d", _rootDir.getPath() + "/test/workspace/modules", "auth-failure"};

Expand Down
Loading