Merge branch 'master' of github.com:r888888888/danbooru

This commit is contained in:
Toks
2015-10-04 16:57:57 -04:00
9 changed files with 70 additions and 21 deletions

View File

@@ -89,14 +89,17 @@ sudo -u danbooru git clone https://github.com/r888888888/danbooru ~danbooru/danb
sudo -u danbooru bash -l -c 'cd ~/danbooru ; bundle'
echo "* Creating a new local git branch called develop"
sudo -u danbooru bash -l -c 'cd ~danbooru ; git checkout -b develop'
sudo -u danbooru bash -l -c 'cd ~/danbooru ; git checkout -b develop'
mkdir -p /var/www/danbooru2/shared/config
mkdir -p /var/www/danbooru2/shared/data
sudo -u danbooru bash -l -c 'cp ~/danbooru/script/install/database.yml.templ /var/www/danbooru2/shared/config/database.yml'
sudo -u danbooru bash -l -c 'cp ~/danbooru/script/install/danbooru_local_config.rb.templ /var/www/danbooru2/shared/config/danbooru_local_config.rb'
chown -R danbooru:danbooru /var/www/danbooru2
echo "* Almost done! The code has been checked out at ~danbooru/danbooru. You can "
echo "* now login as the danbooru user and run the following commands to deploy to "
echo "* the server:"
echo "*"
echo "* cd ~/danbooru"
echo "* bundle exec cap development deploy:setup"
echo "* bundle exec cap development deploy:update"
echo "* bundle exec cap development deploy"

View File

@@ -42,6 +42,9 @@
delay: 500,
minLength: 2,
autoFocus: true,
focus: function() {
return false;
},
select: function(event, ui) {
var before_caret_text = this.value.substring(0, this.selectionStart).replace(/\S+$/, ui.item.value + " ");
var after_caret_text = this.value.substring(this.selectionStart);

View File

@@ -155,6 +155,10 @@ a.blacklisted-active {
}
}
.ui-state-focus.ui-state-focus a.tag-type-0 {
color: white;
}
.category-1 a, a.tag-type-1, .ui-state-focus a.tag-type-1 {
color: #A00;

View File

@@ -33,17 +33,25 @@ class DText
end
def self.parse_inline(str, options = {})
puts str
str.gsub!(/&/, "&")
str.gsub!(/</, "&lt;")
str.gsub!(/>/, "&gt;")
str.gsub!(/(?:^| )@\S+/) do |name|
if name =~ /([:;,.!?\)\]<>])$/
name.chop!
ch = $1
else
ch = ""
end
'<a href="/users?name=' + u(CGI.unescapeHTML(name[1..-1])) + '">' + name + '</a>' + ch
end
str.gsub!(/\n/m, "<br>") unless options[:ignore_newlines]
str.gsub!(/\[b\](.+?)\[\/b\]/i, '<strong>\1</strong>')
str.gsub!(/\[i\](.+?)\[\/i\]/i, '<em>\1</em>')
str.gsub!(/\[s\](.+?)\[\/s\]/i, '<s>\1</s>')
str.gsub!(/\[u\](.+?)\[\/u\]/i, '<u>\1</u>')
str.gsub!(/\[tn\](.+?)\[\/tn\]/i, '<p class="tn">\1</p>')
str.gsub!(/@\w+/) {|name| '<a href="/users?name=' + u(CGI.unescapeHTML(name[1..-1])) + '">' + name + '</a>'}
str = parse_links(str)
str = parse_aliased_wiki_links(str)

View File

@@ -1,2 +1,3 @@
set :user, "danbooru"
set :rails_env, "development"
server "localhost", :roles => %w(web app db), :primary => true

View File

@@ -0,0 +1,25 @@
# Set your full path to application.
app_path = "/var/www/danbooru2/current"
# Set unicorn options
worker_processes 2
preload_app false
timeout 180
listen "127.0.0.1:9000"
# Spawn unicorn master worker for user apps (group: apps)
user 'danbooru', 'danbooru'
# Fill path to your app
working_directory app_path
# Should be 'production' by default, otherwise use other env
rails_env = ENV['RAILS_ENV'] || 'production'
# Log everything to one file
stderr_path "log/unicorn.log"
stdout_path "log/unicorn.log"
# Set master PID location
pid "#{app_path}/tmp/pids/unicorn.pid"

View File

@@ -2,10 +2,12 @@ namespace :delayed_job do
desc "Start delayed_job process"
task :start do
on roles(:app) do
within current_path do
with rails_env: fetch(:rails_env) do
hostname = capture("hostname").strip
execute :bundle, "exec", "script/delayed_job", "--queues=default,#{hostname}", "-n 2", "start"
if test("[ -d #{current_path} ]")
within current_path do
with rails_env: fetch(:rails_env) do
hostname = capture("hostname").strip
execute :bundle, "exec", "script/delayed_job", "--queues=default,#{hostname}", "-n 2", "start"
end
end
end
end
@@ -14,9 +16,11 @@ namespace :delayed_job do
desc "Stop delayed_job process"
task :stop do
on roles(:app) do
within current_path do
with rails_env: fetch(:rails_env) do
execute :bundle, "exec", "script/delayed_job", "stop"
if test("[ -d #{current_path} ]")
within current_path do
with rails_env: fetch(:rails_env) do
execute :bundle, "exec", "script/delayed_job", "stop"
end
end
end
end

View File

@@ -4,7 +4,9 @@ namespace :symlink do
on roles(:app) do
execute :ln, "-s", "#{deploy_to}/shared/config/danbooru_local_config.rb", "#{release_path}/config/danbooru_local_config.rb"
execute :ln, "-s", "#{deploy_to}/shared/config/database.yml", "#{release_path}/config/database.yml"
execute :ln, "-s", "#{deploy_to}/shared/config/newrelic.yml", "#{release_path}/config/newrelic.yml"
if test("[ -f #{deploy_to}/shared/config/newrelic.yml ]")
execute :ln, "-s", "#{deploy_to}/shared/config/newrelic.yml", "#{release_path}/config/newrelic.yml"
end
end
end
@@ -13,7 +15,6 @@ namespace :symlink do
on roles(:app) do
execute :rm, "-f", "#{release_path}/public/data"
execute :ln, "-s", "#{deploy_to}/shared/data", "#{release_path}/public/data"
execute :mkdir, "-p", "#{release_path}/public/cache"
execute :mkdir, "-p", "#{deploy_to}/shared/system/cache"
execute :touch, "#{deploy_to}/shared/system/cache/tags.json"

File diff suppressed because one or more lines are too long