Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

* Fix #1

* Increase worker
  • Loading branch information...
commit 11d5c2683fe0f296280fa4b717db92b1d358d704 1 parent 4ba0b50
@rhenium rhenium authored
Showing with 551 additions and 829 deletions.
  1. +19 −17 .gitignore
  2. +0 −1  Gemfile
  3. +25 −0 Gemfile
  4. +0 −1  Gemfile.lock
  5. +174 −0 Gemfile.lock
  6. +37 −0 README.md
  7. 0  {web → }/Rakefile
  8. BIN  app/assets/images/bird_gray_16.png
  9. 0  {web → }/app/assets/images/rails.png
  10. 0  {web → }/app/assets/javascripts/application.js
  11. +3 −0  app/assets/javascripts/errors.js.coffee
  12. 0  {web → }/app/assets/javascripts/i.js.coffee
  13. 0  {web → }/app/assets/javascripts/main.js.coffee
  14. 0  {web → }/app/assets/javascripts/sessions.js.coffee
  15. 0  {web → }/app/assets/javascripts/users.js.coffee
  16. +9 −1 {web → }/app/assets/stylesheets/_tweets.css.sass
  17. +4 −1 {web → }/app/assets/stylesheets/application.css.sass
  18. +3 −0  app/assets/stylesheets/errors.css.scss
  19. +6 −4 {web → }/app/controllers/application_controller.rb
  20. +7 −0 app/controllers/errors_controller.rb
  21. +8 −0 app/controllers/i_controller.rb
  22. 0  {web → }/app/controllers/main_controller.rb
  23. 0  {web → }/app/controllers/sessions_controller.rb
  24. +13 −19 {web → }/app/controllers/users_controller.rb
  25. +8 −4 {web → }/app/helpers/application_helper.rb
  26. +2 −0  app/helpers/errors_helper.rb
  27. 0  {web → }/app/helpers/i_helper.rb
  28. 0  {web → }/app/helpers/main_helper.rb
  29. 0  {web → }/app/helpers/sessions_helper.rb
  30. 0  {web → }/app/helpers/users_helper.rb
  31. 0  {web → }/app/models/account.rb
  32. 0  {web → }/app/models/favorite.rb
  33. 0  {web → }/app/models/retweet.rb
  34. 0  {web → }/app/models/tweet.rb
  35. 0  {web → }/app/models/user.rb
  36. +1 −0  app/views/errors/error_404.html.haml
  37. +1 −0  app/views/errors/error_500.html.haml
  38. +2 −2 {web → }/app/views/i/show.haml
  39. 0  {web → }/app/views/layouts/application.haml
  40. +23 −0 app/views/main/index.haml
  41. +8 −8 {web → }/app/views/shared/_tweet.haml
  42. +2 −2 {web → }/app/views/shared/_tweets.haml
  43. 0  {web → }/app/views/users/best.haml
  44. 0  {web → }/app/views/users/info.haml
  45. 0  web/app/views/users/timeline.haml → app/views/users/my.haml
  46. 0  {web → }/app/views/users/recent.haml
  47. +1 −0  app/views/users/timeline.haml
  48. 0  {web → }/config.ru
  49. 0  {web → }/config/application.rb
  50. 0  {web → }/config/boot.rb
  51. +16 −0 config/database.yml
  52. 0  {web → }/config/environment.rb
  53. 0  {web → }/config/environments/development.rb
  54. +1 −1  {web → }/config/environments/production.rb
  55. 0  {web → }/config/environments/test.rb
  56. 0  {web → }/config/initializers/backtrace_silencers.rb
  57. 0  {web → }/config/initializers/filter_parameter_logging.rb
  58. 0  {web → }/config/initializers/haml.rb
  59. 0  {web → }/config/initializers/inflections.rb
  60. +1 −6 {web → }/config/initializers/mime_types.rb
  61. 0  {web → }/config/initializers/omniauth.rb
  62. 0  {web → }/config/initializers/rails_config.rb
  63. 0  {web → }/config/initializers/secret_token.rb
  64. 0  {web → }/config/initializers/session_store.rb
  65. 0  {web → }/config/initializers/wrap_parameters.rb
  66. 0  {web → }/config/locales/en.yml
  67. +21 −0 config/routes.rb
  68. +12 −0 config/settings.yml
  69. 0  {web → }/config/settings/development.yml
  70. 0  {web → }/config/settings/production.yml
  71. 0  {web → }/config/settings/test.yml
  72. 0  {web → }/db/migrate/20130225123010_create_accounts.rb
  73. 0  {web → }/db/migrate/20130226145932_create_users.rb
  74. 0  {web → }/db/migrate/20130226150329_create_tweets.rb
  75. 0  {web → }/db/migrate/20130226150829_create_favorites.rb
  76. 0  {web → }/db/migrate/20130226151042_create_retweets.rb
  77. 0  {web → }/db/schema.rb
  78. 0  {web → }/db/seeds.rb
  79. +42 −0 lib/receiver/logger.rb
  80. +57 −55 {worker → lib}/receiver/worker.rb
  81. 0  {web → }/public/404.xhtml
  82. 0  {web → }/public/422.xhtml
  83. 0  {web → }/public/500.xhtml
  84. +16 −4 ...-862b4db892f94edcb21b7275b0a049b0.css → public/assets/application-37cb32f627581ac8bac91345987e7f10.css
  85. BIN  public/assets/application-37cb32f627581ac8bac91345987e7f10.css.gz
  86. +5 −0 ...on-1b8e9e39ac5613519703a2e42949522a.js → public/assets/application-47a9a60feaec5625a9c66b1c985a1179.js
  87. BIN  ...e9e39ac5613519703a2e42949522a.js.gz → public/assets/application-47a9a60feaec5625a9c66b1c985a1179.js.gz
  88. BIN  public/assets/bird_gray_16-93f51980875017e26744056b62aaac22.png
  89. +1 −0  public/assets/manifest-0b26a376c9cfe81af432b634628ee75d.json
  90. 0  {web → }/public/assets/rails-bc7d436ef8afbf0f88829742a43ba3a4.png
  91. 0  {web → }/public/favicon.ico
  92. 0  {web → }/script/rails
  93. +0 −8 start.rb
  94. +14 −0 test/controllers/errors_controller_test.rb
  95. +4 −0 test/helpers/errors_helper_test.rb
  96. +0 −50 web/Gemfile
  97. +0 −182 web/Gemfile.lock
  98. +0 −261 web/README.rdoc
  99. +0 −7 web/app/controllers/i_controller.rb
  100. 0  web/app/mailers/.gitkeep
  101. 0  web/app/models/.gitkeep
  102. +0 −13 web/app/views/main/index.haml
  103. +0 −2  web/app/views/users/my.haml
  104. +0 −33 web/config/database.yml
  105. +0 −24 web/config/routes.rb
  106. +0 −4 web/config/settings.yml
  107. 0  web/lib/assets/.gitkeep
  108. 0  web/lib/tasks/.gitkeep
  109. 0  web/log/.gitkeep
  110. BIN  web/public/assets/application-862b4db892f94edcb21b7275b0a049b0.css.gz
  111. +0 −84 web/public/assets/application-c11f88ddf5d2294cfc1779fcb0be52cf.css
  112. BIN  web/public/assets/application-c11f88ddf5d2294cfc1779fcb0be52cf.css.gz
  113. +0 −1  web/public/assets/manifest-6b01fb44e2a668d3c0196abd4bdfbb15.json
  114. 0  web/vendor/assets/javascripts/.gitkeep
  115. 0  web/vendor/assets/stylesheets/.gitkeep
  116. 0  web/vendor/plugins/.gitkeep
  117. +5 −0 worker.sh
  118. +0 −6 worker/receiver.rb
  119. +0 −28 worker/receiver/logger.rb
View
36 .gitignore
@@ -1,26 +1,28 @@
-# See http://help.github.com/ignore-files/ for more about ignoring files.
-#
-# If you find yourself ignoring temporary files generated by your text editor
-# or operating system, you probably want to add a global ignore instead:
-# git config --global core.excludesfile ~/.gitignore_global
+# Common
+**.orig
-# Ignore bundler config
-.bundle
+# Linux
+.*
+!.gitignore
+*~
-# Ignore the default SQLite database.
-web/db/*.sqlite3
+# SASS
+*.sass-cache
+*.sassc
-# Ignore all logfiles and tempfiles.
-web/log/*.log
-web/tmp
+# Rails
+*.rbc
+/vendor/bundle
+/log/*
+/tmp/*
+/spec/tmp/*
-web/config/settings.local.yml
-web/config/settings/*.local.yml
-web/config/environments/*.local.yml
-web/config/initializers/secret_token.local.rb
+/config/settings.local.yml
+/config/settings/*.local.yml
+/config/environments/*.local.yml
+/config/initializers/secret_token.local.rb
# dotcloud
/dotcloud.yml
/supervisord.conf
-.dotcloud
View
1  Gemfile
View
25 Gemfile
@@ -0,0 +1,25 @@
+ruby '1.9.3'
+source 'https://rubygems.org'
+
+gem 'rails', '4.0.0.beta1'
+gem 'mysql2'
+
+gem 'unicorn'
+
+gem 'rails_config'
+gem 'will_paginate', :github => 're4k/will_paginate'
+
+group :assets do
+ gem 'sass-rails', '~> 4.0.0.beta1'
+ gem 'coffee-rails', '~> 4.0.0.beta1'
+ gem 'uglifier', '>= 1.0.3'
+end
+
+gem 'therubyracer'
+gem 'haml-rails'
+
+gem 'yajl-ruby', :require => "yajl"
+gem 'omniauth-twitter', :github => "re4k/omniauth-twitter"
+gem 'em-twitter'
+gem 'twitter'
+
View
1  Gemfile.lock
View
174 Gemfile.lock
@@ -0,0 +1,174 @@
+GIT
+ remote: git://github.com/re4k/omniauth-twitter.git
+ revision: 313df7eb05e78477cf3eb06bced3c9b64957840f
+ specs:
+ omniauth-twitter (0.0.14)
+ multi_json (~> 1.3)
+ omniauth-oauth (~> 1.0)
+
+GIT
+ remote: git://github.com/re4k/will_paginate.git
+ revision: fcbbd91ced44aaabb1f369875ee9f4f651bc74fb
+ specs:
+ will_paginate (3.0.4)
+
+GEM
+ remote: https://rubygems.org/
+ specs:
+ actionmailer (4.0.0.beta1)
+ actionpack (= 4.0.0.beta1)
+ mail (~> 2.5.3)
+ actionpack (4.0.0.beta1)
+ activesupport (= 4.0.0.beta1)
+ builder (~> 3.1.0)
+ erubis (~> 2.7.0)
+ rack (~> 1.5.2)
+ rack-test (~> 0.6.2)
+ activemodel (4.0.0.beta1)
+ activesupport (= 4.0.0.beta1)
+ builder (~> 3.1.0)
+ activerecord (4.0.0.beta1)
+ activemodel (= 4.0.0.beta1)
+ activerecord-deprecated_finders (~> 0.0.3)
+ activesupport (= 4.0.0.beta1)
+ arel (~> 4.0.0.beta1)
+ activerecord-deprecated_finders (0.0.3)
+ activesupport (4.0.0.beta1)
+ i18n (~> 0.6.2)
+ minitest (~> 4.2)
+ multi_json (~> 1.3)
+ thread_safe (~> 0.1)
+ tzinfo (~> 0.3.33)
+ arel (4.0.0.beta1)
+ atomic (1.0.1)
+ builder (3.1.4)
+ coffee-rails (4.0.0.beta1)
+ coffee-script (>= 2.2.0)
+ railties (>= 4.0.0.beta, < 5.0)
+ coffee-script (2.2.0)
+ coffee-script-source
+ execjs
+ coffee-script-source (1.6.1)
+ em-twitter (0.2.1)
+ eventmachine (~> 1.0)
+ http_parser.rb (~> 0.5)
+ simple_oauth (~> 0.1)
+ erubis (2.7.0)
+ eventmachine (1.0.1)
+ execjs (1.4.0)
+ multi_json (~> 1.0)
+ faraday (0.8.6)
+ multipart-post (~> 1.1)
+ haml (4.0.0)
+ tilt
+ haml-rails (0.4)
+ actionpack (>= 3.1, < 4.1)
+ activesupport (>= 3.1, < 4.1)
+ haml (>= 3.1, < 4.1)
+ railties (>= 3.1, < 4.1)
+ hashie (1.2.0)
+ hike (1.2.1)
+ http_parser.rb (0.5.3)
+ i18n (0.6.4)
+ json (1.7.7)
+ kgio (2.8.0)
+ libv8 (3.11.8.13)
+ mail (2.5.3)
+ i18n (>= 0.4.0)
+ mime-types (~> 1.16)
+ treetop (~> 1.4.8)
+ mime-types (1.21)
+ minitest (4.6.2)
+ multi_json (1.6.1)
+ multipart-post (1.2.0)
+ mysql2 (0.3.11)
+ oauth (0.4.7)
+ omniauth (1.1.3)
+ hashie (~> 1.2)
+ rack
+ omniauth-oauth (1.0.1)
+ oauth
+ omniauth (~> 1.0)
+ polyglot (0.3.3)
+ rack (1.5.2)
+ rack-test (0.6.2)
+ rack (>= 1.0)
+ rails (4.0.0.beta1)
+ actionmailer (= 4.0.0.beta1)
+ actionpack (= 4.0.0.beta1)
+ activerecord (= 4.0.0.beta1)
+ activesupport (= 4.0.0.beta1)
+ bundler (>= 1.3.0, < 2.0)
+ railties (= 4.0.0.beta1)
+ sprockets-rails (~> 2.0.0.rc3)
+ rails_config (0.3.2)
+ activesupport (>= 3.0)
+ railties (4.0.0.beta1)
+ actionpack (= 4.0.0.beta1)
+ activesupport (= 4.0.0.beta1)
+ rake (>= 0.8.7)
+ rdoc (~> 3.4)
+ thor (>= 0.17.0, < 2.0)
+ raindrops (0.10.0)
+ rake (10.0.3)
+ rdoc (3.12.2)
+ json (~> 1.4)
+ ref (1.0.2)
+ sass (3.2.6)
+ sass-rails (4.0.0.beta1)
+ railties (>= 4.0.0.beta, < 5.0)
+ sass (>= 3.1.10)
+ sprockets-rails (~> 2.0.0.rc0)
+ tilt (~> 1.3)
+ simple_oauth (0.2.0)
+ sprockets (2.9.0)
+ hike (~> 1.2)
+ multi_json (~> 1.0)
+ rack (~> 1.0)
+ tilt (~> 1.1, != 1.3.0)
+ sprockets-rails (2.0.0.rc3)
+ actionpack (>= 3.0)
+ activesupport (>= 3.0)
+ sprockets (~> 2.8)
+ therubyracer (0.11.4)
+ libv8 (~> 3.11.8.12)
+ ref
+ thor (0.17.0)
+ thread_safe (0.1.0)
+ atomic
+ tilt (1.3.4)
+ treetop (1.4.12)
+ polyglot
+ polyglot (>= 0.3.1)
+ twitter (4.5.0)
+ faraday (~> 0.8, < 0.10)
+ multi_json (~> 1.0)
+ simple_oauth (~> 0.2)
+ tzinfo (0.3.36)
+ uglifier (1.3.0)
+ execjs (>= 0.3.0)
+ multi_json (~> 1.0, >= 1.0.2)
+ unicorn (4.6.2)
+ kgio (~> 2.6)
+ rack
+ raindrops (~> 0.7)
+ yajl-ruby (1.1.0)
+
+PLATFORMS
+ ruby
+
+DEPENDENCIES
+ coffee-rails (~> 4.0.0.beta1)
+ em-twitter
+ haml-rails
+ mysql2
+ omniauth-twitter!
+ rails (= 4.0.0.beta1)
+ rails_config
+ sass-rails (~> 4.0.0.beta1)
+ therubyracer
+ twitter
+ uglifier (>= 1.0.3)
+ unicorn
+ will_paginate!
+ yajl-ruby
View
37 README.md
@@ -0,0 +1,37 @@
+# Aclog
+Collects favs and retweets in real time by UserStreams.
+A web service like Favstar.
+
+## Aclog is
+* Powered by Ruby on Rails
+* Free and open source (MIT License)
+
+## Status
+* Working on ![aclog-re4k.dotcloud.com](aclog-re4k.dotcloud.com) for testing.
+
+## Requirements
+* Ruby 1.9.3+
+* MySQL or SQLite
+
+## Installation (dotCloud)
+1.
+
+ git clone https://github.com/re4k/aclog.git
+ bundle
+
+ dotcloud push
+ *~(**)~*
+
+2.
+
+ cp dotcloud.yml.sample dotcloud.yml
+ (Edit)
+
+3.
+
+ cp config/settings.yml.sample config/settings.yml
+ (Edit)
+3.
+
+ (今度書きます..)
+
View
0  web/Rakefile → Rakefile
File renamed without changes
View
BIN  app/assets/images/bird_gray_16.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
0  web/app/assets/images/rails.png → app/assets/images/rails.png
File renamed without changes
View
0  web/app/assets/javascripts/application.js → app/assets/javascripts/application.js
File renamed without changes
View
3  app/assets/javascripts/errors.js.coffee
@@ -0,0 +1,3 @@
+# Place all the behaviors and hooks related to the matching controller here.
+# All this logic will automatically be available in application.js.
+# You can use CoffeeScript in this file: http://coffeescript.org/
View
0  web/app/assets/javascripts/i.js.coffee → app/assets/javascripts/i.js.coffee
File renamed without changes
View
0  web/app/assets/javascripts/main.js.coffee → app/assets/javascripts/main.js.coffee
File renamed without changes
View
0  web/app/assets/javascripts/sessions.js.coffee → app/assets/javascripts/sessions.js.coffee
File renamed without changes
View
0  web/app/assets/javascripts/users.js.coffee → app/assets/javascripts/users.js.coffee
File renamed without changes
View
10 web/app/assets/stylesheets/_tweets.css.sass → app/assets/stylesheets/_tweets.css.sass
@@ -26,11 +26,12 @@
.user
:padding 0 5px 15px
:font-weight bold
- :color #666666
.name
:font-size 14px
.screen_name
:font-size 12px
+ a
+ :color #666666
.text
:font-size 18px
:line-height 25px
@@ -40,6 +41,13 @@
:padding 0 5px 15px
:color #666666
:font-size 12px
+ .twitter_bird
+ :display block
+ :float left
+ img
+ :vertical-align top
+ :margin-right 2px
+ :margin-top 1px
.created_at
:display block
:float left
View
5 web/app/assets/stylesheets/application.css.sass → app/assets/stylesheets/application.css.sass
@@ -3,9 +3,12 @@
*
:margin 0
:padding 0
+ :font-family "Ubuntu", sans-serif
a
:text-decoration none
- :color inherit
+ :color #3b5998
+img
+ :border none
.clearfix:after
:content "."
:visibility hidden
View
3  app/assets/stylesheets/errors.css.scss
@@ -0,0 +1,3 @@
+// Place all the styles related to the errors controller here.
+// They will automatically be included in application.css.
+// You can use Sass (SCSS) here: http://sass-lang.com/
View
10 web/app/controllers/application_controller.rb → app/controllers/application_controller.rb
@@ -1,9 +1,11 @@
class ApplicationController < ActionController::Base
protect_from_forgery
- before_filter :set_content_type
+ after_filter :set_content_type
def set_content_type
- request.format = :xhtml if request.format == :html
+ if request.format == :html
+ response.content_type = "application/xhtml+xml"
+ end
end
def get_page_number(params)
@@ -17,8 +19,8 @@ def get_page_number(params)
def get_user_cache(items)
Hash[
- User.find(@items
- .map{|m| m.favorites.map{|u| u.user_id} + m.retweets.map{|u| u.user_id}}
+ User.find(items
+ .map{|m| [m.user_id, m.favorites.map{|u| u.user_id}, m.retweets.map{|u| u.user_id}]}
.flatten
.uniq)
.map{|m| [m.id, m]}
View
7 app/controllers/errors_controller.rb
@@ -0,0 +1,7 @@
+class ErrorsController < ApplicationController
+ def error_404
+ end
+
+ def error_500
+ end
+end
View
8 app/controllers/i_controller.rb
@@ -0,0 +1,8 @@
+class IController < ApplicationController
+ def show
+ id = params[:id].to_i
+ @item = Tweet.find_by(:id => id)
+ @user_cache = get_user_cache([@item])
+ @title = "\"#{ApplicationController.helpers.strip_tags(ApplicationController.helpers.format_tweet_text(@item.text))[0...30]}\" from @#{@user_cache[@item.user_id].screen_name}"
+ end
+end
View
0  web/app/controllers/main_controller.rb → app/controllers/main_controller.rb
File renamed without changes
View
0  web/app/controllers/sessions_controller.rb → app/controllers/sessions_controller.rb
File renamed without changes
View
32 web/app/controllers/users_controller.rb → app/controllers/users_controller.rb
@@ -12,7 +12,7 @@ def best
@items = []
end
@user_cache = get_user_cache(@items)
- @title = "Best tweets of #{screen_name} page #{page}"
+ @title = "@#{screen_name}'s Best Tweets"
end
def recent
@@ -28,7 +28,7 @@ def recent
@items = []
end
@user_cache = get_user_cache(@items)
- @title = "Recent faved of #{screen_name} page #{page}"
+ @title = "@#{screen_name}'s Newest Tweets"
end
def timeline
@@ -43,7 +43,7 @@ def timeline
@items = []
end
@user_cache = get_user_cache(@items)
- @title = "User timeline of #{screen_name} page #{page}"
+ @title = "@#{screen_name}'s Newest Tweets"
end
def my
@@ -51,26 +51,20 @@ def my
screen_name = params[:screen_name]
user = User.find_by(:screen_name => screen_name)
if user
- tweet_ids = ActiveRecord::Base.connection.execute(
- "SELECT * FROM (" +
- "SELECT tweet_id FROM favorites WHERE user_id = #{user.id} " +
- "UNION " +
- "SELECT tweet_id FROM retweets WHERE user_id = #{user.id}" +
- ") rf " +
- "ORDER BY 1 DESC " +
- "LIMIT #{Settings.page_per} " +
- "OFFSET #{Settings.page_per * (page - 1)};")
- tweet_ids.map!{|m| m.values[0]}
- if tweet_ids && tweet_ids.size > 0
- @items = Tweet.find(tweet_ids, :order => "id DESC")
- else
- @items = []
- end
+ @items = Tweet
+ .where("id IN (SELECT tweet_id FROM (" +
+ "SELECT tweet_id FROM favorites WHERE user_id = #{user.id} " +
+ "UNION " +
+ "SELECT tweet_id FROM retweets WHERE user_id = #{user.id}" +
+ ") AS rf)")
+ .order("id DESC")
+ .paginate(:page => page, :per_page => Settings.page_per)
+
else
@items = []
end
@user_cache = get_user_cache(@items)
- @title = "Favs from #{screen_name} page #{page}"
+ @title = "@#{screen_name}'s Recent Discoveries"
end
def info
View
12 web/app/helpers/application_helper.rb → app/helpers/application_helper.rb
@@ -8,7 +8,7 @@ def format_tweet_created_at(dt)
def format_tweet_text(text)
text
.gsub(/<url:((?:https?|ftp).+?):(.+?)>/){link_to($2, $1, :target => "_blank")}
- .gsub(/<hashtag:(.+?)>/){link_to("##{$1}", "https://twitter.com/search?q=%23#{$1}")}
+ .gsub(/<hashtag:(.+?)>/){link_to("##{URI.decode($1)}", "https://twitter.com/search?q=%23#{$1}")}
.gsub(/<mention:(.+?)>/){link_to("@#{$1}", "/#{$1}")}
.gsub(/\r\n|\r|\n/, "<br />")
end
@@ -18,10 +18,14 @@ def format_source_text(text)
end
def status_url(tweet)
- "https://twitter.com/#{tweet.user.screen_name}/status/#{tweet.id}"
+ "/#{@user_cache[tweet.user_id].screen_name}/status/#{tweet.id}"
end
- def user_url(user)
- "/#{user.screen_name}"
+ def twitter_status_url(tweet)
+ "https://twitter.com/#{@user_cache[tweet.user_id].screen_name}/status/#{tweet.id}"
+ end
+
+ def user_url(user_id)
+ "/#{@user_cache[user_id].screen_name}"
end
end
View
2  app/helpers/errors_helper.rb
@@ -0,0 +1,2 @@
+module ErrorsHelper
+end
View
0  web/app/helpers/i_helper.rb → app/helpers/i_helper.rb
File renamed without changes
View
0  web/app/helpers/main_helper.rb → app/helpers/main_helper.rb
File renamed without changes
View
0  web/app/helpers/sessions_helper.rb → app/helpers/sessions_helper.rb
File renamed without changes
View
0  web/app/helpers/users_helper.rb → app/helpers/users_helper.rb
File renamed without changes
View
0  web/app/models/account.rb → app/models/account.rb
File renamed without changes
View
0  web/app/models/favorite.rb → app/models/favorite.rb
File renamed without changes
View
0  web/app/models/retweet.rb → app/models/retweet.rb
File renamed without changes
View
0  web/app/models/tweet.rb → app/models/tweet.rb
File renamed without changes
View
0  web/app/models/user.rb → app/models/user.rb
File renamed without changes
View
1  app/views/errors/error_404.html.haml
@@ -0,0 +1 @@
+%h2 404
View
1  app/views/errors/error_500.html.haml
@@ -0,0 +1 @@
+%h2 500
View
4 web/app/views/i/show.haml → app/views/i/show.haml
@@ -1,3 +1,3 @@
-.content
- = render :partial => "shared/tweet", :locals => {:item => @item}
+.items
+ = render :partial => "shared/tweet", :locals => {:item => @item, :user_cache => @user_cache}
View
0  web/app/views/layouts/application.haml → app/views/layouts/application.haml
File renamed without changes
View
23 app/views/main/index.haml
@@ -0,0 +1,23 @@
+%p
+ %strong (´へεへ`*) < トップページだよ〜〜
+%p
+ Favstar クローンです。UserStreams つかってます。
+ = link_to "@KOBA789", "https://twitter.com/KOBA789"
+ さんにサーバーを貸していただけることになりました…!!
+%strong まだ開発途中段階のものですがとりあえず動いています。登録後接続まで最大30分かかります。
+%strong 動作のテスト中ですので、途中で登録をうちきったりあまりにふぁぼられ・ふぁぼりが多いユーザーの登録を削除する可能性もあります。
+%div
+ URLとかについて
+ %div
+ best:
+ = link_to "(/users)/re4k", "/re4k"
+ %div
+ recent:
+ = link_to "(/users)/re4k/recent", "/re4k/recent"
+ %div
+ こんどほかのところもFavstar互換にする
+%div
+ デザインなんとかしないと...
+%div
+ = link_to "@re4k", "https://twitter.com/re4k"
+
View
16 web/app/views/shared/_tweet.haml → app/views/shared/_tweet.haml
@@ -1,20 +1,20 @@
.item
.tweet
.avatar
- %a{href: user_url(item.user)}
- %img{src: item.user.profile_image_url}
+ %a{href: user_url(item.user_id)}
+ %img{src: user_cache[item.user_id].profile_image_url}
.tweet_content_fix
.tweet_content
.user
%span.name
- = link_to item.user.name, user_url(item.user)
+ = link_to user_cache[item.user_id].name, user_url(item.user_id)
%span.screen_name
- = link_to "@#{item.user.screen_name}", user_url(item.user)
+ = link_to "@#{user_cache[item.user_id].screen_name}", user_url(item.user_id)
.text
= raw format_tweet_text(item.text)
.meta.clearfix
- %span.created_at
- = link_to format_tweet_created_at(item.tweeted_at), status_url(item)
+ = link_to image_tag("bird_gray_16.png"), twitter_status_url(item), :target => "_blank", :class => "twitter_bird"
+ = link_to format_tweet_created_at(item.tweeted_at), status_url(item), :class => "created_at"
%span.source
= raw format_source_text(item.source)
.stats
@@ -25,10 +25,10 @@
%span.type= type
.users_content_fix
.users_content
- - data.map{|m| @user_cache[m.user_id]}.each_slice(10) do |row|
+ - data.map{|m| user_cache[m.user_id]}.each_slice(10) do |row|
%ul.users_row.clearfix
- row.each do |u|
%li
- %a{href: user_url(u)}><
+ %a{href: user_url(u.id)}><
%img{src: u.profile_image_url}
View
4 web/app/views/shared/_tweets.haml → app/views/shared/_tweets.haml
@@ -1,4 +1,4 @@
-%div.items
- = render :partial => "shared/tweet", :collection => items, :as => :item
+.items
+ = render :partial => "shared/tweet", :collection => items, :as => :item, :locals => {:user_cache => @user_cache}
- if items.size > 0
= will_paginate items
View
0  web/app/views/users/best.haml → app/views/users/best.haml
File renamed without changes
View
0  web/app/views/users/info.haml → app/views/users/info.haml
File renamed without changes
View
0  web/app/views/users/timeline.haml → app/views/users/my.haml
File renamed without changes
View
0  web/app/views/users/recent.haml → app/views/users/recent.haml
File renamed without changes
View
1  app/views/users/timeline.haml
@@ -0,0 +1 @@
+= render :partial => "shared/tweets", :locals => {:items => @items}
View
0  web/config.ru → config.ru
File renamed without changes
View
0  web/config/application.rb → config/application.rb
File renamed without changes
View
0  web/config/boot.rb → config/boot.rb
File renamed without changes
View
16 config/database.yml
@@ -0,0 +1,16 @@
+<% #development:
+
+ #test:
+%>
+
+production:
+ adapter: mysql2
+ encoding: utf8
+ reconnect: true
+ database: production
+ pool: 5
+ username: <%= ENV["DOTCLOUD_DB_MYSQL_LOGIN"] %>
+ password: <%= ENV["DOTCLOUD_DB_MYSQL_PASSWORD"] %>
+ host: <%= ENV["DOTCLOUD_DB_MYSQL_HOST"] %>
+ port: <%= ENV["DOTCLOUD_DB_MYSQL_PORT"] %>
+
View
0  web/config/environment.rb → config/environment.rb
File renamed without changes
View
0  web/config/environments/development.rb → config/environments/development.rb
File renamed without changes
View
2  web/config/environments/production.rb → config/environments/production.rb
@@ -20,7 +20,7 @@
# config.action_dispatch.rack_cache = true
# Disable Rails's static asset server (Apache or nginx will already do this).
- config.serve_static_assets = false
+ config.serve_static_assets = true
# Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier
View
0  web/config/environments/test.rb → config/environments/test.rb
File renamed without changes
View
0  web/config/initializers/backtrace_silencers.rb → config/initializers/backtrace_silencers.rb
File renamed without changes
View
0  web/config/initializers/filter_parameter_logging.rb → config/initializers/filter_parameter_logging.rb
File renamed without changes
View
0  web/config/initializers/haml.rb → config/initializers/haml.rb
File renamed without changes
View
0  web/config/initializers/inflections.rb → config/initializers/inflections.rb
File renamed without changes
View
7 web/config/initializers/mime_types.rb → config/initializers/mime_types.rb
@@ -1,10 +1,5 @@
# Be sure to restart your server when you modify this file.
-module Mime
- remove_const("HTML")
-end
+
# Add new mime types for use in respond_to blocks:
# Mime::Type.register "text/richtext", :rtf
# Mime::Type.register_alias "text/html", :iphone
-Mime::Type.register "text/html", :html
-Mime::Type.register "application/xhtml+xml", :xhtml
-
View
0  web/config/initializers/omniauth.rb → config/initializers/omniauth.rb
File renamed without changes
View
0  web/config/initializers/rails_config.rb → config/initializers/rails_config.rb
File renamed without changes
View
0  web/config/initializers/secret_token.rb → config/initializers/secret_token.rb
File renamed without changes
View
0  web/config/initializers/session_store.rb → config/initializers/session_store.rb
File renamed without changes
View
0  web/config/initializers/wrap_parameters.rb → config/initializers/wrap_parameters.rb
File renamed without changes
View
0  web/config/locales/en.yml → config/locales/en.yml
File renamed without changes
View
21 config/routes.rb
@@ -0,0 +1,21 @@
+Aclog::Application.routes.draw do
+ constraints = {
+ :id => /[0-9]+/,
+ :screen_name => /[a-zA-Z0-9_]{1,20}/,
+ :page => /[0-9]+/,
+ }
+
+ root :to => "main#index"
+ get "i/callback" => "sessions#callback"
+ get "i/logout" => "sessions#destroy"
+
+ get "i/:id" => "i#show", :constraints => constraints
+ get "(users)/:screen_name/status(es)/:id" => "i#show", :constraints => constraints
+
+ get "(users)/:screen_name(/:page)" => "users#best", :constraints => constraints
+ get "(users)/:screen_name/my(/:page)" => "users#my", :constraints => constraints
+ get "(users)/:screen_name/discovered(/:page)" => "users#my", :constraints => constraints
+ get "(users)/:screen_name/timeline(/:page)" => "users#timeline", :constraints => constraints
+ get "(users)/:screen_name/recent(/:page)" => "users#recent", :constraints => constraints
+ get "(users)/:screen_name/info(/:page)" => "users#info", :constraints => constraints
+end
View
12 config/settings.yml
@@ -0,0 +1,12 @@
+<%
+# dotCloud
+env_file = "/home/dotcloud/environment.json"
+if File.exists?(env_file)
+ ENV.update(Hash[JSON.parse(File.read(env_file)).map{|k, v| [k.to_s, v.to_s]}])
+end
+%>
+consumer_key: <%= ENV["CONSUMER_KEY"] %>
+consumer_secret: <%= ENV["CONSUMER_SECRET"] %>
+worker_count: <%= ENV["WORKER_COUNT"] %>
+dotcloud_service_name: <%= ENV["DOTCLOUD_SERVICE_NAME"] %>
+page_per: 10
View
0  web/config/settings/development.yml → config/settings/development.yml
File renamed without changes
View
0  web/config/settings/production.yml → config/settings/production.yml
File renamed without changes
View
0  web/config/settings/test.yml → config/settings/test.yml
File renamed without changes
View
0  web/db/migrate/20130225123010_create_accounts.rb → db/migrate/20130225123010_create_accounts.rb
File renamed without changes
View
0  web/db/migrate/20130226145932_create_users.rb → db/migrate/20130226145932_create_users.rb
File renamed without changes
View
0  web/db/migrate/20130226150329_create_tweets.rb → db/migrate/20130226150329_create_tweets.rb
File renamed without changes
View
0  web/db/migrate/20130226150829_create_favorites.rb → db/migrate/20130226150829_create_favorites.rb
File renamed without changes
View
0  web/db/migrate/20130226151042_create_retweets.rb → db/migrate/20130226151042_create_retweets.rb
File renamed without changes
View
0  web/db/schema.rb → db/schema.rb
File renamed without changes
View
0  web/db/seeds.rb → db/seeds.rb
File renamed without changes
View
42 lib/receiver/logger.rb
@@ -0,0 +1,42 @@
+class Receiver::Logger
+ def debug(msg)
+ if @level == :debug
+ log(@out, "DEBUG", msg)
+ end
+ end
+
+ def info(msg)
+ unless @level == :none
+ @level == :error
+ @level == :warn
+ log(@out, "INFO", msg)
+ end
+ end
+
+ def warn(msg)
+ unless @level == :none
+ @level == :error
+ log(@err, "WARN", msg)
+ end
+ end
+
+ def error(msg)
+ unless @level == :none
+ log(@err, "ERROR", msg)
+ end
+ end
+
+ def fatal(msg)
+ log(@err, "FATAL", msg)
+ end
+
+ def log(out, type, msg)
+ out.puts Time.now.utc.iso8601(3) + " " + type + ": " + msg.to_s
+ end
+
+ def initialize(level = :warn)
+ @out = STDOUT
+ @err = STDERR
+ @level = level
+ end
+end
View
112 worker/receiver/worker.rb → lib/receiver/worker.rb
@@ -2,7 +2,15 @@
class Receiver::Worker
def initialize
- @logger = Receiver::Logger.instance
+ @logger = Receiver::Logger.new(:info)
+ @connections = []
+
+ _tm = Settings.dotcloud_service_name.split(/_/).last
+ if _tm =~ /^[0-9]+$/
+ @worker_number = Integer(_tm)
+ else
+ exit(0)
+ end
end
# Create Aclog format text from Twitter Status Hash
@@ -34,56 +42,75 @@ def format_text_from_hash(hash)
return text
end
+ def rescue_duplicate(&proc)
+ begin
+ return proc.call
+ rescue ActiveRecord::StatementInvalid => e
+ if e.to_s =~ /^Mysql2::Error: Duplicate entry /
+ @logger.info("Duplicate entry..")
+ else
+ raise e
+ end
+ end
+ end
+
# Create or Update user by Twitter User Hash
def create_user_from_hash(user)
- rec = User.find_or_initialize_by(:id => user[:id])
- rec.screen_name = user[:screen_name]
- rec.name = user[:name]
- rec.profile_image_url = user[:profile_image_url_https]
- rec.save! if rec.changed?
-
- return rec
+ rescue_duplicate do
+ rec = User.find_or_initialize_by(:id => user[:id])
+ rec.screen_name = user[:screen_name]
+ rec.name = user[:name]
+ rec.profile_image_url = user[:profile_image_url_https]
+ rec.save! if rec.changed?
+
+ return rec
+ end
end
# Create tweet by Twitter Status Hash
def create_tweet_from_hash(status)
- Tweet.find_by(:id => status[:id]) ||
- Tweet.create!(:id => status[:id],
- :text => format_text_from_hash(status),
- :source => status[:source],
- :tweeted_at => Time.parse(status[:created_at]),
- :user => create_user_from_hash(status[:user]))
+ rescue_duplicate do
+ Tweet.find_by(:id => status[:id]) ||
+ Tweet.create!(:id => status[:id],
+ :text => format_text_from_hash(status),
+ :source => status[:source],
+ :tweeted_at => Time.parse(status[:created_at]),
+ :user => create_user_from_hash(status[:user]))
+ end
end
def destroy_tweet_from_hash(status)
- Tweet.delete(status[:delete][:status][:id])
+ Tweet.delete(status[:delete][:status][:id]) ||
+ Retweet.delete(status[:delete][:status][:id])
end
# Create Retweet by Twitter Status Hash
def create_retweet_from_hash(status)
- Retweet.find_by(:id => status[:id]) ||
- Retweet.create!(:id => status[:id],
- :tweet => create_tweet_from_hash(status[:retweeted_status]),
- :user => create_user_from_hash(status[:user]))
+ rescue_duplicate do
+ Retweet.find_by(:id => status[:id]) ||
+ Retweet.create!(:id => status[:id],
+ :tweet => create_tweet_from_hash(status[:retweeted_status]),
+ :user => create_user_from_hash(status[:user]))
+ end
end
# Create Favorite by Streaming Event Hash
def create_favorite_from_hash(status)
- user = create_user_from_hash(status[:source])
- user.favorites.find_by(:tweet_id => status[:target_object][:id]) ||
- user.favorites.create!(:tweet => create_tweet_from_hash(status[:target_object]))
+ rescue_duplicate do
+ user = create_user_from_hash(status[:source])
+ user.favorites.find_by(:tweet_id => status[:target_object][:id]) ||
+ user.favorites.create!(:tweet => create_tweet_from_hash(status[:target_object]))
+ end
end
def destroy_favorite_from_hash(status)
- Favorite.delete_all("tweet_id = #{status[:target_object][:id]} AND " +
- "user_id = #{status[:source][:id]}")
+ create_tweet_from_hash(status[:target_object])
+ .favorites.where(:user_id => status[:source][:id]).delete_all
end
def start
+ @logger.info("Worker ##{@worker_number} started")
EM.run do
- # UserStreams connections
- @connections = []
-
stop = Proc.new do
@connections.map(&:stop)
EM.stop
@@ -141,6 +168,7 @@ def start
con.on_enhance_your_calm do
@logger.error("Enhance Your Calm: #{con.options[:user_id]}")
+ @connections.delete(con)
end
con.on_error do |message|
@@ -201,35 +229,9 @@ def start
@connections << con
end
- # EventReceiver
- #EM.start_server("127.0.0.1", Settings.worker_port) do |server|
- # def server.receive_data(data)
- # d = data.split(/ /)
-
- # if handle_event(d[0].to_sym, s[1].to_i)
- # send_data "Accepted\r\n"
- # else
- # send_data "Denied\r\n"
- # end
-
- # close_connection_after_writing
- # end
-
- # def handle_event(command, id)
- # case command
- # when :REGISTER
- # if account = Account.find_by(:id => id)
- # register.call(account)
- # return true
- # else
- # return false
- # end
- # end
- # end
- #end
-
reconnect = -> do
- Account.all.each do |account|
+ Account.where("id % #{Settings.worker_count} = #{@worker_number}").each do |account|
+ #Account.find_by_sql("SELECT * FROM accounts WHERE id % #{Settings.worker_count} = #{@worker_number}").each do |account|
if con = @connections.find{|m| m.options[:user_id] == account.id}
con.immediate_reconnect
else
View
0  web/public/404.xhtml → public/404.xhtml
File renamed without changes
View
0  web/public/422.xhtml → public/422.xhtml
File renamed without changes
View
0  web/public/500.xhtml → public/500.xhtml
File renamed without changes
View
20 .../application-862b4db892f94edcb21b7275b0a049b0.css → .../application-37cb32f627581ac8bac91345987e7f10.css
@@ -24,12 +24,13 @@
width: 473px; }
.items .item .tweet .tweet_content .user {
padding: 0 5px 15px;
- font-weight: bold;
- color: #666666; }
+ font-weight: bold; }
.items .item .tweet .tweet_content .user .name {
font-size: 14px; }
.items .item .tweet .tweet_content .user .screen_name {
font-size: 12px; }
+ .items .item .tweet .tweet_content .user a {
+ color: #666666; }
.items .item .tweet .tweet_content .text {
font-size: 18px;
line-height: 25px;
@@ -39,6 +40,13 @@
padding: 0 5px 15px;
color: #666666;
font-size: 12px; }
+ .items .item .tweet .tweet_content .meta .twitter_bird {
+ display: block;
+ float: left; }
+ .items .item .tweet .tweet_content .meta .twitter_bird img {
+ vertical-align: top;
+ margin-right: 2px;
+ margin-top: 1px; }
.items .item .tweet .tweet_content .meta .created_at {
display: block;
float: left; }
@@ -79,11 +87,15 @@
* {
margin: 0;
- padding: 0; }
+ padding: 0;
+ font-family: "Ubuntu", sans-serif; }
a {
text-decoration: none;
- color: inherit; }
+ color: #3b5998; }
+
+img {
+ border: none; }
.clearfix:after {
content: ".";
View
BIN  public/assets/application-37cb32f627581ac8bac91345987e7f10.css.gz
Binary file not shown
View
5 ...s/application-1b8e9e39ac5613519703a2e42949522a.js → ...s/application-47a9a60feaec5625a9c66b1c985a1179.js
@@ -18,6 +18,11 @@
}).call(this);
+(function() {
+
+
+
+}).call(this);
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
View
BIN  ...pplication-1b8e9e39ac5613519703a2e42949522a.js.gz → ...pplication-47a9a60feaec5625a9c66b1c985a1179.js.gz
Binary file not shown
View
BIN  public/assets/bird_gray_16-93f51980875017e26744056b62aaac22.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
1  public/assets/manifest-0b26a376c9cfe81af432b634628ee75d.json
@@ -0,0 +1 @@
+{"files":{"bird_gray_16-93f51980875017e26744056b62aaac22.png":{"logical_path":"bird_gray_16.png","mtime":"2013-03-09T14:41:39+09:00","size":1106,"digest":"93f51980875017e26744056b62aaac22"},"rails-bc7d436ef8afbf0f88829742a43ba3a4.png":{"logical_path":"rails.png","mtime":"2013-02-25T21:20:52+09:00","size":6646,"digest":"bc7d436ef8afbf0f88829742a43ba3a4"},"application-47a9a60feaec5625a9c66b1c985a1179.js":{"logical_path":"application.js","mtime":"2013-03-09T01:51:23+09:00","size":743,"digest":"47a9a60feaec5625a9c66b1c985a1179"},"application-37cb32f627581ac8bac91345987e7f10.css":{"logical_path":"application.css","mtime":"2013-03-09T15:10:20+09:00","size":3294,"digest":"37cb32f627581ac8bac91345987e7f10"}},"assets":{"bird_gray_16.png":"bird_gray_16-93f51980875017e26744056b62aaac22.png","rails.png":"rails-bc7d436ef8afbf0f88829742a43ba3a4.png","application.js":"application-47a9a60feaec5625a9c66b1c985a1179.js","application.css":"application-37cb32f627581ac8bac91345987e7f10.css"}}
View
0  ...assets/rails-bc7d436ef8afbf0f88829742a43ba3a4.png → ...assets/rails-bc7d436ef8afbf0f88829742a43ba3a4.png
File renamed without changes
View
0  web/public/favicon.ico → public/favicon.ico
File renamed without changes
View
0  web/script/rails → script/rails
File renamed without changes
View
8 start.rb
@@ -1,8 +0,0 @@
-#!/usr/bin/env ruby
-
-require ::File.expand_path('../web/config/application', __FILE__)
-Rails.application.require_environment!
-
-require ::File.expand_path('../worker/receiver', __FILE__)
-Receiver::Worker.new.start
-
View
14 test/controllers/errors_controller_test.rb
@@ -0,0 +1,14 @@
+require 'test_helper'
+
+class ErrorsControllerTest < ActionController::TestCase
+ test "should get error_404" do
+ get :error_404
+ assert_response :success
+ end
+
+ test "should get error_500" do
+ get :error_500
+ assert_response :success
+ end
+
+end
View
4 test/helpers/errors_helper_test.rb
@@ -0,0 +1,4 @@
+require 'test_helper'
+
+class ErrorsHelperTest < ActionView::TestCase
+end
View
50 web/Gemfile
@@ -1,50 +0,0 @@
-ruby '1.9.3'
-source 'https://rubygems.org'
-
-gem 'rails', '4.0.0.beta1'
-
-gem 'thin'
-
-# Bundle edge Rails instead:
-# gem 'rails', :git => 'git://github.com/rails/rails.git'
-
-gem 'mysql2'
-gem 'haml-rails'
-
-# Gems used only for assets and not required
-# in production environments by default.
-group :assets do
- gem 'sass-rails', '~> 4.0.0.beta1'
- gem 'coffee-rails', '~> 4.0.0.beta1'
-
- # See https://github.com/sstephenson/execjs#readme for more supported runtimes
- gem 'therubyracer', :platforms => :ruby
-
- gem 'uglifier', '>= 1.0.3'
-end
-
-group :development do
- gem 'sqlite3'
-end
-
-gem 'yajl-ruby', :require => "yajl"
-gem 'rails_config'
-gem 'omniauth-twitter', :github => "re4k/omniauth-twitter"
-gem 'em-twitter'
-gem 'twitter'
-gem 'will_paginate', :github => 're4k/will_paginate'
-
-# To use ActiveModel has_secure_password
-# gem 'bcrypt-ruby', '~> 3.0.0'
-
-# To use Jbuilder templates for JSON
-# gem 'jbuilder'
-
-# Use unicorn as the app server
-gem 'unicorn'
-
-# Deploy with Capistrano
-# gem 'capistrano'
-
-# To use debugger
-# gem 'debugger'
View
182 web/Gemfile.lock
@@ -1,182 +0,0 @@
-GIT
- remote: git://github.com/re4k/omniauth-twitter.git
- revision: 313df7eb05e78477cf3eb06bced3c9b64957840f
- specs:
- omniauth-twitter (0.0.14)
- multi_json (~> 1.3)
- omniauth-oauth (~> 1.0)
-
-GIT
- remote: git://github.com/re4k/will_paginate.git
- revision: fcbbd91ced44aaabb1f369875ee9f4f651bc74fb
- specs:
- will_paginate (3.0.4)
-
-GEM
- remote: https://rubygems.org/
- specs:
- actionmailer (4.0.0.beta1)
- actionpack (= 4.0.0.beta1)
- mail (~> 2.5.3)
- actionpack (4.0.0.beta1)
- activesupport (= 4.0.0.beta1)
- builder (~> 3.1.0)
- erubis (~> 2.7.0)
- rack (~> 1.5.2)
- rack-test (~> 0.6.2)
- activemodel (4.0.0.beta1)
- activesupport (= 4.0.0.beta1)
- builder (~> 3.1.0)
- activerecord (4.0.0.beta1)
- activemodel (= 4.0.0.beta1)
- activerecord-deprecated_finders (~> 0.0.3)
- activesupport (= 4.0.0.beta1)
- arel (~> 4.0.0.beta1)
- activerecord-deprecated_finders (0.0.3)
- activesupport (4.0.0.beta1)
- i18n (~> 0.6.2)
- minitest (~> 4.2)
- multi_json (~> 1.3)
- thread_safe (~> 0.1)
- tzinfo (~> 0.3.33)
- arel (4.0.0.beta1)
- atomic (1.0.1)
- builder (3.1.4)
- coffee-rails (4.0.0.beta1)
- coffee-script (>= 2.2.0)
- railties (>= 4.0.0.beta, < 5.0)
- coffee-script (2.2.0)
- coffee-script-source
- execjs
- coffee-script-source (1.6.1)
- daemons (1.1.9)
- em-twitter (0.2.1)
- eventmachine (~> 1.0)
- http_parser.rb (~> 0.5)
- simple_oauth (~> 0.1)
- erubis (2.7.0)
- eventmachine (1.0.1)
- execjs (1.4.0)
- multi_json (~> 1.0)
- faraday (0.8.6)
- multipart-post (~> 1.1)
- haml (4.0.0)
- tilt
- haml-rails (0.4)
- actionpack (>= 3.1, < 4.1)
- activesupport (>= 3.1, < 4.1)
- haml (>= 3.1, < 4.1)
- railties (>= 3.1, < 4.1)
- hashie (1.2.0)
- hike (1.2.1)
- http_parser.rb (0.5.3)
- i18n (0.6.4)
- json (1.7.7)
- kgio (2.8.0)
- libv8 (3.11.8.13)
- mail (2.5.3)
- i18n (>= 0.4.0)
- mime-types (~> 1.16)
- treetop (~> 1.4.8)
- mime-types (1.21)
- minitest (4.6.2)
- multi_json (1.6.1)
- multipart-post (1.2.0)
- mysql2 (0.3.11)
- oauth (0.4.7)
- omniauth (1.1.3)
- hashie (~> 1.2)
- rack
- omniauth-oauth (1.0.1)
- oauth
- omniauth (~> 1.0)
- polyglot (0.3.3)
- rack (1.5.2)
- rack-test (0.6.2)
- rack (>= 1.0)
- rails (4.0.0.beta1)
- actionmailer (= 4.0.0.beta1)
- actionpack (= 4.0.0.beta1)
- activerecord (= 4.0.0.beta1)
- activesupport (= 4.0.0.beta1)
- bundler (>= 1.3.0, < 2.0)
- railties (= 4.0.0.beta1)
- sprockets-rails (~> 2.0.0.rc3)
- rails_config (0.3.2)
- activesupport (>= 3.0)
- railties (4.0.0.beta1)
- actionpack (= 4.0.0.beta1)
- activesupport (= 4.0.0.beta1)
- rake (>= 0.8.7)
- rdoc (~> 3.4)
- thor (>= 0.17.0, < 2.0)
- raindrops (0.10.0)
- rake (10.0.3)
- rdoc (3.12.2)
- json (~> 1.4)
- ref (1.0.2)
- sass (3.2.6)
- sass-rails (4.0.0.beta1)
- railties (>= 4.0.0.beta, < 5.0)
- sass (>= 3.1.10)
- sprockets-rails (~> 2.0.0.rc0)
- tilt (~> 1.3)
- simple_oauth (0.2.0)
- sprockets (2.9.0)
- hike (~> 1.2)
- multi_json (~> 1.0)
- rack (~> 1.0)
- tilt (~> 1.1, != 1.3.0)
- sprockets-rails (2.0.0.rc3)
- actionpack (>= 3.0)
- activesupport (>= 3.0)
- sprockets (~> 2.8)
- sqlite3 (1.3.7)
- therubyracer (0.11.4)
- libv8 (~> 3.11.8.12)
- ref
- thin (1.5.0)
- daemons (>= 1.0.9)
- eventmachine (>= 0.12.6)
- rack (>= 1.0.0)
- thor (0.17.0)
- thread_safe (0.1.0)
- atomic
- tilt (1.3.4)
- treetop (1.4.12)
- polyglot
- polyglot (>= 0.3.1)
- twitter (4.5.0)
- faraday (~> 0.8, < 0.10)
- multi_json (~> 1.0)
- simple_oauth (~> 0.2)
- tzinfo (0.3.36)
- uglifier (1.3.0)
- execjs (>= 0.3.0)
- multi_json (~> 1.0, >= 1.0.2)
- unicorn (4.6.2)
- kgio (~> 2.6)
- rack
- raindrops (~> 0.7)
- yajl-ruby (1.1.0)
-
-PLATFORMS
- ruby
-
-DEPENDENCIES
- coffee-rails (~> 4.0.0.beta1)
- em-twitter
- haml-rails
- mysql2
- omniauth-twitter!
- rails (= 4.0.0.beta1)
- rails_config
- sass-rails (~> 4.0.0.beta1)
- sqlite3
- therubyracer
- thin
- twitter
- uglifier (>= 1.0.3)
- unicorn
- will_paginate!
- yajl-ruby
View
261 web/README.rdoc
@@ -1,261 +0,0 @@
-== Welcome to Rails
-
-Rails is a web-application framework that includes everything needed to create
-database-backed web applications according to the Model-View-Control pattern.
-
-This pattern splits the view (also called the presentation) into "dumb"
-templates that are primarily responsible for inserting pre-built data in between
-HTML tags. The model contains the "smart" domain objects (such as Account,
-Product, Person, Post) that holds all the business logic and knows how to
-persist themselves to a database. The controller handles the incoming requests
-(such as Save New Account, Update Product, Show Post) by manipulating the model
-and directing data to the view.
-
-In Rails, the model is handled by what's called an object-relational mapping
-layer entitled Active Record. This layer allows you to present the data from
-database rows as objects and embellish these data objects with business logic
-methods. You can read more about Active Record in
-link:files/vendor/rails/activerecord/README.html.
-
-The controller and view are handled by the Action Pack, which handles both
-layers by its two parts: Action View and Action Controller. These two layers
-are bundled in a single package due to their heavy interdependence. This is
-unlike the relationship between the Active Record and Action Pack that is much
-more separate. Each of these packages can be used independently outside of
-Rails. You can read more about Action Pack in
-link:files/vendor/rails/actionpack/README.html.
-
-
-== Getting Started
-
-1. At the command prompt, create a new Rails application:
- <tt>rails new myapp</tt> (where <tt>myapp</tt> is the application name)
-
-2. Change directory to <tt>myapp</tt> and start the web server:
- <tt>cd myapp; rails server</tt> (run with --help for options)
-
-3. Go to http://localhost:3000/ and you'll see:
- "Welcome aboard: You're riding Ruby on Rails!"
-
-4. Follow the guidelines to start developing your application. You can find
-the following resources handy:
-
-* The Getting Started Guide: http://guides.rubyonrails.org/getting_started.html
-* Ruby on Rails Tutorial Book: http://www.railstutorial.org/
-
-
-== Debugging Rails
-
-Sometimes your application goes wrong. Fortunately there are a lot of tools that
-will help you debug it and get it back on the rails.
-
-First area to check is the application log files. Have "tail -f" commands
-running on the server.log and development.log. Rails will automatically display
-debugging and runtime information to these files. Debugging info will also be
-shown in the browser on requests from 127.0.0.1.
-
-You can also log your own messages directly into the log file from your code
-using the Ruby logger class from inside your controllers. Example:
-
- class WeblogController < ActionController::Base
- def destroy
- @weblog = Weblog.find(params[:id])
- @weblog.destroy
- logger.info("#{Time.now} Destroyed Weblog ID ##{@weblog.id}!")
- end
- end
-
-The result will be a message in your log file along the lines of:
-
- Mon Oct 08 14:22:29 +1000 2007 Destroyed Weblog ID #1!
-
-More information on how to use the logger is at http://www.ruby-doc.org/core/
-
-Also, Ruby documentation can be found at http://www.ruby-lang.org/. There are
-several books available online as well:
-
-* Programming Ruby: http://www.ruby-doc.org/docs/ProgrammingRuby/ (Pickaxe)
-* Learn to Program: http://pine.fm/LearnToProgram/ (a beginners guide)
-
-These two books will bring you up to speed on the Ruby language and also on
-programming in general.
-
-
-== Debugger
-
-Debugger support is available through the debugger command when you start your
-Mongrel or WEBrick server with --debugger. This means that you can break out of
-execution at any point in the code, investigate and change the model, and then,
-resume execution! You need to install ruby-debug to run the server in debugging
-mode. With gems, use <tt>sudo gem install ruby-debug</tt>. Example:
-
- class WeblogController < ActionController::Base
- def index
- @posts = Post.all
- debugger
- end
- end
-
-So the controller will accept the action, run the first line, then present you
-with a IRB prompt in the server window. Here you can do things like:
-
- >> @posts.inspect
- => "[#<Post:0x14a6be8
- @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>,
- #<Post:0x14a6620
- @attributes={"title"=>"Rails", "body"=>"Only ten..", "id"=>"2"}>]"
- >> @posts.first.title = "hello from a debugger"
- => "hello from a debugger"
-
-...and even better, you can examine how your runtime objects actually work:
-
- >> f = @posts.first
- => #<Post:0x13630c4 @attributes={"title"=>nil, "body"=>nil, "id"=>"1"}>
- >> f.
- Display all 152 possibilities? (y or n)
-
-Finally, when you're ready to resume execution, you can enter "cont".
-
-
-== Console
-
-The console is a Ruby shell, which allows you to interact with your
-application's domain model. Here you'll have all parts of the application
-configured, just like it is when the application is running. You can inspect
-domain models, change values, and save to the database. Starting the script
-without arguments will launch it in the development environment.
-
-To start the console, run <tt>rails console</tt> from the application
-directory.
-
-Options:
-
-* Passing the <tt>-s, --sandbox</tt> argument will rollback any modifications
- made to the database.
-* Passing an environment name as an argument will load the corresponding
- environment. Example: <tt>rails console production</tt>.
-
-To reload your controllers and models after launching the console run
-<tt>reload!</tt>
-
-More information about irb can be found at:
-link:http://www.rubycentral.org/pickaxe/irb.html
-
-
-== dbconsole
-
-You can go to the command line of your database directly through <tt>rails
-dbconsole</tt>. You would be connected to the database with the credentials
-defined in database.yml. Starting the script without arguments will connect you
-to the development database. Passing an argument will connect you to a different
-database, like <tt>rails dbconsole production</tt>. Currently works for MySQL,
-PostgreSQL and SQLite 3.
-
-== Description of Contents
-
-The default directory structure of a generated Ruby on Rails application:
-
- |-- app
- | |-- assets
- | |-- images
- | |-- javascripts
- | `-- stylesheets
- | |-- controllers
- | |-- helpers
- | |-- mailers
- | |-- models
- | `-- views
- | `-- layouts
- |-- config
- | |-- environments
- | |-- initializers
- | `-- locales
- |-- db
- |-- doc
- |-- lib
- | `-- tasks
- |-- log
- |-- public
- |-- script
- |-- test
- | |-- fixtures
- | |-- functional
- | |-- integration
- | |-- performance
- | `-- unit
- |-- tmp
- | |-- cache
- | |-- pids
- | |-- sessions
- | `-- sockets
- `-- vendor
- |-- assets
- `-- stylesheets
- `-- plugins
-
-app
- Holds all the code that's specific to this particular application.
-
-app/assets
- Contains subdirectories for images, stylesheets, and JavaScript files.
-
-app/controllers
- Holds controllers that should be named like weblogs_controller.rb for
- automated URL mapping. All controllers should descend from
- ApplicationController which itself descends from ActionController::Base.
-
-app/models
- Holds models that should be named like post.rb. Models descend from
- ActiveRecord::Base by default.
-
-app/views
- Holds the template files for the view that should be named like
- weblogs/index.html.erb for the WeblogsController#index action. All views use
- eRuby syntax by default.
-
-app/views/layouts
- Holds the template files for layouts to be used with views. This models the
- common header/footer method of wrapping views. In your views, define a layout
- using the <tt>layout :default</tt> and create a file named default.html.erb.
- Inside default.html.erb, call <% yield %> to render the view using this
- layout.
-
-app/helpers
- Holds view helpers that should be named like weblogs_helper.rb. These are
- generated for you automatically when using generators for controllers.
- Helpers can be used to wrap functionality for your views into methods.
-
-config
- Configuration files for the Rails environment, the routing map, the database,
- and other dependencies.
-
-db
- Contains the database schema in schema.rb. db/migrate contains all the
- sequence of Migrations for your schema.
-
-doc
- This directory is where your application documentation will be stored when
- generated using <tt>rake doc:app</tt>
-
-lib
- Application specific libraries. Basically, any kind of custom code that
- doesn't belong under controllers, models, or helpers. This directory is in
- the load path.
-
-public
- The directory available for the web server. Also contains the dispatchers and the
- default HTML files. This should be set as the DOCUMENT_ROOT of your web
- server.
-
-script
- Helper scripts for automation and generation.
-
-test
- Unit and functional tests along with fixtures. When using the rails generate
- command, template test files will be generated for you and placed in this
- directory.
-
-vendor
- External libraries that the application depends on. Also includes the plugins
- subdirectory. If the app has frozen rails, those gems also go here, under
- vendor/rails/. This directory is in the load path.
View
7 web/app/controllers/i_controller.rb
@@ -1,7 +0,0 @@
-class IController < ApplicationController
- def show
- id = params[:id].to_i
- @item = Tweet.find(id)
- @title = "Tweet"
- end
-end
View
0  web/app/mailers/.gitkeep
No changes.
View
0  web/app/models/.gitkeep
No changes.
View
13 web/app/views/main/index.haml
@@ -1,13 +0,0 @@
-%strong (´へεへ`*) < トップページだよ〜〜
-%strong まだ開発途中段階のものであり、いつデータベースをクリアするかわかりませんがとりあえず動いています。ワーカープロセスが1つしかないため、登録後接続まで最大30分かかります。
-%strong 動作のテスト中ですので、途中で登録をうちきったりあまりにふぁぼられ・ふぁぼりが多いユーザーの登録を削除する可能性もあります。
-%strong 学校の方のテスト期間中なんで1週間くらい放置します_(:3 」∠ )_
-%div
- URLとかについて
- %div
- best: /re4k/
- %div
- recent: /re4k/recent
-%div
- = link_to "@re4k", "https://twitter.com/re4k"
-
View
2  web/app/views/users/my.haml
@@ -1,2 +0,0 @@
-%div.items
- = render :partial => "shared/tweet", :collection => @items, :as => :item
View
33 web/config/database.yml
@@ -1,33 +0,0 @@
-<%
-require "json"
-
-environment = File.exists?("/home/dotcloud/environment.json") ?
- JSON.parse(File.read("/home/dotcloud/environment.json")) :
- {}
-%>
-development:
- adapter: sqlite3
- database: db/development.sqlite3
- pool: 5
- timeout: 5000
-
-# Warning: The database defined as "test" will be erased and
-# re-generated from your development database when you run "rake".
-# Do not set this db to the same as development or production.
-test:
- adapter: sqlite3
- database: db/test.sqlite3
- pool: 5
- timeout: 5000
-
-production:
- adapter: mysql2
- encoding: utf8
- reconnect: true
- database: production
- pool: 5
- username: <%= environment["DOTCLOUD_DB_MYSQL_LOGIN"] %>
- password: <%= environment["DOTCLOUD_DB_MYSQL_PASSWORD"] %>
- host: <%= environment["DOTCLOUD_DB_MYSQL_HOST"] %>
- port: <%= environment["DOTCLOUD_DB_MYSQL_PORT"] %>
-
View
24 web/config/routes.rb
@@ -1,24 +0,0 @@
-Aclog::Application.routes.draw do
- constraints = {
- :id => /[0-9]+/,
- :screen_name => /[a-zA-Z0-9_]{1,20}/,
- :page => /[0-9]+/,
- }
-
- paging_defaults = {
- :page => "1"
- }
-
- root :to => "main#index"
- get "i/callback" => "sessions#callback"
- get "i/logout" => "sessions#destroy"
-
- get "i/:id" => "i#show", :constraints => constraints
- get ":screen_name/status(es)/:id" => "i#show", :constraints => constraints
-
- get ":screen_name(/:page)" => "users#best", :constraints => constraints, :defaults => paging_defaults
- get ":screen_name/my(/:page)" => "users#my", :constraints => constraints, :defaults => paging_defaults
- get ":screen_name/timeline(/:page)" => "users#timeline", :constraints => constraints, :defaults => paging_defaults
- get ":screen_name/recent(/:page)" => "users#recent", :constraints => constraints, :defaults => paging_defaults
- get ":screen_name/info(/:page)" => "users#info", :constraints => constraints, :defaults => paging_defaults
-end
View
4 web/config/settings.yml
@@ -1,4 +0,0 @@
-consumer_key: <%= ENV["CONSUMER_KEY"] %>
-consumer_secret: <%= ENV["CONSUMER_SECRET"] %>
-worker_port: 46607
-page_per: 10
View
0  web/lib/assets/.gitkeep
No changes.
View
0  web/lib/tasks/.gitkeep
No changes.
View
0  web/log/.gitkeep
No changes.
View
BIN  web/public/assets/application-862b4db892f94edcb21b7275b0a049b0.css.gz
Binary file not shown
View
84 web/public/assets/application-c11f88ddf5d2294cfc1779fcb0be52cf.css
@@ -1,84 +0,0 @@
-.items {
- width: 572px;
- margin: 15px 0 15px 18px; }
- .items .item {
- margin: 15px 0; }
- .items .item .tweet {
- overflow: hidden;
- background: white;
- border: 1px solid #c1c5cb;
- border-width: 1px 0;
- padding: 15px; }
- .items .item .tweet .avatar {
- width: 60px;
- float: left; }
- .items .item .tweet .avatar img {
- width: 48px;
- height: 48px; }
- .items .item .tweet .tweet_content_fix {
- float: left;
- width: 1px;
- height: 85px; }
- .items .item .tweet .tweet_content {
- float: left;
- width: 473px; }
- .items .item .tweet .tweet_content .user {
- font-weight: bold;
- color: #666666; }
- .items .item .tweet .tweet_content .user .name {
- font-size: 14px; }
- .items .item .tweet .tweet_content .user .screen_name {
- font-size: 12px; }
- .items .item .tweet .tweet_content .text {
- font-size: 18px;
- line-height: 25px;
- padding: 0 5px 15px;
- word-wrap: break-word; }
- .items .item .tweet .tweet_content .meta {
- color: #666666;
- font-size: 12px; }
- .items .item .tweet .tweet_content .meta .created_at {
- display: block;
- float: left; }
- .items .item .tweet .tweet_content .meta .source {
- display: block;
- float: right; }
- .items .item .stats {
- clear: both;
- padding: 15px; }
- .items .item .stats .type_row .info {
- width: 60px;
- float: left; }
- .items .item .stats .type_row .info .count,
- .items .item .stats .type_row .info .type {
- color: #666666;
- display: block; }
- .items .item .stats .type_row .info .count {
- font-weight: bold;
- font-size: 14px; }
- .items .item .stats .type_row .info .type {
- font-size: 10px; }
- .items .item .stats .type_row ul.users_row {
- list-style: none;
- float: left; }
- .items .item .stats .type_row ul.users_row li {
- float: left; }
- .items .item .stats .type_row ul.users_row li img {
- width: 48px;
- height: 48px; }
-
-* {
- vertical-align: baseline;
- margin: 0;
- padding: 0; }
-
-a {
- text-decoration: none;
- color: inherit; }
-
-.clearfix:after {
- content: ".";
- visibility: hidden;
- display: block;
- height: 0;
- clear: both; }
View
BIN  web/public/assets/application-c11f88ddf5d2294cfc1779fcb0be52cf.css.gz
Binary file not shown
View
1  web/public/assets/manifest-6b01fb44e2a668d3c0196abd4bdfbb15.json
@@ -1 +0,0 @@
-{"files":{"rails-bc7d436ef8afbf0f88829742a43ba3a4.png":{"logical_path":"rails.png","mtime":"2013-02-25T21:20:52+09:00","size":6646,"digest":"bc7d436ef8afbf0f88829742a43ba3a4"},"application-1b8e9e39ac5613519703a2e42949522a.js":{"logical_path":"application.js","mtime":"2013-03-03T23:30:08+09:00","size":711,"digest":"1b8e9e39ac5613519703a2e42949522a"},"application-c11f88ddf5d2294cfc1779fcb0be52cf.css":{"logical_path":"application.css","mtime":"2013-03-06T20:39:32+09:00","size":2453,"digest":"c11f88ddf5d2294cfc1779fcb0be52cf"},"application-862b4db892f94edcb21b7275b0a049b0.css":{"logical_path":"application.css","mtime":"2013-03-07T05:23:25+09:00","size":2877,"digest":"862b4db892f94edcb21b7275b0a049b0"}},"assets":{"rails.png":"rails-bc7d436ef8afbf0f88829742a43ba3a4.png","application.js":"application-1b8e9e39ac5613519703a2e42949522a.js","application.css":"application-862b4db892f94edcb21b7275b0a049b0.css"}}
View
0  web/vendor/assets/javascripts/.gitkeep
No changes.
View
0  web/vendor/assets/stylesheets/.gitkeep
No changes.
View
0  web/vendor/plugins/.gitkeep
No changes.
View
5 worker.sh
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+bundle exec rails runner Receiver::Worker.new.start
+
+
View
6 worker/receiver.rb
@@ -1,6 +0,0 @@
-module Receiver
- require ::File.expand_path("../receiver/logger", __FILE__)
- require ::File.expand_path("../receiver/worker", __FILE__)
-
- # monyo
-end
View
28 worker/receiver/logger.rb
@@ -1,28 +0,0 @@
-class Receiver::Logger
- include Singleton
-
- def debug(msg)
- log(@out, "DEBUG", msg)
- end
-
- def info(msg)
- log(@out, "INFO", msg)
- end
-
- def warn(msg)
- log(@err, "WARN", msg)
- end
-
- def error(msg)
- log(@err, "ERROR", msg)
- end
-
- def log(out, type, msg)
- out.puts Time.now.utc.iso8601(3) + " " + type + ": " + msg.to_s
- end
-
- def initialize
- @out = STDOUT
- @err = STDERR
- end
-end
Please sign in to comment.
Something went wrong with that request. Please try again.