diff options
author | Jakub Jirutka <jakub@jirutka.cz> | 2018-01-26 00:53:22 +0100 |
---|---|---|
committer | Jakub Jirutka <jakub@jirutka.cz> | 2018-01-30 19:38:22 +0100 |
commit | a8e82ba99adf1a2a34b136388b088dcfe60d9593 (patch) | |
tree | 567a509fe479ca4d8ed638c06dc54356caa3890f | |
parent | ad3b8da957176360566d678437e10284fc1b8f2c (diff) |
Prepare project structure
-rw-r--r-- | .editorconfig | 10 | ||||
-rw-r--r-- | .gitignore | 9 | ||||
-rw-r--r-- | .rubocop.yml | 90 | ||||
-rw-r--r-- | .travis.yml | 57 | ||||
-rw-r--r-- | .yardopts | 6 | ||||
-rw-r--r-- | Gemfile | 14 | ||||
-rw-r--r-- | LICENSE | 21 | ||||
-rw-r--r-- | README.adoc | 42 | ||||
-rw-r--r-- | Rakefile | 24 | ||||
-rw-r--r-- | asciidoctor-interdoc-reftext.gemspec | 28 | ||||
-rw-r--r-- | lib/asciidoctor-interdoc-reftext.rb | 2 | ||||
-rw-r--r-- | lib/asciidoctor/interdoc_reftext.rb | 2 | ||||
-rw-r--r-- | lib/asciidoctor/interdoc_reftext/version.rb | 8 | ||||
-rw-r--r-- | spec/.rubocop.yml | 59 | ||||
-rw-r--r-- | spec/spec_helper.rb | 20 |
15 files changed, 392 insertions, 0 deletions
diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..8631b49 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,10 @@ +; http://editorconfig.org +root = true + +[*] +charset = utf-8 +end_of_line = lf +indent_size = 2 +indent_style = space +insert_final_newline = true +trim_trailing_whitespace = true diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..23f8e8c --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +/.bundle/ +/.yardoc/ +/coverage/ +/doc/ +/pkg/ +/tmp/ +Gemfile.lock +*.bundle +*.gem diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..880c493 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,90 @@ +AllCops: + TargetRubyVersion: 2.2 + +# False positive... +Bundler/DuplicatedGem: + Enabled: false + +# I prefer no empty line between magic comment and requires. +Layout/EmptyLineAfterMagicComment: + Enabled: false + +Layout/EmptyLinesAroundClassBody: + Enabled: false + +Layout/EmptyLinesAroundModuleBody: + Enabled: false + +# I prefer to put two spaces before inline comment, Rubocop does not allow to +# set exception for this. +Layout/ExtraSpacing: + Enabled: false + +Layout/MultilineMethodCallIndentation: + EnforcedStyle: indented + +Lint/EndAlignment: + EnforcedStyleAlignWith: variable + +Metrics/AbcSize: + Max: 30 + +Metrics/CyclomaticComplexity: + Max: 12 + +Metrics/LineLength: + Max: 99 + +Metrics/MethodLength: + Max: 35 + +Metrics/PerceivedComplexity: + Max: 12 + +Metrics/ParameterLists: + CountKeywordArgs: false + +Naming/FileName: + Exclude: + - 'lib/*.rb' + +Style/AndOr: + EnforcedStyle: conditionals + +Style/BlockDelimiters: + EnforcedStyle: braces_for_chaining + +Style/ClassAndModuleChildren: + Enabled: false + +Style/EmptyMethod: + EnforcedStyle: expanded + +# I don't use guard clause when line would be too long. +Style/GuardClause: + Enabled: false + +Style/HashSyntax: + Exclude: + - Rakefile + +Style/FrozenStringLiteralComment: + Exclude: + - Gemfile* + - Rakefile + - '*.gemspec' + +Style/MultilineBlockChain: + Enabled: false + +Style/NegatedIf: + Enabled: false + +Style/RedundantFreeze: + Enabled: false + +Style/TrailingCommaInArguments: + EnforcedStyleForMultiline: comma + +Style/TrailingCommaInLiteral: + EnforcedStyleForMultiline: comma diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..c0f20c4 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,57 @@ +dist: trusty +sudo: false +language: ruby + +jobs: + include: + - env: &adoc-latest ASCIIDOCTOR_VERSION=1.5.6.1 + rvm: 2.5 + - env: *adoc-latest + rvm: 2.4 + - env: *adoc-latest + rvm: 2.3 + - env: *adoc-latest + rvm: 2.2 + - env: *adoc-latest + rvm: 2.1 + - env: *adoc-latest + # Using exact version as workaround for https://github.com/travis-ci/travis-ci/issues/8446. + rvm: jruby-9.1.15.0 + - env: *adoc-latest + rvm: ruby-head + - env: *adoc-latest + rvm: jruby-head + + - env: ASCIIDOCTOR_VERSION=1.5.6 + rvm: 2.3 + + - env: ASCIIDOCTOR_VERSION="git:master" + rvm: 2.5 + + allow_failures: + - env: *adoc-latest + rvm: ruby-head + - env: *adoc-latest + rvm: jruby-head + - env: ASCIIDOCTOR_VERSION="git:master" + rvm: 2.5 + +env: + global: + secure: # CODACY_PROJECT_TOKEN + +before_install: + # Workaround for https://github.com/travis-ci/travis-ci/issues/8978. + - gem update --system + +script: + - bundle exec rake spec + - bundle exec rake rubocop + +deploy: + provider: rubygems + api_key: + secure: # RUBYGEMS KEY + on: + tags: true + condition: ${TRAVIS_JOB_NUMBER#*.} = 1 diff --git a/.yardopts b/.yardopts new file mode 100644 index 0000000..a754f10 --- /dev/null +++ b/.yardopts @@ -0,0 +1,6 @@ +--title "Asciidoctor Inter-doc Reference Text" +--default-return void +--protected +--markup markdown +- +LICENSE @@ -0,0 +1,14 @@ +source 'https://rubygems.org' +gemspec + +unless ENV.fetch('ASCIIDOCTOR_VERSION', '').empty? + if (match = ENV['ASCIIDOCTOR_VERSION'].match(/^git:(\w+)/)) + gem 'asciidoctor', github: 'asciidoctor/asciidoctor', ref: match[1] + else + gem 'asciidoctor', ENV['ASCIIDOCTOR_VERSION'] + end +end + +group :ci do + gem 'codacy-coverage', '~> 1.1', require: false +end @@ -0,0 +1,21 @@ +The MIT License + +Copyright 2018 Jakub Jirutka <jakub@jirutka.cz>. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README.adoc b/README.adoc new file mode 100644 index 0000000..35f5372 --- /dev/null +++ b/README.adoc @@ -0,0 +1,42 @@ += Asciidoctor Inter-doc Reference Text +:source-language: shell +// custom +:gem-name: asciidoctor-interdoc-reftext +:gh-name: jirutka/{gem-name} +:gh-branch: master +:codacy-id: N/A + +ifdef::env-github[] +image:https://travis-ci.org/{gh-name}.svg?branch={gh-branch}[Build Status, link="https://travis-ci.org/{gh-name}"] +image:https://api.codacy.com/project/badge/Coverage/{codacy-id}["Test Coverage", link="https://www.codacy.com/app/{gh-name}"] +image:https://api.codacy.com/project/badge/Grade/{codacy-id}["Codacy Code quality", link="https://www.codacy.com/app/{gh-name}"] +image:https://img.shields.io/gem/v/{gem-name}.svg?style=flat[Gem Version, link="https://rubygems.org/gems/{gem-name}"] +image:https://img.shields.io/badge/yard-docs-blue.svg[Yard Docs, link="http://www.rubydoc.info/github/{gh-name}/{gh-branch}"] +endif::env-github[] + + +TODO + + +== Installation + +To install (or update to the latest version): + +[source, subs="+attributes"] +gem install {gem-name} + +or to install the latest development version: + +[source, subs="+attributes"] +gem install {gem-name} --pre + + +== Usage + +TODO + + +== License + +This project is licensed under http://opensource.org/licenses/MIT/[MIT License]. +For the full text of the license, see the link:LICENSE[LICENSE] file. diff --git a/Rakefile b/Rakefile new file mode 100644 index 0000000..aa8614e --- /dev/null +++ b/Rakefile @@ -0,0 +1,24 @@ +require 'bundler/gem_tasks' + +begin + require 'rspec/core/rake_task' + + RSpec::Core::RakeTask.new(:spec) + + task :test => :spec + task :default => :spec +rescue LoadError => e + warn "#{e.path} is not available" +end + +begin + require 'rubocop/rake_task' + + RuboCop::RakeTask.new(:rubocop) do |t| + t.options = ['--display-cop-names', '--fail-level', 'W'] + end + + task :default => :rubocop +rescue LoadError => e + warn "#{e.path} is not available" +end diff --git a/asciidoctor-interdoc-reftext.gemspec b/asciidoctor-interdoc-reftext.gemspec new file mode 100644 index 0000000..1896a6b --- /dev/null +++ b/asciidoctor-interdoc-reftext.gemspec @@ -0,0 +1,28 @@ +require File.expand_path('../lib/asciidoctor/interdoc_reftext/version', __FILE__) + +Gem::Specification.new do |s| + s.name = 'asciidoctor-interdoc-reftext' + s.version = Asciidoctor::InterdocReftext::VERSION + s.author = 'Jakub Jirutka' + s.email = 'jakub@jirutka.cz' + s.homepage = 'https://github.com/jirutka/asciidoctor-interdoc-reftext' + s.license = 'MIT' + + s.summary = "Asciidoctor extension providing implicit (automatic) reference \ +text (label) for inter-document cross references" + + s.files = Dir['lib/**/*', '*.gemspec', 'LICENSE*', 'README*'] + s.has_rdoc = 'yard' + + s.required_ruby_version = '>= 2.1' + + s.add_runtime_dependency 'asciidoctor', '~> 1.5.6' + + s.add_development_dependency 'corefines', '~> 1.11' + s.add_development_dependency 'kramdown', '~> 1.16' + s.add_development_dependency 'rake', '~> 12.0' + s.add_development_dependency 'rspec', '~> 3.7' + s.add_development_dependency 'rubocop', '~> 0.51.0' + s.add_development_dependency 'simplecov', '~> 0.15' + s.add_development_dependency 'yard', '~> 0.9' +end diff --git a/lib/asciidoctor-interdoc-reftext.rb b/lib/asciidoctor-interdoc-reftext.rb new file mode 100644 index 0000000..b08b446 --- /dev/null +++ b/lib/asciidoctor-interdoc-reftext.rb @@ -0,0 +1,2 @@ +# frozen_string_literal: true +require 'asciidoctor/interdoc_reftext' diff --git a/lib/asciidoctor/interdoc_reftext.rb b/lib/asciidoctor/interdoc_reftext.rb new file mode 100644 index 0000000..190a41f --- /dev/null +++ b/lib/asciidoctor/interdoc_reftext.rb @@ -0,0 +1,2 @@ +# frozen_string_literal: true +require 'asciidoctor/interdoc_reftext/version' diff --git a/lib/asciidoctor/interdoc_reftext/version.rb b/lib/asciidoctor/interdoc_reftext/version.rb new file mode 100644 index 0000000..033c3f8 --- /dev/null +++ b/lib/asciidoctor/interdoc_reftext/version.rb @@ -0,0 +1,8 @@ +# frozen_string_literal: true + +module Asciidoctor + module InterdocReftext + # Version of the asciidoctor-interdoc-reftext gem. + VERSION = '0.0.0'.freeze + end +end diff --git a/spec/.rubocop.yml b/spec/.rubocop.yml new file mode 100644 index 0000000..752f917 --- /dev/null +++ b/spec/.rubocop.yml @@ -0,0 +1,59 @@ +inherit_from: ../.rubocop.yml + +Layout/ClosingParenthesisIndentation: + Enabled: false + +Layout/EmptyLines: + Enabled: false + +Layout/EmptyLinesAroundBlockBody: + Enabled: false + +Layout/LeadingCommentSpace: + Enabled: false + +Layout/MultilineBlockLayout: + Enabled: false + +Layout/SpaceBeforeComma: + Enabled: false + +Layout/SpaceBeforeComment: + Enabled: false + +Layout/SpaceInsideBlockBraces: + Enabled: false + +Layout/SpaceInsideBrackets: + Enabled: false + +Layout/SpaceInsideParens: + Enabled: false + +Lint/AmbiguousRegexpLiteral: + Enabled: false + +Metrics/ModuleLength: + Enabled: false + +Metrics/BlockLength: + Enabled: false + +Style/BlockDelimiters: + IgnoredMethods: [ expect, let ] + +# I use it for purpose with Corefines, e.g. `using Corefines::String::unindent`. +Style/ColonMethodCall: + Enabled: false + +Style/FrozenStringLiteralComment: + Enabled: false + +Style/NestedParenthesizedCalls: + Enabled: false + +Style/SymbolArray: + Enabled: false + +Style/WordArray: + Enabled: false diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb new file mode 100644 index 0000000..80e5bc6 --- /dev/null +++ b/spec/spec_helper.rb @@ -0,0 +1,20 @@ +require 'rspec' + +RSpec.configure do |config| + config.color = true +end + +unless RUBY_ENGINE == 'jruby' + require 'simplecov' + + formatters = [SimpleCov::Formatter::HTMLFormatter] + if ENV['CODACY_PROJECT_TOKEN'] + require 'codacy-coverage' + formatters << Codacy::Formatter + end + + SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new(formatters) + SimpleCov.start do + add_filter '/spec/' + end +end |