banalize 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2b0087481450fe823d7653961d51e65a77d1c204
4
- data.tar.gz: d0c17b02bfb921f7b9c66f30891b24cd48cc1606
3
+ metadata.gz: bf6d4ff389346ec3266feaf32efab5ba91c17400
4
+ data.tar.gz: bc52e8fe7b830cdbc4a70b07edd71b6189ac0696
5
5
  SHA512:
6
- metadata.gz: 11e7fe1cc961b17e79fab3d8d3c3db3fb9fa36912d7664330c013b12cdb0b7f1d797c7b6a66dfc9df74cd390c2194c414b31a05db8ae4158f2a83204a7edd0c7
7
- data.tar.gz: 4c417850b591635872e6b272b781dda161e4a06cdb8ff9a369f070e8cd161e01f621c169c002fa5fff2ff845e9aa91986036ce40692ecaca7b67d2cf5efaac45
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 ${a} around variables
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
@@ -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
- yellow
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
- puts pol[:description]
21
- puts
22
- end
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
+ ![banalize](images/banalize_small.png)
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
@@ -1 +1 @@
1
- 0.0.3
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.3
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-03-28 00:00:00.000000000 Z
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