summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Schlaeger <chris@linux.com>2014-08-12 21:53:09 +0200
committerChris Schlaeger <chris@linux.com>2014-08-12 21:53:09 +0200
commit59741cd535c47f25971bf8c32b25da25ceadc6d5 (patch)
tree2fea9c3f7c06c7381c388c43e57dd607775413f6
parent4ef55cb921422ed26495c1228cd9082bcf20559a (diff)
downloadpostrunner-59741cd535c47f25971bf8c32b25da25ceadc6d5.zip
Automatically create links to misc directories in html output dir.
-rw-r--r--lib/postrunner/ActivityView.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/postrunner/ActivityView.rb b/lib/postrunner/ActivityView.rb
index 6def7dc..5d34ca0 100644
--- a/lib/postrunner/ActivityView.rb
+++ b/lib/postrunner/ActivityView.rb
@@ -35,8 +35,34 @@ module PostRunner
Log.fatal "Cannot create output directory '#{@output_dir}': #{$!}"
end
end
+ create_symlink('jquery')
+ create_symlink('flot')
+ create_symlink('openlayers')
end
+ def create_symlink(dir)
+ # This file should be in lib/postrunner. The 'misc' directory should be
+ # found in '../../misc'.
+ misc_dir = File.realpath(File.join(File.dirname(__FILE__),
+ '..', '..', 'misc'))
+ unless Dir.exists?(misc_dir)
+ Log.fatal "Cannot find 'misc' directory under '#{misc_dir}': #{$!}"
+ end
+ src_dir = File.join(misc_dir, dir)
+ unless Dir.exists?(src_dir)
+ Log.fatal "Cannot find '#{src_dir}': #{$!}"
+ end
+ dst_dir = File.join(@output_dir, dir)
+ unless File.exists?(dst_dir)
+ begin
+ FileUtils.ln_s(src_dir, dst_dir)
+ rescue IOError
+ Log.fatal "Cannot create symbolic link to '#{dst_dir}': #{$!}"
+ end
+ end
+ end
+
+
def generate_html(doc)
@report = ActivityReport.new(@activity.fit_activity)
@track_view = TrackView.new(@activity)