polishgeeks-dev-tools 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +22 -0
  3. data/.ruby-gemset +1 -0
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +6 -0
  6. data/Gemfile +2 -0
  7. data/Gemfile.lock +193 -0
  8. data/README.md +112 -0
  9. data/Rakefile +20 -0
  10. data/config/haml-lint.yml +74 -0
  11. data/config/rubocop.yml +35 -0
  12. data/config/yardopts +7 -0
  13. data/lib/polishgeeks-dev-tools.rb +43 -0
  14. data/lib/polishgeeks/dev-tools/command/allowed_extensions.rb +62 -0
  15. data/lib/polishgeeks/dev-tools/command/base.rb +73 -0
  16. data/lib/polishgeeks/dev-tools/command/brakeman.rb +46 -0
  17. data/lib/polishgeeks/dev-tools/command/coverage.rb +43 -0
  18. data/lib/polishgeeks/dev-tools/command/examples_comparator.rb +75 -0
  19. data/lib/polishgeeks/dev-tools/command/expires_in.rb +74 -0
  20. data/lib/polishgeeks/dev-tools/command/haml_lint.rb +28 -0
  21. data/lib/polishgeeks/dev-tools/command/readme.rb +32 -0
  22. data/lib/polishgeeks/dev-tools/command/rspec.rb +38 -0
  23. data/lib/polishgeeks/dev-tools/command/rspec_files_names.rb +58 -0
  24. data/lib/polishgeeks/dev-tools/command/rspec_files_structure.rb +134 -0
  25. data/lib/polishgeeks/dev-tools/command/rubocop.rb +50 -0
  26. data/lib/polishgeeks/dev-tools/command/rubycritic.rb +17 -0
  27. data/lib/polishgeeks/dev-tools/command/simplecov.rb +32 -0
  28. data/lib/polishgeeks/dev-tools/command/tasks_files_names.rb +76 -0
  29. data/lib/polishgeeks/dev-tools/command/yard.rb +35 -0
  30. data/lib/polishgeeks/dev-tools/command/yml_parser.rb +85 -0
  31. data/lib/polishgeeks/dev-tools/config.rb +91 -0
  32. data/lib/polishgeeks/dev-tools/hash.rb +24 -0
  33. data/lib/polishgeeks/dev-tools/logger.rb +63 -0
  34. data/lib/polishgeeks/dev-tools/output_storer.rb +17 -0
  35. data/lib/polishgeeks/dev-tools/runner.rb +27 -0
  36. data/lib/polishgeeks/dev-tools/shell.rb +16 -0
  37. data/lib/polishgeeks/dev-tools/tasks/dev-tools.rake +15 -0
  38. data/lib/polishgeeks/dev-tools/version.rb +8 -0
  39. data/polishgeeks_dev_tools.gemspec +36 -0
  40. data/spec/lib/polishgeeks-dev-tools_spec.rb +35 -0
  41. data/spec/lib/polishgeeks/dev-tools/command/allowed_extensions_spec.rb +66 -0
  42. data/spec/lib/polishgeeks/dev-tools/command/base_spec.rb +127 -0
  43. data/spec/lib/polishgeeks/dev-tools/command/brakeman_spec.rb +95 -0
  44. data/spec/lib/polishgeeks/dev-tools/command/coverage_spec.rb +121 -0
  45. data/spec/lib/polishgeeks/dev-tools/command/examples_comparator_spec.rb +171 -0
  46. data/spec/lib/polishgeeks/dev-tools/command/expires_in_spec.rb +69 -0
  47. data/spec/lib/polishgeeks/dev-tools/command/haml_lint_spec.rb +79 -0
  48. data/spec/lib/polishgeeks/dev-tools/command/readme_spec.rb +38 -0
  49. data/spec/lib/polishgeeks/dev-tools/command/rspec_files_names_spec.rb +91 -0
  50. data/spec/lib/polishgeeks/dev-tools/command/rspec_files_structure_spec.rb +262 -0
  51. data/spec/lib/polishgeeks/dev-tools/command/rspec_spec.rb +63 -0
  52. data/spec/lib/polishgeeks/dev-tools/command/rubocop_spec.rb +127 -0
  53. data/spec/lib/polishgeeks/dev-tools/command/rubycritic_spec.rb +27 -0
  54. data/spec/lib/polishgeeks/dev-tools/command/simplecov_spec.rb +53 -0
  55. data/spec/lib/polishgeeks/dev-tools/command/tasks_files_names_spec.rb +108 -0
  56. data/spec/lib/polishgeeks/dev-tools/command/yard_spec.rb +86 -0
  57. data/spec/lib/polishgeeks/dev-tools/command/yml_parser_spec.rb +104 -0
  58. data/spec/lib/polishgeeks/dev-tools/config_spec.rb +78 -0
  59. data/spec/lib/polishgeeks/dev-tools/hash_spec.rb +37 -0
  60. data/spec/lib/polishgeeks/dev-tools/logger_spec.rb +162 -0
  61. data/spec/lib/polishgeeks/dev-tools/output_storer_spec.rb +20 -0
  62. data/spec/lib/polishgeeks/dev-tools/runner_spec.rb +57 -0
  63. data/spec/lib/polishgeeks/dev-tools/shell_spec.rb +13 -0
  64. data/spec/lib/polishgeeks/dev-tools/version_spec.rb +7 -0
  65. data/spec/spec_helper.rb +28 -0
  66. metadata +330 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c2cfc9419ae8508626d77a5455eb886d1a89c20a
4
+ data.tar.gz: 413ff1e0091e908259ec11fcbda3856dff8f6c32
5
+ SHA512:
6
+ metadata.gz: 5fe73b0e2f5e6cdd1312a020a10f4ee6d420cd42c5ef41fd32c0a325afda7ed2a89140a7720dbe1ad0d2eb3c3a836528923c4f967c4767612340eb55fddfb747
7
+ data.tar.gz: ae87dbbaa7e11a683a519702b8c6082aec66fa8f240ab11fb3cf40a8fa6627d4f219c4f4e27b017d86d1a945ed1614e62f18b0990ded21dddf6cb0264a2bfe73
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .idea
5
+ .config
6
+ .yardoc
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ polishgeeks-dev-tools
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.2.2
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.6
4
+ - 2.2.2
5
+ script:
6
+ - bundle exec rake
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,193 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ polishgeeks-dev-tools (1.0.0)
5
+ brakeman
6
+ faker
7
+ haml-lint
8
+ mongoid-rspec
9
+ pry
10
+ rspec
11
+ rubocop
12
+ rubycritic (= 1.2.1)
13
+ shoulda
14
+ simplecov
15
+ timecop
16
+ yard
17
+
18
+ GEM
19
+ remote: https://rubygems.org/
20
+ specs:
21
+ abstract_type (0.0.7)
22
+ activemodel (4.2.3)
23
+ activesupport (= 4.2.3)
24
+ builder (~> 3.1)
25
+ activesupport (4.2.3)
26
+ i18n (~> 0.7)
27
+ json (~> 1.7, >= 1.7.7)
28
+ minitest (~> 5.1)
29
+ thread_safe (~> 0.3, >= 0.3.4)
30
+ tzinfo (~> 1.1)
31
+ adamantium (0.2.0)
32
+ ice_nine (~> 0.11.0)
33
+ memoizable (~> 0.4.0)
34
+ ast (2.1.0)
35
+ astrolabe (1.3.1)
36
+ parser (~> 2.2)
37
+ axiom-types (0.1.1)
38
+ descendants_tracker (~> 0.0.4)
39
+ ice_nine (~> 0.11.0)
40
+ thread_safe (~> 0.3, >= 0.3.1)
41
+ brakeman (3.0.5)
42
+ erubis (~> 2.6)
43
+ fastercsv (~> 1.5)
44
+ haml (>= 3.0, < 5.0)
45
+ highline (~> 1.6.20)
46
+ multi_json (~> 1.2)
47
+ ruby2ruby (~> 2.1.1)
48
+ ruby_parser (~> 3.7.0)
49
+ sass (~> 3.0)
50
+ terminal-table (~> 1.4)
51
+ bson (3.2.1)
52
+ builder (3.2.2)
53
+ coderay (1.1.0)
54
+ coercible (1.0.0)
55
+ descendants_tracker (~> 0.0.1)
56
+ concord (0.1.5)
57
+ adamantium (~> 0.2.0)
58
+ equalizer (~> 0.0.9)
59
+ connection_pool (2.2.0)
60
+ descendants_tracker (0.0.4)
61
+ thread_safe (~> 0.3, >= 0.3.1)
62
+ diff-lcs (1.2.5)
63
+ docile (1.1.5)
64
+ equalizer (0.0.11)
65
+ erubis (2.7.0)
66
+ faker (1.4.3)
67
+ i18n (~> 0.5)
68
+ fastercsv (1.5.5)
69
+ flay (2.4.0)
70
+ ruby_parser (~> 3.0)
71
+ sexp_processor (~> 4.0)
72
+ flog (4.2.1)
73
+ ruby_parser (~> 3.1, > 3.1.0)
74
+ sexp_processor (~> 4.4)
75
+ haml (4.0.7)
76
+ tilt
77
+ haml-lint (0.13.0)
78
+ haml (~> 4.0)
79
+ rubocop (>= 0.25.0)
80
+ sysexits (~> 1.1)
81
+ highline (1.6.21)
82
+ i18n (0.7.0)
83
+ ice_nine (0.11.1)
84
+ json (1.8.3)
85
+ memoizable (0.4.2)
86
+ thread_safe (~> 0.3, >= 0.3.1)
87
+ method_source (0.8.2)
88
+ minitest (5.8.0)
89
+ mongoid (4.0.2)
90
+ activemodel (~> 4.0)
91
+ moped (~> 2.0.0)
92
+ origin (~> 2.1)
93
+ tzinfo (>= 0.3.37)
94
+ mongoid-rspec (2.2.0)
95
+ mongoid (~> 4.0.0)
96
+ rake
97
+ rspec (~> 3.1)
98
+ moped (2.0.6)
99
+ bson (~> 3.0)
100
+ connection_pool (~> 2.0)
101
+ optionable (~> 0.2.0)
102
+ multi_json (1.11.2)
103
+ optionable (0.2.0)
104
+ origin (2.1.1)
105
+ parser (2.2.2.6)
106
+ ast (>= 1.1, < 3.0)
107
+ powerpack (0.1.1)
108
+ procto (0.0.2)
109
+ pry (0.10.1)
110
+ coderay (~> 1.1.0)
111
+ method_source (~> 0.8.1)
112
+ slop (~> 3.4)
113
+ rainbow (2.0.0)
114
+ rake (10.4.2)
115
+ reek (1.6.3)
116
+ parser (~> 2.2.0.pre.7)
117
+ rainbow (>= 1.99, < 3.0)
118
+ unparser (~> 0.2.2)
119
+ rspec (3.3.0)
120
+ rspec-core (~> 3.3.0)
121
+ rspec-expectations (~> 3.3.0)
122
+ rspec-mocks (~> 3.3.0)
123
+ rspec-core (3.3.2)
124
+ rspec-support (~> 3.3.0)
125
+ rspec-expectations (3.3.1)
126
+ diff-lcs (>= 1.2.0, < 2.0)
127
+ rspec-support (~> 3.3.0)
128
+ rspec-mocks (3.3.2)
129
+ diff-lcs (>= 1.2.0, < 2.0)
130
+ rspec-support (~> 3.3.0)
131
+ rspec-support (3.3.0)
132
+ rubocop (0.33.0)
133
+ astrolabe (~> 1.3)
134
+ parser (>= 2.2.2.5, < 3.0)
135
+ powerpack (~> 0.1)
136
+ rainbow (>= 1.99.1, < 3.0)
137
+ ruby-progressbar (~> 1.4)
138
+ ruby-progressbar (1.7.5)
139
+ ruby2ruby (2.1.4)
140
+ ruby_parser (~> 3.1)
141
+ sexp_processor (~> 4.0)
142
+ ruby_parser (3.7.1)
143
+ sexp_processor (~> 4.1)
144
+ rubycritic (1.2.1)
145
+ flay (= 2.4.0)
146
+ flog (= 4.2.1)
147
+ parser (>= 2.2.0, < 3.0)
148
+ reek (= 1.6.3)
149
+ ruby2ruby (>= 2.1.1, < 3.0)
150
+ virtus (~> 1.0)
151
+ sass (3.4.16)
152
+ sexp_processor (4.6.0)
153
+ shoulda (3.5.0)
154
+ shoulda-context (~> 1.0, >= 1.0.1)
155
+ shoulda-matchers (>= 1.4.1, < 3.0)
156
+ shoulda-context (1.2.1)
157
+ shoulda-matchers (2.8.0)
158
+ activesupport (>= 3.0.0)
159
+ simplecov (0.10.0)
160
+ docile (~> 1.1.0)
161
+ json (~> 1.8)
162
+ simplecov-html (~> 0.10.0)
163
+ simplecov-html (0.10.0)
164
+ slop (3.6.0)
165
+ sysexits (1.2.0)
166
+ terminal-table (1.5.2)
167
+ thread_safe (0.3.5)
168
+ tilt (2.0.1)
169
+ timecop (0.8.0)
170
+ tzinfo (1.2.2)
171
+ thread_safe (~> 0.1)
172
+ unparser (0.2.4)
173
+ abstract_type (~> 0.0.7)
174
+ adamantium (~> 0.2.0)
175
+ concord (~> 0.1.5)
176
+ diff-lcs (~> 1.2.5)
177
+ equalizer (~> 0.0.9)
178
+ parser (~> 2.2.2)
179
+ procto (~> 0.0.2)
180
+ virtus (1.0.5)
181
+ axiom-types (~> 0.1)
182
+ coercible (~> 1.0)
183
+ descendants_tracker (~> 0.0, >= 0.0.3)
184
+ equalizer (~> 0.0, >= 0.0.9)
185
+ yard (0.8.7.6)
186
+
187
+ PLATFORMS
188
+ ruby
189
+
190
+ DEPENDENCIES
191
+ bundler
192
+ polishgeeks-dev-tools!
193
+ rake
data/README.md ADDED
@@ -0,0 +1,112 @@
1
+ # PolishGeeks Dev Tools
2
+
3
+ [![Build Status](https://travis-ci.org/polishgeeks/polishgeeks-dev-tools.png)](https://travis-ci.org/polishgeeks/polishgeeks-dev-tools)
4
+ [![Code Climate](https://codeclimate.com/github/polishgeeks/polishgeeks-dev-tools/badges/gpa.svg)](https://codeclimate.com/github/polishgeeks/polishgeeks-dev-tools)
5
+
6
+ Gem with a set of useful tools used when developing Ruby based applications.
7
+
8
+ ## Installation
9
+
10
+ ```ruby
11
+ group :development, :test do
12
+ gem 'polishgeeks-dev-tools'
13
+ end
14
+ ```
15
+
16
+ ## Setup
17
+
18
+ There are multiple options you can set either to true or false. All of them are available with configurator. Please use it only for development and testing environments. This config should be put in config/initializers/polishgeeks_dev_tools.rb file.
19
+
20
+ Note that all the options are turned on by default it depends on an app, which of the you should use.
21
+
22
+ If you want to use DevTools with all the default settings, you don't need to create an initializer.
23
+
24
+ ### Rack apps (Sinatra)
25
+ ```ruby
26
+ if %i( test development ).include?(App.environment)
27
+ PolishGeeks::DevTools.setup do |config|
28
+ # For example - lowering a simplecov_threshold
29
+ config.simplecov_threshold = 98
30
+ end
31
+ end
32
+ ```
33
+ ### Rack apps (Rails)
34
+ ```ruby
35
+ if %w( test development ).include?(Rails.env)
36
+ PolishGeeks::DevTools.setup do |config|
37
+ config.brakeman = true # Rails only
38
+ # You can disable any command that is executed by setting it to false
39
+ config.rubycritic = false
40
+ end
41
+ end
42
+ ```
43
+
44
+ ### Available options
45
+
46
+ Some options might be available only for given framework (Ruby on Rails, Sinatra, etc). Please refer to this table to
47
+ determine, which you can use in your project:
48
+
49
+ | Option | Framework | Description |
50
+ |-----------------------|-----------|---------------------------------------------------------------------------------------|
51
+ | brakeman | Rails | A static analysis security vulnerability scanner for Ruby on Rails |
52
+ | rubocop | - | Used to check Ruby syntax according to our styling |
53
+ | expires_in | - | Checks if there are typos like expire_in, etc that might brake app caching |
54
+ | haml_lint | - | User to check HAML syntax in the app views |
55
+ | yard | - | YARD documentation standards checking |
56
+ | rspec_files_names | - | Checks if all the rspec files have proper sufix (_spec.rb) |
57
+ | rspec_files_structure | - | Checks if we have corresponding _spec.rb files for each app/ lib ruby file |
58
+ | tasks_files_names | - | Checks if all the tasks for Capistrano and Rake files have proper extensions |
59
+ | rspec | - | Specs framework |
60
+ | coverage | - | Specs code coverage generator |
61
+ | simplecov | - | Simplecov code coverage threshold checking |
62
+ | simplecov_threshold | - | Threshold level for code coverage |
63
+ | examples_comparator | - | Compares yml *.example files with non-examples and checks if they have same structure |
64
+ | rubycritic | - | Generates a RubyCritic for given project |
65
+ | allowed_extensions | - | Checks that all the files in ./config directory have an allowed extension |
66
+ | yml_parser | - | Checks that parameters of all yaml files in ./config directory have some value |
67
+
68
+ ## Config options
69
+
70
+ Some validators might accept additional config settings - please refer to this table for a description on how to use them:
71
+
72
+ | Option | Validator | Description |
73
+ |-------------------------------|-----------------------|----------------------------------------------------------|
74
+ | rspec_files_structure_ignored | rspec_files_structure | You can provide an array of files that should be ignored |
75
+
76
+ ## Usage in any Rails/Ruby application
77
+
78
+ Once you've set up all the options and a config initializer, please execute following command:
79
+
80
+ ```bash
81
+ bundle exec rake polishgeeks:dev-tools:check
82
+ ```
83
+
84
+ ## Usage with other Ruby gems
85
+
86
+ If you want to use this gem to check other gems quality, you will have to put following things in your gem Rakefile:
87
+
88
+ ```ruby
89
+ require 'bundler'
90
+ require 'rake'
91
+ require 'polishgeeks-dev-tools'
92
+
93
+ desc 'Self check using command maintained in this gem'
94
+ task :check do
95
+ PolishGeeks::DevTools.setup do |config|
96
+ # Any config option you want to disable/enable
97
+ config.brakeman = false
98
+ end
99
+
100
+ PolishGeeks::DevTools::Runner.new.execute(
101
+ PolishGeeks::DevTools::Logger.new
102
+ )
103
+ end
104
+
105
+ task default: :check
106
+ ```
107
+
108
+ And then from command line, run:
109
+
110
+ ```bash
111
+ bundle exec rake
112
+ ```
data/Rakefile ADDED
@@ -0,0 +1,20 @@
1
+ require 'bundler'
2
+ require 'rake'
3
+ require 'polishgeeks-dev-tools'
4
+
5
+ desc 'Self check using command maintained in this gem'
6
+ task :check do
7
+ PolishGeeks::DevTools.setup do |config|
8
+ config.brakeman = false
9
+ config.haml_lint = false
10
+ config.expires_in_files_ignored = %w(
11
+ lib/polishgeeks/dev-tools/command/expires_in.rb
12
+ )
13
+ end
14
+
15
+ PolishGeeks::DevTools::Runner.new.execute(
16
+ PolishGeeks::DevTools::Logger.new
17
+ )
18
+ end
19
+
20
+ task default: :check
@@ -0,0 +1,74 @@
1
+ skip_frontmatter: false
2
+
3
+ linters:
4
+ ClassAttributeWithStaticValue:
5
+ enabled: true
6
+
7
+ ClassesBeforeIds:
8
+ enabled: false
9
+
10
+ ConsecutiveComments:
11
+ enabled: true
12
+
13
+ ConsecutiveSilentScripts:
14
+ enabled: true
15
+ max_consecutive: 2
16
+
17
+ EmptyScript:
18
+ enabled: true
19
+
20
+ HtmlAttributes:
21
+ enabled: true
22
+
23
+ ImplicitDiv:
24
+ enabled: true
25
+
26
+ LeadingCommentSpace:
27
+ enabled: true
28
+
29
+ LineLength:
30
+ enabled: false
31
+
32
+ MultilinePipe:
33
+ enabled: true
34
+
35
+ ObjectReferenceAttributes:
36
+ enabled: true
37
+
38
+ RuboCop:
39
+ enabled: true
40
+ # These cops are incredibly noisy when it comes to HAML templates, so we
41
+ # ignore them.
42
+ ignored_cops:
43
+ - Lint/BlockAlignment
44
+ - Lint/EndAlignment
45
+ - Lint/Void
46
+ - Metrics/BlockNesting
47
+ - Metrics/LineLength
48
+ - Style/AlignParameters
49
+ - Style/AsciiComments
50
+ - Style/FileName
51
+ - Style/IfUnlessModifier
52
+ - Style/IndentationWidth
53
+ - Style/Next
54
+ - Style/SpaceBeforeComment
55
+ - Style/TrailingWhitespace
56
+ - Style/WhileUntilModifier
57
+
58
+ RubyComments:
59
+ enabled: true
60
+
61
+ SpaceBeforeScript:
62
+ enabled: true
63
+
64
+ TagName:
65
+ enabled: true
66
+
67
+ TrailingWhitespace:
68
+ enabled: true
69
+
70
+ UnnecessaryInterpolation:
71
+ enabled: true
72
+
73
+ UnnecessaryStringOutput:
74
+ enabled: true