Skip to content

Commit

Permalink
Merge pull request #3 from cre-ne-jp/message-models
Browse files Browse the repository at this point in the history
メッセージの記録と表示
  • Loading branch information
koi-chan committed Aug 28, 2016
2 parents 18a1222 + c47d0be commit 839700e
Show file tree
Hide file tree
Showing 89 changed files with 2,886 additions and 216 deletions.
14 changes: 2 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,16 @@
sudo: false
language: ruby
cache: bundler
bundler_args: "--deployment --without development"
rvm:
- 2.1.10
- 2.2.3
- 2.2.5
- 2.3.0
- 2.3.1
services:
- mysql
before_script:
- cp config/database.yml.travis config/database.yml
- mysql -u root -e 'create database IF NOT EXISTS logarchiver_test;'
script:
- bundle exec rake --trace db:create
- bundle exec rake --trace db:migrate
- bundle exec rake test
- mysql -e 'CREATE DATABASE IF NOT EXISTS log_archiver_test;'
notifications:
irc:
use_notice: true
channels:
channels:
- 'irc.trpg.net#irc_test'
on_success: always
on_failure: always
Expand Down
22 changes: 18 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,18 @@ gem 'coffee-rails', '~> 4.1.0'
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
#gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc

gem 'pry-rails'
# デザイン
gem 'bootstrap-sass'
gem 'font-awesome-rails'

# SEO
gem 'meta-tags'

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
Expand All @@ -38,19 +43,28 @@ gem 'pry-rails'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

gem "simple_calendar", "~> 2.0"

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'

gem 'factory_girl_rails'
gem 'minitest-reporters'

gem 'guard'
gem 'guard-minitest'

gem 'coveralls', require: false
end

group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'

# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
#gem 'spring'
end
gem 'spring'

# コンソールとして pry を使う
gem 'pry-rails'
end
71 changes: 65 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,13 @@ GEM
tzinfo (~> 1.1)
ansi (1.5.0)
arel (6.0.3)
autoprefixer-rails (6.4.0.3)
execjs
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
bootstrap-sass (3.3.7)
autoprefixer-rails (>= 5.2.1)
sass (>= 3.3.4)
builder (3.2.2)
byebug (9.0.5)
cinch (2.3.2)
Expand All @@ -52,30 +57,60 @@ GEM
execjs
coffee-script-source (1.10.0)
concurrent-ruby (1.0.2)
coveralls (0.8.15)
json (>= 1.8, < 3)
simplecov (~> 0.12.0)
term-ansicolor (~> 1.3)
thor (~> 0.19.1)
tins (>= 1.6.0, < 2)
debug_inspector (0.0.2)
docile (1.1.5)
erubis (2.7.0)
execjs (2.7.0)
factory_girl (4.7.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.7.0)
factory_girl (~> 4.7.0)
railties (>= 3.0.0)
ffi (1.9.14)
font-awesome-rails (4.6.3.1)
railties (>= 3.2, < 5.1)
formatador (0.2.5)
globalid (0.3.7)
activesupport (>= 4.1.0)
guard (2.14.0)
formatador (>= 0.2.4)
listen (>= 2.7, < 4.0)
lumberjack (~> 1.0)
nenv (~> 0.1)
notiffany (~> 0.0)
pry (>= 0.9.12)
shellany (~> 0.0)
thor (>= 0.18.1)
guard-compat (1.2.1)
guard-minitest (2.4.6)
guard-compat (~> 1.2)
minitest (>= 3.0)
i18n (0.7.0)
jbuilder (2.6.0)
activesupport (>= 3.0.0, < 5.1)
multi_json (~> 1.2)
jquery-rails (4.1.1)
jquery-rails (4.2.1)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (1.8.3)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
ruby_dep (~> 1.2)
loofah (2.0.3)
nokogiri (>= 1.5.9)
lumberjack (1.0.10)
mail (2.6.4)
mime-types (>= 1.16, < 4)
meta-tags (2.2.0)
actionpack (>= 3.2.0)
method_source (0.8.2)
mime-types (3.1)
mime-types-data (~> 3.2015)
Expand All @@ -89,9 +124,13 @@ GEM
ruby-progressbar
multi_json (1.12.1)
mysql2 (0.4.4)
nenv (0.3.0)
nokogiri (1.6.8)
mini_portile2 (~> 2.1.0)
pkg-config (~> 1.1.7)
notiffany (0.1.1)
nenv (~> 0.1)
shellany (~> 0.0)
pkg-config (1.1.7)
pry (0.10.4)
coderay (~> 1.1.0)
Expand Down Expand Up @@ -127,9 +166,13 @@ GEM
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (11.2.2)
rb-fsevent (0.9.7)
rb-inotify (0.9.7)
ffi (>= 0.5.0)
rdoc (4.2.2)
json (~> 1.4)
ruby-progressbar (1.8.1)
ruby_dep (1.4.0)
sass (3.4.22)
sass-rails (5.0.6)
railties (>= 4.0.0, < 6)
Expand All @@ -140,7 +183,16 @@ GEM
sdoc (0.4.1)
json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0)
shellany (0.0.1)
simple_calendar (2.1.5)
rails (>= 3.0)
simplecov (0.12.0)
docile (~> 1.1.0)
json (>= 1.8, < 3)
simplecov-html (~> 0.10.0)
simplecov-html (0.10.0)
slop (3.6.0)
spring (1.7.2)
sprockets (3.7.0)
concurrent-ruby (~> 1.0)
rack (> 1, < 3)
Expand All @@ -149,15 +201,15 @@ GEM
activesupport (>= 4.0)
sprockets (>= 3.0.0)
sysexits (1.2.0)
term-ansicolor (1.3.2)
tins (~> 1.0)
thor (0.19.1)
thread_safe (0.3.5)
tilt (2.0.5)
turbolinks (5.0.1)
turbolinks-source (~> 5)
turbolinks-source (5.0.0)
tins (1.12.0)
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (3.0.1)
uglifier (3.0.2)
execjs (>= 0.3.0, < 3)
web-console (2.3.0)
activemodel (>= 4.0)
Expand All @@ -169,21 +221,28 @@ PLATFORMS
ruby

DEPENDENCIES
bootstrap-sass
byebug
cinch
coffee-rails (~> 4.1.0)
coveralls
factory_girl_rails
font-awesome-rails
guard
guard-minitest
jbuilder (~> 2.0)
jquery-rails
lumberjack
meta-tags
minitest-reporters
mysql2 (>= 0.3.13, < 0.5)
pry-rails
rails (= 4.2.6)
sass-rails (~> 5.0)
sdoc (~> 0.4.0)
simple_calendar (~> 2.0)
spring
sysexits
turbolinks
uglifier (>= 1.3.0)
web-console (~> 2.0)

Expand Down
56 changes: 56 additions & 0 deletions Guardfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# vim: filetype=ruby

guard :minitest, spring: true, all_on_start: false do
watch(%r{^test/(.*)/?(.*)_test\.rb$})
watch('test/test_helper.rb') { 'test' }
watch('config/routes.rb') { integration_tests }
watch(%r{^app/models/(.*?)\.rb$}) do |matches|
"test/models/#{matches[1]}_test.rb"
end
watch(%r{^app/controllers/(.*?)_controller\.rb$}) do |matches|
resource_tests(matches[1])
end
watch(%r{^app/views/([^/]*?)/.*\.html\.erb$}) do |matches|
["test/controllers/#{matches[1]}_controller_test.rb"] +
integration_tests(matches[1])
end
watch(%r{^app/helpers/(.*?)_helper\.rb$}) do |matches|
integration_tests(matches[1])
end
watch('app/views/layouts/application.html.erb') do
'test/integration/site_layout_test.rb'
end
watch('app/helpers/sessions_helper.rb') do
integration_tests << 'test/helpers/sessions_helper_test.rb'
end
watch('app/controllers/sessions_controller.rb') do
['test/controllers/sessions_controller_test.rb',
'test/integration/users_login_test.rb']
end
watch('app/controllers/account_activations_controller.rb') do
'test/integration/users_signup_test.rb'
end
watch(%r{app/views/users/*}) do
resource_tests('users') +
['test/integration/microposts_interface_test.rb']
end
end

# Returns the integration tests corresponding to the given resource.
def integration_tests(resource = :all)
if resource == :all
Dir["test/integration/*"]
else
Dir["test/integration/#{resource}_*.rb"]
end
end

# Returns the controller tests corresponding to the given resource.
def controller_test(resource)
"test/controllers/#{resource}_controller_test.rb"
end

# Returns all tests for the given resource.
def resource_tests(resource)
integration_tests(resource) << controller_test(resource)
end
22 changes: 6 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
# Log Archiver

[![Build Status](https://travis-ci.org/cre-ne-jp/log-archiver.svg?branch=master)](https://travis-ci.org/cre-ne-jp/log-archiver)
[![Coverage Status](https://coveralls.io/repos/github/cre-ne-jp/log-archiver/badge.svg?branch=master)](https://coveralls.io/github/cre-ne-jp/log-archiver?branch=master)

IRC ボットを常駐させることでチャットログをチャンネル単位で RDBMS に直接記録し、Rails アプリケーションにより記録されたログを整形・表示します。


## 動作環境

* Linux または MacOSX
* 現在のところ Windows には未対応。
* Ruby 2.1.0 以降
* Linux または OSX
* Ruby 2.3.0 以降
* MySQL または MariaDB


# インストール

[MySQL](https://www-jp.mysql.com/) もしくは [MariaDB](https://mariadb.org/) をインストールしていない場合はインストールしてください。
Expand All @@ -27,8 +25,7 @@ gem install bundler

上記が完了したら、適当なディレクトリにファイルを設置し、以下を実行して必要な gem(ライブラリ)をインストールしてください。

なお、gem をインストールするためには、システムにいくつかのライブラリと開発環境がインストールされている必要があります。
CentOS 7 を最小限構成でセットアップしている場合、以下の追加パッケージが必要です。
なお、gem をインストールするためには、システムにいくつかのライブラリと開発環境がインストールされている必要があります。CentOS 7 を最小限構成でセットアップしている場合、以下の追加パッケージが必要です。

* make
* gcc
Expand All @@ -37,18 +34,12 @@ CentOS 7 を最小限構成でセットアップしている場合、以下の
* zlib-devel
* mariadb-devel

```bash
cd /path/to/log-archiver
```


## 設定

* [IRC の接続設定](doc/irc.md)
* [データベースの接続設定](doc/database.md)
* [ウェブサーバの設定](doc/nginx.md)


## IRC ボットの起動

IRC ボットを起動するには、以下を実行してください。Ctrl + C を押すと終了します。
Expand All @@ -67,13 +58,11 @@ bin/ircbot -c test # /path/to/log-archiver/config/test.yaml を使用する場

systemd による制御を行なう場合は [systemd](doc/systemd.md) を参照してください。


## 出力部の起動

出力部は Rails アプリケーションとして実装されています。

単体で起動させることもできますが、[Apache]()[nginx]() からのリバースプロキシ設定を行なうことをお勧めします。

単体で起動させることもできますが、Apache や nginx からのリバースプロキシ設定を行なうことをお勧めします。

## 連絡先

Expand All @@ -91,3 +80,4 @@ systemd による制御を行なう場合は [systemd](doc/systemd.md) を参照

* 鯉([@koi-chan](https://github.com/koi-chan)
* ocha([@ochaochaocha3](https://github.com/ochaochaocha3)
* らぁ([@raa0121](https://github.com/raa0121)
3 changes: 1 addition & 2 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,4 @@
//
//= require jquery
//= require jquery_ujs
//= require turbolinks
//= require_tree .
//= require bootstrap-sprockets
3 changes: 0 additions & 3 deletions app/assets/javascripts/channels.coffee

This file was deleted.

Loading

0 comments on commit 839700e

Please sign in to comment.