From b9e97d22b99f07576241dc5defc4068e79f96961 Mon Sep 17 00:00:00 2001 From: Helio Cola Date: Wed, 13 Mar 2024 03:14:52 -0400 Subject: [PATCH 1/2] A round of cleanups --- .ruby-gemset | 1 + .ruby-version | 1 + .rvmrc | 1 - redcloth.gemspec | 19 ++++++++++++------- spec/custom_tags_spec.rb | 6 +++--- spec/erb_spec.rb | 2 +- spec/extension_spec.rb | 2 +- spec/formatters/html_spec.rb | 4 ++-- spec/formatters/latex_spec.rb | 4 ++-- spec/parser_spec.rb | 8 ++++---- spec/spec_helper.rb | 4 ++-- 11 files changed, 29 insertions(+), 23 deletions(-) create mode 100644 .ruby-gemset create mode 100644 .ruby-version delete mode 100644 .rvmrc diff --git a/.ruby-gemset b/.ruby-gemset new file mode 100644 index 00000000..b63763b0 --- /dev/null +++ b/.ruby-gemset @@ -0,0 +1 @@ +redcloth diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 00000000..b347b11e --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +3.2.3 diff --git a/.rvmrc b/.rvmrc deleted file mode 100644 index 91b91d32..00000000 --- a/.rvmrc +++ /dev/null @@ -1 +0,0 @@ -rvm --create use default@redcloth \ No newline at end of file diff --git a/redcloth.gemspec b/redcloth.gemspec index 620bdb47..3231cf14 100644 --- a/redcloth.gemspec +++ b/redcloth.gemspec @@ -9,12 +9,20 @@ Gem::Specification.new do |s| s.authors = ["Jason Garber", "Joshua Siler", "Ola Bini"] s.description = "Textile parser for Ruby." s.summary = RedCloth::SUMMARY - s.email = "redcloth-upwards@rubyforge.org" s.homepage = "https://github.com/jgarber/redcloth" - s.rubyforge_project = "redcloth" + s.license = "MIT" + s.platform = 'ruby' + s.required_ruby_version = Gem::Requirement.new(">= 2.4") s.rubygems_version = "1.3.7" - s.default_executable = "redcloth" + + if s.respond_to?(:metadata=) + s.metadata = { + "bug_tracker_uri" => "https://github.com/jgarber/redcloth/issues", + "changelog_uri" => "https://github.com/jgarber/redcloth/blob/master/CHANGELOG", + "source_code_uri" => "https://github.com/jgarber/redcloth" + } + end s.files = Dir['.gemtest', '.rspec', 'CHANGELOG', 'COPYING', 'Gemfile', 'README.rdoc', 'Rakefile', 'doc/**/*', 'bin/**/*', 'lib/**/*', 'redcloth.gemspec', 'spec/**/*', 'tasks/**/*'] s.test_files = Dir['spec/**/*'] @@ -26,8 +34,6 @@ Gem::Specification.new do |s| s.files -= Dir['lib/**/*.bundle'] s.files -= Dir['lib/**/*.so'] - s.platform = 'ruby' - s.files += %w[attributes inline scan].map {|f| "ext/redcloth_scan/redcloth_#{f}.c"} s.files += ["ext/redcloth_scan/redcloth.h"] s.extensions = Dir['ext/**/extconf.rb'] @@ -37,5 +43,4 @@ Gem::Specification.new do |s| s.add_development_dependency('rspec', '~> 3.12') s.add_development_dependency('diff-lcs', '~> 1.5') - s.license = "MIT" -end +end \ No newline at end of file diff --git a/spec/custom_tags_spec.rb b/spec/custom_tags_spec.rb index 12b077ab..73947102 100644 --- a/spec/custom_tags_spec.rb +++ b/spec/custom_tags_spec.rb @@ -30,13 +30,13 @@ def fig( opts ) html << %Q{
\n} html << %Q{

The last line of text.

} - r.to_html.should == html + expect(r.to_html).to eq(html) end it "should fall back if custom tag isn't defined" do r = RedCloth.new %Q/fig()>[no]{color:red}. 1.1 | img.jpg/ - r.to_html.should == "

fig()>[no]{color:red}. 1.1 | img.jpg

" + expect(r.to_html).to eq("

fig()>[no]{color:red}. 1.1 | img.jpg

") end it "should not call just regular string methods" do @@ -45,6 +45,6 @@ def fig( opts ) html = "

next.

" - r.to_html.should == html + expect(r.to_html).to eq(html) end end diff --git a/spec/erb_spec.rb b/spec/erb_spec.rb index 992903a5..71c11b65 100644 --- a/spec/erb_spec.rb +++ b/spec/erb_spec.rb @@ -5,6 +5,6 @@ template = %{<%=t "This new ERB tag makes is so _easy_ to use *RedCloth*" %>} expected = %{

This new ERB tag makes is so easy to use RedCloth

} - ERB.new(template).result.should == expected + expect(ERB.new(template).result).to eq(expected) end end \ No newline at end of file diff --git a/spec/extension_spec.rb b/spec/extension_spec.rb index d1cb9941..59818c87 100644 --- a/spec/extension_spec.rb +++ b/spec/extension_spec.rb @@ -20,7 +20,7 @@ def refs_smiley(text) html = %Q{

You’re so silly!

} - RedCloth.new(input).to_html(:textile, :refs_smiley).should == html + expect(RedCloth.new(input).to_html(:textile, :refs_smiley)).to eq(html) end end \ No newline at end of file diff --git a/spec/formatters/html_spec.rb b/spec/formatters/html_spec.rb index ac76a08e..5516e8e3 100644 --- a/spec/formatters/html_spec.rb +++ b/spec/formatters/html_spec.rb @@ -6,8 +6,8 @@ end it "should not raise an error when orphaned parentheses in a link are followed by punctuation and words in HTML" do - lambda { + expect { RedCloth.new(%Q{Test "(read this":http://test.host), ok}).to_html - }.should_not raise_error + }.not_to raise_error end end \ No newline at end of file diff --git a/spec/formatters/latex_spec.rb b/spec/formatters/latex_spec.rb index 404160e6..de6e8bc0 100644 --- a/spec/formatters/latex_spec.rb +++ b/spec/formatters/latex_spec.rb @@ -6,8 +6,8 @@ end it "should not raise an error when orphaned parentheses in a link are followed by punctuation and words in LaTeX" do - lambda { + expect { RedCloth.new(%Q{Test "(read this":http://test.host), ok}).to_latex - }.should_not raise_error + }.not_to raise_error end end \ No newline at end of file diff --git a/spec/parser_spec.rb b/spec/parser_spec.rb index f56c3acc..8a0bb017 100644 --- a/spec/parser_spec.rb +++ b/spec/parser_spec.rb @@ -4,15 +4,15 @@ describe "#new" do it "should accept options" do - lambda { + expect { RedCloth.new("test", [:hard_breaks]) - }.should_not raise_error + }.not_to raise_error end end it "should have a VERSION" do - RedCloth.const_defined?("VERSION").should be_truthy - RedCloth::VERSION.const_defined?("STRING").should be_truthy + expect(RedCloth.const_defined?("VERSION")).to be_truthy + expect(RedCloth::VERSION.const_defined?("STRING")).to be_truthy end it "should show the version as a string" do diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 74a5cae4..761895d3 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -10,11 +10,11 @@ def examples_from_yaml(&block) if doc[formatter] example("should output #{formatter} for #{name}") do output = method("format_as_#{formatter}").call(doc) - output.should == doc[formatter] + expect(output).to eq(doc[formatter]) end else example("should not raise errors when rendering #{formatter} for #{name}") do - lambda { method("format_as_#{formatter}").call(doc) }.should_not raise_error + expect { method("format_as_#{formatter}").call(doc) }.not_to raise_error end end end From c60e5dd9e0fbf5e4422934b8e3f7cbdd91b5fdb9 Mon Sep 17 00:00:00 2001 From: Helio Cola Date: Wed, 13 Mar 2024 03:19:00 -0400 Subject: [PATCH 2/2] Updated CHANGELOG --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 6b27e448..60a5761b 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,6 @@ == 4.3.4 +* A round of cleanups [Helio Cola] * Stop checking for main function in libc [Jean byroot Boussier] * Update maintainer, scrub redcloth.org [Jason Garber] * Add GitHub action [Anton Maminov]