kentaroi-okayu 0.0.5 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +1 -1
- data/VERSION +1 -1
- data/lib/app.rb +2 -1
- data/lib/app_dir.rb +1 -1
- data/lib/controllers/live_controller.rb +10 -6
- data/lib/models.rb +20 -10
- data/okayu.gemspec +2 -2
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -15,7 +15,7 @@ Linux:
|
|
15
15
|
sudo gem install kentaroi-okayu --source http://gems.github.com
|
16
16
|
|
17
17
|
Windows:
|
18
|
-
http://www.sqlite.org/download.html
|
18
|
+
http://www.sqlite.org/download.html から、SQLiteのDLLをダウンロードします。
|
19
19
|
|
20
20
|
# Ruby及びRubygemsをインストールしている場合は、gemを入れれば完了です。
|
21
21
|
gem install kentaroi-okayu --source http://gems.github.com
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.7
|
data/lib/app.rb
CHANGED
data/lib/app_dir.rb
CHANGED
@@ -62,13 +62,16 @@ module Okayu
|
|
62
62
|
comment = Comment.new(comment_hash)
|
63
63
|
comment.community = @community
|
64
64
|
comment.program = @program
|
65
|
-
if comment_hash[:user_id]
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
comment.create_visitor(:user_id => comment_hash[:user_id])
|
70
|
-
end
|
65
|
+
if visitor = Visitor.find(:first, :conditions => {:user_id => comment_hash[:user_id]})
|
66
|
+
comment.visitor = visitor
|
67
|
+
else
|
68
|
+
comment.create_visitor(:user_id => comment_hash[:user_id])
|
71
69
|
end
|
70
|
+
if hash[:command]
|
71
|
+
if comment[:message] == '/disconnect'
|
72
|
+
close
|
73
|
+
end
|
74
|
+
end
|
72
75
|
comment.save
|
73
76
|
comment
|
74
77
|
end
|
@@ -80,6 +83,7 @@ module Okayu
|
|
80
83
|
|
81
84
|
def close
|
82
85
|
if @live_now && @client
|
86
|
+
@live_now = false
|
83
87
|
@client.close
|
84
88
|
end
|
85
89
|
end
|
data/lib/models.rb
CHANGED
@@ -8,16 +8,26 @@ require 'models/visitor.rb'
|
|
8
8
|
require 'models/comment.rb'
|
9
9
|
|
10
10
|
module Okayu
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
11
|
+
class AR
|
12
|
+
def self.connect
|
13
|
+
ActiveRecord::Base.establish_connection(:adapter => 'sqlite3',
|
14
|
+
:database => "#{AppDir}/data.sqlite3",
|
15
|
+
:pool => 5,
|
16
|
+
:timeout => 5000)
|
16
17
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
Dir.mkdir("#{AppDir}/log") unless File.exist? "#{AppDir}/log"
|
19
|
+
ActiveRecord::Base.logger = Logger.new(File.open("#{AppDir}/log/database.log", 'a'))
|
20
|
+
ActiveRecord::Base.logger.level = Logger::ERROR
|
21
|
+
dir = File.dirname(File.expand_path(__FILE__))
|
22
|
+
ActiveRecord::Migrator.migrate("#{dir}/db/migrate")
|
23
|
+
end
|
24
|
+
|
25
|
+
def self.remove_irregular_data
|
26
|
+
comments = Comment.find :all, :conditions => {:user_id => nil}
|
27
|
+
comments.each do |comment|
|
28
|
+
comment.destroy
|
29
|
+
end
|
30
|
+
end
|
22
31
|
end
|
32
|
+
|
23
33
|
end
|
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.
|
8
|
+
s.version = "0.0.7"
|
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-
|
12
|
+
s.date = %q{2009-09-22}
|
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}
|
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
|
+
version: 0.0.7
|
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-
|
12
|
+
date: 2009-09-22 00:00:00 -07:00
|
13
13
|
default_executable: okayu
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|