Skip to content

Commit

Permalink
installer with bundled jre
Browse files Browse the repository at this point in the history
  • Loading branch information
Karasiq committed Mar 9, 2016
1 parent 297035f commit d9298ac
Show file tree
Hide file tree
Showing 15 changed files with 83 additions and 73 deletions.
2 changes: 1 addition & 1 deletion README.MD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# nanoboard [![Build Status](https://travis-ci.org/Karasiq/nanoboard.svg?branch=master)](https://travis-ci.org/Karasiq/nanoboard) [![Build status](https://ci.appveyor.com/api/projects/status/05l8dnixhn375kjm?svg=true)](https://ci.appveyor.com/project/Karasiq/nanoboard) [![Version](http://img.shields.io/badge/version-1.0.4-blue.svg?style=flat)](https://github.com/Karasiq/nanoboard/releases)
# nanoboard [![Build Status](https://travis-ci.org/Karasiq/nanoboard.svg?branch=master)](https://travis-ci.org/Karasiq/nanoboard) [![Build status](https://ci.appveyor.com/api/projects/status/05l8dnixhn375kjm?svg=true)](https://ci.appveyor.com/project/Karasiq/nanoboard) [![Version](http://img.shields.io/badge/version-1.0.5--M1-blue.svg?style=flat)](https://github.com/Karasiq/nanoboard/releases)
Scala [nanoboard](https://github.com/nanoboard/nanoboard) implementation

# Links
Expand Down
18 changes: 16 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import sbtassembly.Plugin.AssemblyKeys._

lazy val commonSettings = Seq(
organization := "com.github.karasiq",
version := "1.0.4",
version := "1.0.5-M1",
isSnapshot := version.value.endsWith("SNAPSHOT"),
scalaVersion := "2.11.7"
)
Expand Down Expand Up @@ -59,6 +61,18 @@ lazy val backendSettings = Seq(
"org.scalatest" %% "scalatest" % "2.2.4" % "test"
),
mainClass in Compile := Some("com.karasiq.nanoboard.server.Main"),
mainClass in assembly := (mainClass in Compile).value,
jarName in assembly := "nanoboard-server.jar",
test in assembly := {},
mappings in Universal := {
val universalMappings = (mappings in Universal).value
val fatJar = (assembly in Compile).value
val filtered = universalMappings filter {
case (file, name) !name.endsWith(".jar")
}
filtered :+ (fatJar ("lib/" + fatJar.getName))
},
scriptClasspath := Seq((jarName in assembly).value),
scalaJsBundlerCompile in Compile <<= (scalaJsBundlerCompile in Compile).dependsOn(fullOptJS in Compile in frontend),
scalaJsBundlerAssets in Compile += {
import com.karasiq.scalajsbundler.dsl._
Expand Down Expand Up @@ -125,7 +139,7 @@ lazy val library = Project("nanoboard", file("library"))

lazy val backend = Project("nanoboard-server", file("."))
.dependsOn(library)
.settings(commonSettings, backendSettings)
.settings(assemblySettings, commonSettings, backendSettings)
.enablePlugins(ScalaJSBundlerPlugin, JavaAppPackaging)

lazy val frontend = Project("nanoboard-frontend", file("frontend"))
Expand Down
2 changes: 1 addition & 1 deletion library/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
nanoboard {
version = 1.0.4
version = 1.0.5-M1
client-version = karasiq-nanoboard v${nanoboard.version}
encryption-key = "nano"
bitmessage {
Expand Down
4 changes: 3 additions & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
logLevel := Level.Warn

addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.0.6")
addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.1.0-RC2")

addSbtPlugin("com.github.karasiq" % "sbt-scalajs-bundler" % "1.0.5")

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.7")

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.11.2")

libraryDependencies += "com.lihaoyi" %% "scalatags" % "0.5.4"
32 changes: 32 additions & 0 deletions setup/launch4j.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<launch4jConfig>
<dontWrapJar>false</dontWrapJar>
<headerType>console</headerType>
<jar>G:\Data\IdeaProjects\nanoboard\target\universal\stage\lib\nanoboard-server.jar</jar>
<outfile>G:\Data\IdeaProjects\nanoboard\target\universal\nanoboard.exe</outfile>
<errTitle></errTitle>
<cmdLine></cmdLine>
<chdir>.</chdir>
<priority>normal</priority>
<downloadUrl>http://java.com/download</downloadUrl>
<supportUrl></supportUrl>
<stayAlive>false</stayAlive>
<restartOnCrash>false</restartOnCrash>
<manifest></manifest>
<icon>G:\Data\IdeaProjects\nanoboard\frontend\files\favicon.ico</icon>
<singleInstance>
<mutexName>nanoboard-server</mutexName>
<windowTitle></windowTitle>
</singleInstance>
<jre>
<path>jre1.8.0_74</path>
<bundledJre64Bit>false</bundledJre64Bit>
<bundledJreAsFallback>true</bundledJreAsFallback>
<minVersion>1.8.0</minVersion>
<maxVersion></maxVersion>
<jdkPreference>preferJre</jdkPreference>
<runtimeBits>64/32</runtimeBits>
<initialHeapSize>128</initialHeapSize>
<maxHeapSize>512</maxHeapSize>
</jre>
</launch4jConfig>
57 changes: 9 additions & 48 deletions setup/setup.iss
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#define OutputName "nanoboard"
#define OutputName "nanoboard-server"
#define MyAppName "Nanoboard"
#define MyAppVersion "1.0.4"
#define MyAppVersion "1.0.5-M1"
#define MyAppPublisher "Karasiq, Inc."
#define MyAppURL "http://www.github.com/Karasiq/nanoboard"
#define MyAppExeName "bin\nanoboard-server.bat"
#define MyAppExeName "nanoboard.exe"
#define ProjectFolder "..\"

[Setup]
Expand Down Expand Up @@ -32,54 +32,15 @@ Name: russian; MessagesFile: compiler:Languages\Russian.isl
Name: desktopicon; Description: {cm:CreateDesktopIcon}; GroupDescription: {cm:AdditionalIcons}; Languages:

[Files]
Source: {#ProjectFolder}\target\universal\stage\*; DestDir: {app}; Flags: ignoreversion recursesubdirs
Source: {#ProjectFolder}\setup\places.txt; DestDir: {app}
Source: {#ProjectFolder}\setup\categories.txt; DestDir: {app}
Source: {#ProjectFolder}\frontend\files\favicon.ico; DestDir: {app}
Source: {#ProjectFolder}\target\universal\nanoboard.exe; DestDir: {app}; Flags: ignoreversion
Source: G:\Temp\Java\jre1.8.0_74\*; DestDir: {app}\jre1.8.0_74; Flags: recursesubdirs ignoreversion
Source: {#ProjectFolder}\setup\places.txt; DestDir: {app}; Flags: ignoreversion
Source: {#ProjectFolder}\setup\categories.txt; DestDir: {app}; Flags: ignoreversion
Source: {#ProjectFolder}\frontend\files\favicon.ico; DestDir: {app}; Flags: ignoreversion

[Icons]
Name: {group}\{#MyAppName}; Filename: {app}\{#MyAppExeName}; IconFilename: {app}\favicon.ico; WorkingDir: {app}
Name: {commondesktop}\{#MyAppName}; Filename: {app}\{#MyAppExeName}; Tasks: desktopicon; IconFilename: {app}\favicon.ico; WorkingDir: {app}

[Run]
Filename: {app}\{#MyAppExeName}; Description: {cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}; Flags: shellexec postinstall skipifsilent; WorkingDir: {app}; Check: IsJREInstalled

[Code]
#define MinJRE "1.8"
#define WebJRE "https://www.java.com/ru/download/manual.jsp"
function IsJREInstalled: Boolean;
var
JREVersion: string;
begin
// read JRE version
Result := RegQueryStringValue(HKLM32, 'Software\JavaSoft\Java Runtime Environment',
'CurrentVersion', JREVersion);
// if the previous reading failed and we're on 64-bit Windows, try to read
// the JRE version from WOW node
if not Result and IsWin64 then
Result := RegQueryStringValue(HKLM64, 'Software\JavaSoft\Java Runtime Environment',
'CurrentVersion', JREVersion);
// if the JRE version was read, check if it's at least the minimum one
if Result then
Result := CompareStr(JREVersion, '{#MinJRE}') >= 0;
end;
function InitializeSetup: Boolean;
var
ErrorCode: Integer;
begin
Result := True;
// check if JRE is installed; if not, then...
if not IsJREInstalled then
begin
// show a message box and let user to choose if they want to download JRE;
// if so, go to its download site and exit setup; continue otherwise
if MsgBox('Java is required. Do you want to download it now ?',
mbConfirmation, MB_YESNO) = IDYES then
begin
Result := False;
ShellExec('', '{#WebJRE}', '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
end;
end;
end;
Filename: {app}\{#MyAppExeName}; Description: {cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}; Flags: shellexec postinstall skipifsilent; WorkingDir: {app}
10 changes: 10 additions & 0 deletions src/main/resources/application.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
akka.http {
server {
server-header = nanoboard/${nanoboard.version}
idle-timeout = 24h
}

client {
user-agent-header = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.52 Safari/537.36 OPR/31.0.1889.50 (Edition beta)"
}
}
11 changes: 0 additions & 11 deletions src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,4 @@ nanoboard {
username = "nanoapi"
password = "nano"
}
}

akka.http {
server {
server-header = nanoboard/${nanoboard.version}
idle-timeout = 24h
}

client {
user-agent-header = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.52 Safari/537.36 OPR/31.0.1889.50 (Edition beta)"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package com.karasiq.nanoboard.dispatcher

import akka.util.ByteString
import com.karasiq.nanoboard.NanoboardCategory
import com.karasiq.nanoboard.model.NanoboardMessageData

import scala.concurrent.Future

case class NanoboardMessageData(parent: Option[String], hash: String, text: String, answers: Int)


trait NanoboardDispatcher {
def createContainer(pending: Int, random: Int, format: String, container: ByteString): Future[ByteString]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import akka.stream.{ActorMaterializer, OverflowStrategy}
import akka.util.ByteString
import com.karasiq.nanoboard.encoding.DataEncodingStage._
import com.karasiq.nanoboard.encoding.stages.{GzipCompression, PngEncoding, SalsaCipher}
import com.karasiq.nanoboard.server.model._
import com.karasiq.nanoboard.model._
import com.karasiq.nanoboard.{NanoboardCategory, NanoboardMessage}
import com.typesafe.config.{Config, ConfigFactory}
import slick.driver.H2Driver.api._
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package com.karasiq.nanoboard.model

case class NanoboardMessageData(parent: Option[String], hash: String, text: String, answers: Int)
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.karasiq.nanoboard.server
package com.karasiq.nanoboard

import java.time.Instant

import com.karasiq.nanoboard.dispatcher.NanoboardMessageData
import com.karasiq.nanoboard.{NanoboardCategory, NanoboardMessage}
import slick.driver.H2Driver.api._

import scala.concurrent.ExecutionContext
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/com/karasiq/nanoboard/server/Main.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import akka.http.scaladsl.Http.ServerBinding
import akka.stream.scaladsl._
import akka.stream.{ActorMaterializer, ActorMaterializerSettings}
import com.karasiq.nanoboard.dispatcher.NanoboardSlickDispatcher
import com.karasiq.nanoboard.model.{Place, Post, _}
import com.karasiq.nanoboard.server.cache.MapDbNanoboardCache
import com.karasiq.nanoboard.server.model.{Place, Post, _}
import com.karasiq.nanoboard.server.util.MessageValidator
import com.karasiq.nanoboard.sources.bitmessage.BitMessageTransport
import com.karasiq.nanoboard.sources.png.UrlPngSource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import akka.stream.scaladsl.{Flow, GraphDSL, Source}
import akka.stream.{ActorMaterializer, FlowShape}
import akka.util.ByteString
import boopickle.Default._
import com.karasiq.nanoboard.dispatcher.{NanoboardDispatcher, NanoboardMessageData}
import com.karasiq.nanoboard.dispatcher.NanoboardDispatcher
import com.karasiq.nanoboard.model.NanoboardMessageData
import com.karasiq.nanoboard.server.util.AttachmentGenerator
import com.karasiq.nanoboard.{NanoboardCategory, NanoboardMessage}

Expand Down
3 changes: 1 addition & 2 deletions src/test/scala/DatabaseTest.scala
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import com.karasiq.nanoboard.NanoboardMessage
import com.karasiq.nanoboard.dispatcher.NanoboardMessageData
import com.karasiq.nanoboard.server.model._
import com.karasiq.nanoboard.model._
import org.scalatest.{BeforeAndAfterAll, FlatSpec, Matchers}
import slick.driver.H2Driver.api._

Expand Down

0 comments on commit d9298ac

Please sign in to comment.