headown 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f74423e86a239a4baf00b000cf0ff3fd13ab4af7082750388faa8c462a7ccf20
4
- data.tar.gz: ed615e669ad789158a317dba43c7234793f23e2e76ec693ce626466aaab63c31
3
+ metadata.gz: 541a08c3b53c77ecdf85ffd2304f159c3d77c8fe035015476132faa3d1eea08a
4
+ data.tar.gz: bd9a343fec1e22785efc3c0dddd6b3799b0bd6cc6c3ee065ed93cb084dfdcbab
5
5
  SHA512:
6
- metadata.gz: 788b6416a14427891723fad67e53645514e6eeb647443f81f0f3ac18bcff177d0dc3d83de7cb469c49022626db239632d27cb615b6d458a82d3c16d1f7ce9f08
7
- data.tar.gz: f6c74ca98eeb4efc4236784a56368d15f6f1ab06908c88f74f6fed9e0e7cf2249e0f1502c7b803fbd47c1b5c4f10c57a9ddc0893e1ea4933a3e28b7be162a67e
6
+ metadata.gz: 47ef832759faba71f2c39a7909f98d428b544da18b1ddf30ddc729e9d4d7a722c4a144bceb65720e4523111b22b48229989339e3084dab9a8ef7603ecb8076ef
7
+ data.tar.gz: 0d21103d9d5e864bd957b45c7c974523f33a78b93c7adad8d5d5b058bbcfa213c6a261494bdf644c2cc41e725edefe5d901a06830d6ccc35ad4adb680f095031
@@ -5,8 +5,7 @@
5
5
  # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
6
  # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
7
 
8
- name: Ruby
9
-
8
+ name: Setup Ruby
10
9
  on:
11
10
  push:
12
11
  branches: [ main ]
@@ -15,19 +14,20 @@ on:
15
14
 
16
15
  jobs:
17
16
  test:
18
-
19
- runs-on: ubuntu-latest
20
-
17
+ strategy:
18
+ fail-fast: false
19
+ matrix:
20
+ os: [ubuntu-latest, macos-latest, windows-latest]
21
+ # Due to https://github.com/actions/runner/issues/849, we have to use quotes for '3.0'
22
+ ruby: ['2.7', '3.0', '3.1']
23
+ runs-on: ${{ matrix.os }}
21
24
  steps:
22
- - uses: actions/checkout@v2
23
- - name: Set up Ruby
24
- # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
25
- # change this to (see https://github.com/ruby/setup-ruby#versioning):
26
- # uses: ruby/setup-ruby@v1
27
- uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0
25
+ - uses: actions/checkout@v3
26
+ - uses: ruby/setup-ruby@v1
28
27
  with:
29
- ruby-version: 2.7
30
- - name: Install dependencies
31
- run: bundle install
28
+ ruby-version: ${{ matrix.ruby }}
29
+ bundler-cache: true
32
30
  - name: Run tests
33
31
  run: bundle exec rake
32
+ - name: Type checking
33
+ run: bundle exec steep check
data/CHANGELOG.md CHANGED
@@ -1,61 +1 @@
1
- <a name="v0.2.0"></a>
2
- ## [v0.2.0](https://github.com/noriyotcp/headown/compare/v0.1.0...v0.2.0) (2020-10-03)
3
-
4
- ### Add
5
-
6
- * Add Headown::Extractor which has logic to extract headers
7
- * Add CHANGELOG.md
8
- * Add .chglog which contains git-chglog's config and template files
9
-
10
- ### Create
11
-
12
- * Create ruby.yml
13
-
14
- ### Improve
15
-
16
- * Improve test against html file path
17
- * Raise Headown::NotMarkdownError in constructor in Headown::Extractor
18
- * Raise Headown::NotMarkdownError when file path is not Markdown file
19
-
20
- ### Update
21
-
22
- * Move require 'headown/cli' to exe/headown
23
- * Update README.md
24
- * Update CHANGELOG.md
25
-
26
- ### Pull Requests
27
-
28
- * Merge pull request [#4](https://github.com/noriyotcp/headown/issues/4) from noriyotcp/noriyotcp-patch-1
29
- * Merge pull request [#3](https://github.com/noriyotcp/headown/issues/3) from noriyotcp/extractor-class
30
- * Merge pull request [#2](https://github.com/noriyotcp/headown/issues/2) from noriyotcp/extract-require-headown-cli
31
- * Merge pull request [#1](https://github.com/noriyotcp/headown/issues/1) from noriyotcp/detect-file-extension
32
-
33
- <a name="v0.1.0"></a>
34
- ## v0.1.0 (2020-09-27)
35
-
36
- ### Add
37
-
38
- * Add sample2.md to test against interruption paragraphs for ATX headings
39
- * Add test against passing url
40
- * Add puts_headers to print headers out to stdout
41
-
42
- ### Exec
43
-
44
- * Exec bundle exec rbprettier --write '**/*.rb'
45
-
46
- ### Improve
47
-
48
- * Extract from sample markdown file
49
- * Improve sample.md
50
-
51
- ### Install
52
-
53
- * Install prettier gem
54
- * Install thor
55
- * Install gems
56
-
57
- ### Update
58
-
59
- * Update README.md
60
- * Update gemspec
61
- * Update headown.gemspec
1
+ https://github.com/noriyotcp/headown/releases
data/Gemfile CHANGED
@@ -3,7 +3,7 @@ source 'https://rubygems.org'
3
3
  # Specify your gem's dependencies in headown.gemspec
4
4
  gemspec
5
5
 
6
- gem 'rake', '~> 12.0'
6
+ gem 'rake'
7
7
  gem 'rspec', '~> 3.0'
8
8
  gem 'commonmarker'
9
9
  gem 'thor'
@@ -11,3 +11,7 @@ gem 'thor'
11
11
  group :development do
12
12
  gem 'prettier'
13
13
  end
14
+
15
+ group :development, :test do
16
+ gem 'steep'
17
+ end
data/Gemfile.lock CHANGED
@@ -1,35 +1,88 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- headown (0.2.0)
4
+ headown (0.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
- commonmarker (0.21.0)
10
- ruby-enum (~> 0.5)
11
- concurrent-ruby (1.1.7)
12
- diff-lcs (1.4.4)
13
- i18n (1.8.5)
9
+ activesupport (7.0.4)
10
+ concurrent-ruby (~> 1.0, >= 1.0.2)
11
+ i18n (>= 1.6, < 2)
12
+ minitest (>= 5.1)
13
+ tzinfo (~> 2.0)
14
+ ast (2.4.2)
15
+ commonmarker (0.23.6)
16
+ concurrent-ruby (1.1.10)
17
+ diff-lcs (1.5.0)
18
+ ffi (1.15.5)
19
+ haml (6.0.7)
20
+ temple (>= 0.8.2)
21
+ thor
22
+ tilt
23
+ i18n (1.12.0)
14
24
  concurrent-ruby (~> 1.0)
15
- prettier (0.20.1)
16
- rake (12.3.3)
17
- rspec (3.9.0)
18
- rspec-core (~> 3.9.0)
19
- rspec-expectations (~> 3.9.0)
20
- rspec-mocks (~> 3.9.0)
21
- rspec-core (3.9.2)
22
- rspec-support (~> 3.9.3)
23
- rspec-expectations (3.9.2)
25
+ language_server-protocol (3.17.0.1)
26
+ listen (3.7.1)
27
+ rb-fsevent (~> 0.10, >= 0.10.3)
28
+ rb-inotify (~> 0.9, >= 0.9.10)
29
+ minitest (5.16.3)
30
+ parallel (1.22.1)
31
+ parser (3.1.2.1)
32
+ ast (~> 2.4.1)
33
+ prettier (3.2.2)
34
+ syntax_tree (>= 2.7.1)
35
+ syntax_tree-haml (>= 1.1.0)
36
+ syntax_tree-rbs (>= 0.2.0)
37
+ prettier_print (0.1.0)
38
+ rainbow (3.1.1)
39
+ rake (13.0.6)
40
+ rb-fsevent (0.11.2)
41
+ rb-inotify (0.10.1)
42
+ ffi (~> 1.0)
43
+ rbs (2.7.0)
44
+ rspec (3.11.0)
45
+ rspec-core (~> 3.11.0)
46
+ rspec-expectations (~> 3.11.0)
47
+ rspec-mocks (~> 3.11.0)
48
+ rspec-core (3.11.0)
49
+ rspec-support (~> 3.11.0)
50
+ rspec-expectations (3.11.1)
24
51
  diff-lcs (>= 1.2.0, < 2.0)
25
- rspec-support (~> 3.9.0)
26
- rspec-mocks (3.9.1)
52
+ rspec-support (~> 3.11.0)
53
+ rspec-mocks (3.11.1)
27
54
  diff-lcs (>= 1.2.0, < 2.0)
28
- rspec-support (~> 3.9.0)
29
- rspec-support (3.9.3)
30
- ruby-enum (0.8.0)
31
- i18n
32
- thor (1.0.1)
55
+ rspec-support (~> 3.11.0)
56
+ rspec-support (3.11.1)
57
+ securerandom (0.2.0)
58
+ steep (1.2.0)
59
+ activesupport (>= 5.1)
60
+ language_server-protocol (>= 3.15, < 4.0)
61
+ listen (~> 3.0)
62
+ parallel (>= 1.0.0)
63
+ parser (>= 3.1)
64
+ rainbow (>= 2.2.2, < 4.0)
65
+ rbs (>= 2.7.0)
66
+ securerandom (>= 0.1)
67
+ terminal-table (>= 2, < 4)
68
+ syntax_tree (3.6.3)
69
+ prettier_print
70
+ syntax_tree-haml (1.3.2)
71
+ haml (>= 5.2)
72
+ prettier_print
73
+ syntax_tree (>= 2.0.1)
74
+ syntax_tree-rbs (0.5.1)
75
+ prettier_print
76
+ rbs
77
+ syntax_tree (>= 2.0.1)
78
+ temple (0.8.2)
79
+ terminal-table (3.0.2)
80
+ unicode-display_width (>= 1.1.1, < 3)
81
+ thor (1.2.1)
82
+ tilt (2.0.11)
83
+ tzinfo (2.0.5)
84
+ concurrent-ruby (~> 1.0)
85
+ unicode-display_width (2.3.0)
33
86
 
34
87
  PLATFORMS
35
88
  ruby
@@ -38,9 +91,10 @@ DEPENDENCIES
38
91
  commonmarker
39
92
  headown!
40
93
  prettier
41
- rake (~> 12.0)
94
+ rake
42
95
  rspec (~> 3.0)
96
+ steep
43
97
  thor
44
98
 
45
99
  BUNDLED WITH
46
- 2.1.2
100
+ 2.3.10
data/Steepfile ADDED
@@ -0,0 +1,23 @@
1
+ # D = Steep::Diagnostic
2
+ #
3
+ target :lib do
4
+ signature "sig"
5
+ check "lib" # Directory name
6
+ # # check "Gemfile" # File name
7
+ # # library "pathname", "set" # Standard libraries
8
+ # # library "strong_json" # Gems
9
+ #
10
+ # # configure_code_diagnostics(D::Ruby.strict) # `strict` diagnostics setting
11
+ # # configure_code_diagnostics(D::Ruby.lenient) # `lenient` diagnostics setting
12
+ # # configure_code_diagnostics do |hash| # You can setup everything yourself
13
+ # # hash[D::Ruby::NoMethod] = :information
14
+ # # end
15
+ end
16
+
17
+ # target :test do
18
+ # signature "sig", "sig-private"
19
+ #
20
+ # check "test"
21
+ #
22
+ # # library "pathname", "set" # Standard libraries
23
+ # end
data/headown.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.description = 'This is the CLI tool extracting headers from Markdown files.'
11
11
  spec.homepage = 'https://github.com/noriyotcp/headown'
12
12
  spec.license = 'MIT'
13
- spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
13
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.7.0')
14
14
 
15
15
  spec.metadata['allowed_push_host'] = 'https://rubygems.org'
16
16
 
@@ -1,3 +1,3 @@
1
1
  module Headown
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.0'
3
3
  end
data/sig/headown.rbs ADDED
@@ -0,0 +1,47 @@
1
+ # TypeProf 0.21.2
2
+
3
+ # polyfill for thor
4
+ class Thor
5
+ def self.desc: (String, String, ?Hash[Symbol, String]) -> void
6
+ end
7
+
8
+ # polyfill for URI
9
+ class URI
10
+ def self.open: (String) { (IO) -> (::String | nil) } -> IO
11
+ end
12
+
13
+ # polyfill for commonmarker
14
+ module CommonMarker
15
+ def self.render_doc: (::IO | nil) -> CommonMarker::Node
16
+
17
+ class Node
18
+ def each: [U] { (Node) -> U } -> ::Array[U]
19
+ def walk: [U] { (Node) -> U } -> ::Array[U]
20
+ attr_reader type: Symbol
21
+ attr_reader string_content: String
22
+ attr_reader header_level: Integer
23
+ end
24
+ end
25
+
26
+ # Classes
27
+ module Headown
28
+ VERSION: String
29
+
30
+ class NotMarkdownError < StandardError
31
+ def initialize: (file_path: String) -> void
32
+ end
33
+
34
+ class Extractor
35
+ attr_reader headers: Array[String]
36
+ def initialize: (String file_path) -> Array[String]
37
+
38
+ private
39
+ def extract_headers: (IO file_data) -> Array[String]
40
+ def header_nodes: (IO data) -> Array[CommonMarker::Node]
41
+ def build_header: (CommonMarker::Node node) -> String
42
+ end
43
+
44
+ class CLI < Thor
45
+ def extract: (String file_path) -> void
46
+ end
47
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: headown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - noriyotcp
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-03 00:00:00.000000000 Z
11
+ date: 2022-10-16 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: This is the CLI tool extracting headers from Markdown files.
14
14
  email:
@@ -18,13 +18,10 @@ executables:
18
18
  extensions: []
19
19
  extra_rdoc_files: []
20
20
  files:
21
- - ".chglog/CHANGELOG.tpl.md"
22
- - ".chglog/config.yml"
23
21
  - ".github/workflows/ruby.yml"
24
22
  - ".gitignore"
25
23
  - ".prettierrc.json"
26
24
  - ".rspec"
27
- - ".travis.yml"
28
25
  - CHANGELOG.md
29
26
  - CODE_OF_CONDUCT.md
30
27
  - Gemfile
@@ -32,6 +29,7 @@ files:
32
29
  - LICENSE.txt
33
30
  - README.md
34
31
  - Rakefile
32
+ - Steepfile
35
33
  - bin/console
36
34
  - bin/setup
37
35
  - exe/headown
@@ -39,6 +37,7 @@ files:
39
37
  - lib/headown.rb
40
38
  - lib/headown/cli.rb
41
39
  - lib/headown/version.rb
40
+ - sig/headown.rbs
42
41
  homepage: https://github.com/noriyotcp/headown
43
42
  licenses:
44
43
  - MIT
@@ -55,14 +54,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
55
54
  requirements:
56
55
  - - ">="
57
56
  - !ruby/object:Gem::Version
58
- version: 2.3.0
57
+ version: 2.7.0
59
58
  required_rubygems_version: !ruby/object:Gem::Requirement
60
59
  requirements:
61
60
  - - ">="
62
61
  - !ruby/object:Gem::Version
63
62
  version: '0'
64
63
  requirements: []
65
- rubygems_version: 3.1.2
64
+ rubygems_version: 3.3.7
66
65
  signing_key:
67
66
  specification_version: 4
68
67
  summary: Markdown Headers Extractor
@@ -1,38 +0,0 @@
1
- {{ range .Versions }}
2
- <a name="{{ .Tag.Name }}"></a>
3
- ## {{ if .Tag.Previous }}[{{ .Tag.Name }}]({{ $.Info.RepositoryURL }}/compare/{{ .Tag.Previous.Name }}...{{ .Tag.Name }}){{ else }}{{ .Tag.Name }}{{ end }} ({{ datetime "2006-01-02" .Tag.Date }})
4
-
5
- {{ range .CommitGroups -}}
6
- ### {{ .Title }}
7
-
8
- {{ range .Commits -}}
9
- * {{ .Subject }}
10
- {{ end }}
11
- {{ end -}}
12
-
13
- {{- if .RevertCommits -}}
14
- ### Reverts
15
-
16
- {{ range .RevertCommits -}}
17
- * {{ .Revert.Header }}
18
- {{ end }}
19
- {{ end -}}
20
-
21
- {{- if .MergeCommits -}}
22
- ### Pull Requests
23
-
24
- {{ range .MergeCommits -}}
25
- * {{ .Header }}
26
- {{ end }}
27
- {{ end -}}
28
-
29
- {{- if .NoteGroups -}}
30
- {{ range .NoteGroups -}}
31
- ### {{ .Title }}
32
-
33
- {{ range .Notes }}
34
- {{ .Body }}
35
- {{ end }}
36
- {{ end -}}
37
- {{ end -}}
38
- {{ end -}}
data/.chglog/config.yml DELETED
@@ -1,27 +0,0 @@
1
- style: github
2
- template: CHANGELOG.tpl.md
3
- info:
4
- title: CHANGELOG
5
- repository_url: https://github.com/noriyotcp/headown
6
- options:
7
- commits:
8
- # filters:
9
- # Type:
10
- # - feat
11
- # - fix
12
- # - perf
13
- # - refactor
14
- commit_groups:
15
- # title_maps:
16
- # feat: Features
17
- # fix: Bug Fixes
18
- # perf: Performance Improvements
19
- # refactor: Code Refactoring
20
- header:
21
- pattern: "^((\\w+)\\s.*)$"
22
- pattern_maps:
23
- - Subject
24
- - Type
25
- notes:
26
- keywords:
27
- - BREAKING CHANGE
data/.travis.yml DELETED
@@ -1,6 +0,0 @@
1
- ---
2
- language: ruby
3
- cache: bundler
4
- rvm:
5
- - 2.7.0
6
- before_install: gem install bundler -v 2.1.2