diff --git a/Dockerfile b/Dockerfile index 0d511180..e544ff13 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,38 +1,67 @@ -FROM ubuntu:trusty +FROM ubuntu:focal RUN apt-get update -qq -RUN apt-get install -y apt-transport-https +RUN apt-get install -y \ + apt-transport-https \ + locales \ + software-properties-common \ + curl \ + gnupg2 -RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 379CE192D401AB61 -RUN echo "deb https://dl.bintray.com/nxadm/rakudo-pkg-debs `lsb_release -cs` main" | tee -a /etc/apt/sources.list.d/rakudo-pkg.list +# add the Raku repository +RUN curl -1sLf 'https://dl.cloudsmith.io/public/nxadm-pkgs/rakudo-pkg/gpg.0DD4CA7EB1C6CC6B.key' | gpg --dearmor >> /usr/share/keyrings/nxadm-pkgs-rakudo-pkg-archive-keyring.gpg +RUN curl -1sLf 'https://dl.cloudsmith.io/public/nxadm-pkgs/rakudo-pkg/config.deb.txt?distro=ubuntu&codename=focal&component=main' > /etc/apt/sources.list.d/nxadm-pkgs-rakudo-pkg.list +# add the Node.js repository +RUN curl -1sLf https://deb.nodesource.com/setup_20.x | bash RUN apt-get update -qq RUN apt-get install -y \ - perl rakudo-pkg curl git build-essential \ - libssl-dev libreadline-dev zlib1g-dev \ - libicu-dev cmake pkg-config + perl \ + rakudo-pkg \ + git \ + libssl-dev \ + libreadline-dev \ + zlib1g-dev \ + libicu-dev \ + cmake \ + build-essential \ + g++ \ + pkg-config \ + nodejs \ + libffi-dev \ + libyaml-dev \ + gcc \ + libxslt-dev \ + libxml2-dev \ + zlib1g-dev \ + libidn11-dev ENV PATH $PATH:/opt/rakudo-pkg/bin -RUN install-zef-as-user && zef install Pod::To::HTML +RUN install-zef +ENV PATH $PATH:/root/.raku/bin +RUN zef install Pod::To::HTML2 RUN curl -L http://cpanmin.us | perl - App::cpanminus RUN cpanm --installdeps --notest Pod::Simple +# Install Rbenv and Ruby +RUN git clone https://github.com/rbenv/rbenv.git ~/.rbenv && echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc && echo 'eval "$(rbenv init -)"' >> ~/.bashrc +RUN git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build ENV PATH $PATH:/root/.rbenv/bin:/root/.rbenv/shims -RUN curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-installer | bash -RUN rbenv install 2.4.1 -RUN rbenv global 2.4.1 -RUN rbenv rehash +RUN cd /root/.rbenv/plugins/ruby-build && git pull && cd - +ENV RUBY_VERSION 3.3.0 +RUN rbenv install $RUBY_VERSION && rbenv global $RUBY_VERSION && rbenv rehash +RUN echo 'gem: --no-rdoc --no-ri' >> /.gemrc +RUN gem install bundler:2.4.22 -RUN gem install bundler +RUN bundle config --global build.nokogiri --use-system-libraries RUN dpkg -i https://github.com/jgm/pandoc/releases/download/3.1.12.1/pandoc-3.1.12.1-linux-amd64.tar.gz WORKDIR /data/github-markup COPY github-markup.gemspec . COPY Gemfile . -COPY Gemfile.lock . -COPY lib/github-markup.rb lib/github-markup.rb +ADD lib ./lib RUN bundle ENV LC_ALL en_US.UTF-8 diff --git a/Gemfile b/Gemfile index a6982244..0e1aa030 100644 --- a/Gemfile +++ b/Gemfile @@ -1,18 +1,19 @@ source "http://rubygems.org" gemspec +gem "nokogiri", force_ruby_platform: true gem "posix-spawn", :platforms => :ruby gem "redcarpet", :platforms => :ruby gem "kramdown", :platforms => :jruby gem "RedCloth" -# using a tag version here because 0.18.3 was not published by the author to encourage users to upgrade. -# however we want to bump up to this version since this has a security patch -gem "commonmarker" -gem "rdoc", "~>3.6" -gem "org-ruby", "= 0.9.9" -gem "creole", "~>0.3.6" +gem "commonmarker", "= 1.0.4" +gem 'rdoc', '~> 6.6', '>= 6.6.2' +gem 'org-ruby', '~> 0.9.12' +gem 'creole', '~> 0.5.0' +gem 'idn-ruby', '~> 0.1.5' +gem 'twitter-text', '~> 3.1' gem "wikicloth", "=0.8.3" -gem "twitter-text", "~> 1.14" -gem "asciidoctor", "~> 2.0.5" -gem "rake", "~> 12" -gem "pandoc-ruby", "= 2.1.10" +gem 'asciidoctor', '~> 2.0', '>= 2.0.21' +gem 'rake', '~> 13.1' +gem 'pandoc-ruby', '~> 2.1', '>= 2.1.10' + diff --git a/github-markup.gemspec b/github-markup.gemspec index 594d3507..e4da71d2 100644 --- a/github-markup.gemspec +++ b/github-markup.gemspec @@ -1,30 +1,38 @@ -require File.expand_path("../lib/github-markup", __FILE__) - -Gem::Specification.new do |s| - s.name = "github-markup" - s.version = GitHub::Markup::VERSION - s.summary = "The code GitHub uses to render README.markup" - s.description = <<~DESC - This gem is used by GitHub to render any fancy markup such as Markdown, - Textile, Org-Mode, etc. Fork it and add your own! - DESC - s.authors = ["Chris Wanstrath"] - s.email = "chris@ozmm.org" - s.homepage = "https://github.com/github/markup" - s.license = "MIT" - - s.files = `git ls-files`.split($\) - s.files += Dir['vendor/**/*'] - s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) } - s.test_files = s.files.grep(%r{^(test|spec|features)/}) - s.require_paths = %w[lib] - - s.add_development_dependency 'rake', '~> 12' - s.add_development_dependency 'activesupport', '~> 4.0' - s.add_development_dependency 'minitest', '~> 5.4', '>= 5.4.3' - s.add_development_dependency 'html-pipeline', '~> 1.0' - s.add_development_dependency 'sanitize', '>= 4.6.3' - s.add_development_dependency 'nokogiri', '~> 1.8.1' - s.add_development_dependency 'nokogiri-diff', '~> 0.2.0' - s.add_development_dependency "github-linguist", ">= 7.1.3" -end +# frozen_string_literal: true + +require_relative "lib/github/markup/version" + +Gem::Specification.new do |spec| + spec.name = "github-markup" + spec.version = GitHub::Markup::VERSION + spec.homepage = "https://github.com/github/markup" + spec.summary = "The code GitHub uses to render README.markup" + spec.description = <<~DESC + This gem is used by GitHub to render any fancy markup such as Markdown, + Textile, Org-Mode, etc. Fork it and add your own! +DESC + spec.authors = ["Chris Wanstrath", "Rob Crouch"] + spec.license = "MIT" + + spec.metadata = { + "bug_tracker_uri" => "https://github.com/github/markup/issues", + "source_code_uri" => "https://github.com/github/markup" + } + + spec.required_ruby_version = ">= 2.4" + + spec.files = Dir.glob("lib/**/*", File::FNM_DOTMATCH) + spec.executables = spec.files.grep(%r{^bin/}).map{ |f| File.basename(f) } + spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) + + spec.add_development_dependency 'rake', '~> 13.1' + spec.add_development_dependency 'activesupport', '~> 7.1', '>= 7.1.3.2' + spec.add_development_dependency 'minitest', '~> 5.4', '>= 5.4.3' + spec.add_development_dependency 'html-pipeline', '~> 1.0' + spec.add_development_dependency "sanitize", "~> 4.6", ">= 4.6.3" + spec.add_development_dependency 'nokogiri', '~> 1.8.1' + spec.add_development_dependency 'nokogiri-diff', '~> 0.2.0' + spec.add_development_dependency "github-linguist", "~> 7.1", ">= 7.1.3" + + +end \ No newline at end of file diff --git a/lib/github-markup.rb b/lib/github-markup.rb index 58f9b1c5..7262d652 100644 --- a/lib/github-markup.rb +++ b/lib/github-markup.rb @@ -1,6 +1,6 @@ module GitHub module Markup - VERSION = '4.0.2' + VERSION = '4.0.3' Version = VERSION end end diff --git a/lib/github/markup/version.rb b/lib/github/markup/version.rb new file mode 100644 index 00000000..98a2d3e3 --- /dev/null +++ b/lib/github/markup/version.rb @@ -0,0 +1,6 @@ +module GitHub + module Markup + VERSION = '4.0.3' + Version = VERSION + end +end \ No newline at end of file diff --git a/lib/github/markups.rb b/lib/github/markups.rb index 79e53216..df7f4bea 100644 --- a/lib/github/markups.rb +++ b/lib/github/markups.rb @@ -48,8 +48,8 @@ Asciidoctor.convert(content, :safe => :secure, :attributes => attributes) end -markup(::GitHub::Markups::MARKUP_RST, :rest2html, /re?st(\.txt)?/, ["reStructuredText"]) do |filename, content, options: {}| - PandocRuby.convert(content, :from => 'rst', :to => 'html') +markup(::GitHub::Markups::MARKUP_RST, :rst, /re?st(\.txt)?/, ["reStructuredText"]) do |filename, content, options: {}| + PandocRuby.new(content, from: 'rst').to_html end command(::GitHub::Markups::MARKUP_POD6, :pod62html, /pod6/, ["Pod 6"], "pod6") diff --git a/script/bootstrap b/script/bootstrap index f89f3181..6b87f215 100755 --- a/script/bootstrap +++ b/script/bootstrap @@ -5,4 +5,4 @@ set -e cd $(dirname "$0")/.. bundle install -pip3 install docutils + diff --git a/script/bootstrap.contrib b/script/bootstrap.contrib index 834b6b61..3c0a38bd 100755 --- a/script/bootstrap.contrib +++ b/script/bootstrap.contrib @@ -5,11 +5,8 @@ set -e cd $(dirname "$0")/.. bundle install --path vendor/bundle -virtualenv vendor/python && source vendor/python/bin/activate -pip install docutils echo "" echo "*** DONE ***" echo "" -echo "activate python environment with 'source vendor/python/bin/activate'" echo "run tests with 'bundle exec rake'" diff --git a/script/cibuild b/script/cibuild index 33251773..6d6fd2b5 100755 --- a/script/cibuild +++ b/script/cibuild @@ -10,7 +10,7 @@ export RUBY_HEAP_SLOTS_INCREMENT=400000 export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1 export PATH="/usr/share/rbenv/shims:$PATH" -export RBENV_VERSION="1.9.3" +export RBENV_VERSION="3.3.0" # bootstrap gem environment changes echo "Bootstrapping gem environment ..." diff --git a/test/markup_test.rb b/test/markup_test.rb index 24e78000..bd296ff7 100644 --- a/test/markup_test.rb +++ b/test/markup_test.rb @@ -5,6 +5,7 @@ require 'github/markup' require 'minitest/autorun' require 'html/pipeline' +require 'sanitize' require 'nokogiri' require 'nokogiri/diff'