kpumuk commented on code in PR #14:
URL: https://github.com/apache/thrift-website/pull/14#discussion_r3103320147


##########
_plugins/remote_snippets.rb:
##########
@@ -22,7 +22,7 @@ def initialize(tag_name, text, tokens)
   def render(context)
     title = context.registers[:site].config['title']
     prefix = context.registers[:site].config['gitbox_url']
-    url = "#{prefix};a=blob_plain;hb=HEAD;f=#{@path}"
+    url = ENV["THRIFT_DIR"] ? File.new("#{ENV["THRIFT_DIR"]}/#{@path}") : 
"#{prefix};a=blob_plain;hb=HEAD;f=#{@path}"

Review Comment:
   I left it here to support future development. The site is slightly outdated, 
with a lot of pages that look broken (or are broken). Having no way to test 
locally without first merging changes into Thrift codebase makes the process 
unpredictable, while waiting for 2 minutes for the rebuild after each 
adjustment is quite painful.
   
   Compared to the previous change, I found a way to reduce it to a single 
line. While env variable is kind of weird in general, alternative 
(monkey-patching every time and trying not to forget to not commit) is worse :-)
   
   Another idea I tried is making a custom option in `_config.yml`, and then 
something like
   
   ```ruby
   prefix = context.registers[:site].config['gitbox_url']
   thrift_dir = context.registers[:site].config['thrift_dir']
   url = thrift_dir ? File.new("#{thrift_dir}/#{@path}") : 
"#{prefix};a=blob_plain;hb=HEAD;f=#{@path}"
   ```
   
   With the config override to launch like `bundle exec jekyll server --config 
_config.yml,../config-override.yml --watch`, but the developer experience is 
not great for this. Something like 
[this](https://alexplescan.com/posts/2016/03/28/development-environment-config-overrides-in-jekyll/)
 could improve it, but that's even more exotic.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to