Skip to content

Commit

Permalink
Merge branch 'release/v0.4.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
sdorra committed Aug 1, 2017
2 parents 1346f82 + 7ef5f06 commit 5211c19
Show file tree
Hide file tree
Showing 26 changed files with 2,252 additions and 23 deletions.
78 changes: 78 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!groovy
@Library('github.com/cloudogu/ces-build-lib@a5955fb')
import com.cloudogu.ces.cesbuildlib.*

node() { // No specific label

properties([
// Keep only the last 10 build to preserve space
buildDiscarder(logRotator(numToKeepStr: '10')),
// Don't run concurrent builds for a branch, because they use the same workspace directory
disableConcurrentBuilds()
])

String emailRecipients = env.EMAIL_RECIPIENTS

catchError {

def mvnHome = tool 'M3'
def javaHome = tool 'JDK8'
def sonarQube = 'ces-sonar'

Maven mvn = new Maven(this, mvnHome, javaHome)
Git git = new Git(this)

stage('Checkout') {
checkout scm
git.clean("")
}

stage('Build') {
setupMaven(mvn)
mvn 'clean install -DskipTests'
archive '**/target/*.jar,**/target/*.zip'
}

stage('Unit Test') {
mvn 'test'
}

stage('SonarQube') {
withSonarQubeEnv(sonarQube) {
mvn "$SONAR_MAVEN_GOAL -Dsonar.host.url=$SONAR_HOST_URL " +
//exclude generated code in target folder
"-Dsonar.exclusions=target/**"
}
}
}

// Archive Unit and integration test results, if any
junit allowEmptyResults: true, testResults: '**/target/failsafe-reports/TEST-*.xml,**/target/surefire-reports/TEST-*.xml'

// email on fail
step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: emailRecipients, sendToIndividuals: true])
}

def setupMaven(mvn) {
// TODO refactor this in an object-oriented way and move to build-lib
if ("master".equals(env.BRANCH_NAME)) {
mvn.additionalArgs = "-DperformRelease"
currentBuild.description = mvn.getVersion()
} else if (!"develop".equals(env.BRANCH_NAME)) {
// CHANGE_ID == pull request id
// http://stackoverflow.com/questions/41695530/how-to-get-pull-request-id-from-jenkins-pipeline
if ( env.CHANGE_ID != null && env.CHANGE_ID.length() > 0 ) {
echo 'build pr ' + env.CHANGE_ID + ' at ' + env.BRANCH_NAME
mvn.additionalArgs = "-Dsonar.analysis.mode=preview "
mvn.additionalArgs += "-Dsonar.github.pullRequest=${env.CHANGE_ID} "
mvn.additionalArgs += "-Dsonar.github.repository=cloudogu/cas "
withCredentials([[$class: 'UsernamePasswordMultiBinding', credentialsId: 'sonarqube-gh', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD']]) {
mvn.additionalArgs += "-Dsonar.github.oauth=${env.PASSWORD} "
}
} else {
echo 'build branch ' + env.BRANCH_NAME
// run SQ analysis in specific project for feature, hotfix, etc.
mvn.additionalArgs = "-Dsonar.branch=" + env.BRANCH_NAME
}
}
}
1 change: 1 addition & 0 deletions ces-startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ FQDN=$(doguctl config --global fqdn)
export SMEAGOL_SERVICE_URL="https://${FQDN}/smeagol"
export SMEAGOL_CAS_URL="https://${FQDN}/cas"
export SCM_INSTANCE_URL="https://${FQDN}/scm"
export PLANTUML_URL="https://${FQDN}/plantuml/png"

TRUSTSTORE="${SMEAGOL_HOME}/truststore.jks"
create_truststore.sh "${TRUSTSTORE}" > /dev/null
Expand Down
2 changes: 1 addition & 1 deletion dogu.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"Name": "official/smeagol",
"Version": "0.3.0",
"Version": "0.4.0",
"DisplayName": "Smeagol",
"Description": "Store your technical documentation with in your git repositories",
"Category": "Documentation",
Expand Down
31 changes: 19 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.cloudogu.wiki</groupId>
<artifactId>smeagol</artifactId>
<version>0.3.0</version>
<version>0.4.0</version>
<name>smeagol</name>
<packaging>jar</packaging>

Expand Down Expand Up @@ -42,21 +42,28 @@
<dependency>
<groupId>rubygems</groupId>
<artifactId>gollum</artifactId>
<version>4.0.1</version>
<version>4.1.1</version>
<type>gem</type>
</dependency>

<!--
fix dependency resolution problem:
Gollum depends on github-markup, which depends on rinku, since version 1.5.0.
Rinku uses native extensions, which will not work with jruby.
So we have to use version 1.4.0.
-->

<dependency>
<groupId>rubygems</groupId>
<artifactId>github-markup</artifactId>
<version>1.4.0</version>
<version>1.6.1</version>
<type>gem</type>
</dependency>

<dependency>
<groupId>rubygems</groupId>
<artifactId>asciidoctor</artifactId>
<version>1.5.6.1</version>
<type>gem</type>
</dependency>

<dependency>
<groupId>rubygems</groupId>
<artifactId>creole</artifactId>
<version>0.5.0</version>
<type>gem</type>
</dependency>

Expand Down Expand Up @@ -232,8 +239,8 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<rack-servlet.version>1.7</rack-servlet.version>
<jruby.version>9.1.2.0</jruby.version>
<rack-servlet.version>1.8</rack-servlet.version>
<jruby.version>9.1.12.0</jruby.version>
<jruby-plugins.version>1.1.5</jruby-plugins.version>
<jetty.version>9.3.11.v20160721</jetty.version>
<cas-client.version>3.4.1</cas-client.version>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/com/cloudogu/wiki/header_de.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
<ul class="nav navbar-nav">
<li>
<a href="{{casLogoutUrl}}">
Abmeldung
Logout
</a>
</li>
</ul>
Expand Down
30 changes: 26 additions & 4 deletions src/main/resources/com/cloudogu/wiki/runner.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,22 @@
Kramdown::Document.new(content, :auto_ids => false).to_html
}

# remove non used markup formats
Gollum::Page.send :remove_const, :FORMAT_NAMES if defined? Gollum::Page::FORMAT_NAMES
Gollum::Markup.formats.delete(:org)
Gollum::Markup.formats.delete(:rest)
Gollum::Markup.formats.delete(:mediawiki)
Gollum::Markup.formats.delete(:pod)
Gollum::Markup.formats.delete(:textile)

module Precious
class App < Sinatra::Base

def session
account = settings.wikiContextFactory.get().getAccount()
{ 'gollum.author' => { :name => account.getDisplayName(), :email => account.getMail() }}
end

end
end

Expand Down Expand Up @@ -52,12 +60,26 @@ def call(env)
staticPath = "#{dir}/src/main/webapp"
end

Precious::App.set(:mustache, {:templates => "#{staticPath}/WEB-INF/templates/de/"})
Precious::App.set(:mustache, {
:templates => "#{staticPath}/WEB-INF/templates/de/",
:views => "#{staticPath}/WEB-INF/views/de/"
})
end

plantUmlUrl = ENV["PLANTUML_URL"]
if plantUmlUrl || plantUmlUrl.length == 0
Gollum::Filter::PlantUML.configure do |config|
config.url = plantUmlUrl
# do not verify ssl, in order to work with self signed certificates
config.verify_ssl = false
end
end

Gollum::Hook.register(:post_commit, :hook_id) do |committer, sha1|
provider = wikiContextFactory.get().getProvider()
provider.push(wiki.getName(), sha1)
if sha1.is_a?(String)
provider = wikiContextFactory.get().getProvider()
provider.push(wiki.getName(), sha1)
end
end

MapGollum.new(Precious::App, wiki)
4 changes: 2 additions & 2 deletions src/main/webapp/WEB-INF/templates/de/layout.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
</script>
<script type="text/javascript" src="{{base_url}}/javascript/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="{{base_url}}/javascript/mousetrap.min.js"></script>
<script type="text/javascript" src="{{base_url}}/javascript/gollum.js"></script>
<script type="text/javascript" src="{{base_url}}/javascript/gollum.dialog.js"></script>
<script type="text/javascript" src="/smeagol/_static/scripts/de/gollum.js"></script>
<script type="text/javascript" src="/smeagol/_static/scripts/de/gollum.dialog.js"></script>
<script type="text/javascript" src="{{base_url}}/javascript/gollum.placeholder.js"></script>
<script type="text/javascript" src="{{base_url}}/javascript/editor/gollum.editor.js"></script>
{{#use_identicon}}
Expand Down
6 changes: 3 additions & 3 deletions src/main/webapp/WEB-INF/templates/de/livepreview.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
<a id='preview' class='edit'><img src='images/globe_24.png' alt='Vorschau' title='Vorschau'></a>
<a id='save' class='edit'><img src='images/save_24.png' alt='Speichern' title='Speichern'></a>
<a id='savecomment' class='edit'><img src='images/savecomment_24.png' alt='Speichern mit Kommentar' title='Speichern mit Kommentar'></a>
<a id='toggle' class='edit' href='javascript:void(0)' onclick='jsm.toggleLeftRight();'><img src='images/lr_24.png' alt='Wechsle links nach rechts' title='Wechsle links nach rechts'></a>
<a id='toggle' class='edit' href='javascript:void(0)' onclick='jsm.toggleLeftRight();'><img src='images/lr_24.png' alt='Ansicht links/rechts tauschen' title='Ansicht links/rechts tauschen'></a>
</div>

<div id='editor_bg' class='editor_bg'></div>
<div class='toolpanel_bg'></div>

<div id='commenttoolpanel' class='toolpanel edit' style='width: 500px; right: 0px; '>
<a id='savecommentconfirm' class='edit'><img src='images/savecomment_24.png' alt='Bestätige das Speichern mit Kommentar' title='Bestätige das Speichern mit Kommentar'></a>
<a id='commentcancel' class='edit'><img src='images/cancel_24.png' alt='Abbrechen des Speicherns mit Kommentar' title='Abbrechen des Speicherns mit Kommentar'></a>
<a id='savecommentconfirm' class='edit'><img src='images/savecomment_24.png' alt='Speichern mit Kommentar' title='Speichern mit Kommentar'></a>
<a id='commentcancel' class='edit'><img src='images/cancel_24.png' alt='Speichern abbrechen' title='Speichern abbrechen'></a>
</div>
<div id='comment'></div>
<div id='darkness'></div>
Expand Down
94 changes: 94 additions & 0 deletions src/main/webapp/WEB-INF/views/de/compare.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
module Precious
module Views
class Compare < Layout
include HasPage

attr_reader :page, :diff, :versions, :message, :allow_editing

def title
"Vergleich von #{@page.title}"
end

def before
@versions[0][0..6]
end

def after
@versions[1][0..6]
end

def lines
lines = []
@diff.diff.split("\n")[2..-1].each_with_index do |line, line_index|
lines << { :line => line,
:class => line_class(line),
:ldln => left_diff_line_number(0, line),
:rdln => right_diff_line_number(0, line) }
end if @diff
lines
end

def show_revert
!@message
end

# private

def line_class(line)
if line =~ /^@@/
'gc'
elsif line =~ /^\+/
'gi'
elsif line =~ /^\-/
'gd'
else
''
end
end

@left_diff_line_number = nil

def left_diff_line_number(id, line)
if line =~ /^@@/
m, li = *line.match(/\-(\d+)/)
@left_diff_line_number = li.to_i
@current_line_number = @left_diff_line_number
ret = '...'
elsif line[0] == ?-
ret = @left_diff_line_number.to_s
@left_diff_line_number += 1
@current_line_number = @left_diff_line_number - 1
elsif line[0] == ?+
ret = ' '
else
ret = @left_diff_line_number.to_s
@left_diff_line_number += 1
@current_line_number = @left_diff_line_number - 1
end
ret
end

@right_diff_line_number = nil

def right_diff_line_number(id, line)
if line =~ /^@@/
m, ri = *line.match(/\+(\d+)/)
@right_diff_line_number = ri.to_i
@current_line_number = @right_diff_line_number
ret = '...'
elsif line[0] == ?-
ret = ' '
elsif line[0] == ?+
ret = @right_diff_line_number.to_s
@right_diff_line_number += 1
@current_line_number = @right_diff_line_number - 1
else
ret = @right_diff_line_number.to_s
@right_diff_line_number += 1
@current_line_number = @right_diff_line_number - 1
end
ret
end
end
end
end
Loading

0 comments on commit 5211c19

Please sign in to comment.