diff --git a/Rakefile.rb b/Rakefile.rb index 6c70521e8c..831c2cc3d2 100644 --- a/Rakefile.rb +++ b/Rakefile.rb @@ -25,6 +25,12 @@ def minimal_boot AresMUSH::Install.configure_game end +task :add_plugin, [:plugin_name] do |t, args| + minimal_boot + plugin_name = args[:plugin_name] + importer = AresMUSH::Manage::PluginImporter.new(plugin_name) + importer.import +end task :webexport do minimal_boot diff --git a/bin/addplugin b/bin/addplugin new file mode 100755 index 0000000000..a0922b264b --- /dev/null +++ b/bin/addplugin @@ -0,0 +1,2 @@ +bundle install +bundle exec rake add_plugin[$*] \ No newline at end of file diff --git a/bin/install b/bin/install index 21aa4790eb..a650f75806 100755 --- a/bin/install +++ b/bin/install @@ -60,6 +60,18 @@ bin/configure bin/wipedb +echo -e "${ARES_INSTALL_TEXT} Creating game dir link." + +cd /var/www/html/ + +ln -s /home/ares/aresmush/game game + +echo -e "${ARES_INSTALL_TEXT} Starting game" + +cd /home/ares/aresmush + +bin/startares + echo -e "${ARES_INSTALL_TEXT} Setup the web portal." cd /home/ares/ares-webportal @@ -75,19 +87,7 @@ nvm install node echo -e "${ARES_INSTALL_TEXT} Ember CLI" npm install -g ember-cli -echo -e "${ARES_INSTALL_TEXT} Bower for web dependencies" -npm install -g bower - -echo -e "${ARES_INSTALL_TEXT} Creating game dir link." - -cd /var/www/html/ - -ln -s /home/ares/aresmush/game game - -echo -e "${ARES_INSTALL_TEXT} Starting game" - -cd /home/ares/aresmush - -bin/startares +bin/install +bin/deploy echo -e "${ARES_INSTALL_TEXT} Done!" \ No newline at end of file diff --git a/bin/local_setup_mac b/bin/local_setup_mac new file mode 100644 index 0000000000..f0bd69708e --- /dev/null +++ b/bin/local_setup_mac @@ -0,0 +1,15 @@ +brew update +brew install yarn +brew install git +brew install redis +brew install node + +command curl -sSL https://rvm.io/mpapis.asc | gpg --import - +\curl -sSL https://get.rvm.io | bash -s stable --rails +source /home/ares/.rvm/scripts/rvm +rvm install ruby-2.4.1 +rvm use ruby-2.4.1 + +gem install bundler + +npm install -g ember-cli diff --git a/bin/local_setup_windows b/bin/local_setup_windows new file mode 100644 index 0000000000..cc02e73c29 --- /dev/null +++ b/bin/local_setup_windows @@ -0,0 +1,11 @@ +choco install git +choco install yarn +choco install redis-64 +choco install github +choco install nodejs.install +choco install ruby --version 2.4.3.1 +choco install ruby2.devkit + +gem install bundler + +npm install -g ember-cli diff --git a/engine/aresmush/templates/handlebars_template.rb b/engine/aresmush/templates/handlebars_template.rb index c0819597d0..54d7e4662a 100644 --- a/engine/aresmush/templates/handlebars_template.rb +++ b/engine/aresmush/templates/handlebars_template.rb @@ -1,8 +1,13 @@ module AresMUSH + mattr_accessor :handlebars_context + class HandlebarsTemplate def initialize(file) template = File.read(file) - @handlebars = Handlebars::Context.new + if (!AresMUSH.handlebars_context) + AresMUSH.handlebars_context = Handlebars::Context.new + end + @handlebars = AresMUSH.handlebars_context template_contents = File.read(file) @template = @handlebars.compile(template_contents) diff --git a/game/config/fs3combat_hitloc.yml b/game/config/fs3combat_hitloc.yml index 41a87d2126..d20f9e755e 100644 --- a/game/config/fs3combat_hitloc.yml +++ b/game/config/fs3combat_hitloc.yml @@ -13,7 +13,6 @@ fs3combat: Right Hand: [ 'Chest', 'Chest', 'Abdomen', 'Abdomen', 'Right Arm', 'Right Arm', 'Right Arm', 'Left Hand', 'Left Hand', 'Left Hand' ] Left Arm: [ 'Head', 'Chest', 'Chest', 'Abdomen', 'Abdomen', 'Left Hand', 'Left Hand', 'Left Arm', 'Left Arm', 'Left Hand' ] Right Arm: [ 'Head', 'Chest', 'Chest', 'Abdomen', 'Abdomen', 'Right Hand', 'Right Hand', 'Right Arm', 'Right Arm', 'Right Hand' ] - Abdomen: [ 'Head', 'Chest', 'Chest', 'Left Leg', 'Left Leg', 'Right Leg', 'Right Leg', 'Abdomen', 'Abdomen', 'Abdomen' ] Head: [ 'Right Arm', 'Right Arm', 'Left Arm', 'Chest', 'Chest', 'Neck', 'Neck', 'Head', 'Head', 'Head' ] Neck: [ 'Right Arm', 'Right Arm', 'Left Arm', 'Chest', 'Chest', 'Head', 'Head', 'Neck', 'Neck', 'Neck' ] Abdomen: [ 'Left Leg', 'Right Leg', 'Left Leg', 'Right Leg', 'Chest', 'Chest', 'Chest', 'Abdomen', 'Abdomen', 'Abdomen' ] diff --git a/game/config/fs3combat_misc.yml b/game/config/fs3combat_misc.yml index 1cc4b310f8..2bc677ad5b 100644 --- a/game/config/fs3combat_misc.yml +++ b/game/config/fs3combat_misc.yml @@ -95,7 +95,6 @@ fs3combat: defense_skill: None shortcuts: - "weapons": "weapon" "combat/skill": "combat/summary" "combat/skills": "combat/summary" "combat/slackers": "combat/summary" diff --git a/game/config/fs3skills_chargen.yml b/game/config/fs3skills_chargen.yml index 896a7bff80..0b3cff6111 100644 --- a/game/config/fs3skills_chargen.yml +++ b/game/config/fs3skills_chargen.yml @@ -22,7 +22,7 @@ fs3skills: 3: 4 max_points_on_attrs: 12 - max_points_on_action: 25 + max_points_on_action: 28 unusual_skills: - Celtan diff --git a/game/config/scenes.yml b/game/config/scenes.yml index f030f636b4..125296efa2 100644 --- a/game/config/scenes.yml +++ b/game/config/scenes.yml @@ -33,7 +33,6 @@ scenes: "scene/name" : "scene/title" "scene/info" : "scene" "scene/rename" : "scene/title" - "repose/notify" : "repose/nudge" "repose/log" : "repose/all" "repose/reset": "repose/clear" "repose/gag": "repose/nudge mute" diff --git a/game/config/website.yml b/game/config/website.yml index a490ac8741..5970574fd3 100644 --- a/game/config/website.yml +++ b/game/config/website.yml @@ -13,4 +13,4 @@ website: portal_requires_registration: false - website_code_path: '~/ares-webportal' \ No newline at end of file + website_code_path: '/home/ares/ares-webportal' \ No newline at end of file diff --git a/game/version.txt b/game/version.txt index aec258df73..b63ba696b7 100644 --- a/game/version.txt +++ b/game/version.txt @@ -1 +1 @@ -0.8 +0.9 diff --git a/install/configure_game.rb b/install/configure_game.rb index 4724d3802f..6e72bcabc5 100644 --- a/install/configure_game.rb +++ b/install/configure_game.rb @@ -13,7 +13,7 @@ def self.error_if_blank(current, name) def self.configure_game template_path = File.join(File.dirname(__FILE__), 'templates') - puts "\nLet's set up your database. Please enter the requested information." + puts "\nLet's set up your database. The default options should suffice unless you've done something unusual with your Redis installation." print "Database url (default 127.0.0.1:6379)> " db_url = STDIN.gets.chomp diff --git a/install/upgrades/036-0.9_upgrade.rb b/install/upgrades/036-0.9_upgrade.rb new file mode 100644 index 0000000000..7f7995b2c2 --- /dev/null +++ b/install/upgrades/036-0.9_upgrade.rb @@ -0,0 +1,14 @@ +module AresMUSH + + puts "=======================================================================" + puts "Add timestamps to channel history. " + puts "=======================================================================" + + + Channel.all.each do |c| + messages = c.messages + new_messages = c.messages.map { |m| { message: m, timestamp: DateTime.now }} + c.update(messages: new_messages) + end + puts "Upgrade complete!" +end \ No newline at end of file diff --git a/plugins/channels/commands/channel_recall_cmd.rb b/plugins/channels/commands/channel_recall_cmd.rb index 207492c531..97f1708085 100644 --- a/plugins/channels/commands/channel_recall_cmd.rb +++ b/plugins/channels/commands/channel_recall_cmd.rb @@ -25,9 +25,9 @@ def handle Channels.with_an_enabled_channel(self.name, client, enactor) do |channel| total_messages = channel.messages.count start_message = [ (total_messages - self.num_messages), 0 ].max - messages = channel.messages[start_message, total_messages].map { |m| " #{channel.display_name} #{m}" } - - template = BorderedListTemplate.new messages, t('channels.recall_history', :name => channel.display_name(false)) + messages = channel.messages[start_message, total_messages] + list = messages.map { |m| " [#{OOCTime.local_long_timestr(enactor, m['timestamp'])}] #{channel.display_name} #{m['message']}"} + template = BorderedListTemplate.new list, t('channels.recall_history', :name => channel.display_name(false)) client.emit template.render end end diff --git a/plugins/channels/commands/channel_report_cmd.rb b/plugins/channels/commands/channel_report_cmd.rb index 894ba8976a..c19b81f383 100644 --- a/plugins/channels/commands/channel_report_cmd.rb +++ b/plugins/channels/commands/channel_report_cmd.rb @@ -17,12 +17,13 @@ def required_args def handle Channels.with_an_enabled_channel(self.name, client, enactor) do |channel| - total_messages = channel.messages.count + messages = channel.messages.map { |m| " [#{OOCTime.local_long_timestr(enactor, m['timestamp'])}] #{channel.display_name} #{m['message']}"}.join("%R") body = t('channels.channel_reported_body', :name => channel.name, :reporter => enactor_name) body << self.reason body << "%R-------%R" - body << channel.messages.map { |m| " #{m}" }.join('%R') + body << messages + Jobs.create_job(Jobs.trouble_category, t('channels.channel_reported_title'), body, Game.master.system_character) client.emit_success t('channels.channel_reported') diff --git a/plugins/channels/public/channel.rb b/plugins/channels/public/channel.rb index ebf0dbe431..f19bd54705 100644 --- a/plugins/channels/public/channel.rb +++ b/plugins/channels/public/channel.rb @@ -41,7 +41,7 @@ def display_name(include_markers = true) def add_to_history(msg) return if !self.recall_enabled - new_messages = (self.messages << msg) + new_messages = (self.messages << { message: msg, timestamp: DateTime.now }) if (new_messages.count > 25) new_messages.shift end diff --git a/plugins/channels/web/chat_request_handler.rb b/plugins/channels/web/chat_request_handler.rb index d1b9cde018..c0a3b03731 100644 --- a/plugins/channels/web/chat_request_handler.rb +++ b/plugins/channels/web/chat_request_handler.rb @@ -18,7 +18,15 @@ def handle(request) name: c.name, enabled: Channels.is_on_channel?(enactor, c), allowed: Channels.can_use_channel(enactor, c), - messages: Channels.is_on_channel?(enactor, c) ? c.messages.map { |m| WebHelpers.format_markdown_for_html(m) } : nil + who: Channels.channel_who(c).map { |w| { + name: w.name, + ooc_name: w.ooc_name, + icon: WebHelpers.icon_for_char(w), + muted: Channels.is_muted?(w, c) + }}, + messages: Channels.is_on_channel?(enactor, c) ? c.messages.map { |m| { + message: WebHelpers.format_markdown_for_html(m['message']), + timestamp: OOCTime.local_long_timestr(enactor, m['timestamp']) }} : nil }} { diff --git a/plugins/forum/forum.rb b/plugins/forum/forum.rb index 687eb23b5c..a355103bd1 100644 --- a/plugins/forum/forum.rb +++ b/plugins/forum/forum.rb @@ -85,6 +85,8 @@ def self.get_web_request_handler(request) return ForumTopicRequestHandler when "forumUnread" return ForumUnreadRequestHandler + when "forumRecent" + return RecentForumPostsRequestHandler end end diff --git a/plugins/forum/public/bbs_post.rb b/plugins/forum/public/bbs_post.rb index 7de5768fd4..1cc9086700 100644 --- a/plugins/forum/public/bbs_post.rb +++ b/plugins/forum/public/bbs_post.rb @@ -22,6 +22,14 @@ def authored_by?(char) char == author end + def last_updated + if (bbs_replies.empty?) + return self.updated_at + else + return bbs_replies.to_a[-1].updated_at + end + end + def author_name !self.author ? t('forum.deleted_author') : self.author.name end diff --git a/plugins/forum/public/bbs_reply.rb b/plugins/forum/public/bbs_reply.rb index 8a7e827086..e49943b60f 100644 --- a/plugins/forum/public/bbs_reply.rb +++ b/plugins/forum/public/bbs_reply.rb @@ -18,5 +18,9 @@ def author_name def created_date_str(char) OOCTime.local_long_timestr(char, self.created_at) end + + def created_date_str_short(char) + OOCTime.local_short_timestr(char, self.created_at) + end end end diff --git a/plugins/forum/web/forum_list_request_handler.rb b/plugins/forum/web/forum_list_request_handler.rb index 8f53793b3b..572adee5c1 100644 --- a/plugins/forum/web/forum_list_request_handler.rb +++ b/plugins/forum/web/forum_list_request_handler.rb @@ -13,6 +13,7 @@ def handle(request) .map { |b| { id: b.id, name: b.name, + description: b.description, unread: enactor && b.has_unread?(enactor) }} diff --git a/plugins/forum/web/recent_forum_posts_request_handler.rb b/plugins/forum/web/recent_forum_posts_request_handler.rb new file mode 100644 index 0000000000..8642977b3a --- /dev/null +++ b/plugins/forum/web/recent_forum_posts_request_handler.rb @@ -0,0 +1,49 @@ +module AresMUSH + module Forum + class RecentForumPostsRequestHandler + def handle(request) + + enactor = request.enactor + + error = WebHelpers.check_login(request, true) + return error if error + + posts = BbsPost.all.select { |p| Forum.can_read_category?(enactor, p.bbs_board ) } + .sort_by { |p| p.last_updated }.reverse[0..6] + + recent = [] + + posts.each do |p| + if (p.bbs_replies.empty?) + recent << { + id: p.id, + category_id: p.bbs_board.id, + author: { + name: p.author_name, + icon: p.author ? WebHelpers.icon_for_char(p.author) : nil + }, + date: p.created_date_str_short(enactor), + subject: p.subject, + is_reply: false + } + else + last_reply = p.bbs_replies.to_a[-1] + recent << { + id: p.id, + category_id: p.bbs_board.id, + author: { + name: last_reply.author_name, + icon: last_reply.author ? WebHelpers.icon_for_char(last_reply.author) : nil + }, + date: last_reply.created_date_str_short(enactor), + subject: p.subject, + is_reply: true + } + end + end + + recent + end + end + end +end \ No newline at end of file diff --git a/plugins/fs3skills/commands/char_backup_command.rb b/plugins/fs3skills/commands/char_backup_command.rb index bae30dd907..e8c81efd6c 100644 --- a/plugins/fs3skills/commands/char_backup_command.rb +++ b/plugins/fs3skills/commands/char_backup_command.rb @@ -18,13 +18,18 @@ def check_permission def handle ClassTargetFinder.with_a_character(self.target, client, enactor) do |model| - Global.dispatcher.queue_command(client, Command.new("sheet #{model.name}")) - Global.dispatcher.queue_command(client, Command.new("bg #{model.name}")) - Global.dispatcher.queue_command(client, Command.new("info #{model.name}")) + + ["sheet", "bg", "profile", "damage", "relationships"].each_with_index do |cmd, seconds| + Global.dispatcher.queue_timer(seconds, "Character backup #{model.name}", client) do + Global.dispatcher.queue_command(client, Command.new("#{cmd} #{model.name}")) + end + end template = Describe.desc_template(model, enactor) client.emit template.render end + + end end end diff --git a/plugins/manage/plugin_importer.rb b/plugins/manage/plugin_importer.rb new file mode 100644 index 0000000000..889186ab5a --- /dev/null +++ b/plugins/manage/plugin_importer.rb @@ -0,0 +1,93 @@ +module AresMUSH + module Manage + class PluginImporter + def initialize(plugin_name) + @tmp_dir = "/tmp/ares-extras" + @plugin_name = plugin_name + @source_dir = File.join(@tmp_dir, @plugin_name) + end + + def import + + #if (Dir.exist?(@tmp_dir)) + # FileUtils.rm_rf @tmp_dir + # end + #`git clone https://github.com/AresMUSH/ares-extras.git /tmp/ares-extras` + + + if (!Dir.exist?(@source_dir)) + puts "ERROR! Directory #{@source_dir} not found." + return + end + + import_plugin + import_game + import_portal + + puts "Plugin #{@plugin_name} added." + end + + def import_plugin + + plugin_dir = File.join(@source_dir, "plugin") + dest_path = File.join(AresMUSH.root_path, "plugins", @plugin_name) + + if (!Dir.exist?(plugin_dir)) + return + end + + if (!Dir.exist?(dest_path)) + Dir.mkdir dest_path + end + + if (!File.exists?(File.join(plugin_dir, "#{@plugin_name}.rb"))) + puts "ERROR! Plugin module file #{@plugin_name}.rb not found. This plugin can't be automatically imported." + return + end + + puts "Copying plugin files to #{dest_path}." + plugin_files = Dir["#{plugin_dir}/*"] + plugin_files.each do |f| + FileUtils.cp_r(f, dest_path) + end + end + + def import_game + + game_dir = File.join(@source_dir, "game") + dest_path = AresMUSH.game_path + + if (!Dir.exist?(game_dir)) + return + end + + puts "Copying game files to #{dest_path}." + game_files = Dir["#{game_dir}/*"] + game_files.each do |f| + FileUtils.cp_r(f, dest_path) + end + end + + def import_portal + web_source_dir = File.join(@source_dir, "webportal") + dest_path = File.join( Global.read_config("website", "website_code_path"), "app" ) + + if (!Dir.exist?(web_source_dir)) + return + end + + if (!Dir.exist?(dest_path)) + puts "WARNING! Web Portal directory #{dest_path} not found. You'll need to install web files manually." + return + end + + puts "Copying web portal files to #{dest_path}." + + web_files = Dir["#{web_source_dir}/*"] + web_files.each do |f| + FileUtils.cp_r(f, dest_path) + end + end + end + end +end \ No newline at end of file diff --git a/plugins/profile/help/en/profile.md b/plugins/profile/help/en/profile.md index a0dfbb72f3..57ac03be19 100644 --- a/plugins/profile/help/en/profile.md +++ b/plugins/profile/help/en/profile.md @@ -16,7 +16,9 @@ Each character has a **character profile** showing various information. Any IC ## Managing Your Profile -The basic fields in your profile will be set up as part of character creation (see [Demographics](/help/demographics)). You can also set custom profile fields for extra things like notes, quotes, etc. These custom fields can display standard MUSH formatting codes (like ansi and linebreaks). See [Formatting](/help/formatting). +The basic fields in your profile will be set up as part of character creation (see [Demographics](/help/demographics)). You can also set custom profile fields for extra things like notes, quotes, etc. These will show up on your web page profile; they're too spammy to show in-game. + +Custom profile fields can use [Markdown](/help/markdown), including images and links. `profile/add =` - Adds or updates a custom profile field `profile/delete ` - Deletes a custom profile field @@ -27,4 +29,4 @@ If you have a handle, people viewing your character profile will also see a link ## Setting Relationships -You can also track IC relationships in your profile. See [ Relationships](/help/relationships). \ No newline at end of file +You can also track IC relationships in your profile. See [Relationships](/help/relationships). \ No newline at end of file diff --git a/plugins/website/public/wiki_page.rb b/plugins/website/public/wiki_page.rb index 30d8a41419..582b5a418d 100644 --- a/plugins/website/public/wiki_page.rb +++ b/plugins/website/public/wiki_page.rb @@ -20,12 +20,11 @@ class WikiPage < Ohm::Model before_delete :delete_versions def self.sanitize_page_name(name) - new_name = AresMUSH::Website::FilenameSanitizer.sanitize(name) - new_name.gsub(' ', '-').downcase + AresMUSH::Website::FilenameSanitizer.sanitize(name) end def self.find_by_name_or_id(name_or_id) - name_or_id = name_or_id.gsub(' ', '-').downcase + name_or_id = WikiPage.sanitize_page_name(name_or_id) page = WikiPage[name_or_id] if (!page) page = find_one_by_name(name_or_id) diff --git a/plugins/website/web/delete_wiki_page_handler.rb b/plugins/website/web/delete_wiki_page_handler.rb index faf6b55f72..05a7d8dcfe 100644 --- a/plugins/website/web/delete_wiki_page_handler.rb +++ b/plugins/website/web/delete_wiki_page_handler.rb @@ -8,7 +8,6 @@ def handle(request) error = WebHelpers.check_login(request) return error if error - name = WikiPage.sanitize_page_name(name) page = WikiPage.find_by_name_or_id(name_or_id) if (!page) return { error: t('webportal.not_found') } diff --git a/plugins/website/web/get_sidebar_info_handler.rb b/plugins/website/web/get_sidebar_info_handler.rb index cbb4b5f19c..59cd4f62b6 100644 --- a/plugins/website/web/get_sidebar_info_handler.rb +++ b/plugins/website/web/get_sidebar_info_handler.rb @@ -6,40 +6,13 @@ def handle(request) error = WebHelpers.check_login(request, true) return error if error - - - sixty_days_in_seconds = 86400 * 60 - recent_profiles = ProfileVersion.all.select { |p| Time.now - p.created_at < sixty_days_in_seconds }.uniq { |p| p.character } - recent_wiki = WikiPageVersion.all.select { |w| Time.now - w.created_at < sixty_days_in_seconds}.uniq { |w| w.wiki_page } - - recent_changes = [] - recent_profiles.each do |p| - recent_changes << { - title: p.character.name, - id: p.id, - change_type: 'char', - created: p.created_at, - name: p.character.name - } - end - recent_wiki.each do |w| - recent_changes << { - title: w.wiki_page.heading, - id: w.id, - change_type: 'wiki', - created: w.created_at, - name: w.wiki_page.name - } - end - - recent_changes = recent_changes.sort_by { |r| r[:created] }[0..10] - { timestamp: Time.now.getutc, game: GetGameInfoRequestHandler.new.handle(request), upcoming_events: Events::UpcomingEventsRequestHandler.new.handle(request), recent_scenes: Scenes::RecentScenesRequestHandler.new.handle(request), + recent_forum: Forum::RecentForumPostsRequestHandler.new.handle(request), happenings: Who::WhoRequestHandler.new.handle(request), unread_mail: enactor ? enactor.unread_mail.count : nil, recent_changes: WebHelpers.get_recent_changes(true, 10), diff --git a/plugins/website/web_helpers.rb b/plugins/website/web_helpers.rb index bccacaa844..7146433052 100644 --- a/plugins/website/web_helpers.rb +++ b/plugins/website/web_helpers.rb @@ -71,23 +71,25 @@ def self.get_recent_changes(unique_only = false, limit = nil) recent_profiles = ProfileVersion.all.select { |p| Time.now - p.created_at < sixty_days_in_seconds } recent_wiki = WikiPageVersion.all.select { |w| Time.now - w.created_at < sixty_days_in_seconds} + if (unique_only) recent_profiles = recent_profiles.sort_by { |p| p.created_at } - .reverse - .uniq { |p| p.character } + .reverse + .uniq { |p| p.character } recent_wiki = recent_wiki.sort_by { |w| w.created_at } - .reverse - .uniq { |w| w.wiki_page } + .reverse + .uniq { |w| w.wiki_page } end - + recent_changes = [] recent_profiles.each do |p| recent_changes << { title: p.character.name, id: p.id, change_type: 'char', - created: p.created_at, + created_at: p.created_at, + created: OOCTime.local_long_timestr(nil, p.created_at), name: p.character.name, author: p.author_name } @@ -97,13 +99,14 @@ def self.get_recent_changes(unique_only = false, limit = nil) title: w.wiki_page.heading, id: w.id, change_type: 'wiki', - created: w.created_at, + created_at: w.created_at, + created: OOCTime.local_long_timestr(nil, w.created_at), name: w.wiki_page.name, author: w.author_name } end - recent_changes = recent_changes.sort_by { |r| r[:created] }.reverse + recent_changes = recent_changes.sort_by { |r| r[:created_at] }.reverse if (limit) recent_changes[0..limit] @@ -124,11 +127,11 @@ def self.rebuild_css def self.deploy_portal(client = nil) Global.dispatcher.spawn("Deploying website", nil) do install_path = Global.read_config('website', 'website_code_path') - path = File.join( install_path, "bin", "deploy" ) - output = `#{path} #{install_path} 2>&1` - - Global.logger.info "Deployed web portal: #{output}" - client.emit_ooc t('webportal.portal_deployed', :output => output) if client + Dir.chdir(install_path) do + output = `bin/deploy 2>&1` + Global.logger.info "Deployed web portal: #{output}" + client.emit_ooc t('webportal.portal_deployed', :output => output) if client + end end end end diff --git a/plugins/website/wiki_exporter.rb b/plugins/website/wiki_exporter.rb index 0ad4330a8f..94a0def89b 100644 --- a/plugins/website/wiki_exporter.rb +++ b/plugins/website/wiki_exporter.rb @@ -2,6 +2,7 @@ module AresMUSH module Website + module WikiExporter def self.export begin @@ -197,7 +198,10 @@ def self.format_wiki_template(text, title) class ExportHandlebarsTemplate def initialize(file) template = File.read(file) - @handlebars = Handlebars::Context.new + if (!AresMUSH.handlebars_context) + AresMUSH.handlebars_context = Handlebars::Context.new + end + @handlebars = AresMUSH.handlebars_context template_contents = File.read(file) @handlebars.register_helper("link-to") do |this, page, param1, param2, block | diff --git a/plugins/website/wiki_markdown/wikidot_compatibility.rb b/plugins/website/wiki_markdown/wikidot_compatibility.rb index b2a77426b0..41a1a12b86 100644 --- a/plugins/website/wiki_markdown/wikidot_compatibility.rb +++ b/plugins/website/wiki_markdown/wikidot_compatibility.rb @@ -46,10 +46,10 @@ def self.parse(matches, sinatra) link = link.after(":") end - url = url.downcase.gsub(' ', '-') if (url.start_with?("char:")) "#{link}" else + url = WikiPage.sanitize_page_name(url) "#{link}" end end