sinicum-runner 0.5.0.pre2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 20cfedf5952b2f5c27b67531d06a59f509dea9b8
4
+ data.tar.gz: 34c9bdbb630e96fea95454f1478d49e32ea324fa
5
+ SHA512:
6
+ metadata.gz: 91c3822b92f2eaa865fa3e7e8bc5171bff9ec23b4a562e63823d4471372395ef52a398d720c58811e9ed23f3c98d252d52c3ffd2d7a637cf717f8674fea8a04f
7
+ data.tar.gz: c59a573de5dfecea97b234385f05c49bd98e1fb76b917912bfbc75fe99f634fb0f41c23ba634a78184ec43de0fb192a06b888a759680ea586516adb1ddba24f8
data/.gitignore ADDED
@@ -0,0 +1,21 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+
19
+ # Maven
20
+ /target
21
+ /dependency-reduced-pom.xml
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in sinicum-runner.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,29 @@
1
+ == Sinicum-Runner
2
+
3
+ The MIT License
4
+
5
+ Copyright (c) 2008-2014 Jon Yurek and thoughtbot, inc.
6
+
7
+ Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the Software is
12
+ furnished to do so, subject to the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be included in
15
+ all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ THE SOFTWARE.
24
+
25
+ == Tomcat
26
+
27
+ Apache Tomcat (Copyright 1999-2013 The Apache Software Foundation)
28
+ is licensed under the Apache License, Version 2.0.
29
+ See http://www.apache.org/licenses/LICENSE-2.0 for details.
data/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # Sinicum::Runner
2
+
3
+ Sinicum-runner is a simple embedded Tomcat server, which runs Magnolia CMS from
 the app’s root directory.
4
+
5
+ It takes care of maven builds and makes it easy for a Rails Developer to use [Sinicum](https://github.com/dievision/sinicum).
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ gem 'sinicum-runner'
12
+
13
+ And then execute:
14
+
15
+ $ bundle
16
+
17
+ For more information, please visit [Sinicum](https://github.com/dievision/sinicum).
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'sinicum-runner'
4
+
5
+ runner = Sinicum::Runner::RunnerCli.new
6
+ runner.run(ARGV)
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,202 @@
1
+ require 'rexml/document'
2
+ require 'optparse'
3
+
4
+ module Sinicum
5
+ module Runner
6
+ class RunnerCli
7
+ RUNNER_TMP_DIR = ".sinicum-runner"
8
+
9
+ def run(args)
10
+ parse_args(args)
11
+ check_environment
12
+ setup_directories
13
+ build_webapp unless @options.skip_build
14
+ start_tomcat unless @options.only_build
15
+ end
16
+
17
+ private
18
+
19
+ def check_environment
20
+ check_for_file("pom.xml")
21
+ check_for_file("Gemfile")
22
+ check_for_file(File.join(magnolia_module_dir, "pom.xml"))
23
+ end
24
+
25
+ def setup_directories
26
+ FileUtils.mkdir(runner_dir) unless File.exists?(runner_dir)
27
+ end
28
+
29
+ def check_for_file(file)
30
+ unless File.exists?(file)
31
+ puts "Required file #{file} not found. Please check if you are running the command " +
32
+ "from the Rails root directory."
33
+ exit 1
34
+ end
35
+ end
36
+
37
+ def build_webapp
38
+ current_dir = FileUtils.pwd
39
+ FileUtils.cd(magnolia_module_dir)
40
+ run_command("mvn -Dmaven.test.skip=true clean package war:exploded")
41
+ ensure
42
+ FileUtils.cd(current_dir)
43
+ end
44
+
45
+ def start_tomcat
46
+ options = []
47
+ options.concat(@options.to_jvm_options)
48
+ options.concat(["-jar", jar_location, "--basedir", runner_dir,
49
+ "--appbase", webapp_directory_path])
50
+ options.concat(@options.to_option_args)
51
+ ret_value = system("java", *options)
52
+ exit 1 unless ret_value
53
+ ret_value
54
+ end
55
+
56
+ def runner_dir
57
+ File.expand_path(RUNNER_TMP_DIR)
58
+ end
59
+
60
+ def jar_location
61
+ loc = "#{File.dirname(__FILE__)}/../java/sinicum-runner-#{runner_jar_version}.jar"
62
+ File.expand_path(loc)
63
+ end
64
+
65
+ def runner_jar_version
66
+ unless @runner_jar_version
67
+ @runner_jar_version = version_from_pom(
68
+ File.join(File.dirname(__FILE__), "..", "..", "pom.xml"))
69
+ end
70
+ @runner_jar_version
71
+ end
72
+
73
+ def magnolia_module_dir
74
+ unless @magnolia_module_dir
75
+ pom = File.new("pom.xml")
76
+ doc = REXML::Document.new(pom)
77
+ @magnolia_module_dir = File.expand_path(
78
+ find_first_element(doc, "/project/modules/module").text)
79
+ end
80
+ @magnolia_module_dir
81
+ end
82
+
83
+ def webapp_directory_path
84
+ "#{magnolia_module_dir}/target/#{magnolia_module_name}-#{magnolia_module_version}"
85
+ end
86
+
87
+ def magnolia_module_name
88
+ unless @magnolia_module_name
89
+ pom = File.new(File.join(magnolia_module_dir, "pom.xml"))
90
+ doc = REXML::Document.new(pom)
91
+ @magnolia_module_name = find_first_element(doc, "/project/artifactId").text
92
+ end
93
+ @magnolia_module_name
94
+ end
95
+
96
+ def magnolia_module_version
97
+ unless @magnolia_module_version
98
+ pom = File.new(File.join(magnolia_module_dir, "pom.xml"))
99
+ doc = REXML::Document.new(pom)
100
+ element = find_first_element(doc, "/project/version")
101
+ unless element
102
+ find_first_element(doc, "/project/parent/version")
103
+ end
104
+ @magnolia_module_version = element.text
105
+ end
106
+ @magnolia_module_version
107
+ end
108
+
109
+ def version_from_pom(path)
110
+ version = nil
111
+ if File.exists?(path)
112
+ pom = File.new(path)
113
+ doc = REXML::Document.new(pom)
114
+ version = find_first_element(doc, "/project/version").text
115
+ end
116
+ version
117
+ end
118
+
119
+ def find_first_element(document, path)
120
+ element = nil
121
+ document.elements.each(path) do |el|
122
+ element = el
123
+ break
124
+ end
125
+ unless element
126
+ puts "No element with the path #{path} found pom.xml"
127
+ exit 1
128
+ end
129
+ element
130
+ end
131
+
132
+ def parse_args(args)
133
+ @options = Options.new(args)
134
+ end
135
+
136
+ def run_command(command, options = nil)
137
+ if options
138
+ ret_value = system(command, *options)
139
+ else
140
+ ret_value = system(command)
141
+ end
142
+ raise "Error running command '#{command}'" unless ret_value
143
+ end
144
+ end
145
+
146
+ class Options
147
+ attr_reader :port, :ajp_port, :context, :skip_build, :only_build, :hostname
148
+
149
+ def initialize(args = [])
150
+ opts = OptionParser.new do |opts|
151
+ opts.on("-p", "--port [PORT]", "HTTP port to bind to") do |port|
152
+ @port = port
153
+ end
154
+ opts.on("-a", "--ajp [AJP_PORT]", "enable the AJP web protocol") do |ajp_port|
155
+ @ajp_port = ajp_port
156
+ end
157
+ opts.on("-c", "--context [CONTEXT_PATH]", "application context path") do |context|
158
+ @context = context
159
+ end
160
+ opts.on("-n", "--hostname [HOSTNAME]", "application host name") do |hostname|
161
+ @hostname = hostname
162
+ end
163
+ @skip_build = false
164
+ opts.on("-s", "--skip-build", "skips the build of the Maven project") do |skip|
165
+ @skip_build = true
166
+ end
167
+ @only_build = false
168
+ opts.on("-b", "--only-build", "only builds the Maven project") do |skip|
169
+ @only_build = true
170
+ end
171
+ opts.on("-J[PARAM]", "JVM parameter") do |parameter|
172
+ jvm_params << parameter
173
+ end
174
+ end
175
+ opts.parse!(args)
176
+ end
177
+
178
+ def jvm_params
179
+ @jvm_params ||= []
180
+ end
181
+
182
+ def to_jvm_options
183
+ result = []
184
+ if jvm_params.size == 0
185
+ result << "-Xmx512m"
186
+ else
187
+ jvm_params.each { |par| result << par }
188
+ end
189
+ result
190
+ end
191
+
192
+ def to_option_args
193
+ args = []
194
+ args.concat(["-p", port]) if port
195
+ args.concat(["-a", ajp_port]) if ajp_port
196
+ args.concat(["-c", context]) if context
197
+ args.concat(["-n", hostname]) if hostname
198
+ args
199
+ end
200
+ end
201
+ end
202
+ end
@@ -0,0 +1,5 @@
1
+ module Sinicum
2
+ module Runner
3
+ VERSION = "0.5.0.pre2"
4
+ end
5
+ end
@@ -0,0 +1,7 @@
1
+ require "sinicum-runner/version"
2
+ require 'sinicum-runner/runner_cli'
3
+
4
+ module Sinicum
5
+ module Runner
6
+ end
7
+ end
data/pom.xml ADDED
@@ -0,0 +1,129 @@
1
+ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3
+ <modelVersion>4.0.0</modelVersion>
4
+
5
+ <groupId>com.dievision.sinicum</groupId>
6
+ <artifactId>sinicum-runner</artifactId>
7
+ <version>0.5.0.pre2</version>
8
+ <packaging>jar</packaging>
9
+
10
+ <name>sinicum-runner</name>
11
+ <url>http://maven.apache.org</url>
12
+
13
+ <properties>
14
+ <tomcatVersion>7.0.53</tomcatVersion>
15
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
16
+ </properties>
17
+
18
+ <dependencies>
19
+ <dependency>
20
+ <groupId>junit</groupId>
21
+ <artifactId>junit</artifactId>
22
+ <version>4.11</version>
23
+ <scope>test</scope>
24
+ </dependency>
25
+
26
+ <dependency>
27
+ <groupId>org.apache.tomcat</groupId>
28
+ <artifactId>tomcat-catalina</artifactId>
29
+ <version>${tomcatVersion}</version>
30
+ </dependency>
31
+
32
+ <dependency>
33
+ <groupId>org.apache.tomcat</groupId>
34
+ <artifactId>tomcat-jasper</artifactId>
35
+ <version>${tomcatVersion}</version>
36
+ </dependency>
37
+
38
+ <dependency>
39
+ <groupId>org.apache.tomcat.embed</groupId>
40
+ <artifactId>tomcat-embed-core</artifactId>
41
+ <version>${tomcatVersion}</version>
42
+ </dependency>
43
+
44
+ <dependency>
45
+ <groupId>com.beust</groupId>
46
+ <artifactId>jcommander</artifactId>
47
+ <version>1.30</version>
48
+ </dependency>
49
+ </dependencies>
50
+
51
+ <build>
52
+ <plugins>
53
+ <plugin>
54
+ <artifactId>maven-jar-plugin</artifactId>
55
+ <configuration>
56
+ <archive>
57
+ <manifest>
58
+ <addClasspath>true</addClasspath>
59
+ <classpathPrefix>lib/</classpathPrefix>
60
+ <mainClass>com.dievision.sinicum.runner.Main</mainClass>
61
+ </manifest>
62
+ </archive>
63
+ </configuration>
64
+ </plugin>
65
+
66
+ <plugin>
67
+ <groupId>org.apache.maven.plugins</groupId>
68
+ <artifactId>maven-dependency-plugin</artifactId>
69
+ <version>2.6</version>
70
+ <executions>
71
+ <execution>
72
+ <id>copy-dependencies</id>
73
+ <phase>package</phase>
74
+ <goals>
75
+ <goal>copy-dependencies</goal>
76
+ </goals>
77
+ <configuration>
78
+ <outputDirectory>${basedir}/lib/java/lib</outputDirectory>
79
+ <excludeArtifactIds>junit</excludeArtifactIds>
80
+ </configuration>
81
+ </execution>
82
+ </executions>
83
+ </plugin>
84
+
85
+ <plugin>
86
+ <artifactId>maven-resources-plugin</artifactId>
87
+ <version>2.6</version>
88
+ <executions>
89
+ <execution>
90
+ <id>copy-resources</id>
91
+ <phase>package</phase>
92
+ <goals>
93
+ <goal>copy-resources</goal>
94
+ </goals>
95
+ <configuration>
96
+ <outputDirectory>${basedir}/lib/java</outputDirectory>
97
+ <resources>
98
+ <resource>
99
+ <directory>target</directory>
100
+ <includes>
101
+ <include>sinicum-runner-${version}.jar</include>
102
+ </includes>
103
+ </resource>
104
+ </resources>
105
+ </configuration>
106
+ </execution>
107
+ </executions>
108
+ </plugin>
109
+
110
+ <plugin>
111
+ <artifactId>maven-clean-plugin</artifactId>
112
+ <version>2.5</version>
113
+ <configuration>
114
+ <filesets>
115
+ <fileset>
116
+ <directory>${basedir}/lib/java</directory>
117
+ <includes>
118
+ <include>**/*.*</include>
119
+ </includes>
120
+ <excludes>
121
+ <exclude>.gitkeep</exclude>
122
+ </excludes>
123
+ </fileset>
124
+ </filesets>
125
+ </configuration>
126
+ </plugin>
127
+ </plugins>
128
+ </build>
129
+ </project>
@@ -0,0 +1,20 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'sinicum-runner/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "sinicum-runner"
8
+ gem.version = Sinicum::Runner::VERSION
9
+ gem.authors = ["Patrik Metzmacher", "Daniel Trierweiler"]
10
+ gem.email = ["sinicum@dievision.de"]
11
+ gem.description = "A gem to easily run Magnolia CMS in a Tomcat instance"
12
+ gem.summary = "Simple embedded Tomcat server"
13
+ gem.homepage = "https://github.com/dievision/sinicum-runner"
14
+ gem.license = "MIT/Apache-2.0"
15
+
16
+ gem.files = `git ls-files`.split($/)
17
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
+ gem.require_paths = ["lib"]
20
+ end
@@ -0,0 +1,62 @@
1
+ require_relative '../../lib/sinicum-runner/runner_cli'
2
+
3
+ module Sinicum
4
+ module Runner
5
+ describe Options do
6
+ it "should work without options" do
7
+ opts = Options.new([])
8
+ opts.should_not be nil
9
+ end
10
+
11
+ it "shoud parse the port" do
12
+ opts = Options.new(["-p", "8090"])
13
+ opts.port.should eq("8090")
14
+ end
15
+
16
+ it "should parse the AJP port" do
17
+ opts = Options.new(["-a", "8009"])
18
+ opts.ajp_port.should eq("8009")
19
+ end
20
+
21
+ it "should parse the context path" do
22
+ opts = Options.new(["-c", "some_context"])
23
+ opts.context.should eq("some_context")
24
+ end
25
+
26
+ it "should allow for multiple JVM args" do
27
+ opts = Options.new(["-JXmx256m", "-JXmn256m"])
28
+ opts.jvm_params.should eq(["Xmx256m", "Xmn256m"])
29
+ end
30
+
31
+ it "should use Xmx512m as JVM option by default" do
32
+ opts = Options.new
33
+ opts.to_jvm_options.should eq(["-Xmx512m"])
34
+ end
35
+
36
+ it "should use other JVM options if any JVM arguments are given" do
37
+ opts = Options.new(["-J-Xmn256m", "-J-XX:MaxPermSize=256m"])
38
+ opts.to_jvm_options.should eq(["-Xmn256m", "-XX:MaxPermSize=256m"])
39
+ end
40
+
41
+ it "should not skip the build by default" do
42
+ opts = Options.new
43
+ opts.skip_build.should be false
44
+ end
45
+
46
+ it "should skip the build if asked to do so" do
47
+ opts = Options.new(["-s"])
48
+ opts.skip_build.should be true
49
+ end
50
+
51
+ it "should not skip the server by default" do
52
+ opts = Options.new
53
+ opts.only_build.should be false
54
+ end
55
+
56
+ it "should skip the server if asked to do so" do
57
+ opts = Options.new(["-b"])
58
+ opts.only_build.should be true
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,50 @@
1
+ package com.dievision.sinicum.runner;
2
+
3
+ import com.beust.jcommander.Parameter;
4
+
5
+ /**
6
+ *
7
+ */
8
+ public class Configuration {
9
+ @Parameter(names = "-p", description = "HTTP Port")
10
+ private Integer httpPort = 8080;
11
+
12
+ @Parameter(names = {"-a", "--ajp"}, description = "AJP Port")
13
+ private Integer ajpPort;
14
+
15
+ @Parameter(names = {"-c", "--context"}, description = "AJP Port")
16
+ private String contextPath = "";
17
+
18
+ @Parameter(names = {"-n", "--hostname"}, description = "Tomcat Hostname")
19
+ private String hostname;
20
+
21
+ @Parameter(names = "--basedir", description = "Tomcat Base directory", required = true)
22
+ private String baseDir;
23
+
24
+ @Parameter(names = "--appbase", description = "Tomcat App Base directory", required = true)
25
+ private String appBase;
26
+
27
+ public Integer getHttpPort() {
28
+ return httpPort;
29
+ }
30
+
31
+ public Integer getAjpPort() {
32
+ return ajpPort;
33
+ }
34
+
35
+ public String getAppBase() {
36
+ return appBase;
37
+ }
38
+
39
+ public String getBaseDir() {
40
+ return baseDir;
41
+ }
42
+
43
+ public String getContextPath() {
44
+ return contextPath;
45
+ }
46
+
47
+ public String getHostname() {
48
+ return hostname;
49
+ }
50
+ }
@@ -0,0 +1,48 @@
1
+ package com.dievision.sinicum.runner;
2
+
3
+ import org.apache.catalina.LifecycleException;
4
+ import org.apache.catalina.connector.Connector;
5
+ import org.apache.catalina.startup.Tomcat;
6
+
7
+ import com.beust.jcommander.JCommander;
8
+
9
+ public class Main {
10
+ public static void main(String[] args) throws Exception {
11
+ Configuration config = new Configuration();
12
+ new JCommander(config, args);
13
+
14
+ Tomcat tomcat = new Tomcat();
15
+ tomcat.setPort(config.getHttpPort());
16
+ tomcat.getConnector().setURIEncoding("UTF-8");
17
+ if (config.getAjpPort() != null) {
18
+ Connector connector = new Connector("AJP/1.3");
19
+ connector.setPort(config.getAjpPort());
20
+ connector.setURIEncoding("UTF-8");
21
+ tomcat.getService().addConnector(connector);
22
+ }
23
+ tomcat.setBaseDir(config.getBaseDir());
24
+ tomcat.getHost().setAppBase(config.getAppBase());
25
+ if (config.getHostname() != null) {
26
+ tomcat.setHostname(config.getHostname());
27
+ tomcat.getHost().setName(config.getHostname());
28
+ }
29
+ tomcat.addWebapp(config.getContextPath(), config.getAppBase());
30
+ addShutdownHook(tomcat);
31
+ tomcat.start();
32
+ tomcat.getServer().await();
33
+ }
34
+
35
+ private static void addShutdownHook(final Tomcat tomcat) {
36
+ Runtime runtime = Runtime.getRuntime();
37
+ runtime.addShutdownHook(new Thread(new Runnable() {
38
+ @Override
39
+ public void run() {
40
+ try {
41
+ tomcat.getServer().stop();
42
+ } catch (LifecycleException e) {
43
+ System.err.println("Error stopping Tomcat: " + e.toString());
44
+ }
45
+ }
46
+ }));
47
+ }
48
+ }
@@ -0,0 +1,83 @@
1
+ package com.dievision.sinicum.runner;
2
+
3
+ import org.junit.Before;
4
+ import org.junit.Test;
5
+
6
+ import com.beust.jcommander.JCommander;
7
+ import static junit.framework.Assert.*;
8
+
9
+ /**
10
+ *
11
+ */
12
+ public class ConfigurationTest {
13
+ private Configuration config;
14
+ private String[] argv;
15
+
16
+ @Before
17
+ public void setUp() {
18
+ this.config = new Configuration();
19
+ this.argv = new String[]{"--basedir", ".", "--appbase", "."};
20
+ }
21
+
22
+ @Test
23
+ public void testDefaultHttpPort() {
24
+ new JCommander(config, argv);
25
+ assertEquals(8080, config.getHttpPort().intValue());
26
+ }
27
+
28
+ @Test
29
+ public void testHttpPortOption() {
30
+ addArgs(new String[]{ "-p", "3000" });
31
+ new JCommander(config, argv);
32
+ assertEquals(3000, config.getHttpPort().intValue());
33
+ }
34
+
35
+ @Test
36
+ public void testAjpNullByDefault() {
37
+ new JCommander(config, argv);
38
+ assertNull(config.getAjpPort());
39
+ }
40
+
41
+ @Test
42
+ public void testSetAjpPort() {
43
+ addArgs(new String[]{ "--ajp", "8009" });
44
+ new JCommander(config, argv);
45
+ assertEquals(8009, config.getAjpPort().intValue());
46
+ }
47
+
48
+ @Test
49
+ public void testHostname() {
50
+ addArgs(new String[]{ "-n", "ahostname" });
51
+ new JCommander(config, argv);
52
+ assertEquals("ahostname", config.getHostname());
53
+ }
54
+
55
+ @Test
56
+ public void testBaseDirAppBase() {
57
+ argv = new String[]{ "--basedir", "/path/to/dir", "--appbase", "/path/to/appbase"};
58
+ new JCommander(config, argv);
59
+ assertEquals("/path/to/dir", config.getBaseDir());
60
+ assertEquals("/path/to/appbase", config.getAppBase());
61
+ }
62
+
63
+ @Test
64
+ public void contextPathIsEmptyByDefault() {
65
+ new JCommander(config, argv);
66
+ assertEquals("", config.getContextPath());
67
+ }
68
+
69
+ @Test
70
+ public void contextPathCanBeSet() {
71
+ addArgs(new String[]{"-c", "/somepath"});
72
+ new JCommander(config, argv);
73
+ assertEquals("/somepath", config.getContextPath());
74
+ }
75
+
76
+ private void addArgs(String[] args) {
77
+ String[] newArgv = new String[argv.length + args.length];
78
+ System.arraycopy(argv, 0, newArgv, 0, argv.length);
79
+ System.arraycopy(args, 0, newArgv, argv.length, args.length);
80
+ this.argv = newArgv;
81
+ }
82
+
83
+ }
metadata ADDED
@@ -0,0 +1,79 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sinicum-runner
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.5.0.pre2
5
+ platform: ruby
6
+ authors:
7
+ - Patrik Metzmacher
8
+ - Daniel Trierweiler
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-04-16 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: A gem to easily run Magnolia CMS in a Tomcat instance
15
+ email:
16
+ - sinicum@dievision.de
17
+ executables:
18
+ - sinicum-runner
19
+ extensions: []
20
+ extra_rdoc_files: []
21
+ files:
22
+ - ".gitignore"
23
+ - Gemfile
24
+ - LICENSE
25
+ - README.md
26
+ - Rakefile
27
+ - bin/sinicum-runner
28
+ - lib/java/lib/ecj-P20140317-1600.jar
29
+ - lib/java/lib/hamcrest-core-1.3.jar
30
+ - lib/java/lib/jcommander-1.30.jar
31
+ - lib/java/lib/tomcat-annotations-api-7.0.53.jar
32
+ - lib/java/lib/tomcat-api-7.0.53.jar
33
+ - lib/java/lib/tomcat-catalina-7.0.53.jar
34
+ - lib/java/lib/tomcat-el-api-7.0.53.jar
35
+ - lib/java/lib/tomcat-embed-core-7.0.53.jar
36
+ - lib/java/lib/tomcat-jasper-7.0.53.jar
37
+ - lib/java/lib/tomcat-jasper-el-7.0.53.jar
38
+ - lib/java/lib/tomcat-jsp-api-7.0.53.jar
39
+ - lib/java/lib/tomcat-juli-7.0.53.jar
40
+ - lib/java/lib/tomcat-servlet-api-7.0.53.jar
41
+ - lib/java/lib/tomcat-util-7.0.53.jar
42
+ - lib/java/sinicum-runner-0.5.0.jar
43
+ - lib/java/sinicum-runner-0.5.0.pre1.jar
44
+ - lib/sinicum-runner.rb
45
+ - lib/sinicum-runner/runner_cli.rb
46
+ - lib/sinicum-runner/version.rb
47
+ - pom.xml
48
+ - sinicum-runner.gemspec
49
+ - spec/sinicum-runner/runner_cli_spec.rb
50
+ - src/main/java/com/dievision/sinicum/runner/Configuration.java
51
+ - src/main/java/com/dievision/sinicum/runner/Main.java
52
+ - src/test/java/com/dievision/sinicum/runner/ConfigurationTest.java
53
+ homepage: https://github.com/dievision/sinicum-runner
54
+ licenses:
55
+ - MIT/Apache-2.0
56
+ metadata: {}
57
+ post_install_message:
58
+ rdoc_options: []
59
+ require_paths:
60
+ - lib
61
+ required_ruby_version: !ruby/object:Gem::Requirement
62
+ requirements:
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ required_rubygems_version: !ruby/object:Gem::Requirement
67
+ requirements:
68
+ - - ">"
69
+ - !ruby/object:Gem::Version
70
+ version: 1.3.1
71
+ requirements: []
72
+ rubyforge_project:
73
+ rubygems_version: 2.2.2
74
+ signing_key:
75
+ specification_version: 4
76
+ summary: Simple embedded Tomcat server
77
+ test_files:
78
+ - spec/sinicum-runner/runner_cli_spec.rb
79
+ has_rdoc: