mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 02:58:48 +08:00
remove trailing whitespaces ❤️
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
desc "Add the topic to quotes"
|
||||
task "add_topic_to_quotes" => :environment do
|
||||
task "add_topic_to_quotes" => :environment do
|
||||
Post.where("raw like '%topic:%'").each do |p|
|
||||
new_raw = p.raw.gsub(/topic:(\d+)\]/, "topic:#{p.topic_id}\"]")
|
||||
new_cooked = p.cook(new_raw, topic_id: p.topic_id)
|
||||
|
@ -1,5 +1,5 @@
|
||||
desc "stamp the current build with the git hash placed in version.rb"
|
||||
task "build:stamp" => :environment do
|
||||
task "build:stamp" => :environment do
|
||||
git_version = `git rev-parse HEAD`.strip
|
||||
File.open(Rails.root.to_s + '/config/version.rb', 'w') do |f|
|
||||
f.write("$git_version = #{git_version.inspect}\n")
|
||||
|
@ -8,7 +8,7 @@ task 'build_test_topic' => :environment do
|
||||
# Acceptable options:
|
||||
#
|
||||
# raw - raw text of post
|
||||
# image_sizes - We can pass a list of the sizes of images in the post as a shortcut.
|
||||
# image_sizes - We can pass a list of the sizes of images in the post as a shortcut.
|
||||
#
|
||||
# When replying to a topic:
|
||||
# topic_id - topic we're replying to
|
||||
@ -37,14 +37,14 @@ task 'build_test_topic' => :environment do
|
||||
links << "Link to ##{where}: #{topic_url}/#{where}"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
raw = <<eos
|
||||
This is post ##{post_number}.
|
||||
|
||||
#{links.join("\n")}
|
||||
eos
|
||||
|
||||
PostCreator.new(evil_trout, raw: raw, topic_id: topic.id).create
|
||||
PostCreator.new(evil_trout, raw: raw, topic_id: topic.id).create
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
@ -1,10 +1,10 @@
|
||||
# cdn related tasks
|
||||
# cdn related tasks
|
||||
#
|
||||
desc 'pre-stage assets on cdn'
|
||||
task 'assets:prestage' => :environment do |t|
|
||||
require "net/https"
|
||||
require "uri"
|
||||
|
||||
|
||||
config = YAML::load(File.open("#{Rails.root}/config/cdn.yml"))
|
||||
|
||||
# pre-stage css/js only for now
|
||||
@ -17,7 +17,7 @@ task 'assets:prestage' => :environment do |t|
|
||||
puts "pre staging: #{a.join(' ')}"
|
||||
start = Time.now
|
||||
|
||||
uri = URI.parse("https://client.cdn77.com/api/prefetch")
|
||||
uri = URI.parse("https://client.cdn77.com/api/prefetch")
|
||||
http = Net::HTTP.new(uri.host, uri.port)
|
||||
http.use_ssl = true
|
||||
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
||||
@ -36,5 +36,5 @@ task 'assets:prestage' => :environment do |t|
|
||||
raise "Failed to pre-stage"
|
||||
end
|
||||
puts "Done (took: #{((Time.now - start) * 1000.0).to_i}ms)"
|
||||
|
||||
|
||||
end
|
||||
|
@ -1,4 +1,4 @@
|
||||
task "images:compress" => :environment do
|
||||
task "images:compress" => :environment do
|
||||
io = ImageOptim.new
|
||||
images = Dir.glob("#{Rails.root}/app/**/*.png")
|
||||
image_sizes = Hash[*images.map{|i| [i,File.size(i)]}.to_a.flatten]
|
||||
|
@ -1,5 +1,5 @@
|
||||
desc "walk all posts updating cooked with latest markdown"
|
||||
task "posts:rebake" => :environment do
|
||||
task "posts:rebake" => :environment do
|
||||
RailsMultisite::ConnectionManagement.each_connection do |db|
|
||||
puts "Re baking post markdown for #{db} , changes are denoted with # , no change with ."
|
||||
i = 0
|
||||
|
@ -1,10 +1,10 @@
|
||||
task "search:reindex" => :environment do
|
||||
task "search:reindex" => :environment do
|
||||
RailsMultisite::ConnectionManagement.each_connection do |db|
|
||||
puts "Reindexing #{db}"
|
||||
puts ""
|
||||
puts "Posts:"
|
||||
Post.exec_sql("select p.id, p.cooked, c.name category, t.title from
|
||||
posts p
|
||||
Post.exec_sql("select p.id, p.cooked, c.name category, t.title from
|
||||
posts p
|
||||
join topics t on t.id = p.topic_id
|
||||
left join categories c on c.id = t.category_id
|
||||
").each do |p|
|
||||
@ -12,18 +12,18 @@ task "search:reindex" => :environment do
|
||||
cooked = p["cooked"]
|
||||
title = p["title"]
|
||||
category = p["cat"]
|
||||
SearchObserver.update_posts_index(post_id, cooked, title, category)
|
||||
|
||||
SearchObserver.update_posts_index(post_id, cooked, title, category)
|
||||
|
||||
putc "."
|
||||
end
|
||||
|
||||
puts
|
||||
puts
|
||||
puts "Users:"
|
||||
User.exec_sql("select id, name, username from users").each do |u|
|
||||
id = u["id"]
|
||||
name = u["name"]
|
||||
username = u["username"]
|
||||
SearchObserver.update_users_index(id, username, name)
|
||||
SearchObserver.update_users_index(id, username, name)
|
||||
|
||||
putc "."
|
||||
end
|
||||
@ -34,9 +34,9 @@ task "search:reindex" => :environment do
|
||||
Category.exec_sql("select id, name from categories").each do |c|
|
||||
id = c["id"]
|
||||
name = c["name"]
|
||||
SearchObserver.update_categories_index(id, name)
|
||||
SearchObserver.update_categories_index(id, name)
|
||||
end
|
||||
|
||||
|
||||
puts
|
||||
end
|
||||
end
|
||||
|
@ -1,12 +1,12 @@
|
||||
desc "run phantomjs based smoke tests on current build"
|
||||
task "smoke:test" => :environment do
|
||||
|
||||
phantom_path = File.expand_path('~/phantomjs/bin/phantomjs')
|
||||
phantom_path = File.expand_path('~/phantomjs/bin/phantomjs')
|
||||
phantom_path = nil unless File.exists?(phantom_path)
|
||||
phantom_path = phantom_path || 'phantomjs'
|
||||
|
||||
url = ENV["URL"] || Discourse.base_url
|
||||
|
||||
|
||||
puts "Testing: #{url}"
|
||||
|
||||
require 'open-uri'
|
||||
|
@ -1,13 +1,13 @@
|
||||
desc "rebuild the user_actions table"
|
||||
task "user_actions:rebuild" => :environment do
|
||||
o = UserActionObserver.send :new
|
||||
task "user_actions:rebuild" => :environment do
|
||||
o = UserActionObserver.send :new
|
||||
MessageBus.off
|
||||
UserAction.delete_all
|
||||
PostAction.all.each{|i| o.after_save(i)}
|
||||
Topic.all.each {|i| o.after_save(i)}
|
||||
Post.all.each {|i| o.after_save(i)}
|
||||
Notification.all.each {|i| o.after_save(i)}
|
||||
# not really needed but who knows
|
||||
# not really needed but who knows
|
||||
MessageBus.on
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user