mirror of
https://github.com/ENSL/ensl.org.git
synced 2025-01-11 20:30:47 +00:00
Removed unused rails plugins & code/comments
This commit is contained in:
parent
cd5520b948
commit
28a1112a1c
8 changed files with 25 additions and 36 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -1,5 +1,4 @@
|
||||||
# Rails, Ruby, etc
|
# Rails, Ruby, etc
|
||||||
/coverage/
|
|
||||||
/log/*
|
/log/*
|
||||||
/tmp/*
|
/tmp/*
|
||||||
/spec/tmp/*
|
/spec/tmp/*
|
||||||
|
@ -36,6 +35,8 @@
|
||||||
.bundle
|
.bundle
|
||||||
|
|
||||||
# Misc
|
# Misc
|
||||||
|
/coverage/
|
||||||
|
/backups
|
||||||
/index/*
|
/index/*
|
||||||
rerun.txt
|
rerun.txt
|
||||||
pickle-email-*.html
|
pickle-email-*.html
|
||||||
|
|
|
@ -18,11 +18,11 @@ Create a new upstart config and set permissions
|
||||||
touch /etc/init/ensl.conf
|
touch /etc/init/ensl.conf
|
||||||
chown deploy /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
|
# /etc/sudoers
|
||||||
deploy ALL=NOPASSWD:/etc/init.d/nginx
|
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
|
deploy ALL=NOPASSWD:/usr/sbin/service ensl start, /usr/sbin/service ensl stop, /usr/sbin/service ensl restart
|
||||||
|
|
||||||
## Install MySQL & Memcached
|
## Install MySQL & Memcached
|
||||||
|
|
|
@ -20,8 +20,6 @@ class Comment < ActiveRecord::Base
|
||||||
|
|
||||||
before_save :parse_text
|
before_save :parse_text
|
||||||
|
|
||||||
# acts_as_indexed :fields => [:text]
|
|
||||||
|
|
||||||
def parse_text
|
def parse_text
|
||||||
self.text_parsed = RbbCode::Parser.new.parse(text)
|
self.text_parsed = RbbCode::Parser.new.parse(text)
|
||||||
end
|
end
|
||||||
|
|
|
@ -34,8 +34,6 @@ class Post < ActiveRecord::Base
|
||||||
belongs_to :user
|
belongs_to :user
|
||||||
belongs_to :topic
|
belongs_to :topic
|
||||||
|
|
||||||
# acts_as_indexed :fields => [:text]
|
|
||||||
|
|
||||||
def number pages, i
|
def number pages, i
|
||||||
if i != -1
|
if i != -1
|
||||||
pages.per_page * (pages.current_page - 1) + i + 1
|
pages.per_page * (pages.current_page - 1) + i + 1
|
||||||
|
|
|
@ -1,42 +1,19 @@
|
||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
class ImageUploader < CarrierWave::Uploader::Base
|
class ImageUploader < CarrierWave::Uploader::Base
|
||||||
# Include RMagick or ImageScience support:
|
|
||||||
include CarrierWave::RMagick
|
include CarrierWave::RMagick
|
||||||
# include CarrierWave::ImageScience
|
|
||||||
|
|
||||||
# Choose what kind of storage to use for this uploader:
|
|
||||||
storage :file
|
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
|
def store_dir
|
||||||
"images"
|
"images"
|
||||||
end
|
end
|
||||||
|
|
||||||
# Override filename
|
|
||||||
def filename
|
def filename
|
||||||
model.id.to_s + File.extname(@filename) unless @filename.nil?
|
model.id.to_s + File.extname(@filename) unless @filename.nil?
|
||||||
end
|
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
|
def extension_white_list
|
||||||
%w(jpg jpeg gif png)
|
%w(jpg jpeg gif png)
|
||||||
end
|
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
|
end
|
||||||
|
|
|
@ -2,6 +2,7 @@ lock '3.1.0'
|
||||||
|
|
||||||
set :application, 'ensl'
|
set :application, 'ensl'
|
||||||
set :deploy_user, 'deploy'
|
set :deploy_user, 'deploy'
|
||||||
|
set :deploy_to, '/var/www/virtual/ensl.org/deploy'
|
||||||
set :pty, true
|
set :pty, true
|
||||||
|
|
||||||
set :scm, :git
|
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
|
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle
|
||||||
public/system public/local public/uploads}
|
public/system public/local public/uploads}
|
||||||
|
|
||||||
|
set :writable_dirs, %w{public tmp}
|
||||||
set :normalize_asset_timestamps, %{public/images public/javascripts public/stylesheets}
|
set :normalize_asset_timestamps, %{public/images public/javascripts public/stylesheets}
|
||||||
|
|
||||||
namespace :deploy do
|
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'
|
desc 'Restart application'
|
||||||
task :restart do
|
task :restart do
|
||||||
invoke 'foreman:export'
|
invoke 'foreman:export'
|
||||||
|
@ -33,7 +52,7 @@ namespace :foreman do
|
||||||
task :export do
|
task :export do
|
||||||
on roles(:app) do |host|
|
on roles(:app) do |host|
|
||||||
within release_path do
|
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
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,6 +5,4 @@ role :app, %w{deploy@ensl.org}
|
||||||
role :web, %w{deploy@ensl.org}
|
role :web, %w{deploy@ensl.org}
|
||||||
role :db, %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}
|
server 'ensl.org', user: 'deploy', roles: %w{web app}
|
||||||
|
|
|
@ -5,6 +5,4 @@ role :app, %w{deploy@staging.ensl.org}
|
||||||
role :web, %w{deploy@staging.ensl.org}
|
role :web, %w{deploy@staging.ensl.org}
|
||||||
role :db, %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}
|
|
||||||
|
|
Loading…
Reference in a new issue