docrb 0.2.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.
data/lib/docrb.rb ADDED
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "parser/current"
4
+ require "forwardable"
5
+ require "json"
6
+ require "redcarpet"
7
+ require "rouge"
8
+ require "rouge/plugins/redcarpet"
9
+ require "rubygems"
10
+
11
+ Parser::Builders::Default.emit_lambda = true
12
+ Parser::Builders::Default.emit_procarg0 = true
13
+ Parser::Builders::Default.emit_encoding = true
14
+ Parser::Builders::Default.emit_index = true
15
+ Parser::Builders::Default.emit_arg_inside_procarg0 = true
16
+ Parser::Builders::Default.emit_forward_arg = true
17
+ Parser::Builders::Default.emit_kwargs = true
18
+ Parser::Builders::Default.emit_match_pattern = true
19
+
20
+ require_relative "docrb/version"
21
+ require_relative "docrb/ruby_parser"
22
+ require_relative "docrb/module_extensions"
23
+
24
+ # Docrb implements a source and documentation parser for Ruby projects
25
+ module Docrb
26
+ # Error class from which all other Docrb errors derive from
27
+ class Error < StandardError; end
28
+
29
+ autoload :CommentParser, "docrb/comment_parser"
30
+ autoload :DocCompiler, "docrb/doc_compiler"
31
+ autoload :Resolvable, "docrb/resolvable"
32
+ autoload :Markdown, "docrb/markdown"
33
+ autoload :Spec, "docrb/spec"
34
+
35
+ # Public: Parses a single file under a provided path
36
+ #
37
+ # path - Path to the file to be parsed
38
+ #
39
+ # Returns an object representing the parsed source and documentation
40
+ def self.parse(path)
41
+ inst = RubyParser.new(path)
42
+ inst.parse
43
+ inst
44
+ end
45
+
46
+ # Public: Parses a given input folder recursivelly and returns all sources
47
+ # and documentations
48
+ #
49
+ # inp - Folder to be parsed. Finds all .rb files recursivelly from this path.
50
+ #
51
+ # Returns an array with all parsed files
52
+ def self.parse_folder(inp)
53
+ output = []
54
+ Dir["#{inp}/**/*.rb"].each do |f|
55
+ inst = parse(f)
56
+ inst.classes.each do |c|
57
+ c[:filename] = f
58
+ output << c
59
+ end
60
+ inst.modules.each do |c|
61
+ c[:filename] = f
62
+ output << c
63
+ end
64
+ inst.methods.each do |c|
65
+ c[:filename] = f
66
+ output << c
67
+ end
68
+ end
69
+ output
70
+ end
71
+ end
metadata ADDED
@@ -0,0 +1,139 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: docrb
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ platform: ruby
6
+ authors:
7
+ - Victor Gama
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2023-02-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: docrb-html
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: parser
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '3.2'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '3.2'
41
+ - !ruby/object:Gem::Dependency
42
+ name: redcarpet
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '3.6'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '3.6'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rouge
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '4.1'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '4.1'
69
+ description: An opinionated documentation parser
70
+ email:
71
+ - hey@vito.io
72
+ executables:
73
+ - docrb
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - ".editorconfig"
78
+ - ".rspec"
79
+ - ".rubocop.yml"
80
+ - Gemfile
81
+ - Gemfile.lock
82
+ - Rakefile
83
+ - bin/console
84
+ - bin/json
85
+ - bin/md
86
+ - bin/setup
87
+ - docrb.gemspec
88
+ - exe/docrb
89
+ - lib/docrb.rb
90
+ - lib/docrb/comment_parser.rb
91
+ - lib/docrb/comment_parser/code_example_block.rb
92
+ - lib/docrb/comment_parser/code_example_parser.rb
93
+ - lib/docrb/comment_parser/field_block.rb
94
+ - lib/docrb/comment_parser/field_list_parser.rb
95
+ - lib/docrb/comment_parser/text_block.rb
96
+ - lib/docrb/doc_compiler.rb
97
+ - lib/docrb/doc_compiler/base_container.rb
98
+ - lib/docrb/doc_compiler/base_container/computations.rb
99
+ - lib/docrb/doc_compiler/doc_attribute.rb
100
+ - lib/docrb/doc_compiler/doc_blocks.rb
101
+ - lib/docrb/doc_compiler/doc_class.rb
102
+ - lib/docrb/doc_compiler/doc_method.rb
103
+ - lib/docrb/doc_compiler/doc_module.rb
104
+ - lib/docrb/doc_compiler/file_ref.rb
105
+ - lib/docrb/doc_compiler/object_container.rb
106
+ - lib/docrb/markdown.rb
107
+ - lib/docrb/module_extensions.rb
108
+ - lib/docrb/resolvable.rb
109
+ - lib/docrb/ruby_parser.rb
110
+ - lib/docrb/spec.rb
111
+ - lib/docrb/version.rb
112
+ homepage: https://github.com/heyvito/docrb
113
+ licenses:
114
+ - MIT
115
+ metadata:
116
+ homepage_uri: https://github.com/heyvito/docrb
117
+ source_code_uri: https://github.com/heyvito/docrb/tree/trunk/lib/docrb
118
+ changelog_uri: https://github.com/heyvito/docrb
119
+ rubygems_mfa_required: 'true'
120
+ post_install_message:
121
+ rdoc_options: []
122
+ require_paths:
123
+ - lib
124
+ required_ruby_version: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: '3.2'
129
+ required_rubygems_version: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - ">="
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ requirements: []
135
+ rubygems_version: 3.4.2
136
+ signing_key:
137
+ specification_version: 4
138
+ summary: An opinionated documentation parser
139
+ test_files: []