Initialize gem
This commit is contained in:
parent
10d7696e40
commit
34d393f83e
11 changed files with 378 additions and 2 deletions
41
.gitignore
vendored
41
.gitignore
vendored
|
@ -1,3 +1,44 @@
|
|||
*.gem
|
||||
*.rbc
|
||||
*.so
|
||||
|
||||
/.byebug_history
|
||||
/.config/
|
||||
/.rake_tasks~
|
||||
/InstalledFiles/
|
||||
/pkg/
|
||||
/tmp/
|
||||
|
||||
# Used by dotenv library to load environment variables.
|
||||
/.env
|
||||
|
||||
# RSpec configuration and generated files.
|
||||
/.rspec
|
||||
/coverage/
|
||||
/spec/examples.txt
|
||||
/spec/reports/
|
||||
/test/tmp/
|
||||
/test/version_tmp/
|
||||
|
||||
# Documentation cache and generated files.
|
||||
/.yardoc/
|
||||
/_yardoc/
|
||||
/doc/
|
||||
/rdoc/
|
||||
|
||||
# Environment normalization.
|
||||
/.bundle/
|
||||
/vendor/bundle/
|
||||
/lib/bundler/man/
|
||||
|
||||
# For a library or gem, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in.
|
||||
/Gemfile.lock
|
||||
/.ruby-version
|
||||
/.ruby-gemset
|
||||
|
||||
# Unless supporting rvm < 1.11.0 or doing something fancy, ignore this.
|
||||
/.rvmrc
|
||||
|
||||
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
||||
/.rubocop-https?--*
|
||||
|
|
46
.rubocop.yml
Normal file
46
.rubocop.yml
Normal file
|
@ -0,0 +1,46 @@
|
|||
inherit_from: .rubocop_todo.yml
|
||||
|
||||
require:
|
||||
- rubocop-performance
|
||||
- rubocop-rake
|
||||
|
||||
AllCops:
|
||||
TargetRubyVersion: 3.2
|
||||
DisplayCopNames: true
|
||||
NewCops: enable
|
||||
|
||||
Layout/AccessModifierIndentation:
|
||||
EnforcedStyle: outdent
|
||||
|
||||
Layout/LineLength:
|
||||
Max: 80
|
||||
|
||||
Lint/AmbiguousOperatorPrecedence:
|
||||
Enabled: false
|
||||
|
||||
Lint/ReturnInVoidContext:
|
||||
Enabled: false
|
||||
|
||||
Style/AndOr:
|
||||
EnforcedStyle: conditionals
|
||||
|
||||
Style/DoubleNegation:
|
||||
Enabled: false
|
||||
|
||||
Style/HashAsLastArrayItem:
|
||||
Enabled: false
|
||||
|
||||
Style/PerlBackrefs:
|
||||
Enabled: false
|
||||
|
||||
Style/TrailingCommaInArguments:
|
||||
EnforcedStyleForMultiline: comma
|
||||
|
||||
Style/TrailingCommaInArrayLiteral:
|
||||
EnforcedStyleForMultiline: comma
|
||||
|
||||
Style/TrailingCommaInHashLiteral:
|
||||
EnforcedStyleForMultiline: comma
|
||||
|
||||
Style/VariableInterpolation:
|
||||
Enabled: false
|
129
.rubocop_todo.yml
Normal file
129
.rubocop_todo.yml
Normal file
|
@ -0,0 +1,129 @@
|
|||
# This configuration was generated by
|
||||
# `rubocop --auto-gen-config`
|
||||
# on 2024-10-18 14:41:13 UTC using RuboCop version 1.67.0.
|
||||
# The point is for the user to remove these configuration records
|
||||
# one by one as the offenses are removed from the code base.
|
||||
# Note that changes in the inspected code, or installation of new
|
||||
# versions of RuboCop, may require this file to be generated again.
|
||||
|
||||
# Offense count: 2
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: EnforcedStyle, IndentationWidth.
|
||||
# SupportedStyles: with_first_argument, with_fixed_indentation
|
||||
Layout/ArgumentAlignment:
|
||||
Exclude:
|
||||
- 'Rakefile'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: Max, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns.
|
||||
# URISchemes: http, https
|
||||
Layout/LineLength:
|
||||
Exclude:
|
||||
- 'lib/repubmark/elems/footnote.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: AllowedMethods.
|
||||
# AllowedMethods: present?, blank?, presence, try, try!, in?
|
||||
Lint/SafeNavigationChain:
|
||||
Exclude:
|
||||
- 'lib/repubmark/elems/article.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
|
||||
Metrics/AbcSize:
|
||||
Max: 35
|
||||
|
||||
# Offense count: 1
|
||||
# Configuration parameters: CountComments, CountAsOne.
|
||||
Metrics/ClassLength:
|
||||
Max: 104
|
||||
|
||||
# Offense count: 1
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
||||
Metrics/CyclomaticComplexity:
|
||||
Max: 10
|
||||
|
||||
# Offense count: 5
|
||||
# Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
|
||||
Metrics/MethodLength:
|
||||
Max: 33
|
||||
|
||||
# Offense count: 1
|
||||
# Configuration parameters: AllowedMethods, AllowedPatterns.
|
||||
Metrics/PerceivedComplexity:
|
||||
Max: 11
|
||||
|
||||
# Offense count: 2
|
||||
Performance/MapMethodChain:
|
||||
Exclude:
|
||||
- 'lib/repubmark/elems/footnotes_category.rb'
|
||||
|
||||
# Offense count: 14
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: AllowOnlyRestArgument, UseAnonymousForwarding, RedundantRestArgumentNames, RedundantKeywordRestArgumentNames, RedundantBlockArgumentNames.
|
||||
# RedundantRestArgumentNames: args, arguments
|
||||
# RedundantKeywordRestArgumentNames: kwargs, options, opts
|
||||
# RedundantBlockArgumentNames: blk, block, proc
|
||||
Style/ArgumentsForwarding:
|
||||
Exclude:
|
||||
- 'lib/repubmark/elems/canvas.rb'
|
||||
- 'lib/repubmark/elems/footnotes_category.rb'
|
||||
- 'lib/repubmark/elems/joint.rb'
|
||||
- 'lib/repubmark/elems/link.rb'
|
||||
|
||||
# Offense count: 34
|
||||
# Configuration parameters: AllowedConstants.
|
||||
Style/Documentation:
|
||||
Enabled: false
|
||||
|
||||
# Offense count: 7
|
||||
# Configuration parameters: AllowedVariables.
|
||||
Style/GlobalVars:
|
||||
Exclude:
|
||||
- 'exe/repubmark'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: AllowIfModifier.
|
||||
Style/IfInsideElse:
|
||||
Exclude:
|
||||
- 'lib/repubmark/elems/footnote.rb'
|
||||
|
||||
# Offense count: 4
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
Style/RedundantFreeze:
|
||||
Exclude:
|
||||
- 'lib/repubmark/elems/fraction.rb'
|
||||
- 'lib/repubmark/elems/power.rb'
|
||||
|
||||
# Offense count: 2
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
Style/RedundantStringEscape:
|
||||
Exclude:
|
||||
- 'lib/repubmark/elems/footnote.rb'
|
||||
|
||||
# Offense count: 1
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
# Configuration parameters: AllowModifier.
|
||||
Style/SoleNestedConditional:
|
||||
Exclude:
|
||||
- 'lib/repubmark/elems/footnote.rb'
|
||||
|
||||
# Offense count: 7
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
Style/SuperArguments:
|
||||
Exclude:
|
||||
- 'lib/repubmark/elems/annotation.rb'
|
||||
- 'lib/repubmark/elems/blockquote.rb'
|
||||
- 'lib/repubmark/elems/canvas.rb'
|
||||
- 'lib/repubmark/elems/caption.rb'
|
||||
- 'lib/repubmark/elems/figures.rb'
|
||||
- 'lib/repubmark/elems/joint.rb'
|
||||
- 'lib/repubmark/elems/paragraph.rb'
|
||||
|
||||
# Offense count: 24
|
||||
# This cop supports safe autocorrection (--autocorrect).
|
||||
Style/SuperWithArgsParentheses:
|
||||
Enabled: false
|
4
.yardopts
Normal file
4
.yardopts
Normal file
|
@ -0,0 +1,4 @@
|
|||
--markup markdown
|
||||
--readme README.md
|
||||
--protected
|
||||
--private
|
14
Gemfile
14
Gemfile
|
@ -2,5 +2,15 @@
|
|||
|
||||
source 'https://rubygems.org'
|
||||
|
||||
gem 'addressable', '~> 2.8'
|
||||
gem 'i18n', '~> 1.14'
|
||||
# Specify your gem's dependencies in repubmark.gemspec
|
||||
gemspec
|
||||
|
||||
group :development do
|
||||
gem 'bundler', '~> 2.4'
|
||||
gem 'pry', '~> 0.14'
|
||||
gem 'rake', '~> 13.2'
|
||||
gem 'rubocop', '~> 1.67'
|
||||
gem 'rubocop-performance', '~> 1.22'
|
||||
gem 'rubocop-rake', '~> 0.6.0'
|
||||
gem 'yard', '~> 0.9.37'
|
||||
end
|
||||
|
|
70
Rakefile
Normal file
70
Rakefile
Normal file
|
@ -0,0 +1,70 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'bundler/gem_tasks'
|
||||
|
||||
module Bundler
|
||||
class GemHelper
|
||||
def tag_version(*)
|
||||
yield if block_given?
|
||||
end
|
||||
|
||||
def git_push(*); end
|
||||
|
||||
def perform_git_push(*); end
|
||||
end
|
||||
end
|
||||
|
||||
CLEAN << '.yardoc'
|
||||
CLEAN << 'coverage'
|
||||
CLEAN << 'doc'
|
||||
|
||||
desc 'Run default checks'
|
||||
task default: %i[test lint]
|
||||
|
||||
desc 'Run tests'
|
||||
task test: :tests
|
||||
|
||||
desc 'Run code analysis tools'
|
||||
task lint: %i[rubocop yard:cov]
|
||||
|
||||
desc 'Fix code style (rubocop --auto-correct)'
|
||||
task fix: 'rubocop:auto_correct'
|
||||
|
||||
begin
|
||||
require 'rubocop/rake_task'
|
||||
RuboCop::RakeTask.new
|
||||
rescue LoadError
|
||||
nil
|
||||
end
|
||||
|
||||
begin
|
||||
require 'yard'
|
||||
YARD::Rake::YardocTask.new
|
||||
rescue LoadError
|
||||
nil
|
||||
end
|
||||
|
||||
desc 'Open development console'
|
||||
task :console do
|
||||
sh 'bundle', 'exec',
|
||||
File.expand_path(File.join('bin', 'console'), __dir__)
|
||||
end
|
||||
|
||||
desc 'Run tests'
|
||||
task :tests do
|
||||
sh 'bundle', 'exec',
|
||||
File.expand_path(File.join('tests', 'examples.rb'), __dir__)
|
||||
end
|
||||
|
||||
namespace :yard do
|
||||
desc 'Measure documentation coverage'
|
||||
task :cov do
|
||||
result = `bundle exec yard stats`.lines.last.strip.freeze
|
||||
m = result.match(/\A(\d+(\.\d+)?)% documented\z/)
|
||||
raise 'Invalid result' if m.nil?
|
||||
|
||||
coverage = m[1].to_f.round(2)
|
||||
puts "Documentation coverage: #{coverage}%"
|
||||
raise 'Not fully documented!' if coverage < 38.32
|
||||
end
|
||||
end
|
9
bin/console
Executable file
9
bin/console
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/env ruby
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'bundler/setup'
|
||||
|
||||
require 'pry'
|
||||
require 'repubmark'
|
||||
|
||||
Pry.start
|
5
bin/setup
Executable file
5
bin/setup
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -euvx
|
||||
|
||||
bundle install
|
|
@ -63,6 +63,10 @@ require_relative 'repubmark/elems/power'
|
|||
# Always inside FootnotesCategory
|
||||
require_relative 'repubmark/elems/footnote'
|
||||
|
||||
##
|
||||
# A Markdown-inspired markup language that can be compiled into HTML and
|
||||
# Gemtext.
|
||||
#
|
||||
module Repubmark
|
||||
FORMATS = %i[chapters gemtext html summary_plain word_count].freeze
|
||||
|
||||
|
|
6
lib/repubmark/version.rb
Normal file
6
lib/repubmark/version.rb
Normal file
|
@ -0,0 +1,6 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
module Repubmark
|
||||
# Gem version.
|
||||
VERSION = '0.0.0'
|
||||
end
|
52
repubmark.gemspec
Normal file
52
repubmark.gemspec
Normal file
|
@ -0,0 +1,52 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require_relative 'lib/repubmark/version'
|
||||
|
||||
Gem::Specification.new do |spec|
|
||||
repo = 'https://git.causa-arcana.com/causa-arcana/repubmark'
|
||||
mail = 'me+repubmark@kotovalexarian.com'
|
||||
home = repo
|
||||
# bugs = "mailto:#{mail}"
|
||||
docs = "https://www.rubydoc.info/gems/repubmark/#{Repubmark::VERSION}"
|
||||
|
||||
spec.name = 'repubmark'
|
||||
spec.version = Repubmark::VERSION
|
||||
spec.license = 'MIT'
|
||||
spec.homepage = home
|
||||
|
||||
spec.required_ruby_version = '~> 3.2'
|
||||
|
||||
spec.authors = ['Alex Kotov']
|
||||
spec.email = [mail]
|
||||
|
||||
spec.summary =
|
||||
'A Markdown-inspired markup language ' \
|
||||
'that can be compiled into HTML and Gemtext'
|
||||
|
||||
spec.description = <<~DESCRIPTION.split("\n").map(&:strip).join ' '
|
||||
A Markdown-inspired markup language that can be compiled into HTML and
|
||||
Gemtext
|
||||
DESCRIPTION
|
||||
|
||||
spec.metadata['rubygems_mfa_required'] = 'true'
|
||||
spec.metadata['homepage_uri'] = home
|
||||
spec.metadata['source_code_uri'] = home
|
||||
# spec.metadata['bug_tracker_uri'] = FIXME: bugs
|
||||
spec.metadata['documentation_uri'] = docs
|
||||
# spec.metadata['changelog_uri'] = 'TODO: changelog'
|
||||
|
||||
spec.bindir = 'exe'
|
||||
spec.require_paths = ['lib']
|
||||
|
||||
spec.files = Dir.chdir __dir__ do
|
||||
`git ls-files -z`.split("\x0").reject do |f|
|
||||
(File.expand_path(f) == __FILE__) ||
|
||||
f.start_with?(*%w[.git bin/ test/ spec/ features/ Gemfile])
|
||||
end
|
||||
end
|
||||
|
||||
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename f }
|
||||
|
||||
spec.add_dependency 'addressable', '~> 2.8'
|
||||
spec.add_dependency 'i18n', '~> 1.14'
|
||||
end
|
Loading…
Reference in a new issue