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.
Files changed (3) hide show
  1. data/lib/kinit/version.rb +1 -1
  2. data/lib/kinit.rb +15 -7
  3. metadata +1 -1
data/lib/kinit/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kinit
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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
- if Gem.available?(gemname)
39
- plain_output "Gem '#{gemname}' is present in your project. Neat." , 'green'
40
- else
41
- add_error "Gem '#{gemname}' is not present in your project. Not Good."
42
- end
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. Cool! Your project passed Kinit checks.", 'green')
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')
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.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: