kinit 0.1.0 → 0.1.1
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.
- data/lib/kinit/version.rb +1 -1
- data/lib/kinit.rb +15 -7
- metadata +1 -1
data/lib/kinit/version.rb
CHANGED
data/lib/kinit.rb
CHANGED
@@ -30,16 +30,16 @@ module Kinit
|
|
30
30
|
|
31
31
|
def CheckIsGemPresent
|
32
32
|
gemList = YAML.load_file @config
|
33
|
-
|
34
33
|
#puts gemList.inspect
|
34
|
+
|
35
35
|
if gemList
|
36
36
|
if gemList.has_key?("bestPracticesGems")
|
37
37
|
gemList["bestPracticesGems"].each do |gemname|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
|
39
|
+
gem_available?(gemname) ?
|
40
|
+
(plain_output "Gem '#{gemname}' is present in your project. Neat." , 'green')
|
41
|
+
:
|
42
|
+
(add_error "Gem '#{gemname}' is not present in your project. Not Good.")
|
43
43
|
# if Gem::Specification.find_by_name(gem)
|
44
44
|
# raise GemsEnforcer::GemError, "Please include gem 'cane' to the project."
|
45
45
|
end
|
@@ -68,10 +68,18 @@ module Kinit
|
|
68
68
|
def errors
|
69
69
|
@errors ||= []
|
70
70
|
end
|
71
|
+
|
72
|
+
def gem_available?(name)
|
73
|
+
Gem::Specification.find_by_name(name)
|
74
|
+
rescue Gem::LoadError
|
75
|
+
false
|
76
|
+
rescue
|
77
|
+
Gem.available?(name)
|
78
|
+
end
|
71
79
|
|
72
80
|
def output_terminal_errors
|
73
81
|
if errors.empty?
|
74
|
-
plain_output("\nNo issues or errors found.
|
82
|
+
plain_output("\nNo issues or errors found. Good! Your project passed Kinit checks.", 'green')
|
75
83
|
else
|
76
84
|
@errors.each { |error| plain_output(error.to_s, 'red') }
|
77
85
|
plain_output("\nFound #{errors.size} errors.", 'red')
|