yogi 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +9 -10
- data/bin/checkme +0 -0
- data/lib/yogi/version.rb +1 -1
- data/lib/yogi.rb +120 -59
- data/yogi.gemspec +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eed66e4b1ad351e98186e6a7973fc1b8ca9f7b49
|
4
|
+
data.tar.gz: 95ec9f3c5d32565b19655a35473b7aaa07bc39be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1740c7ca813c41ad14e14198e8b4a5dfb86828453e71d2e256fa88381f52a3c3b39c09aa3457a9d456f79f5aa669737baa27d836625182b7efc209c8de1456c
|
7
|
+
data.tar.gz: 04ff282458eb2238a8a279a48223ee7a0cd1011db37c8e01256f52ab5c5ee4638d5b541a292a6221acdf9968cf1159e82f65ead1a6a2ffb330779aa41cbb4301
|
data/README.md
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
# Yogi
|
2
2
|
|
3
|
-
|
3
|
+
When new to rails getting used to error codes and debugging is quite helpful.
|
4
|
+
to practice your debugging skills you can use this gem.
|
4
5
|
|
5
|
-
|
6
|
+
Currently are just the activate and the fixme function working.
|
7
|
+
to later stage a checkme will be included to keep track of your debugging progress.
|
8
|
+
|
9
|
+
latest stable version 0.2.4.
|
6
10
|
|
7
11
|
## Installation
|
8
12
|
|
@@ -22,19 +26,14 @@ Or install it yourself as:
|
|
22
26
|
|
23
27
|
## Usage
|
24
28
|
|
25
|
-
type "activate" to generate some errors in your rails project...happy debugging
|
26
|
-
to check yourself type "checkme"
|
27
|
-
sick of debugging type "fixme"
|
28
|
-
|
29
|
-
## Development
|
29
|
+
type "activate" to generate some errors in your rails project...happy debugging..(to check yourself type "checkme" ** not working jet**)
|
30
30
|
|
31
|
-
|
31
|
+
sick of debugging type "fixme"
|
32
32
|
|
33
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
34
33
|
|
35
34
|
## Contributing
|
36
35
|
|
37
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/Yogibeer/
|
36
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/Yogibeer/Yogify. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
38
37
|
|
39
38
|
|
40
39
|
## License
|
data/bin/checkme
CHANGED
File without changes
|
data/lib/yogi/version.rb
CHANGED
data/lib/yogi.rb
CHANGED
@@ -1,15 +1,28 @@
|
|
1
1
|
require "yogi/version"
|
2
2
|
require 'fileutils'
|
3
|
+
require 'json'
|
3
4
|
|
4
5
|
$file_names = []
|
5
6
|
$file_names = Dir.glob("app/**/*.rb") + Dir.glob("app/**/*.js") + Dir.glob("app/**/*.css") + Dir.glob("app/**/*.scss") + Dir.glob("app/**/*.erb") + Dir.glob("app/**/*.html")
|
6
7
|
$file_sample = $file_names.sample(5)
|
7
8
|
|
8
|
-
module Yogi
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
module Yogi
|
11
|
+
$pre_counted_comma = 0
|
12
|
+
$pre_counted_semicolon = 0
|
13
|
+
$pre_counted_l = 0
|
14
|
+
$pre_counted_3 = 0
|
15
|
+
$pre_counted_s = 0
|
16
|
+
$pre_counted_bracket = 0
|
17
|
+
$pre_counted_px = 0
|
18
|
+
|
19
|
+
$pre_diff_comma = 0
|
20
|
+
$pre_diff_semicolon = 0
|
21
|
+
$pre_diff_l = 0
|
22
|
+
$pre_diff_3 = 0
|
23
|
+
$pre_diff_s = 0
|
24
|
+
$pre_diff_bracket = 0
|
25
|
+
$pre_diff_px = 0
|
13
26
|
|
14
27
|
class ErrorInside
|
15
28
|
|
@@ -17,8 +30,8 @@ module Yogi
|
|
17
30
|
text.scan(/(?=#{substring})/).count
|
18
31
|
end
|
19
32
|
|
33
|
+
# creating backup directory
|
20
34
|
def backup
|
21
|
-
# creating backup directory
|
22
35
|
FileUtils.mkdir_p '.backupFiles' unless File.exists?('.backupFiles')
|
23
36
|
# puts "created folder backupFiles"
|
24
37
|
|
@@ -26,13 +39,13 @@ module Yogi
|
|
26
39
|
FileUtils.cp_r "./app", ".backupFiles/"
|
27
40
|
# puts "copied files to backupFiles #{$file_names}"
|
28
41
|
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
42
|
+
# #rename files in backupFiles folder
|
43
|
+
# backup_file_path = "./backupFiles/"
|
44
|
+
# Dir.foreach('./backupFiles') do |item|
|
45
|
+
# next if item == '.' or item == '..'
|
46
|
+
# File.rename(backup_file_path+item, backup_file_path+item +".bak")
|
47
|
+
# end
|
48
|
+
# end
|
36
49
|
end
|
37
50
|
|
38
51
|
def yogify
|
@@ -40,6 +53,7 @@ module Yogi
|
|
40
53
|
text = File.open(file_name, "r"){ |file| file.read }#File.read(file_name)
|
41
54
|
# puts "editing #{$file_sample}"
|
42
55
|
|
56
|
+
|
43
57
|
$pre_counted_comma = count_em(text,",")
|
44
58
|
$pre_counted_semicolon = count_em(text,";")
|
45
59
|
$pre_counted_l = count_em(text,"l")
|
@@ -48,13 +62,14 @@ module Yogi
|
|
48
62
|
$pre_counted_bracket = count_em(text,"}")
|
49
63
|
$pre_counted_px = count_em(text,"px")
|
50
64
|
|
51
|
-
|
52
|
-
puts "
|
53
|
-
puts "
|
54
|
-
puts "
|
55
|
-
puts "
|
56
|
-
puts "
|
57
|
-
puts "
|
65
|
+
|
66
|
+
# puts "commas : #{$pre_counted_comma}"
|
67
|
+
# puts "semicolons : #{$pre_counted_semicolon}"
|
68
|
+
# puts "l : #{$pre_counted_l}"
|
69
|
+
# puts "3 : #{$pre_counted_3}"
|
70
|
+
# puts "s : #{$pre_counted_s}"
|
71
|
+
# puts "} : #{$pre_counted_bracket}"
|
72
|
+
# puts "px : #{$pre_counted_px}"
|
58
73
|
|
59
74
|
#counts total symbols to be effected
|
60
75
|
# pre_total = pre_counted_comma + pre_counted_semicolon + pre_counted_l + pre_counted_3 + pre_counted_s + pre_counted_bracket + pre_counted_px
|
@@ -75,7 +90,7 @@ module Yogi
|
|
75
90
|
File.open(file_name, "w") {|file| file.puts new_contents7 }
|
76
91
|
|
77
92
|
text = File.open(file_name, "r"){ |file| file.read }#File.read(file_name)
|
78
|
-
puts text
|
93
|
+
# puts text
|
79
94
|
#counts ocurences in the file after initial change
|
80
95
|
post_counted_comma = count_em(text,",")
|
81
96
|
post_counted_semicolon = count_em(text,";")
|
@@ -85,13 +100,13 @@ module Yogi
|
|
85
100
|
post_counted_bracket = count_em(text,"}")
|
86
101
|
post_counted_px = count_em(text,"px")
|
87
102
|
|
88
|
-
puts "commas : #{post_counted_comma}"
|
89
|
-
puts "
|
90
|
-
puts "l : #{post_counted_l}"
|
91
|
-
puts "3 : #{post_counted_3}"
|
92
|
-
puts "s : #{post_counted_s}"
|
93
|
-
puts "} : #{post_counted_bracket}"
|
94
|
-
puts "px : #{post_counted_px}"
|
103
|
+
# puts "commas : #{post_counted_comma}"
|
104
|
+
# puts "semicolons : #{post_counted_semicolon}"
|
105
|
+
# puts "l : #{post_counted_l}"
|
106
|
+
# puts "3 : #{post_counted_3}"
|
107
|
+
# puts "s : #{post_counted_s}"
|
108
|
+
# puts "} : #{post_counted_bracket}"
|
109
|
+
# puts "px : #{post_counted_px}"
|
95
110
|
#counts total symbols to be effected
|
96
111
|
# post_total = post_counted_comma + post_counted_semicolon + post_counted_l + post_counted_3 + post_counted_s + post_counted_bracket + post_counted_px
|
97
112
|
# puts post_total
|
@@ -104,16 +119,44 @@ module Yogi
|
|
104
119
|
$pre_diff_bracket = $pre_counted_bracket - post_counted_bracket
|
105
120
|
$pre_diff_px = $pre_counted_px - post_counted_px
|
106
121
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
122
|
+
# pre_count_hash = { :file_name =>[
|
123
|
+
# "pre_counted_comma": $pre_counted_comma,
|
124
|
+
# "pre_counted_semicolon": $pre_counted_semicolon,
|
125
|
+
# "pre_counted_l": $pre_counted_l,
|
126
|
+
# "pre_counted_3": $pre_counted_3,
|
127
|
+
# "pre_counted_s": $pre_counted_s,
|
128
|
+
# "pre_counted_bracket": $pre_counted_bracket,
|
129
|
+
# "pre_counted_px": $pre_counted_px,
|
130
|
+
# "pre_diff_comma": $pre_diff_comma,
|
131
|
+
# "pre_diff_semicolon": $pre_diff_semicolon,
|
132
|
+
# "pre_diff_l": $pre_diff_l,
|
133
|
+
# "pre_diff_3": $pre_diff_3,
|
134
|
+
# "pre_diff_s": $pre_diff_s,
|
135
|
+
# "pre_diff_bracket": $pre_diff_bracket,
|
136
|
+
# "pre_diff_px": $pre_diff_px
|
137
|
+
# ]}
|
138
|
+
# File.open('.ignoreme.json', "a") {|file| file.write pre_count_hash.to_json}
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
# puts "commas : #{$pre_diff_comma}"
|
145
|
+
# puts "semicolons : #{$pre_diff_semicolon}"
|
146
|
+
# puts "l : #{$pre_diff_l}"
|
147
|
+
# puts "3 : #{$pre_diff_3}"
|
148
|
+
# puts "s : #{$pre_diff_s}"
|
149
|
+
# puts "} : #{$pre_diff_bracket}"
|
150
|
+
# puts "px : #{$pre_diff_px}"
|
151
|
+
|
152
|
+
# json_file = File.read(".ignoreme.json")
|
153
|
+
# variable_hash = JSON.parse(json_file)
|
154
|
+
# # counter_test = variable_hash[file_name]
|
155
|
+
# puts "pre_counted_l schould be : #{variable_hash}"
|
115
156
|
end
|
116
157
|
end
|
158
|
+
puts "You can start your debugging..."
|
159
|
+
puts "if your are sick of it, just type...'fixme'"
|
117
160
|
end
|
118
161
|
|
119
162
|
class CheckErrors
|
@@ -123,6 +166,16 @@ module Yogi
|
|
123
166
|
end
|
124
167
|
|
125
168
|
def checker
|
169
|
+
|
170
|
+
puts $pre_diff_comma
|
171
|
+
puts $pre_diff_semicolon
|
172
|
+
puts $pre_diff_l
|
173
|
+
puts $pre_diff_3
|
174
|
+
puts $pre_diff_s
|
175
|
+
puts $pre_diff_bracket
|
176
|
+
puts $pre_diff_px
|
177
|
+
|
178
|
+
|
126
179
|
$file_sample.each do |file_name|
|
127
180
|
text = File.open(file_name, "r"){ |file| file.read }#File.read(file_name)
|
128
181
|
post_counted_comma = count_em(text,",")
|
@@ -133,14 +186,20 @@ module Yogi
|
|
133
186
|
post_counted_bracket = count_em(text,"}")
|
134
187
|
post_counted_px = count_em(text,"px")
|
135
188
|
|
136
|
-
puts "commas : #{post_counted_comma}"
|
137
|
-
puts "
|
138
|
-
puts "l : #{post_counted_l}"
|
139
|
-
puts "3 : #{post_counted_3}"
|
140
|
-
puts "s : #{post_counted_s}"
|
141
|
-
puts "} : #{post_counted_bracket}"
|
142
|
-
puts "px : #{post_counted_px}"
|
143
|
-
|
189
|
+
# puts "commas : #{post_counted_comma}"
|
190
|
+
# puts "semicolons : #{post_counted_semicolon}"
|
191
|
+
# puts "l : #{post_counted_l}"
|
192
|
+
# puts "3 : #{post_counted_3}"
|
193
|
+
# puts "s : #{post_counted_s}"
|
194
|
+
# puts "} : #{post_counted_bracket}"
|
195
|
+
# puts "px : #{post_counted_px}"
|
196
|
+
puts ($pre_counted_comma)
|
197
|
+
puts ($pre_counted_semicolon)
|
198
|
+
puts ($pre_counted_l)
|
199
|
+
puts ($pre_counted_3)
|
200
|
+
puts ($pre_counted_s)
|
201
|
+
puts ($pre_counted_bracket)
|
202
|
+
puts ($pre_counted_px)
|
144
203
|
post_diff_comma = $pre_counted_comma - post_counted_comma
|
145
204
|
post_diff_semicolon = $pre_counted_semicolon - post_counted_semicolon
|
146
205
|
post_diff_l = $pre_counted_l - post_counted_l
|
@@ -149,52 +208,52 @@ module Yogi
|
|
149
208
|
post_diff_bracket = $pre_counted_bracket - post_counted_bracket
|
150
209
|
post_diff_px = $pre_counted_px - post_counted_px
|
151
210
|
|
152
|
-
if pre_diff_comma == 0
|
211
|
+
if $pre_diff_comma == 0
|
153
212
|
comma_fix = 100
|
154
213
|
else
|
155
|
-
comma_fix = ((pre_diff_comma - post_diff_comma)
|
214
|
+
comma_fix = (($pre_diff_comma - post_diff_comma)/$pre_diff_comma)*100
|
156
215
|
end
|
157
216
|
puts " #{comma_fix}% of comma errors fixed"
|
158
217
|
|
159
|
-
if
|
160
|
-
|
218
|
+
if $pre_diff_semicolon == 0
|
219
|
+
semicolon_fix = 100
|
161
220
|
else
|
162
|
-
|
221
|
+
semicolon_fix = (($pre_diff_semicolon - post_diff_semicolon)/$pre_diff_semicolon)*100
|
163
222
|
end
|
164
|
-
puts " #{
|
223
|
+
puts " #{semicolon_fix}% of comma errors fixed"
|
165
224
|
|
166
|
-
if
|
225
|
+
if $pre_diff_l == 0
|
167
226
|
l_fix = 100
|
168
227
|
else
|
169
|
-
l_fix = ((pre_diff_l - post_diff_l)
|
228
|
+
l_fix = (($pre_diff_l - post_diff_l)/$pre_diff_l)*100
|
170
229
|
end
|
171
230
|
puts " #{l_fix}% of comma errors fixed"
|
172
231
|
|
173
|
-
if
|
232
|
+
if $pre_diff_3 == 0
|
174
233
|
three_fix = 100
|
175
234
|
else
|
176
|
-
three_fix = ((pre_diff_3 - post_diff_3)
|
235
|
+
three_fix = (($pre_diff_3 - post_diff_3)/$pre_diff_3)*100
|
177
236
|
end
|
178
237
|
puts " #{three_fix}% of comma errors fixed"
|
179
238
|
|
180
|
-
if
|
239
|
+
if $pre_diff_s == 0
|
181
240
|
s_fix = 100
|
182
241
|
else
|
183
|
-
s_fix = ((pre_diff_s - post_diff_s)
|
242
|
+
s_fix = (($pre_diff_s - post_diff_s)/$pre_diff_s)*100
|
184
243
|
end
|
185
244
|
puts " #{s_fix}% of comma errors fixed"
|
186
245
|
|
187
|
-
if
|
246
|
+
if $pre_diff_bracket == 0
|
188
247
|
bracket_fix = 100
|
189
248
|
else
|
190
|
-
bracket_fix = ((pre_diff_bracket - post_diff_bracket)
|
249
|
+
bracket_fix = (($pre_diff_bracket - post_diff_bracket)/$pre_diff_bracket)*100
|
191
250
|
end
|
192
251
|
puts " #{bracket_fix}% of comma errors fixed"
|
193
252
|
|
194
|
-
if
|
253
|
+
if $pre_diff_px == 0
|
195
254
|
px_fix = 100
|
196
255
|
else
|
197
|
-
px_fix = ((pre_diff_px - post_diff_px)
|
256
|
+
px_fix = (($pre_diff_px - post_diff_px)/$pre_diff_px)*100
|
198
257
|
end
|
199
258
|
puts " #{px_fix}% of comma errors fixed"
|
200
259
|
end
|
@@ -216,6 +275,8 @@ module Yogi
|
|
216
275
|
end
|
217
276
|
#removes folder backupFiles
|
218
277
|
FileUtils.rm_r '.backupFiles'
|
278
|
+
FileUtils.rm_r '.ignoreme.json'
|
279
|
+
puts " Hope You had fun and try it again later."
|
219
280
|
end
|
220
281
|
end
|
221
282
|
|
data/yogi.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["Langnickel.thomas@gmail.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{practice debugging skills}
|
13
|
-
spec.description = %q{The Master of Syntax Error brings you... this exercise}
|
13
|
+
spec.description = %q{The Master of Syntax Error brings you... this exercise please type "activate" to start the exercise ...debugg your project, or if your are sick of it just type "fixme" to fix the errors}
|
14
14
|
spec.homepage = "http://github.io/Yogibeer2001/Yogify"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yogi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Langnickel
|
@@ -38,7 +38,9 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
-
description: The Master of Syntax Error brings you... this exercise
|
41
|
+
description: The Master of Syntax Error brings you... this exercise please type "activate"
|
42
|
+
to start the exercise ...debugg your project, or if your are sick of it just type
|
43
|
+
"fixme" to fix the errors
|
42
44
|
email:
|
43
45
|
- Langnickel.thomas@gmail.com
|
44
46
|
executables:
|