Skip to content

Commit

Permalink
Merge pull request #177 from JavaEden/dev
Browse files Browse the repository at this point in the history
Version 0.12.6
  • Loading branch information
cjbrooks12 authored Oct 2, 2018
2 parents f9a15dc + 5ec1bd7 commit 68075af
Show file tree
Hide file tree
Showing 59 changed files with 208 additions and 98 deletions.
19 changes: 16 additions & 3 deletions OrchidCore/src/main/java/com/eden/orchid/Orchid.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public boolean start(List<Module> modules) {
return true;
}
catch (Exception e) {
Clog.e("Something went wrong running Orchid: {}", e, e.getMessage());
Clog.e("Something went wrong running Orchid", e);
e.printStackTrace();

context.broadcast(Orchid.Lifecycle.Shutdown.fire(this));
Expand Down Expand Up @@ -292,9 +292,22 @@ public static class DeployStart extends OrchidEvent {
* A deployment phase has completed, and we are now at the end of the {@link Orchid.State#DEPLOYING } state.
*/
public static class DeployFinish extends OrchidEvent {
private DeployFinish(Object sender) { super(sender); }
private final boolean success;
private DeployFinish(Object sender, boolean success) {
super(sender);
this.success = success;
}

@Override
public String toString() {
JSONObject data = new JSONObject();

data.put("success", success);

return data.toString();
}

public static DeployFinish fire(Object sender) { return new DeployFinish(sender); }
public static DeployFinish fire(Object sender, boolean success) { return new DeployFinish(sender, success); }
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
@ImplementedBy(IndexServiceImpl.class)
public interface IndexService extends OrchidService {

String[] locateParams = new String[] {"itemId", "collectionId", "collectionType"};
String[] locateParams = new String[] {"itemId", "collectionType", "collectionId"};

default void clearIndex() {
getService(IndexService.class).clearIndex();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
package com.eden.orchid.api.indexing;

import com.eden.common.util.EdenUtils;
import com.eden.orchid.Orchid;
import com.eden.orchid.api.OrchidContext;
import com.eden.orchid.api.events.On;
import com.eden.orchid.api.events.OrchidEventListener;
import com.eden.orchid.api.generators.GlobalCollection;
import com.eden.orchid.api.generators.OrchidCollection;
import com.eden.orchid.api.options.annotations.Description;
import com.eden.orchid.api.theme.pages.OrchidPage;
import com.eden.orchid.utilities.CacheKt;
import com.eden.orchid.utilities.LRUCache;
import lombok.Data;
import lombok.Getter;

import javax.inject.Inject;
Expand All @@ -25,7 +31,7 @@
*/
@Singleton
@Description(value = "How Orchid organizes the data it collects.", name = "Index")
public final class IndexServiceImpl implements IndexService {
public final class IndexServiceImpl implements IndexService, OrchidEventListener {

private final Set<GlobalCollection> globalCollections;

Expand All @@ -35,9 +41,12 @@ public final class IndexServiceImpl implements IndexService {

@Getter private List<OrchidCollection> collections;

private final LRUCache<CollectionSearchCacheKey, Object> collectionSearchCache;

@Inject
public IndexServiceImpl(Set<GlobalCollection> globalCollections) {
this.globalCollections = Collections.unmodifiableSet(globalCollections);
this.collectionSearchCache = new LRUCache<>();
}

@Override
Expand Down Expand Up @@ -70,7 +79,10 @@ public void addCollections(List<? extends OrchidCollection> collections) {

@Override
public Object find(String collectionType, String collectionId, String itemId) {
return filterCollections(getCollections(collectionType, collectionId), itemId).findFirst().orElse(null);
final CollectionSearchCacheKey key = new CollectionSearchCacheKey(collectionType, collectionId, itemId);
return CacheKt.computeIfAbsent(collectionSearchCache, key, () -> {
return filterCollections(getCollections(collectionType, collectionId), itemId).findFirst().orElse(null);
});
}

@Override
Expand Down Expand Up @@ -129,4 +141,19 @@ private Stream<?> optionallyFilterCollections(Stream<? extends OrchidCollection>
}
}

// Cache Implementation
//----------------------------------------------------------------------------------------------------------------------

@Data
public static class CollectionSearchCacheKey {
private final String collectionType;
private final String collectionId;
private final String itemId;
}

@On(Orchid.Lifecycle.ClearCache.class)
public void onClearCache(Orchid.Lifecycle.ClearCache event) {
collectionSearchCache.clear();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ default void serve() {
getService(TaskService.class).serve();
}

default void deploy(boolean dryDeploy) {
getService(TaskService.class).deploy(dryDeploy);
default boolean deploy(boolean dryDeploy) {
return getService(TaskService.class).deploy(dryDeploy);
}

default TaskType getTaskType() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,22 +214,18 @@ public void serve() {
}

@Override
public void deploy(boolean dryDeploy) {
public boolean deploy(boolean dryDeploy) {
initOptions();

Orchid.getInstance().setState(Orchid.State.DEPLOYING);
Clog.i("Deploy Starting...");
context.broadcast(Orchid.Lifecycle.DeployStart.fire(this));
boolean success = context.publishAll(dryDeploy);
context.broadcast(Orchid.Lifecycle.DeployFinish.fire(this));
context.broadcast(Orchid.Lifecycle.DeployFinish.fire(this, success));
Clog.i("Deploy complete");
Orchid.getInstance().setState(Orchid.State.IDLE);

if(success) {
Clog.i("Deployment completed successfully");
}
else {
Clog.w("Deployment failed");
}
return success;
}

// Build Events
Expand Down
2 changes: 2 additions & 0 deletions OrchidCore/src/main/java/com/eden/orchid/impl/ImplModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.eden.orchid.api.events.OrchidEventListener;
import com.eden.orchid.api.generators.GlobalCollection;
import com.eden.orchid.api.generators.OrchidGenerator;
import com.eden.orchid.api.indexing.IndexServiceImpl;
import com.eden.orchid.api.publication.OrchidPublisher;
import com.eden.orchid.api.registration.IgnoreModule;
import com.eden.orchid.api.registration.OrchidModule;
Expand Down Expand Up @@ -188,6 +189,7 @@ protected void configure() {
addToSet(OrchidEventListener.class,
TaskServiceImpl.class,
ResourceServiceImpl.class,
IndexServiceImpl.class,
ClogSetupListener.class);

addToSet(OrchidController.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.eden.orchid.api.OrchidContext;
import com.eden.orchid.api.compilers.TemplateFunction;
import com.eden.orchid.api.indexing.IndexService;
import com.eden.orchid.api.options.annotations.Description;
import com.eden.orchid.api.options.annotations.Option;
import com.eden.orchid.api.theme.pages.OrchidPage;
Expand Down Expand Up @@ -36,7 +37,7 @@ public LinkFunction(OrchidContext context) {

@Override
public String[] parameters() {
return new String[] {"itemId", "collectionId", "collectionType"};
return IndexService.locateParams;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ constructor(
@Option
@BooleanDefault(true)
@Description("Whether to run a dry deploy, validating all options but not actually deploying anything.")
var isDry: Boolean = false
var dry: Boolean = true

override fun parameters(): Array<String> {
return arrayOf("dry")
}

@Throws(Exception::class)
override fun run(commandName: String) {
contextProvider.get().deploy(isDry)
contextProvider.get().deploy(dry)
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ constructor(
lateinit var collectionId: String

override fun load(): OrchidPage? {
return context.findPage(this.collectionType, this.collectionId, this.itemId)
if(listOf(collectionType, collectionId, itemId).any { it.isNotBlank() }) {
return context.findPage(this.collectionType, this.collectionId, this.itemId)
}
else {
return null
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ class DeployTask
@Inject
constructor(
private val contextProvider: Provider<OrchidContext>,
@param:Named("dryDeploy") private val dryDeploy: Boolean
@Named("dryDeploy") private val dryDeploy: Boolean
) : OrchidTask(100, "deploy", TaskService.TaskType.DEPLOY) {

override fun run() {
contextProvider.get().build()
contextProvider.get().deploy(dryDeploy)
val success = contextProvider.get().deploy(dryDeploy)

if(!success) {
throw Exception("deployment failed, check logs for details")
}
}

}
2 changes: 1 addition & 1 deletion OrchidCore/src/main/resources/templates/server/404.peb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@
</div>
</div>
</div>
<!-- <div>Icons made by <a href="http://www.flaticon.com/authors/madebyoliver" title="Madebyoliver">Madebyoliver</a> from <a href="http://www.flaticon.com" title="Flaticon">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a></div> -->
<!-- <div>Icons made by <a href="https://www.flaticon.com/authors/madebyoliver" title="Madebyoliver">Madebyoliver</a> from <a href="https://www.flaticon.com" title="Flaticon">www.flaticon.com</a> is licensed by <a href="https://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a></div> -->
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
</div>
</div>
</div>
<!-- <div>Icons made by <a href="http://www.flaticon.com/authors/madebyoliver" title="Madebyoliver">Madebyoliver</a> from <a href="http://www.flaticon.com" title="Flaticon">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a></div> -->
<!-- <div>Icons made by <a href="https://www.flaticon.com/authors/smashicons" title="Smashicons">Smashicons</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a> is licensed by <a href="http://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a></div> -->
<!-- <div>Icons made by <a href="https://www.flaticon.com/authors/madebyoliver" title="Madebyoliver">Madebyoliver</a> from <a href="https://www.flaticon.com" title="Flaticon">www.flaticon.com</a> is licensed by <a href="https://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a></div> -->
<!-- <div>Icons made by <a href="https://www.flaticon.com/authors/smashicons" title="Smashicons">Smashicons</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a> is licensed by <a href="https://creativecommons.org/licenses/by/3.0/" title="Creative Commons BY 3.0" target="_blank">CC 3.0 BY</a></div> -->
</div>
</div>
8 changes: 8 additions & 0 deletions OrchidCore/src/orchid/resources/changelog/0_12_6.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
version: '0.12.6'
---

- Changes standard ordering of collection search params to ['itemId', 'collectionType', 'collectionId'], which is more
natural to think about and better matches the order in which the params would be needed.
- Adds changelog publisher to require a changelog entry for publishing.
- Orchid now exits with a failure status code when the `deploy` task deployment fails for any reason.
5 changes: 4 additions & 1 deletion OrchidCore/src/orchid/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,11 @@ services:
disabled:
- 'javadoc'
- 'swiftdoc'
- 'kotlindoc'
# - 'kotlindoc'
externalIndices:
- 'https://javaeden.github.io/Clog/meta/javadoc.index.json'
- 'https://javaeden.github.io/Common/meta/javadoc.index.json'
- 'https://copper-leaf.github.io/krow/meta/kotlindoc.index.json'
publications:
stages:
- type: requireChangelogVersion
3 changes: 2 additions & 1 deletion OrchidCore/src/orchid/resources/config/wiki.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
includeIndexInPageTitle: false
defaultConfig:
includeIndexInPageTitle: false
sections:
- key: 'user-manual'
title: 'User Manual'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ The Orchid Language Pack bundle is not a ready-to-use bundle, but does group tog
improve your composing and documenting experience. All official Orchid plugins which add new Compilers, markup your
page content, or otherwise extend the language capabilities of your Orchid site are bundled here. Some examples include:

* Compile your pages with [Asciidoctor](http://asciidoctor.org/docs/asciidoctorj/) by using the `.ad` or `.asciidoc`
* Compile your pages with [Asciidoctor](https://asciidoctor.org/docs/asciidoctorj/) by using the `.ad` or `.asciidoc`
file extension
* Add syntax highlighting to your code snippets. Choose from static highlighting with
[Pygments](http://pygments.org/docs/java/), or browser-side highlighting with [Prism.js](http://prismjs.com/).
[Pygments](http://pygments.org/docs/java/), or browser-side highlighting with [Prism.js](https://prismjs.com/).
* Load the text of Bible verse references automatically. Choose from static references loading with a Markdown
extension, or use the [Faithlife Reftagger.js](https://reftagger.com) to load verses on-demand.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ official: true
noDocs: true
description: Compile your content using Asciidoctor.
images:
- src: http://res.cloudinary.com/orchid/image/upload/c_scale,w_300,e_blur:150/v1524973072/plugins/asciidoc.jpg
- src: https://res.cloudinary.com/orchid/image/upload/c_scale,w_300,e_blur:150/v1524973072/plugins/asciidoc.jpg
alt: Asciidoc
caption: Photo by Markus Spiske on Unsplash
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ official: true
noDocs: true
description: Load the full text of Bible verses quickly and easily.
images:
- src: http://res.cloudinary.com/orchid/image/upload/c_scale,w_300,e_blur:150/v1524973072/plugins/bible.jpg
- src: https://res.cloudinary.com/orchid/image/upload/c_scale,w_300,e_blur:150/v1524973072/plugins/bible.jpg
alt: Bible
caption: Photo by Priscilla Du Preez on Unsplash
---
Expand All @@ -12,8 +12,8 @@ images:

Bible verses can be added simply by passing their reference to the `bible` function. The verse text will be downloaded
and displayed on the page, along with the verse reference. You will need to sign up for an API key for the
[Bibles.org API](http://www.bibles.org/pages/api) to download verse text, and the Bible version must be the `id` of one
of the [available versions on Bibles.org](http://www.bibles.org/versions_api).
[Bibles.org API](https://www.bibles.org/pages/api) to download verse text, and the Bible version must be the `id` of one
of the [available versions on Bibles.org](https://www.bibles.org/versions_api).

As a filter

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
official: true
description: Track and discover changes across the various versions of your library or application.
images:
- src: http://res.cloudinary.com/orchid/image/upload/c_scale,w_300,e_blur:150/v1524974267/plugins/changelog.jpg
- src: https://res.cloudinary.com/orchid/image/upload/c_scale,w_300,e_blur:150/v1524974267/plugins/changelog.jpg
alt: Changelog
caption: Photo by Baron Fig on Unsplash
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ official: true
noDocs: true
description: Create flowcharts and sequence diagrams using the PlantUML markup language.
images:
- src: http://res.cloudinary.com/orchid/image/upload/c_scale,w_300,e_blur:150/v1524974867/plugins/diagrams.jpg
- src: https://res.cloudinary.com/orchid/image/upload/c_scale,w_300,e_blur:150/v1524974867/plugins/diagrams.jpg
alt: Diagrams
caption: Photo by William Iven on Unsplash
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
official: true
description: Engage your users with embeddable, fully customizable forms.
images:
- src: http://res.cloudinary.com/orchid/image/upload/c_scale,w_300,e_blur:150/v1524974798/plugins/forms.jpg
- src: https://res.cloudinary.com/orchid/image/upload/c_scale,w_300,e_blur:150/v1524974798/plugins/forms.jpg
alt: Forms
caption: Photo by Gemma Evans on Unsplash
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
official: true
description: Where Orchid began. Create beautiful Javadocs for your project within your Orchid site.
images:
- src: http://res.cloudinary.com/orchid/image/upload/c_scale,w_300,e_blur:150/v1524974952/plugins/javadoc.jpg
- src: https://res.cloudinary.com/orchid/image/upload/c_scale,w_300,e_blur:150/v1524974952/plugins/javadoc.jpg
alt: Javadoc
caption: Photo by Brooke Lark on Unsplash
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
official: true
description: Generate a living styleguide from annotated CSS, Sass, Scss, or LESS
images:
- src: http://res.cloudinary.com/orchid/image/upload/c_scale,w_300,e_blur:150/v1524974377/plugins/styleguide.jpg
- src: https://res.cloudinary.com/orchid/image/upload/c_scale,w_300,e_blur:150/v1524974377/plugins/styleguide.jpg
alt: KSS Styleguide
caption: Photo by Jan Losert on Unsplash
---

### Using Orchid KSS

[KSS](http://warpspire.com/kss/syntax/) is a methodology for documenting your CSS and generating a styleguide which
[KSS](https://warpspire.com/kss/syntax/) is a methodology for documenting your CSS and generating a styleguide which
shows example usage of your stylesheets. This plugin implements a basic KSS parser and renders KSS blocks as Orchid
pages. KSS are block comments placed within your stylesheets, an example is given below:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
official: true
description: Embed Kotlin and Java documentation in your Orchid site using Dokka.
images:
- src: http://res.cloudinary.com/orchid/image/upload/c_scale,w_300,e_blur:150/v1524974952/plugins/javadoc.jpg
- src: https://res.cloudinary.com/orchid/image/upload/c_scale,w_300,e_blur:150/v1524974952/plugins/javadoc.jpg
alt: Javadoc
caption: Photo by Brooke Lark on Unsplash
---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
official: true
description: No configuration, fully-featured Netlify CMS for Orchid.
images:
- src: http://res.cloudinary.com/orchid/image/upload/c_scale,w_300,e_blur:150/v1524974475/plugins/netlifycms.jpg
- src: https://res.cloudinary.com/orchid/image/upload/c_scale,w_300,e_blur:150/v1524974475/plugins/netlifycms.jpg
alt: Netlify CMS
caption: Screenshot of Netlify CMS
---
Expand Down
Loading

0 comments on commit 68075af

Please sign in to comment.