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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d050a750692a0d7575d8ace635776d83cd31f6c6
4
- data.tar.gz: d6efc60953e32aa8eacace97ac64a07d452b9c7b
3
+ metadata.gz: c2ba08bdec35891e253256b7ba9886ba361d72d2
4
+ data.tar.gz: 1f9e9b2cb0b09545e2f87e53b32fd8015b5a674f
5
5
  SHA512:
6
- metadata.gz: d99d7854705f604d82aea1f6b160301033de8980a558f3ac935ff2155c334a93759ed5ea5f1c7484459c37c600c7cbf515837d89c16d53e634d4a8683bcf60bc
7
- data.tar.gz: 6d2c31cd9718bec759d0018de7c6aa71bf6cf6dff899923547cc91acb5f0dc06be795eb44543556511b40a3590b9076f52e4af52a353391940321cca0a188822
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 Status](https://img.shields.io/codeclimate/coverage/github/lucascaton/massa.svg)](https://codeclimate.com/github/lucascaton/massa)
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 common to see Ruby (and Rails) projects becomming hard to maintain and less fun after a while.
9
- This gem helps you to keep its quality, good practices and security.
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 and it will run different code analyzers tools, instead of only running your automated tests.
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
- Create a configuration file:
37
+ Generate a config file:
38
38
 
39
- $ ... # TODO
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
@@ -1,29 +1,29 @@
1
- - :description: 'Rubocop'
2
- :gem_name: 'rubocop'
3
- :command: 'bundle exec rubocop'
4
- :required: true
1
+ rubocop:
2
+ description: 'Rubocop'
3
+ command: 'bundle exec rubocop'
4
+ required: true
5
5
 
6
- - :description: 'Brakeman'
7
- :gem_name: 'brakeman'
8
- :command: 'bundle exec brakeman -Aqz'
9
- :required: true
6
+ brakeman:
7
+ description: 'Brakeman'
8
+ command: 'bundle exec brakeman -Aqz'
9
+ required: true
10
10
 
11
- - :description: 'Rails Best Practices'
12
- :gem_name: 'rails_best_practices'
13
- :command: 'bundle exec rails_best_practices'
14
- :required: true
11
+ rails_best_practices:
12
+ description: 'Rails Best Practices'
13
+ command: 'bundle exec rails_best_practices'
14
+ required: true
15
15
 
16
- - :description: 'HAML lint'
17
- :gem_name: 'haml_lint'
18
- :command: 'bundle exec haml-lint app/views'
19
- :required: true
16
+ haml_lint:
17
+ description: 'HAML lint'
18
+ command: 'bundle exec haml-lint app/views'
19
+ required: true
20
20
 
21
- - :description: 'I18n translations'
22
- :gem_name: 'i18n-tasks'
23
- :command: 'bundle exec i18n-tasks missing'
24
- :required: false
21
+ i18n-tasks:
22
+ description: 'I18n translations'
23
+ command: 'bundle exec i18n-tasks missing'
24
+ required: false
25
25
 
26
- - :description: 'RSpec'
27
- :gem_name: 'rspec-rails'
28
- :command: 'RAILS_ENV=test bundle exec rspec'
29
- :required: true
26
+ rspec-rails:
27
+ description: 'RSpec'
28
+ command: 'RAILS_ENV=test bundle exec rspec'
29
+ required: true
@@ -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.description}"
22
+ Massa::Tool.list.each do |gem_name, tool|
23
+ Massa::CLI.colorize :blue, "➙ #{tool['description']}"
24
24
 
25
- next unless gem_installed?(tool.gem_name, required: tool.required)
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.command)
45
+ system(tool['command'])
46
46
  else
47
- IO.popen(tool.command, err: [:child, :out]) { |io| command_output = io.read }
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.description} failed:"
52
- Massa::CLI.colorize :yellow, "$ #{tool.command}"
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.required
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(tools_yaml_file).map { |tool| OpenStruct.new(tool) }
7
+ YAML.load_file(config_file_from_gem).merge YAML.load_file(config_file_from_project)
8
8
  end
9
9
 
10
- def tools_yaml_file
11
- "#{Gem::Specification.find_by_name('massa').gem_dir}/config/default_tools.yml"
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Massa
4
- VERSION = '0.0.9'
4
+ VERSION = '0.1.0'
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.0.9
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