Removed unused rails plugins & code/comments

This commit is contained in:
Luke Barratt 2014-03-24 14:23:08 +00:00
parent cd5520b948
commit 28a1112a1c
8 changed files with 25 additions and 36 deletions

3
.gitignore vendored
View file

@ -1,5 +1,4 @@
# Rails, Ruby, etc
/coverage/
/log/*
/tmp/*
/spec/tmp/*
@ -36,6 +35,8 @@
.bundle
# Misc
/coverage/
/backups
/index/*
rerun.txt
pickle-email-*.html

View file

@ -18,11 +18,11 @@ Create a new upstart config and set permissions
touch /etc/init/ensl.conf
chown deploy /etc/init/ensl.conf
Add the following to `/etc/sudoers` to allow the `deploy` user to manage nginx, rbenv and upstart via sudo without a password
Add the following to `/etc/sudoers` to allow the `deploy` user to manage nginx, rbenv and upstart commands via sudo without a password
# /etc/sudoers
deploy ALL=NOPASSWD:/etc/init.d/nginx
deploy ALL=NOPASSWD:/home/deploy/.rbenv/bin/*
deploy ALL=NOPASSWD:/home/deploy/.rbenv/bin/rbenv
deploy ALL=NOPASSWD:/usr/sbin/service ensl start, /usr/sbin/service ensl stop, /usr/sbin/service ensl restart
## Install MySQL & Memcached

View file

@ -20,8 +20,6 @@ class Comment < ActiveRecord::Base
before_save :parse_text
# acts_as_indexed :fields => [:text]
def parse_text
self.text_parsed = RbbCode::Parser.new.parse(text)
end

View file

@ -34,8 +34,6 @@ class Post < ActiveRecord::Base
belongs_to :user
belongs_to :topic
# acts_as_indexed :fields => [:text]
def number pages, i
if i != -1
pages.per_page * (pages.current_page - 1) + i + 1

View file

@ -1,42 +1,19 @@
# encoding: utf-8
class ImageUploader < CarrierWave::Uploader::Base
# Include RMagick or ImageScience support:
include CarrierWave::RMagick
# include CarrierWave::ImageScience
# Choose what kind of storage to use for this uploader:
storage :file
# storage :fog
# Override the directory where uploaded files will be stored.
# This is a sensible default for uploaders that are meant to be mounted:
def store_dir
"images"
end
# Override filename
def filename
model.id.to_s + File.extname(@filename) unless @filename.nil?
end
# Provide a default URL as a default if there hasn't been a file uploaded:
# def default_url
# "/images/fallback/" + [version_name, "default.png"].compact.join('_')
# end
# Process files as they are uploaded:
# process :scale => [200, 300]
# Add a white list of extensions which are allowed to be uploaded.
# For images you might use something like this:
def extension_white_list
%w(jpg jpeg gif png)
end
# Override the filename of the uploaded files:
# Avoid using model.id or version_name here, see uploader/store.rb for details.
# def filename
# "something.jpg" if original_filename
# end
end

View file

@ -2,6 +2,7 @@ lock '3.1.0'
set :application, 'ensl'
set :deploy_user, 'deploy'
set :deploy_to, '/var/www/virtual/ensl.org/deploy'
set :pty, true
set :scm, :git
@ -16,9 +17,27 @@ set :linked_files, %w{.env}
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle
public/system public/local public/uploads}
set :writable_dirs, %w{public tmp}
set :normalize_asset_timestamps, %{public/images public/javascripts public/stylesheets}
namespace :deploy do
namespace :check do
desc "Check write permissions"
task :permissions do
on roles(:all) do |host|
fetch(:writable_dirs).each do |dir|
path = "#{shared_path}/#{dir}"
if test("[ -w #{path} ]")
info "#{path} is writable on #{host}"
else
error "#{path} is not writable on #{host}"
end
end
end
end
end
desc 'Restart application'
task :restart do
invoke 'foreman:export'
@ -33,7 +52,7 @@ namespace :foreman do
task :export do
on roles(:app) do |host|
within release_path do
execute "#{fetch(:rbenv_sudo)} bundle exec foreman export upstart /etc/init -a #{fetch(:application)} -u #{fetch(:deploy_user)} -l #{fetch(:deploy_to)}/shared/log"
execute fetch(:rbenv_sudo), "bundle exec foreman export upstart /etc/init -a #{fetch(:application)} -u #{fetch(:deploy_user)} -l #{fetch(:deploy_to)}/shared/log"
end
end
end

View file

@ -5,6 +5,4 @@ role :app, %w{deploy@ensl.org}
role :web, %w{deploy@ensl.org}
role :db, %w{deploy@ensl.org}
set :deploy_to, '/var/www/virtual/ensl.org/deploy'
server 'ensl.org', user: 'deploy', roles: %w{web app}

View file

@ -5,6 +5,4 @@ role :app, %w{deploy@staging.ensl.org}
role :web, %w{deploy@staging.ensl.org}
role :db, %w{deploy@staging.ensl.org}
set :deploy_to, '/var/www/virtual/ensl.org/deploy'
server 'staging.ensl.org', user: 'deploy', roles: %w{web app}
server 'staging.ensl.org', user: 'deploy', roles: %w{web app}