kinit 0.1.1 → 0.1.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.
@@ -5,6 +5,7 @@ bestPracticesGems:
5
5
  - simplecov
6
6
 
7
7
  testingGems:
8
+ - factory_girl_rails
8
9
  - rspec
9
10
  - shoulda
10
11
 
@@ -28,27 +28,30 @@ module Kinit
28
28
  @base_path || "."
29
29
  end
30
30
 
31
+ def checkGemsForCategory(gemListHash, category_name)
32
+ if gemListHash.has_key?(category_name)
33
+ gemListHash[category_name].each do |gemname|
34
+ gem_available?(gemname) ?
35
+ (plain_output "\nGem '#{gemname}' is present in your project. Neat." , 'green')
36
+ :
37
+ (add_error "Gem '#{gemname}' is not present in your project. Not Good.")
38
+ # if Gem::Specification.find_by_name(gem)
39
+ # raise GemsEnforcer::GemError, "Please include gem 'cane' to the project."
40
+ end
41
+ end
42
+ end
43
+
31
44
  def CheckIsGemPresent
32
- gemList = YAML.load_file @config
45
+ gemListHash = YAML.load_file @config
33
46
  #puts gemList.inspect
34
-
35
- if gemList
36
- if gemList.has_key?("bestPracticesGems")
37
- gemList["bestPracticesGems"].each do |gemname|
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
- # if Gem::Specification.find_by_name(gem)
44
- # raise GemsEnforcer::GemError, "Please include gem 'cane' to the project."
45
- end
46
- end
47
47
 
48
+ if gemListHash
49
+ checkGemsForCategory(gemListHash, "bestPracticesGems")
50
+ checkGemsForCategory(gemListHash, "testingGems")
48
51
  output_terminal_errors
49
52
 
50
- if gemList.has_key?("suggestions")
51
- gemList["suggestions"].each do |suggestion|
53
+ if gemListHash.has_key?("suggestions")
54
+ gemListHash["suggestions"].each do |suggestion|
52
55
  plain_output "Kinit Suggestions: You may use tools like '#{suggestion}' for your project.", 'green'
53
56
  end
54
57
  end
@@ -69,7 +72,8 @@ module Kinit
69
72
  @errors ||= []
70
73
  end
71
74
 
72
- def gem_available?(name)
75
+ def gem_available?(name)
76
+ show_wait_cursor(0.3)
73
77
  Gem::Specification.find_by_name(name)
74
78
  rescue Gem::LoadError
75
79
  false
@@ -81,6 +85,7 @@ module Kinit
81
85
  if errors.empty?
82
86
  plain_output("\nNo issues or errors found. Good! Your project passed Kinit checks.", 'green')
83
87
  else
88
+ puts
84
89
  @errors.each { |error| plain_output(error.to_s, 'red') }
85
90
  plain_output("\nFound #{errors.size} errors.", 'red')
86
91
  end
@@ -92,5 +97,16 @@ module Kinit
92
97
 
93
98
  def red(text); colorize(text, 31); end
94
99
  def green(text); colorize(text, 32); end
100
+
101
+ def show_wait_cursor(seconds,fps=10)
102
+ chars = %w[| / - \\]
103
+ delay = 1.0/fps
104
+ (seconds*fps).round.times{ |i|
105
+ print chars[i % chars.length]
106
+ sleep delay
107
+ print "\b"
108
+ }
109
+ end
110
+
95
111
  end
96
112
  end
@@ -8,4 +8,4 @@ module Kinit
8
8
  load "tasks/kinit_enforcer.rake"
9
9
  end
10
10
  end
11
- end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module Kinit
2
- VERSION = "0.1.1"
3
- end
2
+ VERSION = "0.1.2"
3
+ end
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.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: