Sha256: bfd7be2ecbdcc734e43f97ca7f128741a2d708cc5139ed0879c99867c50475c9

Contents?: true

Size: 1.45 KB

Versions: 18

Compression:

Stored size: 1.45 KB

Contents

class EmailTask
  def initialize language, readme, changelog
    @language   = language
    @readme     = readme
    @changelog  = changelog
    @languages = {
      :en => {
        :release  => 'release',
        :released => 'has been released',
      },
      :ja => {
        :release  => 'リリース',
        :released => 'はリリースしました',
      }
    }
    define_tasks
  end

  private
  def define_tasks
    namespace :email do
      task @language do
        subject = "#{SPEC.name} #{SPEC.version} #{@languages[@language][:release]}"
        title = "#{SPEC.name} #{SPEC.version} #{@languages[@language][:released]}!"
        readme = Hash[*(File.read(@readme).split(/^(=+ .*)$/)[1..-1])]
        description = readme[readme.keys.find { |x| x =~ /description/i }]
        description = description.split(/\n\n+/).find { |x|
          x.length > 0
        }.gsub(/^\s*/, '')
        urls = readme[readme.keys.find { |x| x =~ /#{SPEC.name}/i }]
        urls = urls.strip.gsub(/\*\s/, '').split(/\n/).map { |s| "* <#{s}>" }
        File.open("email.#{@language}.txt", "wb") { |file|
          file.puts(<<-eomail)
Subject: [ANN] #{subject}

#{title}

#{urls.join("\n")}

#{description}

Changes:

#{File.read(@changelog).split(/^(===.*)/)[1..2].join.strip.gsub(/=/, '#')}

#{urls.join("\n")}
eomail
        }
      end
    end
  end
end

EmailTask.new(:en, 'README.en.rdoc', 'doc/en/NEWS.en.rdoc')
EmailTask.new(:ja, 'README.ja.rdoc', 'doc/ja/NEWS.ja.rdoc')

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
racc-1.4.16-java tasks/email.rb
racc-1.4.16 tasks/email.rb
racc-1.4.15-java tasks/email.rb
racc-1.4.15 tasks/email.rb
racc-1.4.14-java tasks/email.rb
racc-1.4.14 tasks/email.rb
racc-1.4.13-java tasks/email.rb
racc-1.4.13 tasks/email.rb
racc-1.4.12-java tasks/email.rb
racc-1.4.12 tasks/email.rb
racc-1.4.11 tasks/email.rb
gd-racc-1.4.11 tasks/email.rb
racc-1.4.10 tasks/email.rb
racc-1.4.9-java tasks/email.rb
racc-1.4.9 tasks/email.rb
racc-1.4.8 tasks/email.rb
racc-1.4.7 tasks/email.rb
racc-1.4.6 tasks/email.rb