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.
- data/kinit_config.yml +1 -0
- data/lib/kinit.rb +33 -17
- data/lib/kinit/railtie.rb +1 -1
- data/lib/kinit/version.rb +2 -2
- metadata +1 -1
data/kinit_config.yml
CHANGED
data/lib/kinit.rb
CHANGED
@@ -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
|
-
|
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
|
51
|
-
|
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
|
data/lib/kinit/railtie.rb
CHANGED
data/lib/kinit/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
module Kinit
|
2
|
-
VERSION = "0.1.
|
3
|
-
end
|
2
|
+
VERSION = "0.1.2"
|
3
|
+
end
|