olddoc user/dev discussion/patches/bugs/etc
 help / color / mirror / code / Atom feed
* [PATCH] allow multiple rdoc_url and cgit_url values
@ 2020-07-26  2:15 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2020-07-26  2:15 UTC (permalink / raw)
  To: olddoc-public

Might as well, since domain name ownership is a shaky thing
and ICANN may try to screw the world over once again.
---
 lib/olddoc/history.rb   |  2 +-
 lib/olddoc/news_atom.rb |  4 ++--
 lib/olddoc/prepare.rb   |  4 ++--
 lib/oldweb.rb           | 20 ++++++++++----------
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/lib/olddoc/history.rb b/lib/olddoc/history.rb
index dcdf0fe..800446e 100644
--- a/lib/olddoc/history.rb
+++ b/lib/olddoc/history.rb
@@ -9,7 +9,7 @@ module Olddoc::History # :nodoc:
 
   # returns a cgit URI for a given +tag_name+
   def tag_uri(tag_name)
-    uri = @cgit_uri.dup
+    uri = @cgit_uri[0].dup
     uri.path += "/tag/"
     uri.query = "id=#{tag_name}"
     uri
diff --git a/lib/olddoc/news_atom.rb b/lib/olddoc/news_atom.rb
index ed01197..39f9bb8 100644
--- a/lib/olddoc/news_atom.rb
+++ b/lib/olddoc/news_atom.rb
@@ -32,9 +32,9 @@ module Olddoc::NewsAtom # :nodoc:
   def news_atom_xml
     project_name, short_desc, _ = readme_metadata
     new_tags = tags[0,10]
-    atom_uri = @rdoc_uri.dup
+    atom_uri = @rdoc_uri[0].dup
     atom_uri.path += "NEWS.atom.xml"
-    news_uri = @rdoc_uri.dup
+    news_uri = @rdoc_uri[0].dup
     news_uri.path += "NEWS.html"
 
     dst = ''
diff --git a/lib/olddoc/prepare.rb b/lib/olddoc/prepare.rb
index f902fff..f0e6329 100644
--- a/lib/olddoc/prepare.rb
+++ b/lib/olddoc/prepare.rb
@@ -12,8 +12,8 @@ class Olddoc::Prepare # :nodoc:
     cgit_url = opts['cgit_url']
     rdoc_url && cgit_url or
       abort "rdoc_url and cgit_url required in .olddoc.yml for `prepare'"
-    @rdoc_uri = URI.parse(rdoc_url)
-    @cgit_uri = URI.parse(cgit_url)
+    @rdoc_uri = Array(rdoc_url).map { |u| URI.parse(u) }
+    @cgit_uri = Array(cgit_url).map { |u| URI.parse(u) }
     @name, @short_desc = readme_metadata
   end
 
diff --git a/lib/oldweb.rb b/lib/oldweb.rb
index 74b4db1..3b2b2f2 100644
--- a/lib/oldweb.rb
+++ b/lib/oldweb.rb
@@ -73,23 +73,23 @@ class Oldweb
     noindex = @old_cfg['noindex'] and noindex.each { |k| ni[k] = true }
     @old_cfg['noindex'] = ni
 
-    cgit_url = @old_cfg['cgit_url']
+    cgit_url = Array(@old_cfg['cgit_url'])
     source = @old_cfg['source_code'] ||= []
     if source.empty?
-      if cgit_url
-        source << "git clone #{cgit_url}"
-      end
+      source << "git clone #{cgit_url[0]}" if cgit_url[0]
       git_url = @old_cfg['git_url']
-      if git_url && git_url != cgit_url
+      if git_url && git_url != cgit_url[0]
         source << "git clone #{git_url}"
       end
     end
 
-    if cgit_url
-      cgit_url += '/tree/%s' # path name
-      tag = @git_tag and cgit_url << "id=#{CGI.escape(tag)}"
-      cgit_url << '#n%d' # lineno
-      @old_vcs_url = cgit_url
+    if cgit_url[0]
+      cgit_url.each do |u|
+        u += '/tree/%s' # path name
+        tag = @git_tag and u << "id=#{CGI.escape(tag)}"
+        u << '#n%d' # lineno
+      end
+      @old_vcs_url = cgit_url[0]
     end
     @oldweb_style = nil # used by dark216
   end

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-07-26  2:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-26  2:15 [PATCH] allow multiple rdoc_url and cgit_url values Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/olddoc.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).