marmottawrapper 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -2
- data/README.md +12 -1
- data/lib/marmottawrapper.rb +22 -19
- data/lib/marmottawrapper/tasks/marmottawrapper.rake +4 -4
- data/lib/marmottawrapper/version.rb +1 -1
- data/marmottawrapper.gemspec +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec0bb85d1d99a22c5d4d1dac464eb1c5a5e9c4ae
|
4
|
+
data.tar.gz: 649d3459d4aa182637bfd9ec6dcff97471ed91a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8efafa1b20fc70d9b5db3007760d23f218204404a0052d159d0ba8dcdd5efd1fa07d733050e166d1812c0fb00810a822ceb53785d2e6ca3cec06949c49fa76e6
|
7
|
+
data.tar.gz: 124b5971b75c31edfa1c01246e22f7ae61cc0b1000cd2bf582d70f213f039e0294d5a7d079c2a7d82811694846d165938dd0257c29bd646123e40f15c65ab62f
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -17,6 +17,17 @@ Download and install Marmotta:
|
|
17
17
|
* To start a Marmotta app in Tomcat 7 on port `8080`: `rake marmotta:start`
|
18
18
|
* To stop Tomcat: `rake marmotta:stop`
|
19
19
|
|
20
|
+
|
21
|
+
Configuration
|
22
|
+
-------------
|
23
|
+
|
24
|
+
By default, Marmotta will create all its necessary files in a `marmotta`
|
25
|
+
subdirectory of your application's root once you start it for the first time,
|
26
|
+
including sensible defaults for configuration. Configuration changes can be
|
27
|
+
made by altering `marmotta/system-config.properties` (see the
|
28
|
+
[Marmotta documentation](http://marmotta.apache.org/configuration.html)
|
29
|
+
for more details).
|
30
|
+
|
20
31
|
Use in Rails Projects
|
21
32
|
----------------------
|
22
33
|
|
@@ -43,7 +54,7 @@ Marmotta should now be available on your host machine at port `8087`.
|
|
43
54
|
TODO:
|
44
55
|
-----
|
45
56
|
* [ ] Make Tomcat port configurable.
|
46
|
-
* [ ] Make Marmotta configurable.
|
47
57
|
* [ ] Wait for Tomcat to start before quitting `start` task.
|
58
|
+
* [ ] Add support for Windows.
|
48
59
|
|
49
60
|
License: Apache 2.0
|
data/lib/marmottawrapper.rb
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
require 'fileutils'
|
2
|
+
require 'open-uri'
|
3
|
+
require 'zlib'
|
4
|
+
require 'archive/tar/minitar'
|
2
5
|
|
3
6
|
class Marmottawrapper
|
4
7
|
|
5
8
|
require 'marmottawrapper/railtie' if defined?(Rails)
|
9
|
+
Dir[File.expand_path(File.join(File.dirname(__FILE__),"marmottawrapper/tasks/*.rake"))].each { |ext| load ext } if defined?(Rake)
|
6
10
|
|
7
11
|
class << self
|
8
12
|
def app_root
|
@@ -12,7 +16,7 @@ class Marmottawrapper
|
|
12
16
|
end
|
13
17
|
|
14
18
|
def url
|
15
|
-
@url ||= defined?(ZIP_URL) ? ZIP_URL : "https://github.com/dpla/
|
19
|
+
@url ||= defined?(ZIP_URL) ? ZIP_URL : "https://github.com/dpla/marmottawrapper/releases/download/v0.0.5/tomcat-marmotta.tgz"
|
16
20
|
end
|
17
21
|
|
18
22
|
def marmotta_dir
|
@@ -27,44 +31,43 @@ class Marmottawrapper
|
|
27
31
|
File.join(app_root, 'tomcat')
|
28
32
|
end
|
29
33
|
|
34
|
+
def tarball
|
35
|
+
File.join(tmp_dir, 'tomcat-marmotta.tgz')
|
36
|
+
end
|
37
|
+
|
30
38
|
def clean
|
31
|
-
|
32
|
-
|
33
|
-
|
39
|
+
File.delete(tarball)
|
40
|
+
FileUtils.rm_rf(tomcat_dir) if File.directory?(tomcat_dir)
|
41
|
+
FileUtils.rm_rf(marmotta_dir) if File.directory?(marmotta_dir)
|
34
42
|
end
|
35
43
|
|
36
44
|
##
|
37
45
|
# Fetch the Tomcat/Marmotta distribution
|
38
46
|
def fetch
|
47
|
+
File.delete(tarball)
|
39
48
|
FileUtils.makedirs(tmp_dir) unless File.directory?(tmp_dir)
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
}
|
49
|
+
open(tarball, 'wb') do |tm|
|
50
|
+
tm.write(open(url).read)
|
51
|
+
end
|
44
52
|
end
|
45
53
|
|
46
54
|
def install
|
47
|
-
fetch unless File.exists?(
|
48
|
-
|
49
|
-
|
55
|
+
fetch unless File.exists?(tarball)
|
56
|
+
FileUtils.makedirs(marmotta_dir) unless File.directory?(marmotta_dir)
|
57
|
+
tb = Zlib::GzipReader.new(File.open(tarball, 'rb'))
|
58
|
+
Archive::Tar::Minitar.unpack(tb, app_root.to_path)
|
50
59
|
end
|
51
60
|
|
52
61
|
##
|
53
62
|
# Start the Tomcat server with Marmotta
|
54
63
|
def start
|
55
|
-
system "#{tomcat_dir}/bin/startup.sh"
|
64
|
+
system "MARMOTTA_HOME=#{marmotta_dir} #{tomcat_dir}/bin/startup.sh"
|
56
65
|
end
|
57
66
|
|
58
67
|
##
|
59
68
|
# Stop Tomcat/Marmotta
|
60
69
|
def stop
|
61
|
-
system "#{tomcat_dir}/bin/shutdown.sh"
|
62
|
-
end
|
63
|
-
|
64
|
-
def restart
|
65
|
-
stop
|
66
|
-
sleep 2
|
67
|
-
start
|
70
|
+
system "MARMOTTA_HOME=#{marmotta_dir} #{tomcat_dir}/bin/shutdown.sh"
|
68
71
|
end
|
69
72
|
|
70
73
|
end
|
@@ -17,19 +17,19 @@ namespace :marmotta do
|
|
17
17
|
|
18
18
|
desc "Start Marmotta/Tomcat"
|
19
19
|
task :start do
|
20
|
-
|
21
|
-
puts "Tomcat started with PID #{pid}"
|
20
|
+
Marmottawrapper.start
|
22
21
|
end
|
23
22
|
|
24
23
|
desc "Stop Marmotta/Tomcat"
|
25
24
|
task :stop do
|
26
|
-
|
27
|
-
puts "Tomcat/Marmotta stopped"
|
25
|
+
Marmottawrapper.stop
|
28
26
|
end
|
29
27
|
|
30
28
|
desc "Restart Marmotta/Tomcat"
|
31
29
|
task :restart do
|
32
30
|
Marmottawrapper.stop
|
31
|
+
sleep 2
|
33
32
|
Marmottawrapper.start
|
34
33
|
end
|
34
|
+
|
35
35
|
end
|
data/marmottawrapper.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marmottawrapper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Matienzo
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-10-
|
12
|
+
date: 2014-10-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -25,6 +25,20 @@ dependencies:
|
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: archive-tar-minitar
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - ">="
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
28
42
|
- !ruby/object:Gem::Dependency
|
29
43
|
name: pry
|
30
44
|
requirement: !ruby/object:Gem::Requirement
|