massa 0.1.2 → 0.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1e726ebbaf50804a1d13ebe8057c4126ff6528f8
4
- data.tar.gz: bf7063a071237f48ed27a4bb6f4c3ee539417126
3
+ metadata.gz: d73ed47d52f86581a800df65e74bfaf03d158558
4
+ data.tar.gz: a7cf3f0f19f8dad4ac430b5d4ae15edf082cd105
5
5
  SHA512:
6
- metadata.gz: 88b6950d184e591757e1615a2c06b3ffbd9b3f20ae418e942e1a7813790386be6a8267f8e3dbf800319a3fd676a42e48cad0a18afc8d43fe00506e782bc35371
7
- data.tar.gz: 804f9065d86103cb1eed9becb89e3e1423a9e1460c4b2ada7f397132543bee847592cb066c68a0b826b8712509b32250b0eb623e3586479c811d3dfa61c66b6f
6
+ metadata.gz: 13dae513194f94526bc814b9643f570d93edbc2181d17910fb1028d8f11061edd1b1bba4c395ecc0613170a1c0502dda3f598de877ded3e1f13ec0901826b203
7
+ data.tar.gz: ccc6ea870d4586de0cc2dfc7356660c822c66682754bb7c2e4a24352870f4a01ff262cea3f02f9a8314e1d77526d38eb75c84e62ee859bfb27d6c949a1ab97a5
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- massa (0.1.2)
4
+ massa (0.1.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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 = File.expand_path('../../lib/massa/templates/massa.yml', __FILE__)
14
- FileUtils.cp(template, "#{Dir.pwd}/config/massa.yml")
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(color, string)
7
- puts "\n\e[#{code(color)}m#{string}\e[0m\n"
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 = YAML.load_file(config_file_from_gem)
8
-
9
- if File.exist?(config_file_from_project)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Massa
4
- VERSION = '0.1.2'
4
+ VERSION = '0.1.3'
5
5
  end
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.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lucas Caton