diff options
-rw-r--r-- | core/addon/bugreport.rb | 19 | ||||
-rw-r--r-- | core/config.rb | 4 | ||||
-rw-r--r-- | core/environment.rb | 1 | ||||
-rw-r--r-- | mikutter.rb | 12 |
4 files changed, 25 insertions, 11 deletions
diff --git a/core/addon/bugreport.rb b/core/addon/bugreport.rb index 257a72e1..984b59a9 100644 --- a/core/addon/bugreport.rb +++ b/core/addon/bugreport.rb @@ -9,7 +9,7 @@ class Addon::Bugreport < Addon::Addon include Addon::SettingUtils def onboot(watch) - if File.size? File.join(Environment::TMPDIR, 'mikutter_error') + if File.size? File.expand_path(File.join(Environment::TMPDIR, 'mikutter_error')) popup end end @@ -70,15 +70,24 @@ class Addon::Bugreport < Addon::Addon def send Thread.new{ - Net::HTTP.start('mikutter.d.hachune.net'){ |http| + Net::HTTP.start('192.168.0.129'){ |http| param = encode_parameters({ 'backtrace' => backtrace, + 'svn' => revision, + 'ruby_version' => RUBY_VERSION, + 'platform' => RUBY_PLATFORM, 'url' => 'bugreport', 'version' => Environment::VERSION }) - http.post('/', param) } - File.delete(File.join(Environment::TMPDIR, 'mikutter_error')) } end + http.post('/mikutter.d.hachune.net/', param) } + File.delete(File.expand_path(File.join(Environment::TMPDIR, 'mikutter_error'))) } end + + def revision + begin + open('|env LANG=C svn info').read.match(/Revision\s*:\s*(\d+)/)[1] + rescue + '' end end def backtrace - file_get_contents(File.join(Environment::TMPDIR, 'mikutter_error')) + file_get_contents(File.expand_path(File.join(Environment::TMPDIR, 'mikutter_error'))) end def encode_parameters(params, delimiter = '&', quote = nil) diff --git a/core/config.rb b/core/config.rb index b00af38a..45b7116a 100644 --- a/core/config.rb +++ b/core/config.rb @@ -4,6 +4,7 @@ # # アプリケーションごとの設定たち +# mikutterの設定 module Config # このアプリケーションの名前。 @@ -19,7 +20,7 @@ module Config CONFROOT = "~#{File::SEPARATOR}.mikutter#{File::SEPARATOR}" # 一時ディレクトリ - TMPDIR = "#{File::SEPARATOR}tmp#{File::SEPARATOR}" + TMPDIR = "~#{File::SEPARATOR}.mikutter#{File::SEPARATOR}tmp#{File::SEPARATOR}" # ログディレクトリ LOGDIR = "~#{File::SEPARATOR}.mikutter#{File::SEPARATOR}log#{File::SEPARATOR}" @@ -34,3 +35,4 @@ module Config VERSION = [0,0,1,0] end + diff --git a/core/environment.rb b/core/environment.rb index 4b8469ac..41614b44 100644 --- a/core/environment.rb +++ b/core/environment.rb @@ -5,6 +5,7 @@ # 変更不能な設定たち # コアで変更されるもの +# CHIの設定 miquire :core, 'config' diff --git a/mikutter.rb b/mikutter.rb index a15a1ef9..a5dddeef 100644 --- a/mikutter.rb +++ b/mikutter.rb @@ -13,6 +13,7 @@ miquire :core, 'delayer' require 'benchmark' require 'webrick' # require to daemon require 'thread' +require 'fileutils' Thread.abort_on_exception = true @@ -146,19 +147,20 @@ def gen_xml(msg) return xml end -errfile = File.join(Environment::TMPDIR, 'mikutter_dump') +FileUtils.mkdir_p(File.expand_path(Environment::TMPDIR)) + +errfile = File.join(File.expand_path(Environment::TMPDIR), 'mikutter_dump') if File.exist?(errfile) - File.rename(errfile, File.join(Environment::TMPDIR, 'mikutter_error')) + File.rename(errfile, File.expand_path(File.join(Environment::TMPDIR, 'mikutter_error'))) end argument_parser() begin - errlog = File.open(errfile, 'w') - $stderr = errlog if not $debug + $stderr = File.open(errfile, 'w') if not $debug boot() errlog.close File.delete(errfile) ensure - errlog.close if errlog.closed? + # $stderr.close if errlog.closed? end |