Permalink
Browse files

Update scripts

  • Loading branch information...
1 parent d47d1fe commit 40662dff74b3151b7c30bf4834e9c66c48538523 @jpallen jpallen committed Feb 13, 2013
Showing with 21 additions and 124 deletions.
  1. +21 −0 script/ensure_token_exists
  2. +0 −24 script/mount_clsi
  3. +0 −41 script/mount_wildcard_resource_filesystem
  4. +0 −59 script/remote_latex
View
@@ -0,0 +1,21 @@
+#!script/runner
+
+token = ARGV[0]
+
+if !token
+ print "Usage: script/runner script/ensure_token_exists <token>"
+end
+
+u = User.find_by_token token
+
+if !u
+ print "Creating token..."
+ u = User.create :token => token
+ u.token = token
+ u.save
+ print "done\n"
+else
+ print "Token already exists\n"
+end
+
+
View
@@ -1,24 +0,0 @@
-#!script/runner
-print "Mounting wildcard filesystem..."
-pid = fork{
- Kernel.exec("script/mount_wildcard_resource_filesystem", "#{WILDCARD_FS_DIR}")
-}
-Process.detach pid
-File.open('.wildcard_filesystem_pid', 'w'){|f| f.write(pid.to_s)}
-print "Done!\n"
-
-#sleep 10
-
-#print "Joining filesystems...\n"
-#command = "sudo mount -t unionfs -o " +
-# "dir=#{STATIC_FILESYSTEM_DIR}:#{WILDCARD_RESOURCE_FILESYSTEM_DIR}=ro " +
-# "none #{LATEX_COMPILE_DIR}"
-
-#command = "sudo mount -t aufs -o " +
-# "br=#{STATIC_FILESYSTEM_DIR}:#{WILDCARD_RESOURCE_FILESYSTEM_DIR}=ro " +
-# "none #{LATEX_COMPILE_DIR}"
-
-#print "The following command requires root privileges:\n#{command}\n"
-#system(command)
-
-
@@ -1,41 +0,0 @@
-#!script/runner
-
-require 'fusefs'
-
-class WildcardResourceFS < FuseFS::FuseDir
- def contents(path)
- print "contents: #{path}\n"
- end
-
- def file?(path)
- print "file?: #{path}\n"
- WildcardResourceFilesystem.file?(path)
- end
-
- def directory?(path)
- print "directory?: #{path}\n"
- WildcardResourceFilesystem.directory?(path)
- end
-
- def read_file(path)
- print "read file: #{path}\n"
- WildcardResourceFilesystem.read_file(path)
- end
-end
-
-
-if ARGV.size != 1
- puts "Usage: #{$0} <dirname>"
- exit
-end
-dirname = ARGV[0]
-
-root = WildcardResourceFS.new
-FuseFS.set_root(root)
-trap("INT") do
- FuseFS.unmount
- exit
-end
-FuseFS.mount_under(dirname)
-FuseFS.run
-
View
@@ -1,59 +0,0 @@
-#!/usr/bin/env ruby
-require 'webrick'
-include WEBrick
-require "soap/wsdlDriver"
-require 'rexml/document'
-
-unless ARGV.size == 2
- puts "Usage: #{$0} <clsi-host> <filename>"
- exit
-end
-host = ARGV[0]
-filename = ARGV[1]
-
-#s = HTTPServer.new(
-# :Port => 2000,
-# :DocumentRoot => Dir::pwd
-#
-
-# Start resources server
-#print "Starting resources server...\n"
-#pid = fork{
-# trap("INT"){ s.shutdown }
-# s.start
-#}
-
-# Create SOAP driver
-wsdl = "#{host}/Clsi/wsdl"
-clsi = SOAP::WSDLDriverFactory.new(wsdl).create_rpc_driver
-token = clsi.getToken
-
-print "Sending compile request...\n"
-response = clsi.compile(<<-EOS
- <compile>
- <token>#{token}</token>
- <resources>
- <resource path='main.tex'>#{File.read(filename)}</resource>
- <resource path='*' url='http://localhost:2000/%path%' />
- </resources>
- </compile>
-EOS
-)
-
-# Shutdown resources server
-#Process.kill('INT', pid)
-
-# Parse response
-parser = REXML::Document.new response
-
-status = parser.elements['compile'].elements['status'].text
-print "Compile status: #{status}\n"
-
-unless parser.elements['compile'].elements['output'].nil?
- print "The following files were returned:\n"
- for file in parser.elements['compile'].elements['output'].elements
- print "\t#{file.attributes['url']}\n"
- system("wget #{host}/#{file.attributes['url']}")
- end
-end
-

0 comments on commit 40662df

Please sign in to comment.