massa 0.0.2
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 +7 -0
- data/.document +5 -0
- data/.rspec +2 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +63 -0
- data/LICENSE.txt +20 -0
- data/README.md +33 -0
- data/Rakefile +26 -0
- data/bin/massa +22 -0
- data/lib/massa.rb +6 -0
- data/lib/massa/analyzer.rb +55 -0
- data/lib/massa/cli.rb +17 -0
- data/lib/massa/default_tools.yml +29 -0
- data/lib/massa/tool.rb +16 -0
- data/lib/massa/version.rb +3 -0
- data/massa.gemspec +61 -0
- metadata +103 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b637d9708f9678b2a5a485a64c271a9599a07f63
|
4
|
+
data.tar.gz: 9d2d70b8e9c207556ec772a0e8841481289b5f66
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: bab93ed29ebea4a2883a135078f2734a111eb4a2cae6d9671308cee39a52d6a63b8637b713f388f72f91736ace968e90050c7db237e7cb09cc50bf283b6523b9
|
7
|
+
data.tar.gz: e4db48e29c9c4344f780ed56d6b76e387f658c219676b83d3fb114ae5bdd062afe5c088fcf6f060ebec7691e7c237bcc6f11ab8cdab4af65cd9556272b2b7853
|
data/.document
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
addressable (2.4.0)
|
5
|
+
builder (3.2.2)
|
6
|
+
coderay (1.1.0)
|
7
|
+
descendants_tracker (0.0.4)
|
8
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
9
|
+
faraday (0.9.2)
|
10
|
+
multipart-post (>= 1.2, < 3)
|
11
|
+
git (1.2.9.1)
|
12
|
+
github_api (0.13.1)
|
13
|
+
addressable (~> 2.4.0)
|
14
|
+
descendants_tracker (~> 0.0.4)
|
15
|
+
faraday (~> 0.8, < 0.10)
|
16
|
+
hashie (>= 3.4)
|
17
|
+
multi_json (>= 1.7.5, < 2.0)
|
18
|
+
oauth2
|
19
|
+
hashie (3.4.3)
|
20
|
+
highline (1.7.8)
|
21
|
+
jeweler (2.0.1)
|
22
|
+
builder
|
23
|
+
bundler (>= 1.0)
|
24
|
+
git (>= 1.2.5)
|
25
|
+
github_api
|
26
|
+
highline (>= 1.6.15)
|
27
|
+
nokogiri (>= 1.5.10)
|
28
|
+
rake
|
29
|
+
rdoc
|
30
|
+
jwt (1.5.2)
|
31
|
+
method_source (0.8.2)
|
32
|
+
mini_portile2 (2.0.0)
|
33
|
+
multi_json (1.11.2)
|
34
|
+
multi_xml (0.5.5)
|
35
|
+
multipart-post (2.0.0)
|
36
|
+
nokogiri (1.6.7.1)
|
37
|
+
mini_portile2 (~> 2.0.0.rc2)
|
38
|
+
oauth2 (1.0.0)
|
39
|
+
faraday (>= 0.8, < 0.10)
|
40
|
+
jwt (~> 1.0)
|
41
|
+
multi_json (~> 1.3)
|
42
|
+
multi_xml (~> 0.5)
|
43
|
+
rack (~> 1.2)
|
44
|
+
pry (0.10.3)
|
45
|
+
coderay (~> 1.1.0)
|
46
|
+
method_source (~> 0.8.1)
|
47
|
+
slop (~> 3.4)
|
48
|
+
rack (1.6.4)
|
49
|
+
rake (10.4.2)
|
50
|
+
rdoc (4.2.0)
|
51
|
+
slop (3.6.0)
|
52
|
+
thread_safe (0.3.5)
|
53
|
+
|
54
|
+
PLATFORMS
|
55
|
+
ruby
|
56
|
+
|
57
|
+
DEPENDENCIES
|
58
|
+
bundler
|
59
|
+
jeweler
|
60
|
+
pry
|
61
|
+
|
62
|
+
BUNDLED WITH
|
63
|
+
1.11.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2015 Lucas Caton
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# Massa
|
2
|
+
|
3
|
+
[](https://rubygems.org/gems/massa)
|
4
|
+
[](https://travis-ci.org/lucascaton/massa)
|
5
|
+
[](https://codeclimate.com/github/lucascaton/massa)
|
6
|
+
[](https://codeclimate.com/github/lucascaton/massa)
|
7
|
+
|
8
|
+
Keep the quality, good practices and security of Rails projects.
|
9
|
+
|
10
|
+
## About the gem name
|
11
|
+
|
12
|
+
"Massa" is a Portuguese slang which means "awesome",
|
13
|
+
so once you add it to your project, it becomes "massa"!
|
14
|
+
|
15
|
+
## Contributing
|
16
|
+
|
17
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't
|
18
|
+
been fixed yet.
|
19
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and / or
|
20
|
+
contributed it.
|
21
|
+
* Fork the project.
|
22
|
+
* Start a feature / bugfix branch.
|
23
|
+
* Commit and push until you are happy with your contribution.
|
24
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version
|
25
|
+
unintentionally.
|
26
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own
|
27
|
+
version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can
|
28
|
+
cherry-pick around it.
|
29
|
+
* Submit a Pull Request
|
30
|
+
|
31
|
+
## Copyright
|
32
|
+
|
33
|
+
Copyright (c) 2015 Lucas Caton. See LICENSE.txt for further details.
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
|
4
|
+
begin
|
5
|
+
Bundler.setup(:default, :development)
|
6
|
+
rescue Bundler::BundlerError => e
|
7
|
+
$stderr.puts e.message
|
8
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
9
|
+
exit e.status_code
|
10
|
+
end
|
11
|
+
|
12
|
+
require 'rake'
|
13
|
+
require 'jeweler'
|
14
|
+
require './lib/massa/version'
|
15
|
+
|
16
|
+
Jeweler::Tasks.new do |gem|
|
17
|
+
gem.name = 'massa'
|
18
|
+
gem.homepage = 'http://github.com/lucascaton/massa'
|
19
|
+
gem.license = 'MIT'
|
20
|
+
gem.summary = %q{Keep the quality, good practices and security of Rails projects.}
|
21
|
+
gem.description = %q{Keep the quality, good practices and security of Rails projects.}
|
22
|
+
gem.authors = ['Lucas Caton']
|
23
|
+
gem.version = Massa::VERSION
|
24
|
+
end
|
25
|
+
|
26
|
+
Jeweler::RubygemsDotOrgTasks.new
|
data/bin/massa
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
$LOAD_PATH.push File.expand_path('../../lib', __FILE__)
|
5
|
+
|
6
|
+
options = {}
|
7
|
+
|
8
|
+
OptionParser.new do |opts|
|
9
|
+
opts.banner = 'Usage: massa [options]' # \n\nYou can use flags as such:'
|
10
|
+
|
11
|
+
opts.on('-h', '--help', 'Display this screen') do
|
12
|
+
puts opts
|
13
|
+
exit
|
14
|
+
end
|
15
|
+
|
16
|
+
opts.on('-v', '--verbose', 'Run verbosely') do |v|
|
17
|
+
options[:verbose] = v
|
18
|
+
end
|
19
|
+
end.parse!
|
20
|
+
|
21
|
+
require 'massa'
|
22
|
+
Massa::Analyzier.run!(options)
|
data/lib/massa.rb
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'bundler/setup' # Set up gems listed in the Gemfile.
|
2
|
+
require 'ostruct'
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
module Massa
|
6
|
+
class Analyzier
|
7
|
+
attr_reader :verbose
|
8
|
+
alias :verbose? :verbose
|
9
|
+
|
10
|
+
def self.run!(options)
|
11
|
+
new(options).run!
|
12
|
+
end
|
13
|
+
|
14
|
+
def initialize(verbose: false)
|
15
|
+
@verbose = verbose
|
16
|
+
end
|
17
|
+
|
18
|
+
def run!
|
19
|
+
Massa::Tool.list.each do |tool|
|
20
|
+
Massa::CLI.colorize :blue, "➙ #{tool.description}"
|
21
|
+
|
22
|
+
next unless gem_installed?(tool.gem_name, required: tool.required)
|
23
|
+
|
24
|
+
execute(tool)
|
25
|
+
end
|
26
|
+
|
27
|
+
Massa::CLI.colorize :green, "~(‾▿‾)~ All good!"
|
28
|
+
end
|
29
|
+
|
30
|
+
def gem_installed?(name, required:)
|
31
|
+
return true if Bundler.require.map(&:name).include?(name)
|
32
|
+
|
33
|
+
Massa::CLI.colorize :yellow, "༼ つ ◕_◕ ༽つ '#{name}' is not installed"
|
34
|
+
|
35
|
+
required ? exit(1) : false
|
36
|
+
end
|
37
|
+
|
38
|
+
def execute(tool)
|
39
|
+
command_output = ''
|
40
|
+
|
41
|
+
if verbose?
|
42
|
+
system(tool.command)
|
43
|
+
else
|
44
|
+
IO.popen(tool.command, err: [:child, :out]) { |io| command_output = io.read }
|
45
|
+
end
|
46
|
+
|
47
|
+
unless $?.success?
|
48
|
+
Massa::CLI.colorize :red, "¯\\_(ツ)_/¯ #{tool.description} failed."
|
49
|
+
puts command_output if command_output.present?
|
50
|
+
|
51
|
+
exit 1 if tool.required
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/massa/cli.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
module Massa
|
2
|
+
class CLI
|
3
|
+
def self.colorize(color, string)
|
4
|
+
color_code = case color
|
5
|
+
when :red then 31
|
6
|
+
when :green then 32
|
7
|
+
when :yellow then 33
|
8
|
+
when :blue then 34
|
9
|
+
when :pink then 35
|
10
|
+
when :light_blue then 36
|
11
|
+
else 0
|
12
|
+
end
|
13
|
+
|
14
|
+
puts "\n\e[#{color_code}m#{string}\e[0m\n"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
- :description: 'Rubocop'
|
2
|
+
:gem_name: 'rubocop'
|
3
|
+
:command: 'bundle exec rubocop'
|
4
|
+
:required: true
|
5
|
+
|
6
|
+
- :description: 'Brakeman'
|
7
|
+
:gem_name: 'brakeman'
|
8
|
+
:command: 'bundle exec brakeman -Aqz'
|
9
|
+
:required: true
|
10
|
+
|
11
|
+
- :description: 'Rails Best Practices'
|
12
|
+
:gem_name: 'rails_best_practices'
|
13
|
+
:command: 'bundle exec rails_best_practices'
|
14
|
+
:required: true
|
15
|
+
|
16
|
+
- :description: 'HAML lint'
|
17
|
+
:gem_name: 'haml-lint'
|
18
|
+
:command: 'bundle exec haml-lint app/views'
|
19
|
+
:required: true
|
20
|
+
|
21
|
+
- :description: 'I18n translations'
|
22
|
+
:gem_name: 'i18n-tasks'
|
23
|
+
:command: 'bundle exec i18n-tasks missing'
|
24
|
+
:required: false
|
25
|
+
|
26
|
+
- :description: 'RSpec'
|
27
|
+
:gem_name: 'rspec'
|
28
|
+
:command: 'RAILS_ENV=test bundle exec rspec'
|
29
|
+
:required: true
|
data/lib/massa/tool.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
module Massa
|
2
|
+
class Tool
|
3
|
+
class << self
|
4
|
+
def list
|
5
|
+
YAML.load_file(tools_yaml_file).map { |tool| OpenStruct.new(tool) }
|
6
|
+
end
|
7
|
+
|
8
|
+
def tools_yaml_file
|
9
|
+
"#{Gem::Specification.find_by_name('massa').gem_dir}/lib/massa/default_tools.yml"
|
10
|
+
rescue Gem::LoadError
|
11
|
+
Massa::CLI.colorize :red, "¯\\_(ツ)_/¯ 'massa' gem is not in your Gemfile."
|
12
|
+
exit 1
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/massa.gemspec
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: massa 0.0.2 ruby lib
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "massa"
|
9
|
+
s.version = "0.0.2"
|
10
|
+
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
13
|
+
s.authors = ["Lucas Caton"]
|
14
|
+
s.date = "2015-12-22"
|
15
|
+
s.description = "Keep the quality, good practices and security of Rails projects."
|
16
|
+
s.executables = ["massa"]
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE.txt",
|
19
|
+
"README.md"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".document",
|
23
|
+
".rspec",
|
24
|
+
"Gemfile",
|
25
|
+
"Gemfile.lock",
|
26
|
+
"LICENSE.txt",
|
27
|
+
"README.md",
|
28
|
+
"Rakefile",
|
29
|
+
"bin/massa",
|
30
|
+
"lib/massa.rb",
|
31
|
+
"lib/massa/analyzer.rb",
|
32
|
+
"lib/massa/cli.rb",
|
33
|
+
"lib/massa/default_tools.yml",
|
34
|
+
"lib/massa/tool.rb",
|
35
|
+
"lib/massa/version.rb",
|
36
|
+
"massa.gemspec"
|
37
|
+
]
|
38
|
+
s.homepage = "http://github.com/lucascaton/massa"
|
39
|
+
s.licenses = ["MIT"]
|
40
|
+
s.rubygems_version = "2.4.8"
|
41
|
+
s.summary = "Keep the quality, good practices and security of Rails projects."
|
42
|
+
|
43
|
+
if s.respond_to? :specification_version then
|
44
|
+
s.specification_version = 4
|
45
|
+
|
46
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
47
|
+
s.add_runtime_dependency(%q<bundler>, [">= 0"])
|
48
|
+
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
49
|
+
s.add_development_dependency(%q<pry>, [">= 0"])
|
50
|
+
else
|
51
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
52
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
53
|
+
s.add_dependency(%q<pry>, [">= 0"])
|
54
|
+
end
|
55
|
+
else
|
56
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
57
|
+
s.add_dependency(%q<jeweler>, [">= 0"])
|
58
|
+
s.add_dependency(%q<pry>, [">= 0"])
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
metadata
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: massa
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Lucas Caton
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-12-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: jeweler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
description: Keep the quality, good practices and security of Rails projects.
|
56
|
+
email:
|
57
|
+
executables:
|
58
|
+
- massa
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files:
|
61
|
+
- LICENSE.txt
|
62
|
+
- README.md
|
63
|
+
files:
|
64
|
+
- ".document"
|
65
|
+
- ".rspec"
|
66
|
+
- Gemfile
|
67
|
+
- Gemfile.lock
|
68
|
+
- LICENSE.txt
|
69
|
+
- README.md
|
70
|
+
- Rakefile
|
71
|
+
- bin/massa
|
72
|
+
- lib/massa.rb
|
73
|
+
- lib/massa/analyzer.rb
|
74
|
+
- lib/massa/cli.rb
|
75
|
+
- lib/massa/default_tools.yml
|
76
|
+
- lib/massa/tool.rb
|
77
|
+
- lib/massa/version.rb
|
78
|
+
- massa.gemspec
|
79
|
+
homepage: http://github.com/lucascaton/massa
|
80
|
+
licenses:
|
81
|
+
- MIT
|
82
|
+
metadata: {}
|
83
|
+
post_install_message:
|
84
|
+
rdoc_options: []
|
85
|
+
require_paths:
|
86
|
+
- lib
|
87
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
requirements: []
|
98
|
+
rubyforge_project:
|
99
|
+
rubygems_version: 2.4.8
|
100
|
+
signing_key:
|
101
|
+
specification_version: 4
|
102
|
+
summary: Keep the quality, good practices and security of Rails projects.
|
103
|
+
test_files: []
|