Skip to content

Commit

Permalink
Update Rails to 4.2.*
Browse files Browse the repository at this point in the history
  • Loading branch information
tsujigiri committed Mar 18, 2015
1 parent 9e9e7fe commit 3b5261b
Show file tree
Hide file tree
Showing 12 changed files with 127 additions and 85 deletions.
8 changes: 4 additions & 4 deletions Gemfile
@@ -1,6 +1,6 @@
source 'http://rubygems.org'

gem 'rails', '~> 4.0.0'
gem 'rails', '~> 4.1.0'
gem 'authlogic' # lots of user-related magic
gem 'i18n', '>= 0.6.6'
gem 'rails3-generators'
Expand All @@ -26,7 +26,7 @@ gem 'newrelic_rpm'
# DB
gem 'pg'
gem 'activerecord-import', '>= 0.4.0'
gem 'composite_primary_keys', '~> 6.0'
gem 'composite_primary_keys', '~> 7.0'
gem 'pg_search'

# so we can create zip-files for genotypes
Expand Down Expand Up @@ -67,8 +67,7 @@ group :test do
gem 'test-unit' # TODO: Remove me
gem 'minitest' # TODO: Remove me
gem 'rspec-rails'
gem 'shoulda-context', require: false
gem 'factory_girl_rails'
gem 'shoulda-context'
gem 'mocha', require: false
gem 'simplecov', require: false
gem 'webmock'
Expand All @@ -80,6 +79,7 @@ end
group :development, :test do
gem 'uuidtools'
gem 'pry-rails', require: 'pry' unless ENV['CI']
gem 'factory_girl_rails'
end

group :development do
Expand Down
85 changes: 45 additions & 40 deletions Gemfile.lock
Expand Up @@ -30,44 +30,46 @@ GIT
GEM
remote: http://rubygems.org/
specs:
actionmailer (4.0.13)
actionpack (= 4.0.13)
actionmailer (4.1.9)
actionpack (= 4.1.9)
actionview (= 4.1.9)
mail (~> 2.5, >= 2.5.4)
actionpack (4.0.13)
activesupport (= 4.0.13)
builder (~> 3.1.0)
erubis (~> 2.7.0)
actionpack (4.1.9)
actionview (= 4.1.9)
activesupport (= 4.1.9)
rack (~> 1.5.2)
rack-test (~> 0.6.2)
activemodel (4.0.13)
activesupport (= 4.0.13)
builder (~> 3.1.0)
activerecord (4.0.13)
activemodel (= 4.0.13)
activerecord-deprecated_finders (~> 1.0.2)
activesupport (= 4.0.13)
arel (~> 4.0.0)
activerecord-deprecated_finders (1.0.3)
actionview (4.1.9)
activesupport (= 4.1.9)
builder (~> 3.1)
erubis (~> 2.7.0)
activemodel (4.1.9)
activesupport (= 4.1.9)
builder (~> 3.1)
activerecord (4.1.9)
activemodel (= 4.1.9)
activesupport (= 4.1.9)
arel (~> 5.0.0)
activerecord-import (0.7.0)
activerecord (>= 3.0)
activesupport (4.0.13)
activesupport (4.1.9)
i18n (~> 0.6, >= 0.6.9)
minitest (~> 4.2)
multi_json (~> 1.3)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1)
thread_safe (~> 0.1)
tzinfo (~> 0.3.37)
tzinfo (~> 1.1)
addressable (2.3.5)
airbrake (4.0.0)
builder
multi_json
arel (4.0.2)
arel (5.0.1.20140414130214)
authlogic (3.4.5)
activerecord (>= 3.2)
activesupport (>= 3.2)
request_store (~> 1.0)
scrypt (~> 1.2)
bcrypt-ruby (3.1.2)
builder (3.1.4)
builder (3.2.2)
capistrano (2.15.5)
highline
net-scp (>= 1.0.0)
Expand All @@ -88,8 +90,8 @@ GEM
cocaine (0.5.4)
climate_control (>= 0.0.3, < 1.0)
coderay (1.1.0)
composite_primary_keys (6.0.8)
activerecord (~> 4.0.6)
composite_primary_keys (7.0.13)
activerecord (~> 4.1.7)
connection_pool (1.1.0)
crack (0.4.1)
safe_yaml (~> 0.9.0)
Expand All @@ -98,10 +100,10 @@ GEM
dynamic_form (1.1.4)
erubis (2.7.0)
execjs (2.0.2)
factory_girl (4.4.0)
factory_girl (4.5.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.4.1)
factory_girl (~> 4.4.0)
factory_girl_rails (4.5.0)
factory_girl (~> 4.5.0)
railties (>= 3.0.0)
ffi (1.9.3)
ffi-compiler (0.1.3)
Expand Down Expand Up @@ -149,7 +151,7 @@ GEM
method_source (0.8.2)
mime-types (2.4.3)
mini_portile (0.6.2)
minitest (4.7.5)
minitest (5.5.1)
mocha (0.14.0)
metaclass (~> 0.0.1)
multi_json (1.11.0)
Expand Down Expand Up @@ -190,19 +192,21 @@ GEM
rack
rack-test (0.6.3)
rack (>= 1.0)
rails (4.0.13)
actionmailer (= 4.0.13)
actionpack (= 4.0.13)
activerecord (= 4.0.13)
activesupport (= 4.0.13)
rails (4.1.9)
actionmailer (= 4.1.9)
actionpack (= 4.1.9)
actionview (= 4.1.9)
activemodel (= 4.1.9)
activerecord (= 4.1.9)
activesupport (= 4.1.9)
bundler (>= 1.3.0, < 2.0)
railties (= 4.0.13)
railties (= 4.1.9)
sprockets-rails (~> 2.0)
rails3-generators (1.0.0)
railties (>= 3.0.0)
railties (4.0.13)
actionpack (= 4.0.13)
activesupport (= 4.0.13)
railties (4.1.9)
actionpack (= 4.1.9)
activesupport (= 4.1.9)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.4.2)
Expand Down Expand Up @@ -247,7 +251,7 @@ GEM
scrypt (1.2.1)
ffi-compiler (>= 0.0.2)
rake
shoulda-context (1.1.5)
shoulda-context (1.2.1)
sidekiq (2.16.0)
celluloid (>= 0.15.2)
connection_pool (>= 1.0.0)
Expand Down Expand Up @@ -295,7 +299,8 @@ GEM
execjs
rails (>= 3.1)
railties (>= 3.1)
tzinfo (0.3.43)
tzinfo (1.2.2)
thread_safe (~> 0.1)
uglifier (2.3.0)
execjs (>= 0.3.0)
json (>= 1.8.0)
Expand Down Expand Up @@ -325,7 +330,7 @@ DEPENDENCIES
bcrypt-ruby
capistrano (~> 2.0)
capybara
composite_primary_keys (~> 6.0)
composite_primary_keys (~> 7.0)
database_cleaner
dynamic_form
execjs
Expand All @@ -349,7 +354,7 @@ DEPENDENCIES
pg_search
plos
pry-rails
rails (~> 4.0.0)
rails (~> 4.1.0)
rails3-generators
recaptcha
recommendify!
Expand Down
39 changes: 20 additions & 19 deletions app/views/phenotypes/index.html.erb
@@ -1,26 +1,27 @@
<legend>Listing all phenotypes</legend>
<%if current_user%>
<h4>
<%=link_to(image_tag("addphenotype_small.png",:style => "vertical-align:middle" ),:action =>"new")%> <%=link_to "The phenotype of your interest is missing? Add a new one!",:action => "new"%>
</h4>
<h4>
<%= link_to(image_tag("addphenotype_small.png", style: 'vertical-align: middle;' ), action: 'new')%>
<%= link_to "The phenotype of your interest is missing? Add a new one!", action: 'new' %>
</h4>
<%end%>
<br/>
<table class="table table-striped" id="no_snp_overview">
<tr>
<th>#</th>
<th><%= sortable "id", "ID"%></th>
<th><%= sortable "characteristic","Phenotype"%></th>
<th><%= sortable "number_of_users","Number of users"%></th>
<th><%= sortable "created_at", "Created"%>
</tr>
<% @phenotypes_paginate.each do |s| %>
<tr>
<td><%= Phenotype.all.sort! { |a,b| a.id <=> b.id}.index(s) + 1%></td>
<td><%= s.id %></td>
<td><%= link_to(s.characteristic, s) %></td>
<td><%=s.number_of_users%></td>
<td><%=s.created_at%></td>
</tr>
<% end %>
<tr>
<th>#</th>
<th><%= sortable "id", "ID" %></th>
<th><%= sortable "characteristic", "Phenotype" %></th>
<th><%= sortable "number_of_users", "Number of users" %></th>
<th><%= sortable "created_at", "Created" %></th>
</tr>
<% @phenotypes_paginate.each_with_index do |phenotype, i| %>
<tr>
<td><%= i + 1 %></td>
<td><%= phenotype.id %></td>
<td><%= link_to(phenotype.characteristic, phenotype) %></td>
<td><%= phenotype.number_of_users %></td>
<td><%= phenotype.created_at %></td>
</tr>
<% end %>
</table>
<%= page_navigation_links @phenotypes_paginate %>
21 changes: 8 additions & 13 deletions app/views/snp_comments/_show.html.erb
Expand Up @@ -7,22 +7,17 @@ function sendCommentId(e, text)

<% @comments.each do |c|%>

<div id="<%="comment"+c.id.to_s%>">
<b><%= c.subject %></b> by user <%if User.find_by_id(c.user_id) != nil%><%= link_to User.find_by_id(c.user_id).name, User.find_by_id(c.user_id)%><%else%>Deleted User<%end%> on <%= c.created_at %><br/>
<div class="well">
<a href="#" rel="comment_tooltip" title="<%if c.reply_to_id != -1 and c.reply_to_id != nil%><%if SnpComment.find_by_id(c.reply_to_id).user != nil%><b><%=SnpComment.find_by_id(c.reply_to_id).user.name%><%else%>Deleted User<%end%></b> wrote:"data-content="<%=SnpComment.find_by_id(c.reply_to_id).comment_text%><%end%>"><% if c.reply_to_id != -1 and c.reply_to_id != nil%><%if SnpComment.find_by_id(c.reply_to_id).user%>@<%=SnpComment.find_by_id(c.reply_to_id).user.name%><%else%>@Deleted User<%end%><% end %></a>
<% if User.where(id: c.user_id).count > 0 # TODO: Move to controller %>
<%=image_tag c.user.avatar.url(:head),:style => "vertical-align:middle;margin: 10px;float:left"%>
<% end %>
<%= simple_format(c.comment_text) %>
<br/>
<a onclick="sendCommentId(document.new_comment.snp_comment_comment_text,'@#<%= c.id.to_s %>: '); return false;" href="#">reply to</a>
</div>
</div>
<div id="<%="comment"+c.id.to_s%>">
<b><%= c.subject %></b> by user <%if User.find_by_id(c.user_id) != nil%><%= link_to User.find_by_id(c.user_id).name, User.find_by_id(c.user_id)%><%else%>Deleted User<%end%> on <%= c.created_at %><br/>
<div class="well">
<a href="#" rel="comment_tooltip" title="<%if c.reply_to_id != -1 and c.reply_to_id != nil%><%if SnpComment.find_by_id(c.reply_to_id).user != nil%><b><%=SnpComment.find_by_id(c.reply_to_id).user.name%><%else%>Deleted User<%end%></b> wrote:"data-content="<%=SnpComment.find_by_id(c.reply_to_id).comment_text%><%end%>"><% if c.reply_to_id != -1 and c.reply_to_id != nil%><%if SnpComment.find_by_id(c.reply_to_id).user%>@<%=SnpComment.find_by_id(c.reply_to_id).user.name%><%else%>@Deleted User<%end%><% end %></a>
<%if User.find_by_id(c.user_id) != nil%><%=image_tag c.user.avatar.url(:head),:style => "vertical-align:middle;margin: 10px;float:left"%><%end%> <%= simple_format(c.comment_text) %><br/><a onclick="sendCommentId(document.new_comment.snp_comment_comment_text,'@#<%= c.id %>: '); return false;" href="#">reply to</a>
</div>
</div>
<% end %>

<script type="text/javascript">
$(document).ready(function () {
$("[rel=comment_tooltip]").popover({ placement:'right' });
$("[rel=comment_tooltip]").popover({placement:'right'});
});
</script>
10 changes: 10 additions & 0 deletions bin/rails
@@ -0,0 +1,10 @@
#!/usr/bin/env ruby
begin
load File.expand_path("../spring", __FILE__)
rescue LoadError
end
# This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.

APP_PATH = File.expand_path('../../config/application', __FILE__)
require File.expand_path('../../config/boot', __FILE__)
require 'rails/commands'
7 changes: 7 additions & 0 deletions bin/rake
@@ -0,0 +1,7 @@
#!/usr/bin/env ruby
begin
load File.expand_path("../spring", __FILE__)
rescue LoadError
end
require 'bundler/setup'
load Gem.bin_path('rake', 'rake')
7 changes: 7 additions & 0 deletions bin/rspec
@@ -0,0 +1,7 @@
#!/usr/bin/env ruby
begin
load File.expand_path("../spring", __FILE__)
rescue LoadError
end
require 'bundler/setup'
load Gem.bin_path('rspec-core', 'rspec')
18 changes: 18 additions & 0 deletions bin/spring
@@ -0,0 +1,18 @@
#!/usr/bin/env ruby

# This file loads spring without using Bundler, in order to be fast
# It gets overwritten when you run the `spring binstub` command

unless defined?(Spring)
require "rubygems"
require "bundler"

if match = Bundler.default_lockfile.read.match(/^GEM$.*?^ spring \((.*?)\)$.*?^$/m)
ENV["GEM_PATH"] = ([Bundler.bundle_path.to_s] + Gem.path).join(File::PATH_SEPARATOR)
ENV["GEM_HOME"] = ""
Gem.paths = ENV

gem "spring", match[1]
require "spring/binstub"
end
end
5 changes: 5 additions & 0 deletions config/application.rb
Expand Up @@ -51,5 +51,10 @@ class Application < Rails::Application

# Version of your assets, change this if you want to expire all your assets
config.assets.version = '1.0'

config.generators do |g|
g.test_framework :rspec
g.factory_girl dir: 'test/factories'
end
end
end
4 changes: 0 additions & 4 deletions config/environments/development.rb
Expand Up @@ -20,10 +20,6 @@
# Only use best-standards-support built into browsers
config.action_dispatch.best_standards_support = :builtin

# Log the query plan for queries taking more than this (works
# with SQLite, MySQL, and PostgreSQL)
config.active_record.auto_explain_threshold_in_seconds = 0.1

# Do not compress assets
config.assets.compress = false

Expand Down
5 changes: 2 additions & 3 deletions test/factories.rb → test/factories/factories.rb
@@ -1,6 +1,6 @@
# TODO: One file per model.

# Needed (?) when test/unit and Rspec tests are run
unless $factories_already_read
$factories_already_read = true

FactoryGirl.define do
factory :user do
Expand Down Expand Up @@ -111,4 +111,3 @@
factory :phenotype_comment do
end
end
end
3 changes: 1 addition & 2 deletions test/test_helper.rb
Expand Up @@ -11,8 +11,7 @@
require "authlogic/test_case"
require 'webmock'
WebMock.disable_net_connect!(:allow_localhost => true)
require 'factory_girl'
FactoryGirl.find_definitions
require 'factory_girl_rails'
require 'paperclip/matchers'
require 'plos'

Expand Down

0 comments on commit 3b5261b

Please sign in to comment.