massa 0.1.5 → 0.2.0.rc1
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/.gitignore +0 -1
- data/Gemfile.lock +70 -0
- data/README.md +3 -3
- data/lib/massa/analyzer.rb +12 -12
- data/lib/massa/templates/massa.yml +35 -7
- data/lib/massa/tool.rb +18 -6
- data/lib/massa/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5294c5345ac2c5b006693c600568831d1de6649d
|
4
|
+
data.tar.gz: 2afeac396df3302a6edd7241692487745147684f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60eac8dff6af846ab950b3478e9a388e056216756cd4952ebee9e475bdf7e59b4b4b08db077500a46ed7b7243e7a6330236f0a3cc05612f3c714545467463b64
|
7
|
+
data.tar.gz: 25585fa5aecf1887868b16382eafc075360f4d7cccb8db8892c8e0cf7955f1c25c21be43ff7c599e2e52eb75797d6abe430f471dda4e6b5cf3874f05256a0cf3
|
data/.gitignore
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
massa (0.2.0.rc1)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
ast (2.2.0)
|
10
|
+
codeclimate-test-reporter (0.5.0)
|
11
|
+
simplecov (>= 0.7.1, < 1.0.0)
|
12
|
+
coderay (1.1.1)
|
13
|
+
diff-lcs (1.2.5)
|
14
|
+
docile (1.1.5)
|
15
|
+
json (1.8.3)
|
16
|
+
method_source (0.8.2)
|
17
|
+
parser (2.3.0.7)
|
18
|
+
ast (~> 2.2)
|
19
|
+
powerpack (0.1.1)
|
20
|
+
pry (0.10.3)
|
21
|
+
coderay (~> 1.1.0)
|
22
|
+
method_source (~> 0.8.1)
|
23
|
+
slop (~> 3.4)
|
24
|
+
rainbow (2.1.0)
|
25
|
+
rake (10.5.0)
|
26
|
+
rspec (3.4.0)
|
27
|
+
rspec-core (~> 3.4.0)
|
28
|
+
rspec-expectations (~> 3.4.0)
|
29
|
+
rspec-mocks (~> 3.4.0)
|
30
|
+
rspec-core (3.4.4)
|
31
|
+
rspec-support (~> 3.4.0)
|
32
|
+
rspec-expectations (3.4.0)
|
33
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
34
|
+
rspec-support (~> 3.4.0)
|
35
|
+
rspec-mocks (3.4.1)
|
36
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
+
rspec-support (~> 3.4.0)
|
38
|
+
rspec-support (3.4.1)
|
39
|
+
rubocop (0.39.0)
|
40
|
+
parser (>= 2.3.0.7, < 3.0)
|
41
|
+
powerpack (~> 0.1)
|
42
|
+
rainbow (>= 1.99.1, < 3.0)
|
43
|
+
ruby-progressbar (~> 1.7)
|
44
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
45
|
+
rubocop-rspec (1.4.1)
|
46
|
+
rubocop (= 0.39.0)
|
47
|
+
ruby-progressbar (1.7.5)
|
48
|
+
simplecov (0.11.2)
|
49
|
+
docile (~> 1.1.0)
|
50
|
+
json (~> 1.8)
|
51
|
+
simplecov-html (~> 0.10.0)
|
52
|
+
simplecov-html (0.10.0)
|
53
|
+
slop (3.6.0)
|
54
|
+
unicode-display_width (1.0.3)
|
55
|
+
|
56
|
+
PLATFORMS
|
57
|
+
ruby
|
58
|
+
|
59
|
+
DEPENDENCIES
|
60
|
+
bundler (~> 1.11)
|
61
|
+
codeclimate-test-reporter
|
62
|
+
massa!
|
63
|
+
pry
|
64
|
+
rake (~> 10.0)
|
65
|
+
rspec (~> 3.4)
|
66
|
+
rubocop
|
67
|
+
rubocop-rspec
|
68
|
+
|
69
|
+
BUNDLED WITH
|
70
|
+
1.11.2
|
data/README.md
CHANGED
@@ -12,13 +12,13 @@ This gem helps you to keep or increase the quality, good practices and security
|
|
12
12
|
|
13
13
|
Ie.: Instead of:
|
14
14
|
|
15
|
-
$ bundle exec rubocop && bundle exec brakeman -Aqz && bundle exec rails_best_practices && bundle exec rspec && etc
|
15
|
+
$ bundle exec rubocop && bundle exec brakeman -Aqz && bundle exec rails_best_practices && bundle exec rspec && karma start --single-run --browsers PhantomJS && etc
|
16
16
|
|
17
17
|
You will only need:
|
18
18
|
|
19
19
|
$ bundle exec massa
|
20
20
|
|
21
|
-
You can either use only the [default tools](https://github.com/lucascaton/massa/blob/master/config/default_tools.yml) or
|
21
|
+
You can either use only the [default tools](https://github.com/lucascaton/massa/blob/master/config/default_tools.yml) or define your own by using a [simple config file](https://github.com/lucascaton/massa#usage).
|
22
22
|
|
23
23
|

|
24
24
|
|
@@ -42,7 +42,7 @@ And then execute:
|
|
42
42
|
|
43
43
|
## Usage
|
44
44
|
|
45
|
-
Generate a config file:
|
45
|
+
Generate a config file (optional):
|
46
46
|
|
47
47
|
$ bundle exec massa -g
|
48
48
|
|
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 |
|
23
|
-
Massa::CLI.colorize :blue, "➙ #{tool
|
22
|
+
Massa::Tool.list.each do |tool|
|
23
|
+
Massa::CLI.colorize :blue, "➙ #{tool.description}"
|
24
24
|
|
25
|
-
next
|
25
|
+
next if tool.gem? && !gem_installed?(tool)
|
26
26
|
|
27
27
|
execute(tool)
|
28
28
|
end
|
@@ -30,30 +30,30 @@ module Massa
|
|
30
30
|
Massa::CLI.colorize :green, "~(‾▿‾)~ All good!"
|
31
31
|
end
|
32
32
|
|
33
|
-
def gem_installed?(
|
34
|
-
return true if `gem query -i #{name}`.chomp == 'true'
|
33
|
+
def gem_installed?(tool)
|
34
|
+
return true if `gem query -i #{tool.name}`.chomp == 'true'
|
35
35
|
|
36
|
-
Massa::CLI.colorize :yellow, "༼ つ ◕_◕ ༽つ '#{name}' is not installed"
|
36
|
+
Massa::CLI.colorize :yellow, "༼ つ ◕_◕ ༽つ '#{tool.name}' gem is not installed"
|
37
37
|
|
38
|
-
required ? exit(1) : false
|
38
|
+
tool.required? ? exit(1) : false
|
39
39
|
end
|
40
40
|
|
41
41
|
def execute(tool)
|
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
|
@@ -1,11 +1,39 @@
|
|
1
|
-
#
|
1
|
+
# By leaving this file empty, massa will run all default tools. You can check them here:
|
2
2
|
# https://github.com/lucascaton/massa/blob/master/config/default_tools.yml
|
3
|
-
#
|
3
|
+
# Otherwise you can define your own tools like in the following examples:
|
4
4
|
|
5
|
-
#
|
6
|
-
#
|
5
|
+
# rubocop:
|
6
|
+
# description: 'Rubocop'
|
7
|
+
# command: 'bundle exec rubocop'
|
8
|
+
# required: true
|
9
|
+
#
|
10
|
+
# brakeman:
|
11
|
+
# description: 'Brakeman'
|
12
|
+
# command: 'bundle exec brakeman -Aqz'
|
13
|
+
# required: true
|
14
|
+
#
|
15
|
+
# rails_best_practices:
|
16
|
+
# description: 'Rails Best Practices'
|
17
|
+
# command: 'bundle exec rails_best_practices'
|
18
|
+
# required: true
|
7
19
|
#
|
8
|
-
#
|
9
|
-
# description: '
|
10
|
-
# command: 'bundle exec
|
20
|
+
# haml_lint:
|
21
|
+
# description: 'HAML lint'
|
22
|
+
# command: 'bundle exec haml-lint app/views'
|
23
|
+
# required: true
|
24
|
+
#
|
25
|
+
# i18n-tasks:
|
26
|
+
# description: 'I18n translations'
|
27
|
+
# command: 'bundle exec i18n-tasks missing'
|
28
|
+
# required: false
|
29
|
+
#
|
30
|
+
# karma:
|
31
|
+
# description: 'Karma (JS specs)'
|
32
|
+
# command: 'karma start --single-run --browsers PhantomJS'
|
33
|
+
# required: true
|
34
|
+
# gem: false
|
35
|
+
#
|
36
|
+
# rspec-rails:
|
37
|
+
# description: 'RSpec'
|
38
|
+
# command: 'RAILS_ENV=test bundle exec rspec'
|
11
39
|
# required: true
|
data/lib/massa/tool.rb
CHANGED
@@ -2,23 +2,35 @@
|
|
2
2
|
|
3
3
|
module Massa
|
4
4
|
class Tool
|
5
|
+
attr_reader :name, :description, :gem, :command, :required
|
6
|
+
|
7
|
+
def initialize(name, attributes)
|
8
|
+
@name = name
|
9
|
+
@description = attributes['description']
|
10
|
+
@gem = attributes['gem'].nil? ? true : attributes[:gem]
|
11
|
+
@command = attributes['command']
|
12
|
+
@required = attributes['required'].nil? ? true : attributes[:required]
|
13
|
+
end
|
14
|
+
|
15
|
+
alias required? required
|
16
|
+
alias gem? gem
|
17
|
+
|
5
18
|
class << self
|
6
19
|
def list
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
end
|
20
|
+
tools = custom_tools.any? ? custom_tools : default_tools
|
21
|
+
|
22
|
+
tools.map { |name, attributes| new(name, attributes) }
|
11
23
|
end
|
12
24
|
|
13
25
|
private
|
14
26
|
|
15
27
|
def default_tools
|
16
|
-
YAML.load_file(config_file_from_gem)
|
28
|
+
@default_tools ||= YAML.load_file(config_file_from_gem)
|
17
29
|
end
|
18
30
|
|
19
31
|
def custom_tools
|
20
32
|
# Returns an empty hash if config file is empty
|
21
|
-
YAML.load_file(config_file_from_project) || {}
|
33
|
+
@custom_tools ||= YAML.load_file(config_file_from_project) || {}
|
22
34
|
|
23
35
|
# When there is no config file in the project
|
24
36
|
rescue Errno::ENOENT
|
data/lib/massa/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: massa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lucas Caton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -149,9 +149,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
149
149
|
version: '0'
|
150
150
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
151
151
|
requirements:
|
152
|
-
- - "
|
152
|
+
- - ">"
|
153
153
|
- !ruby/object:Gem::Version
|
154
|
-
version:
|
154
|
+
version: 1.3.1
|
155
155
|
requirements: []
|
156
156
|
rubyforge_project:
|
157
157
|
rubygems_version: 2.5.1
|