yahns Ruby server user/dev discussion
 help / color / Atom feed
b776c4af3749002e27571b62ecb638ea562a4717 blob 2486 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
 
# Copyright (C) 2013-2016 all contributors <yahns-public@yhbt.net>
# License: GPL-3.0+ (https://www.gnu.org/licenses/gpl-3.0.txt)
require 'tempfile'
include Rake::DSL

gendocs = %w(NEWS NEWS.atom.xml)
task rsync_docs: gendocs do
  dest = ENV["RSYNC_DEST"] || "yhbt.net:/srv/yhbt/yahns/"
  top = %w(INSTALL HACKING README COPYING)

  # git-set-file-times is distributed with rsync,
  # Also available at: https://yhbt.net/git-set-file-times
  # on Debian systems: /usr/share/doc/rsync/scripts/git-set-file-times.gz
  sh("git", "set-file-times", "Documentation", "examples", *top)
  make = ENV['MAKE'] || 'make'
  sh(%Q(#{make} -C Documentation))

  do_gzip = lambda do |txt|
    gz = "#{txt}.gz"
    tmp = "#{gz}.#$$"
    sh("gzip --rsyncable -9 < #{txt} > #{tmp}")
    st = File.stat(txt)
    File.utime(st.atime, st.mtime, tmp) # make nginx gzip_static happy
    File.rename(tmp, gz)
    gz
  end

  files = `git ls-files Documentation/*.txt`.split(/\n/)
  files.concat(top)
  files.concat(gendocs)
  files.concat(%w(yahns yahns-rackup yahns_config).map! { |x|
    "Documentation/#{x}.txt"
  })
  gzfiles = files.map { |txt| do_gzip.call(txt) }
  files.concat(gzfiles)

  sh("rsync --chmod=Fugo=r -av #{files.join(' ')} #{dest}")

  examples = `git ls-files examples`.split(/\n/)
  gzex = examples.map { |txt| do_gzip.call(txt) }
  examples.concat(gzex)

  sh("rsync --chmod=Fugo=r -av #{examples.join(' ')} #{dest}/examples/")
end

def tags
  timefmt = '%Y-%m-%dT%H:%M:%SZ'
  @tags ||= `git tag -l`.split(/\n/).map do |tag|
    if %r{\Av[\d\.]+} =~ tag
      header, subject, body = `git cat-file tag #{tag}`.split(/\n\n/, 3)
      header = header.split(/\n/)
      tagger = header.grep(/\Atagger /).first
      body ||= "initial"
      time = Time.at(tagger.split(/ /)[-2].to_i).utc
      {
        time_obj: time,
        time: time.strftime(timefmt),
        tagger_name: %r{^tagger ([^<]+)}.match(tagger)[1].strip,
        tagger_email: %r{<([^>]+)>}.match(tagger)[1].strip,
        id: `git rev-parse refs/tags/#{tag}`.chomp!,
        tag: tag,
        subject: subject,
        body: body,
      }
    end
  end.compact.sort { |a,b| b[:time] <=> a[:time] }
end

desc 'prints news as an Atom feed'
task "NEWS.atom.xml" do
  # gem install 'olddoc', 'olddoc prepare' has no API besides the
  # command-line.  This requires olddoc 1.1 or later.
  system('olddoc', 'prepare') or abort "olddoc prepare failed #$?"
end

desc 'prints news as a text file'
task 'NEWS' => 'NEWS.atom.xml'
debug log:

solving b776c4a ...
found b776c4a in https://yhbt.net/yahns.git

yahns Ruby server user/dev discussion

Archives are clonable:
	git clone --mirror https://yhbt.net/yahns-public
	git clone --mirror http://ou63pmih66umazou.onion/yahns-public

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.lang.ruby.yahns
	nntp://ou63pmih66umazou.onion/inbox.comp.lang.ruby.yahns

 note: .onion URLs require Tor: https://www.torproject.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox