ttl2html 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/bin/ttl2html +11 -0
- data/lib/ttl2html/version.rb +1 -1
- data/lib/ttl2html.rb +12 -3
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 0adfcf13ff29a3d0d420398f5bbad8d3d5069dfe8d140134d57c12eb62641a0d
|
4
|
+
data.tar.gz: fe672d37d3eaa68e912f2757b968c050fa249dbe829d52a20b2a985e11e0ce64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad8b3f54a77163a673dd397dbd956052e0b024f6fe7306fb177b1db0871c22a8a8eda87b982079472062c92c494ec4f5bb8f21f1719da9cdd05d713a1e1fc4c5
|
7
|
+
data.tar.gz: e431b8064f4ce660dd7c1bcec821412586de1fa6405e8c309a4718e3338431f11170a1b43214621352a351fa6ce69618e952479d5b7cc42eb6b79243c58b750f
|
data/bin/ttl2html
CHANGED
@@ -3,6 +3,10 @@
|
|
3
3
|
require "getoptlong"
|
4
4
|
require "ttl2html"
|
5
5
|
|
6
|
+
def usage
|
7
|
+
puts "Usage: #$0 [ --config config.yml ] dataset.ttl ..."
|
8
|
+
end
|
9
|
+
|
6
10
|
parser = GetoptLong.new
|
7
11
|
parser.set_options(
|
8
12
|
['--cleanup', GetoptLong::NO_ARGUMENT],
|
@@ -19,6 +23,13 @@ parser.each_option do |optname, optarg|
|
|
19
23
|
end
|
20
24
|
end
|
21
25
|
|
26
|
+
if not File.exist? opt_config
|
27
|
+
puts "Configuration file [#{opt_config}] not found."
|
28
|
+
puts " Please setup a configuration file, or specify it with --config option."
|
29
|
+
puts
|
30
|
+
usage
|
31
|
+
exit
|
32
|
+
end
|
22
33
|
ttl2html = TTL2HTML::App.new(opt_config)
|
23
34
|
ARGV.each do |file|
|
24
35
|
ttl2html.load_turtle(file)
|
data/lib/ttl2html/version.rb
CHANGED
@@ -1 +1 @@
|
|
1
|
-
TTL2HTML::VERSION = "0.0.
|
1
|
+
TTL2HTML::VERSION = "0.0.5
|
data/lib/ttl2html.rb
CHANGED
@@ -135,7 +135,8 @@ module TTL2HTML
|
|
135
135
|
end
|
136
136
|
template.output_to(file, param)
|
137
137
|
end
|
138
|
-
index_html =
|
138
|
+
index_html = "index.html"
|
139
|
+
index_html = File.join(@config[:output_dir], "index.html") if @config[:output_dir]
|
139
140
|
if @config.has_key? :top_class and not File.exist? index_html
|
140
141
|
template = Template.new("index.html.erb", @config)
|
141
142
|
param = @config.dup
|
@@ -163,7 +164,11 @@ module TTL2HTML
|
|
163
164
|
end
|
164
165
|
end
|
165
166
|
def cleanup
|
166
|
-
|
167
|
+
@data.select do |uri, v|
|
168
|
+
uri.start_with? @config[:base_uri]
|
169
|
+
end.sort_by do |uri, v|
|
170
|
+
-(uri.size)
|
171
|
+
end.each do |uri, v|
|
167
172
|
if @data.keys.find{|e| e.start_with?(uri + "/") }
|
168
173
|
file = uri + "/index.html"
|
169
174
|
else
|
@@ -175,8 +180,12 @@ module TTL2HTML
|
|
175
180
|
ttl_file = uri.sub(@config[:base_uri], "") + ".ttl"
|
176
181
|
ttl_file = File.join(@config[:output_dir], ttl_file) if @config[:output_dir]
|
177
182
|
File.unlink ttl_file
|
183
|
+
dir = uri.sub(@config[:base_uri], "")
|
184
|
+
dir = File.join(@config[:output_dir], dir) if @config[:output_dir]
|
185
|
+
Dir.rmdir dir if File.exist? dir
|
178
186
|
end
|
179
|
-
index_html =
|
187
|
+
index_html = "index.html"
|
188
|
+
index_html = File.join(@config[:output_dir], "index.html") if @config[:output_dir]
|
180
189
|
if @config[:top_class] and File.exist? index_html
|
181
190
|
File.unlink index_html
|
182
191
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ttl2html
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Masao Takaku
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|
@@ -128,8 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
128
|
- !ruby/object:Gem::Version
|
129
129
|
version: '0'
|
130
130
|
requirements: []
|
131
|
-
|
132
|
-
rubygems_version: 2.6.14.4
|
131
|
+
rubygems_version: 3.1.2
|
133
132
|
signing_key:
|
134
133
|
specification_version: 4
|
135
134
|
summary: ttl2html
|