massa 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +8 -9
- data/bin/massa +6 -0
- data/config/default_tools.yml +24 -24
- data/lib/massa/analyzer.rb +8 -8
- data/lib/massa/templates/massa.yml +11 -0
- data/lib/massa/tool.rb +7 -3
- data/lib/massa/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c2ba08bdec35891e253256b7ba9886ba361d72d2
|
4
|
+
data.tar.gz: 1f9e9b2cb0b09545e2f87e53b32fd8015b5a674f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d6f304f6f0dc662fd5d171c8b47e8126a49835b6fcf419a98750efc36c8e3d7a0e1707590b824ee361ede8cb0a8f267a68dd2f5ee8eb498f28423c7078095b6
|
7
|
+
data.tar.gz: a263467e79bf57730572ce65a39dc8f2202482d8ac8dd654024a80589acac0a1002b663655b14aa8dce9dff0ef2e687efe30780b7a8b193a83c6a246aed207bc
|
data/README.md
CHANGED
@@ -2,13 +2,13 @@
|
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/massa.svg)](https://rubygems.org/gems/massa)
|
4
4
|
[![Build Status](https://travis-ci.org/lucascaton/massa.svg?branch=master)](https://travis-ci.org/lucascaton/massa)
|
5
|
-
[![Coverage
|
5
|
+
[![Test Coverage](https://codeclimate.com/github/lucascaton/massa/badges/coverage.svg)](https://codeclimate.com/github/lucascaton/massa/coverage)
|
6
6
|
[![Code Climate](https://codeclimate.com/github/lucascaton/massa/badges/gpa.svg)](https://codeclimate.com/github/lucascaton/massa)
|
7
7
|
|
8
|
-
It's
|
9
|
-
This gem helps you to keep
|
8
|
+
It's not rare to have Ruby (and Rails) projects becomming hard to maintain and less fun after a while.
|
9
|
+
This gem helps you to keep or increase the quality, good practices and security of your projects.
|
10
10
|
|
11
|
-
**Massa** can run in your CI
|
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
13
|
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
14
|
|
@@ -34,11 +34,11 @@ And then execute:
|
|
34
34
|
|
35
35
|
## Usage
|
36
36
|
|
37
|
-
|
37
|
+
Generate a config file:
|
38
38
|
|
39
|
-
$
|
39
|
+
$ bundle exec massa -g
|
40
40
|
|
41
|
-
Then, run
|
41
|
+
Then, run:
|
42
42
|
|
43
43
|
$ bundle exec massa
|
44
44
|
|
@@ -48,8 +48,7 @@ It's recommended to use `-V` (or `--verbose`) flag when running it in a CI:
|
|
48
48
|
|
49
49
|
## About the gem name
|
50
50
|
|
51
|
-
"Massa" is a Portuguese slang which means "awesome",
|
52
|
-
so once you add it to your project, it becomes "massa"!
|
51
|
+
**"Massa"** is a Portuguese slang which means "awesome", so once you add it to your project, it becomes "massa"!
|
53
52
|
|
54
53
|
## Contributing
|
55
54
|
|
data/bin/massa
CHANGED
@@ -9,6 +9,12 @@ options = {}
|
|
9
9
|
OptionParser.new do |opts|
|
10
10
|
opts.banner = 'Usage: massa [options]'
|
11
11
|
|
12
|
+
opts.on('-g', '--generate-config', 'Generate config file') do
|
13
|
+
template = File.expand_path('../../lib/massa/templates/massa.yml', __FILE__)
|
14
|
+
FileUtils.cp(template, "#{Dir.pwd}/config/massa.yml")
|
15
|
+
exit
|
16
|
+
end
|
17
|
+
|
12
18
|
opts.on('-h', '--help', 'Display this help') do
|
13
19
|
puts opts
|
14
20
|
puts
|
data/config/default_tools.yml
CHANGED
@@ -1,29 +1,29 @@
|
|
1
|
-
|
2
|
-
:
|
3
|
-
|
4
|
-
|
1
|
+
rubocop:
|
2
|
+
description: 'Rubocop'
|
3
|
+
command: 'bundle exec rubocop'
|
4
|
+
required: true
|
5
5
|
|
6
|
-
|
7
|
-
:
|
8
|
-
|
9
|
-
|
6
|
+
brakeman:
|
7
|
+
description: 'Brakeman'
|
8
|
+
command: 'bundle exec brakeman -Aqz'
|
9
|
+
required: true
|
10
10
|
|
11
|
-
|
12
|
-
:
|
13
|
-
|
14
|
-
|
11
|
+
rails_best_practices:
|
12
|
+
description: 'Rails Best Practices'
|
13
|
+
command: 'bundle exec rails_best_practices'
|
14
|
+
required: true
|
15
15
|
|
16
|
-
|
17
|
-
:
|
18
|
-
|
19
|
-
|
16
|
+
haml_lint:
|
17
|
+
description: 'HAML lint'
|
18
|
+
command: 'bundle exec haml-lint app/views'
|
19
|
+
required: true
|
20
20
|
|
21
|
-
-
|
22
|
-
:
|
23
|
-
|
24
|
-
|
21
|
+
i18n-tasks:
|
22
|
+
description: 'I18n translations'
|
23
|
+
command: 'bundle exec i18n-tasks missing'
|
24
|
+
required: false
|
25
25
|
|
26
|
-
-
|
27
|
-
:
|
28
|
-
|
29
|
-
|
26
|
+
rspec-rails:
|
27
|
+
description: 'RSpec'
|
28
|
+
command: 'RAILS_ENV=test bundle exec rspec'
|
29
|
+
required: true
|
data/lib/massa/analyzer.rb
CHANGED
@@ -19,10 +19,10 @@ module Massa
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def run!
|
22
|
-
Massa::Tool.list.each do |tool|
|
23
|
-
Massa::CLI.colorize :blue, "➙ #{tool
|
22
|
+
Massa::Tool.list.each do |gem_name, tool|
|
23
|
+
Massa::CLI.colorize :blue, "➙ #{tool['description']}"
|
24
24
|
|
25
|
-
next unless gem_installed?(
|
25
|
+
next unless gem_installed?(gem_name, required: tool['required'])
|
26
26
|
|
27
27
|
execute(tool)
|
28
28
|
end
|
@@ -42,18 +42,18 @@ module Massa
|
|
42
42
|
command_output = ''
|
43
43
|
|
44
44
|
if verbose?
|
45
|
-
system(tool
|
45
|
+
system(tool['command'])
|
46
46
|
else
|
47
|
-
IO.popen(tool
|
47
|
+
IO.popen(tool['command'], err: [:child, :out]) { |io| command_output = io.read }
|
48
48
|
end
|
49
49
|
|
50
50
|
unless $CHILD_STATUS.success?
|
51
|
-
Massa::CLI.colorize :red, "¯\\_(ツ)_/¯ #{tool
|
52
|
-
Massa::CLI.colorize :yellow, "$ #{tool
|
51
|
+
Massa::CLI.colorize :red, "¯\\_(ツ)_/¯ #{tool['description']} failed:"
|
52
|
+
Massa::CLI.colorize :yellow, "$ #{tool['command']}"
|
53
53
|
|
54
54
|
puts command_output if command_output.to_s != ''
|
55
55
|
|
56
|
-
exit 1 if tool
|
56
|
+
exit 1 if tool['required']
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# Default tools will run by default:
|
2
|
+
# https://github.com/lucascaton/massa/blob/master/config/default_tools.yml
|
3
|
+
# You can overwrite any tool completely or just change its `require` config to `false`
|
4
|
+
|
5
|
+
# rspec-rails:
|
6
|
+
# required: false
|
7
|
+
#
|
8
|
+
# minitest:
|
9
|
+
# description: 'minitest'
|
10
|
+
# command: 'bundle exec rake'
|
11
|
+
# required: true
|
data/lib/massa/tool.rb
CHANGED
@@ -4,11 +4,15 @@ module Massa
|
|
4
4
|
class Tool
|
5
5
|
class << self
|
6
6
|
def list
|
7
|
-
YAML.load_file(
|
7
|
+
YAML.load_file(config_file_from_gem).merge YAML.load_file(config_file_from_project)
|
8
8
|
end
|
9
9
|
|
10
|
-
def
|
11
|
-
|
10
|
+
def config_file_from_gem
|
11
|
+
File.expand_path('../../../config/default_tools.yml', __FILE__)
|
12
|
+
end
|
13
|
+
|
14
|
+
def config_file_from_project
|
15
|
+
"#{Dir.pwd}/config/massa.yml"
|
12
16
|
end
|
13
17
|
end
|
14
18
|
end
|
data/lib/massa/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: massa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lucas Caton
|
@@ -130,6 +130,7 @@ files:
|
|
130
130
|
- lib/massa.rb
|
131
131
|
- lib/massa/analyzer.rb
|
132
132
|
- lib/massa/cli.rb
|
133
|
+
- lib/massa/templates/massa.yml
|
133
134
|
- lib/massa/tool.rb
|
134
135
|
- lib/massa/version.rb
|
135
136
|
- massa.gemspec
|