banalize 0.0.3 → 0.0.4
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 +4 -4
- data/History.md +7 -1
- data/lib/commands/describe.rb +7 -12
- data/lib/helpers/description.rb +79 -0
- data/version.txt +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf6d4ff389346ec3266feaf32efab5ba91c17400
|
4
|
+
data.tar.gz: bc52e8fe7b830cdbc4a70b07edd71b6189ac0696
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 10160e842179287216bb7dcddf90206120d1d0d3acc0938131cbcf635cb38f4b600cc6beeec742fd748e55d5330d22cacf3c7a1279b4aa053bfb48d1d4e6bbf0
|
7
|
+
data.tar.gz: c196f2e6d6bcf7394ae2b4a2c0fdcbfedff7d47919a5192184f1903b7a8631ea4dc5f768faf26722a7c7a3598f21a3397f2dca439e7e399a896524d7c5f5fd8a
|
data/History.md
CHANGED
@@ -1,10 +1,16 @@
|
|
1
|
+
## v.0.0.4
|
2
|
+
|
3
|
+
* Fri Mar 29 2013 -- Dmytro Kovalov
|
4
|
+
|
5
|
+
- Generate Markdown documentation from policy descriptions
|
6
|
+
|
1
7
|
## v.0.0.3
|
2
8
|
|
3
9
|
* Thu Mar 28 2013 -- Dmytro Kovalov
|
4
10
|
|
5
11
|
- Filtering files by extension list: comma separated
|
6
12
|
- Add default sorting to policy search
|
7
|
-
- Policy to check braces $
|
13
|
+
- Policy to check braces $a around variables
|
8
14
|
with test for it
|
9
15
|
- Add template for ruby policy in the docs directory
|
10
16
|
- Policy to check uninitialized variables
|
data/lib/commands/describe.rb
CHANGED
@@ -6,20 +6,15 @@ command [:describe,:desc] do |c|
|
|
6
6
|
c.desc 'Print help for the specified policy'
|
7
7
|
c.command [:policy, :pol, :p] do |p|
|
8
8
|
|
9
|
-
def yellow
|
10
|
-
printf "%s\n", ('~' * 80).color(:yellow)
|
11
|
-
end
|
12
|
-
|
13
|
-
p.action do |global_options, options, args|
|
14
|
-
$policies.each do |pol|
|
15
9
|
|
16
|
-
|
17
|
-
printf "%s : %s\n", pol[:policy].to_s.color(:bold), pol[:synopsis].color(:green)
|
18
|
-
yellow
|
10
|
+
p.switch [:markdown, :m], desc: "Print description in markdown format"
|
19
11
|
|
20
|
-
|
21
|
-
|
22
|
-
|
12
|
+
|
13
|
+
p.action do |global_options, options, args|
|
14
|
+
Banalize::Describe.send(
|
15
|
+
options[:markdown] ? :markdown : :screen,
|
16
|
+
$policies
|
17
|
+
)
|
23
18
|
end
|
24
19
|
|
25
20
|
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
module Banalize
|
2
|
+
##
|
3
|
+
# Helper methods for printing out policies descriptions.
|
4
|
+
#
|
5
|
+
class Describe
|
6
|
+
|
7
|
+
##
|
8
|
+
# Format for markdown documentation for policies
|
9
|
+
#
|
10
|
+
FORMAT =<<-FORM
|
11
|
+
|
12
|
+
## %s
|
13
|
+
|
14
|
+
*%s*
|
15
|
+
|
16
|
+
* Policy name: %s
|
17
|
+
* Severity: %s
|
18
|
+
* Style: %s
|
19
|
+
* Defaults: %s
|
20
|
+
|
21
|
+
**Description**
|
22
|
+
|
23
|
+
````
|
24
|
+
%s
|
25
|
+
|
26
|
+
````
|
27
|
+
|
28
|
+
------------------------------------------------------------------
|
29
|
+
|
30
|
+
FORM
|
31
|
+
|
32
|
+
def self.yellow
|
33
|
+
printf "%s\n", ('~' * 80).color(:yellow)
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.markdown policies
|
37
|
+
|
38
|
+
puts <<-PUT
|
39
|
+
# @title List of available policies
|
40
|
+
|
41
|
+
# Banalizer
|
42
|
+
|
43
|
+

|
44
|
+
|
45
|
+
PUT
|
46
|
+
|
47
|
+
policies.each do |pol|
|
48
|
+
|
49
|
+
defl = ""
|
50
|
+
|
51
|
+
if pol[:default]
|
52
|
+
pol[:default].each { |k,v| defl << "\n * #{k}: #{v}\n" }
|
53
|
+
end
|
54
|
+
|
55
|
+
defl = "N/A" if defl.empty?
|
56
|
+
|
57
|
+
printf FORMAT,
|
58
|
+
pol[:policy].to_s.titleize,
|
59
|
+
pol[:synopsis],
|
60
|
+
pol[:policy],
|
61
|
+
pol[:severity],
|
62
|
+
pol[:style],
|
63
|
+
defl,
|
64
|
+
pol[:description]
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.screen policies
|
69
|
+
policies.each do |pol|
|
70
|
+
yellow
|
71
|
+
printf "%s : %s\n", pol[:policy].to_s.color(:bold), pol[:synopsis].color(:green)
|
72
|
+
yellow
|
73
|
+
|
74
|
+
puts pol[:description]
|
75
|
+
puts
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
data/version.txt
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: banalize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dmytro Kovalov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- ./lib/commands/list.rb
|
98
98
|
- ./lib/core_extensions/string.rb
|
99
99
|
- ./lib/helpers/beautify.rb
|
100
|
+
- ./lib/helpers/description.rb
|
100
101
|
- ./lib/policies/braces_for_variables.rb
|
101
102
|
- ./lib/policies/comment_coverage.rb
|
102
103
|
- ./lib/policies/consistent_indents.rb
|