Last active
August 29, 2015 13:58
-
-
Save ginkouno/9970679 to your computer and use it in GitHub Desktop.
poi server(?)をdaemonとして起動する
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'bundler/setup' | |
Bundler.require | |
# SpponDaemon can accept options :pid_dir, :name. | |
# Please read ->https://github.com/etaque/spoon_daemon | |
if ["start", "stop", "restart"].index(ARGV[0]) | |
SpoonDaemon::Runner.new('./server.rb', ARGV[0]) | |
else | |
puts "Usage:daemonize.rb [start|stop|restart]" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source "https://rubygems.org" | |
gem "jruby-poi", github: "kameeoze/jruby-poi", require: "poi" | |
gem "spoon_daemon" | |
gem "pry" | |
gem "bundler", require: ['drb/drb', 'stringio'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require "bundler/setup" | |
Bundler.require | |
class Excel | |
def password=(password) | |
org.apache.poi.hssf.record.crypto.Biff8EncryptionKey.setCurrentUserPassword(password) | |
end | |
def workbook(string) | |
POI::Workbook.open(StringIO.new(string, 'r')) | |
end | |
end | |
DRb.start_service("druby://localhost:3999", Excel.new) | |
puts DRb.uri | |
loop do | |
sleep(5) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment