kinit 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/run_kinit +0 -2
- data/kinit_config.yml +12 -0
- data/lib/kinit.rb +49 -31
- data/lib/kinit/version.rb +1 -1
- metadata +3 -66
data/bin/run_kinit
CHANGED
data/kinit_config.yml
ADDED
data/lib/kinit.rb
CHANGED
@@ -1,52 +1,67 @@
|
|
1
1
|
Dir["tasks/*.rake"].each { |ext| load ext } if defined?(Rake)
|
2
|
-
|
3
2
|
require "kinit/version"
|
4
|
-
|
3
|
+
require 'yaml'
|
5
4
|
|
6
5
|
module Kinit
|
7
6
|
require 'kinit/railtie' if defined?(Rails)
|
8
7
|
|
9
8
|
class GemsEnforcer
|
10
9
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
gemList = ["cane","rails_best_practices", "reek", "simplecov"]
|
10
|
+
GemError = Class.new(ArgumentError)
|
11
|
+
|
12
|
+
def initialize(options={})
|
13
|
+
default_config = File.join(File.dirname(__FILE__), "..", "kinit_config.yml")
|
14
|
+
custom_config = File.join(base_path, 'config/kinit_config.yml')
|
15
|
+
@config = File.exists?(custom_config) ? custom_config : default_config
|
16
|
+
end
|
19
17
|
|
20
|
-
|
21
|
-
|
22
|
-
|
18
|
+
def add_error(message)
|
19
|
+
errors << message
|
20
|
+
end
|
23
21
|
|
24
|
-
|
25
|
-
|
26
|
-
|
22
|
+
def base_path=(path)
|
23
|
+
@base_path = path
|
24
|
+
end
|
27
25
|
|
28
|
-
|
29
|
-
|
26
|
+
def base_path
|
27
|
+
@base_path || "."
|
28
|
+
end
|
30
29
|
|
31
|
-
|
30
|
+
def CheckIsGemPresent
|
31
|
+
gemList = YAML.load_file @config
|
32
|
+
#puts gemList.inspect
|
33
|
+
if !gemList.nil?
|
34
|
+
gemList["bestPracticesGems"].each do |gemname|
|
35
|
+
if Gem.available?(gemname)
|
36
|
+
plain_output "Gem '#{gemname}' is present in your project. Neat." , 'green'
|
37
|
+
else
|
38
|
+
add_error "Gem '#{gemname}' is not present in your project. Not Good."
|
39
|
+
end
|
40
|
+
# if Gem::Specification.find_by_name(gem)
|
41
|
+
# raise GemsEnforcer::GemError, "Please include gem 'cane' to the project."
|
42
|
+
end
|
43
|
+
|
44
|
+
output_terminal_errors
|
45
|
+
|
46
|
+
gemList["suggestions"].each do |suggestion|
|
47
|
+
plain_output "Suggestion - You should use tools like #{suggestion} for your project.", 'green'
|
48
|
+
end
|
49
|
+
|
50
|
+
return true
|
51
|
+
else
|
52
|
+
return false
|
53
|
+
end
|
32
54
|
end
|
33
55
|
|
34
56
|
def colorize(text, color_code)
|
35
57
|
"\e[#{color_code}m#{text}\e[0m"
|
36
58
|
end
|
37
59
|
|
38
|
-
def red(text); colorize(text, 31); end
|
39
|
-
def green(text); colorize(text, 32); end
|
40
|
-
|
41
60
|
def errors
|
42
61
|
@errors ||= []
|
43
62
|
end
|
44
|
-
|
45
|
-
def
|
46
|
-
errors << message
|
47
|
-
end
|
48
|
-
|
49
|
-
def output_terminal_errors
|
63
|
+
|
64
|
+
def output_terminal_errors
|
50
65
|
if errors.empty?
|
51
66
|
plain_output("\nNo issues or errors found. Cool! Your project passed Kinit checks.", 'green')
|
52
67
|
else
|
@@ -55,9 +70,12 @@ module Kinit
|
|
55
70
|
end
|
56
71
|
end
|
57
72
|
|
58
|
-
def plain_output(message, color)
|
73
|
+
def plain_output(message, color)
|
59
74
|
puts result = (color == "red" && red(message) ) || green(message)
|
60
75
|
end
|
61
76
|
|
62
|
-
|
63
|
-
|
77
|
+
def red(text); colorize(text, 31); end
|
78
|
+
def green(text); colorize(text, 32); end
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
data/lib/kinit/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kinit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -59,70 +59,6 @@ dependencies:
|
|
59
59
|
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: cane
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
|
-
requirements:
|
67
|
-
- - ! '>='
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
70
|
-
type: :development
|
71
|
-
prerelease: false
|
72
|
-
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
|
-
requirements:
|
75
|
-
- - ! '>='
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: '0'
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
name: reek
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
|
-
requirements:
|
83
|
-
- - ! '>='
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: '0'
|
86
|
-
type: :development
|
87
|
-
prerelease: false
|
88
|
-
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
|
-
requirements:
|
91
|
-
- - ! '>='
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: '0'
|
94
|
-
- !ruby/object:Gem::Dependency
|
95
|
-
name: rails_best_practices
|
96
|
-
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
|
-
requirements:
|
99
|
-
- - ! '>='
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
version: '0'
|
102
|
-
type: :development
|
103
|
-
prerelease: false
|
104
|
-
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
|
-
requirements:
|
107
|
-
- - ! '>='
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '0'
|
110
|
-
- !ruby/object:Gem::Dependency
|
111
|
-
name: simplecov
|
112
|
-
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
|
-
requirements:
|
115
|
-
- - ! '>='
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
type: :development
|
119
|
-
prerelease: false
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
|
-
requirements:
|
123
|
-
- - ! '>='
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: '0'
|
126
62
|
description: A gem enforcer tool to check and enforce important gems and best practices
|
127
63
|
for code quality in ruby and rails code. Its configurable to enable disable what
|
128
64
|
all to enforce.
|
@@ -139,6 +75,7 @@ files:
|
|
139
75
|
- lib/kinit.rb
|
140
76
|
- bin/run_kinit
|
141
77
|
- lib/tasks/kinit_enforcer.rake
|
78
|
+
- kinit_config.yml
|
142
79
|
- ext/kinit/extconf.rb
|
143
80
|
homepage: https://github.com/rohandaxini/kinit
|
144
81
|
licenses:
|