massa 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +8 -0
- data/bin/massa +7 -4
- data/lib/massa/cli.rb +4 -2
- data/lib/massa/tool.rb +18 -6
- data/lib/massa/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d73ed47d52f86581a800df65e74bfaf03d158558
|
4
|
+
data.tar.gz: a7cf3f0f19f8dad4ac430b5d4ae15edf082cd105
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 13dae513194f94526bc814b9643f570d93edbc2181d17910fb1028d8f11061edd1b1bba4c395ecc0613170a1c0502dda3f598de877ded3e1f13ec0901826b203
|
7
|
+
data.tar.gz: ccc6ea870d4586de0cc2dfc7356660c822c66682754bb7c2e4a24352870f4a01ff262cea3f02f9a8314e1d77526d38eb75c84e62ee859bfb27d6c949a1ab97a5
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -10,6 +10,14 @@ This gem helps you to keep or increase the quality, good practices and security
|
|
10
10
|
|
11
11
|
**Massa** can run in your CI using different code analyzers tools along with automated tests, instead of running only your automated tests.
|
12
12
|
|
13
|
+
Ie.: Instead of:
|
14
|
+
|
15
|
+
$ bundle exec rubocop && bundle exec brakeman -Aqz && bundle exec rails_best_practices && bundle exec rspec && etc
|
16
|
+
|
17
|
+
You will only need:
|
18
|
+
|
19
|
+
$ bundle exec massa
|
20
|
+
|
13
21
|
You can either use only the [default tools](https://github.com/lucascaton/massa/blob/master/config/default_tools.yml) or adding custom ones by using a [simple config file](https://github.com/lucascaton/massa#usage).
|
14
22
|
|
15
23
|
![massa](https://raw.githubusercontent.com/lucascaton/massa/master/readme/massa.gif)
|
data/bin/massa
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require 'optparse'
|
5
|
+
require 'massa'
|
6
|
+
|
5
7
|
$LOAD_PATH.push File.expand_path('../../lib', __FILE__)
|
6
8
|
|
7
9
|
options = {}
|
@@ -10,8 +12,11 @@ OptionParser.new do |opts|
|
|
10
12
|
opts.banner = 'Usage: massa [options]'
|
11
13
|
|
12
14
|
opts.on('-g', '--generate-config', 'Generate config file') do
|
13
|
-
template
|
14
|
-
|
15
|
+
template = File.expand_path('../../lib/massa/templates/massa.yml', __FILE__)
|
16
|
+
config_file = 'config/massa.yml'
|
17
|
+
|
18
|
+
FileUtils.cp(template, "#{Dir.pwd}/config_file")
|
19
|
+
Massa::CLI.colorize :default, 'File generated: ', :green, "#{config_file}\n"
|
15
20
|
exit
|
16
21
|
end
|
17
22
|
|
@@ -35,8 +40,6 @@ OptionParser.new do |opts|
|
|
35
40
|
end
|
36
41
|
end.parse!
|
37
42
|
|
38
|
-
require 'massa'
|
39
|
-
|
40
43
|
begin
|
41
44
|
Massa::Analyzier.run!(options)
|
42
45
|
rescue Gem::LoadError
|
data/lib/massa/cli.rb
CHANGED
@@ -3,8 +3,10 @@
|
|
3
3
|
module Massa
|
4
4
|
class CLI
|
5
5
|
class << self
|
6
|
-
def colorize(
|
7
|
-
|
6
|
+
def colorize(*args)
|
7
|
+
print "\n"
|
8
|
+
args.each_slice(2) { |color, string| print "\e[#{code(color)}m#{string}\e[0m" }
|
9
|
+
print "\n"
|
8
10
|
end
|
9
11
|
|
10
12
|
def code(color)
|
data/lib/massa/tool.rb
CHANGED
@@ -4,15 +4,27 @@ module Massa
|
|
4
4
|
class Tool
|
5
5
|
class << self
|
6
6
|
def list
|
7
|
-
default_tools
|
8
|
-
|
9
|
-
|
10
|
-
default_tools.merge YAML.load_file(config_file_from_project)
|
11
|
-
else
|
12
|
-
default_tools
|
7
|
+
default_tools.each_with_object({}) do |(tool, options), hash|
|
8
|
+
hash[tool] = options.merge(custom_tools[tool] || {})
|
9
|
+
hash
|
13
10
|
end
|
14
11
|
end
|
15
12
|
|
13
|
+
private
|
14
|
+
|
15
|
+
def default_tools
|
16
|
+
YAML.load_file(config_file_from_gem)
|
17
|
+
end
|
18
|
+
|
19
|
+
def custom_tools
|
20
|
+
# Returns an empty hash if config file is empty
|
21
|
+
YAML.load_file(config_file_from_project) || {}
|
22
|
+
|
23
|
+
# When there is no config file in the project
|
24
|
+
rescue Errno::ENOENT
|
25
|
+
{}
|
26
|
+
end
|
27
|
+
|
16
28
|
def config_file_from_gem
|
17
29
|
File.expand_path('../../../config/default_tools.yml', __FILE__)
|
18
30
|
end
|
data/lib/massa/version.rb
CHANGED