doc-digger 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -4
- data/doc-digger.gemspec +2 -1
- data/lib/doc-digger.rb +21 -2
- data/lib/doc-digger/line_parser.rb +1 -1
- data/lib/doc-digger/scan.rb +30 -0
- data/lib/doc-digger/version.rb +1 -1
- metadata +19 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e4efff0f3943fa58408708569f8193c93e58003
|
4
|
+
data.tar.gz: 313168a6f88256bd4355963c2f0a410670d2d952
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80529ae19ab34fe5d4b0cae56546e8a2775b72d52e72c47eaf79a7c5fb636d7e36176fb079d801de9ffa4b1ca42c60b793e4f7b081b8170dbc9162af733e7759
|
7
|
+
data.tar.gz: 17cf1c3a102d8bf785b59279cee95e84658d87b5b05338f7792978b9c8b303aa92e0d5bb2136275a7bbc8fca2d73b9f7d6841b13886801666228ae6f40312474
|
data/README.md
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
# DocDigger
|
2
2
|
|
3
3
|
[![Build Status](https://travis-ci.org/wootaw/doc-digger.svg?branch=master)](https://travis-ci.org/wootaw/doc-digger)
|
4
|
-
[![Gem Version](https://badge.fury.io/rb/doc-digger.
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/doc-digger.svg)](https://badge.fury.io/rb/doc-digger)
|
5
5
|
[![Code Climate](https://codeclimate.com/github/wootaw/doc-digger/badges/gpa.svg)](https://codeclimate.com/github/wootaw/doc-digger)
|
6
6
|
[![Test Coverage](https://codeclimate.com/github/wootaw/doc-digger/badges/coverage.svg)](https://codeclimate.com/github/wootaw/doc-digger/coverage)
|
7
7
|
|
8
8
|
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/doc-digger`. To experiment with that code, run `bin/console` for an interactive prompt.
|
9
9
|
|
10
|
-
TODO: Delete this and the text above, and describe your gem
|
11
|
-
|
12
10
|
## Installation
|
13
11
|
|
14
12
|
Add this line to your application's Gemfile:
|
@@ -27,7 +25,7 @@ Or install it yourself as:
|
|
27
25
|
|
28
26
|
## Basic Usage
|
29
27
|
|
30
|
-
DocDigger is a tool for generating RESTful web API documentation by analyzing block comments. Below is a simple example showing some of the more common features of DocDigger in documenting parts of the Twitter API that created by Grape.
|
28
|
+
DocDigger is a tool for generating RESTful web API documentation by analyzing block comments in source code. Below is a simple example showing some of the more common features of DocDigger in documenting parts of the Twitter API that created by Grape.
|
31
29
|
|
32
30
|
```ruby
|
33
31
|
module Twitter
|
data/doc-digger.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["wootaw@gmail.com"]
|
11
11
|
|
12
12
|
spec.summary = "This gem generate RESTful web API documentation."
|
13
|
-
spec.description = "
|
13
|
+
spec.description = "DocDigger is a tool for generating RESTful web API documentation by analyzing block comments in source code."
|
14
14
|
spec.homepage = "https://github.com/wootaw/doc-digger"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
@@ -40,4 +40,5 @@ Gem::Specification.new do |spec|
|
|
40
40
|
spec.add_development_dependency "pry-remote", '~> 0'
|
41
41
|
spec.add_development_dependency "pry-nav", '~> 0'
|
42
42
|
spec.add_development_dependency "codeclimate-test-reporter", '~> 0.4.8'
|
43
|
+
spec.add_development_dependency "git", '~> 1'
|
43
44
|
end
|
data/lib/doc-digger.rb
CHANGED
@@ -1,9 +1,28 @@
|
|
1
1
|
require "base64"
|
2
2
|
require "json"
|
3
|
+
require "git"
|
3
4
|
require "doc-digger/version"
|
4
5
|
require "doc-digger/line_parser"
|
5
6
|
require "doc-digger/file_parser"
|
7
|
+
require "doc-digger/scan"
|
6
8
|
|
7
|
-
|
8
|
-
#
|
9
|
+
class String
|
10
|
+
# def black; "\033[30m#{self}\033[0m" end
|
11
|
+
# def red; "\033[31m#{self}\033[0m" end
|
12
|
+
def green; "\033[32m#{self}\033[0m" end
|
13
|
+
# def brown; "\033[33m#{self}\033[0m" end
|
14
|
+
def blue; "\033[34m#{self}\033[0m" end
|
15
|
+
# def magenta; "\033[35m#{self}\033[0m" end
|
16
|
+
# def cyan; "\033[36m#{self}\033[0m" end
|
17
|
+
# def gray; "\033[37m#{self}\033[0m" end
|
18
|
+
# def bg_black; "\033[40m#{self}\033[0m" end
|
19
|
+
# def bg_red; "\033[41m#{self}\033[0m" end
|
20
|
+
# def bg_green; "\033[42m#{self}\033[0m" end
|
21
|
+
# def bg_brown; "\033[43m#{self}\033[0m" end
|
22
|
+
# def bg_blue; "\033[44m#{self}\033[0m" end
|
23
|
+
# def bg_magenta; "\033[45m#{self}\033[0m" end
|
24
|
+
# def bg_cyan; "\033[46m#{self}\033[0m" end
|
25
|
+
# def bg_gray; "\033[47m#{self}\033[0m" end
|
26
|
+
# def bold; "\033[1m#{self}\033[22m" end
|
27
|
+
# def reverse_color; "\033[7m#{self}\033[27m" end
|
9
28
|
end
|
@@ -3,7 +3,7 @@ module DocDigger
|
|
3
3
|
|
4
4
|
PICKS = { java: /\A\s*\*/, erlang: /\A\s*%/, perl: /\A\s*#/ }
|
5
5
|
COMMANDS = /\A@(doc(\_state)?|res(\_(param|response|state|bind))?|cmd\_(def|use))\Z/
|
6
|
-
PARAMETER_LOCATIONS = /\Apath|query|header|form|body\Z/
|
6
|
+
PARAMETER_LOCATIONS = /\Apath|query|header|form|body|cookie\Z/
|
7
7
|
RESPONSE_LOCATIONS = /\Aheader|body\Z/
|
8
8
|
|
9
9
|
def initialize(str, clazz)
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module DocDigger
|
2
|
+
|
3
|
+
def self.scan(root, files='*')
|
4
|
+
all = []
|
5
|
+
Dir[File.join(root, "**/#{files}")].each do |fn|
|
6
|
+
dp = DocDigger::FileParser.new(fn)
|
7
|
+
docs = dp.results
|
8
|
+
if docs.length == 0
|
9
|
+
print ".".blue
|
10
|
+
else
|
11
|
+
all += docs
|
12
|
+
docs.each do |doc|
|
13
|
+
print "#{'*' * doc[:resources].length}".green
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
all
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.scan_current_branch(root)
|
21
|
+
git = Git.open(root)
|
22
|
+
|
23
|
+
current_branch = git.current_branch
|
24
|
+
|
25
|
+
lastest_commit = git.log.first
|
26
|
+
|
27
|
+
files = lastest_commit.diff(git.log[3].sha).stats[:files]
|
28
|
+
# ap files
|
29
|
+
end
|
30
|
+
end
|
data/lib/doc-digger/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doc-digger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- wootaw
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -164,8 +164,22 @@ dependencies:
|
|
164
164
|
- - "~>"
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: 0.4.8
|
167
|
-
|
168
|
-
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: git
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '1'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '1'
|
181
|
+
description: DocDigger is a tool for generating RESTful web API documentation by analyzing
|
182
|
+
block comments in source code.
|
169
183
|
email:
|
170
184
|
- wootaw@gmail.com
|
171
185
|
executables: []
|
@@ -187,6 +201,7 @@ files:
|
|
187
201
|
- lib/doc-digger.rb
|
188
202
|
- lib/doc-digger/file_parser.rb
|
189
203
|
- lib/doc-digger/line_parser.rb
|
204
|
+
- lib/doc-digger/scan.rb
|
190
205
|
- lib/doc-digger/version.rb
|
191
206
|
homepage: https://github.com/wootaw/doc-digger
|
192
207
|
licenses:
|