kentaroi-okayu 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -7,18 +7,17 @@ Github: http://github.com/kentaroi/okayu/tree/master
7
7
 
8
8
  == Installing
9
9
  Linux:
10
- # Install packagies for sqlite3
11
- # if you use Debian:
10
+ # まず、sqlite3を入れてください。
11
+ # たとえば、Debian/Ubuntuの場合は、以下のようにします。
12
12
  sudo aptitude install sqlite3 libsqlite3-dev libsqlite3-ruby1.8
13
13
 
14
- # Install the gem
14
+ # おかゆのgemを入れます。
15
15
  sudo gem install kentaroi-okayu --source http://gems.github.com
16
16
 
17
17
  Windows:
18
- http://www.sqlite.org/download.html
19
- 上記サイトから、SQLiteのDLLをダウンロード
18
+ http://www.sqlite.org/download.html から、SQLiteのDLLをダウンロードします。
20
19
 
21
- # Install the gem
20
+ # Ruby及びRubygemsをインストールしている場合は、gemを入れれば完了です。
22
21
  gem install kentaroi-okayu --source http://gems.github.com
23
22
 
24
23
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.4
1
+ 0.0.5
data/lib/app_dir.rb CHANGED
@@ -1,28 +1,14 @@
1
1
  require 'rubygems'
2
- require 'facter'
3
2
 
4
3
  module Okayu
5
- # for some windows environment
6
- ENV['HOME'] = ENV['HOMEPATH'].gsub(/\\/, '/') unless ENV['HOME']
7
4
 
8
5
  class AppDir
9
- if Facter.value(:kernel) == 'Linux'
10
- if File.exist?(@@app_dir = ENV['HOME'] + '/.okayu')
11
- else
12
- Dir.mkdir(@@app_dir)
13
- end
14
- elsif Facter.value(:kernel) == 'windows'
15
- if Facter.value(:operatingsystemrelease).slice(/^\d*/).to_i < 6 # Before Vista
16
- if File.exist?(@@app_dir = ENV['HOME'] + '/Local Settings/Application Data/okayu')
17
- else
18
- Dir.mkdir(@@app_dir)
19
- end
20
- else # From Vista
21
- if File.exist?(@@app_dir = ENV['HOME'] + '/AppData/Local/okayu')
22
- else
23
- Dir.mkdir(@@app_dir)
24
- end
25
- end
6
+ if OS == 'Linux'
7
+ @@app_dir = HOME_PATH + '/.okayu'
8
+ Dir.mkdir(@@app_dir) unless File.exist?(@@app_dir)
9
+ elsif OS == 'Windows'
10
+ @@app_dir = LOCALAPPDATA_PATH + '/okayu'
11
+ Dir.mkdir unless File.exist?(@@app_dir)
26
12
  end
27
13
 
28
14
  def self.to_s
data/lib/client.rb CHANGED
@@ -159,8 +159,10 @@ module Okayu
159
159
 
160
160
  def comments
161
161
  comments = []
162
- until @channel.queue.empty?
162
+ counter = 0
163
+ until @channel.queue.empty? || counter > 5
163
164
  comments << @channel.queue.deq
165
+ counter += 1
164
166
  end
165
167
  comments.map{|comment| comment_hash_from_xml(comment)}
166
168
  end
data/lib/constants.rb ADDED
@@ -0,0 +1,27 @@
1
+ require 'rbconfig'
2
+
3
+ # Facter don't work in exe which is generated with ocra.
4
+ #
5
+ module Okayu
6
+ if ENV['OS'] =~ /Windows/i || Config::CONFIG['host_os'] =~ /mswin/i
7
+ OS = 'Windows'
8
+ HOME_PATH = (ENV['HOME'] || ENV['HOMEPATH']).gsub(/\\/, '/')
9
+ APPDATA_PATH = ENV['APPDATA'].gsub(/\\/, '/')
10
+ LOCALAPPDATA_PATH = (ENV['LOCALAPPDATA'] || ENV['TMP'].sub(/Temp$/,'Application Data')).gsub(/\\/, '/')
11
+ TMP_INET_FILES_PATH = ENV['TMP'].sub(/Temp$/, 'Temporary Internet Files').gsub(/\\/, '/')
12
+ elsif `uname -s 2>/dev/null`.chomp == 'Linux'
13
+ OS = 'Linux'
14
+ HOME_PATH = ENV['HOME']
15
+ else
16
+ OS = 'Linux' # This should be replaced when we got other platform information.
17
+ HOME_PATH = ENV['HOME']
18
+ end
19
+
20
+ if File.exist?("#{ENV['HOME']}/Local Settings")
21
+ BEFORE_VISTA = true
22
+ FROM_VISTA = false
23
+ elsif File.exist?("#{ENV['HOME']}/AppData")
24
+ BEFORE_VISTA = false
25
+ FROM_VISTA = true
26
+ end
27
+ end
data/lib/cookie_thief.rb CHANGED
@@ -82,17 +82,13 @@ module Okayu
82
82
 
83
83
  def cookie_filenames host
84
84
  cookie_filename = []
85
- case Facter.value(:kernel)
86
- when 'windows'
87
- if Facter.value(:operatingsystemrelease).to_i < 6 # before Vista
88
- unless cookie_filenames = Dir.glob("#{ENV['HOME']}/Application Data/Microsoft/Windows/Cookies/Low/*").select{|path| path =~ /#{host_main_str(host)}/}
89
- cookie_filenames = Dir.glob("#{ENV['HOME']}/../Administrator/Application Data/Microsoft/Windows/Cookies/Low/*").select{|path| path =~ /#{host_main_str(host)}/}
90
-
91
- end
92
- else # from Vista
93
- cookie_filenames = Dir.glob("#{ENV['HOME']}/AppData/Roaming/Microsoft/Windows/Cookies/Low/*").select{|path| path =~ /#{host_main_str(host)}/}
85
+ if OS == 'Windows'
86
+ cookie_filenames = Dir.glob("#{APPDATA_PATH}/Microsoft/Windows/Cookies/Low/*").select{|path| path =~ /#{host_main_str(host)}/}
87
+ if cookie_filenames == []
88
+ cookie_filename = Dir.glob("#{TMP_INET_FILES_PATH}/*").select{|path| path =~ /#{host_main_str(host)}/}
94
89
  end
95
90
  end
91
+
96
92
  cookie_filenames
97
93
  end
98
94
 
@@ -112,27 +108,17 @@ module Okayu
112
108
 
113
109
  def cookies_filename
114
110
  cookies_filename = nil
115
- case Facter.value(:kernel)
111
+ case OS
116
112
  when 'Linux'
117
113
  if dir = Dir.glob("#{ENV['HOME']}/.mozilla/firefox/*").select{|path| path =~ /.*\.default$/}.first
118
114
  if File.exist?("#{dir}/cookies.sqlite")
119
115
  cookies_filename = "#{dir}/cookies.sqlite"
120
116
  end
121
117
  end
122
- when 'windows'
123
- if Facter.value(:operatingsystemrelease).to_i < 6 # before Vista
124
- unless dir = Dir.glob("#{ENV['HOME']}/Application Data/Mozilla/Firefox/Profiles/*").select{|path| path =~ /.*\.default$/}.first
125
- dir = Dir.glob("#{ENV['HOME']}/../Administrator/Application Data/Mozilla/Firefox/Profiles/*").select{|path| path =~ /.*\.default$/}.first
126
- end
127
- if dir && File.exist?("#{dir}/cookies.sqlite")
128
- cookies_filename = "#{dir}/cookies.sqlite"
129
- end
130
- else # from Vista
131
- if dir = Dir.glob("#{ENV['HOME']}/AppData/Roaming/Mozilla/Firefox/Profiles/*").select{|path| path =~ /.*\.default$/}.first
132
- if File.exist?("#{dir}/cookies.sqlite")
133
- cookies_filename = "#{dir}/cookies.sqlite"
134
- end
135
- end
118
+ when 'Windows'
119
+ dir = Dir.glob("#{APPDATA_PATH}/Mozilla/Firefox/Profiles/*").select{|path| path =~ /.*\.default$/}.first
120
+ if dir && File.exist?("#{dir}/cookies.sqlite")
121
+ cookies_filename = "#{dir}/cookies.sqlite"
136
122
  end
137
123
  end
138
124
  cookies_filename
@@ -144,18 +130,10 @@ module Okayu
144
130
  class << self
145
131
  def cookies_filename
146
132
  cookies_filename = nil
147
- case Facter.value(:kernel)
148
- when 'windows'
149
- if Facter.value(:operatingsystemrelease).to_i < 6 # before Vista
150
- if File.exist?(filename = "#{ENV['HOME']}/LocalApplication Data/Google/Chrome/User Data/Default/Cookies")
151
- cookies_filename = filename
152
- elsif File.exist?(filename = "#{ENV['HOME']}/../Administrator/LocalApplication Data/Google/Chrome/User Data/Default/Cookies")
153
- cookies_filename = filename
154
- end
155
- else # from Vista
156
- if File.exist?(filename = "#{ENV['HOME']}/AppData/Local/Google/Chrome/User Data/Default/Cookies")
157
- cookies_filename = filename
158
- end
133
+ case OS
134
+ when 'Windows'
135
+ if File.exist?(filename = "#{LOCALAPPDATA_PATH}/Google/Chrome/User Data/Default/Cookies")
136
+ cookies_filename = filename
159
137
  end
160
138
  end
161
139
  cookies_filename
@@ -0,0 +1,9 @@
1
+ # This is the dummy definition for ocra
2
+ module ActiveRecord::ActionController
3
+ module Session
4
+ class AbstractStore
5
+ end
6
+ end
7
+ end
8
+
9
+
data/lib/okayu.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require 'constants.rb'
1
2
  require 'app_dir.rb'
2
3
  require 'user_info.rb'
3
4
  require 'cookie_thief.rb'
@@ -8,3 +9,4 @@ require 'controllers.rb'
8
9
  require 'client.rb'
9
10
  require 'app.rb'
10
11
 
12
+ require 'for_windows.rb'
data/okayu.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{okayu}
8
- s.version = "0.0.4"
8
+ s.version = "0.0.5"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kentaro Imai"]
12
- s.date = %q{2009-09-19}
12
+ s.date = %q{2009-09-21}
13
13
  s.default_executable = %q{okayu}
14
14
  s.description = %q{A comment viewer for http://live.nicovideo.jp/}
15
15
  s.email = %q{kentaroi@gmail.com}
@@ -29,6 +29,7 @@ Gem::Specification.new do |s|
29
29
  "lib/app.rb",
30
30
  "lib/app_dir.rb",
31
31
  "lib/client.rb",
32
+ "lib/constants.rb",
32
33
  "lib/controllers.rb",
33
34
  "lib/controllers/live_controller.rb",
34
35
  "lib/cookie_thief.rb",
@@ -39,6 +40,7 @@ Gem::Specification.new do |s|
39
40
  "lib/db/migrate/004_create_communities.rb",
40
41
  "lib/db/migrate/005_create_listeners_programs.rb",
41
42
  "lib/db/migrate/006_create_programs_visitors.rb",
43
+ "lib/for_windows.rb",
42
44
  "lib/models.rb",
43
45
  "lib/models/comment.rb",
44
46
  "lib/models/community.rb",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kentaroi-okayu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kentaro Imai
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-19 00:00:00 -07:00
12
+ date: 2009-09-21 00:00:00 -07:00
13
13
  default_executable: okayu
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -112,6 +112,7 @@ files:
112
112
  - lib/app.rb
113
113
  - lib/app_dir.rb
114
114
  - lib/client.rb
115
+ - lib/constants.rb
115
116
  - lib/controllers.rb
116
117
  - lib/controllers/live_controller.rb
117
118
  - lib/cookie_thief.rb
@@ -122,6 +123,7 @@ files:
122
123
  - lib/db/migrate/004_create_communities.rb
123
124
  - lib/db/migrate/005_create_listeners_programs.rb
124
125
  - lib/db/migrate/006_create_programs_visitors.rb
126
+ - lib/for_windows.rb
125
127
  - lib/models.rb
126
128
  - lib/models/comment.rb
127
129
  - lib/models/community.rb