yogi 0.2.5.5 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +15 -10
- data/lib/yogi/version.rb +1 -1
- data/lib/yogi.rb +112 -74
- data/yogi.gemspec +3 -1
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e1002b11ed72625208ee597d622ceaf30762dd70
|
4
|
+
data.tar.gz: b2a8968027cd8c68acd2fbc9158f3f1f312e182c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7476403e39342de14afa3700d0f8ba726e08f984c31f8a1dfbd8e24fb8e8ed92166f3cb6f2a24565a330a6b340f48e6b87e089d983bef2247a7119b5971a55c8
|
7
|
+
data.tar.gz: 6f379c34ce6c1833ae9e9890de1dce6e268a6e150bb3ac95eaef8c787a44b06898b29b0d59649b7f36badb71ee951389684b22ba1f472e93e5b9b10c3915b386
|
data/README.md
CHANGED
@@ -1,19 +1,21 @@
|
|
1
1
|
# Yogi
|
2
2
|
|
3
|
-
When new to rails getting used to error codes and debugging is quite helpful.
|
4
|
-
|
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.
|
5
5
|
|
6
|
-
Currently are just the basic
|
7
|
-
|
6
|
+
Currently are just the basic 3 operations are working.
|
7
|
+
So this is good enough to start practice your debugging skills.
|
8
|
+
You can check you progress or..
|
9
|
+
when you get stuck, you can fix your project anytime with just one word.
|
8
10
|
|
9
|
-
latest stable version 0.
|
11
|
+
latest stable version 0.3.1
|
10
12
|
|
11
13
|
## Installation
|
12
14
|
|
13
15
|
Add this line to your application's Gemfile:
|
14
16
|
|
15
17
|
```ruby
|
16
|
-
gem 'yogi', '~> 0.
|
18
|
+
gem 'yogi', '~> 0.3.1'
|
17
19
|
```
|
18
20
|
|
19
21
|
And then execute:
|
@@ -26,13 +28,16 @@ Or install it yourself as:
|
|
26
28
|
|
27
29
|
## Usage
|
28
30
|
|
29
|
-
type "activate" to generate some errors in your rails project...happy debugging..
|
31
|
+
type _"activate"_ to generate some errors in your rails project...happy debugging..
|
30
32
|
|
31
|
-
|
33
|
+
To check yourself type _"checkme"_ and get a status update
|
34
|
+
|
35
|
+
Sick of debugging type _"fixme"_
|
32
36
|
|
33
37
|
## in Planing
|
34
|
-
|
35
|
-
|
38
|
+
|
39
|
+
increase in error complexity and more status updates
|
40
|
+
|
36
41
|
|
37
42
|
## Contributing
|
38
43
|
|
data/lib/yogi/version.rb
CHANGED
data/lib/yogi.rb
CHANGED
@@ -3,9 +3,6 @@ require "yogi/version"
|
|
3
3
|
require 'fileutils'
|
4
4
|
require 'json'
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
6
|
module Yogi
|
10
7
|
|
11
8
|
class Setup
|
@@ -65,7 +62,6 @@ module Yogi
|
|
65
62
|
# puts file_sample.class
|
66
63
|
# puts file_sample
|
67
64
|
|
68
|
-
|
69
65
|
file_sample.each do |file_name|
|
70
66
|
text = File.open(file_name, "r"){ |file| file.read }#File.read(file_name)
|
71
67
|
# puts "editing #{$file_sample}"
|
@@ -77,7 +73,6 @@ module Yogi
|
|
77
73
|
$pre_counted_bracket = count_em(text,"}")
|
78
74
|
$pre_counted_px = count_em(text,"px")
|
79
75
|
|
80
|
-
|
81
76
|
# puts "commas : #{$pre_counted_comma}"
|
82
77
|
# puts "semicolons : #{$pre_counted_semicolon}"
|
83
78
|
# puts "l : #{$pre_counted_l}"
|
@@ -91,8 +86,8 @@ module Yogi
|
|
91
86
|
# puts pre_total
|
92
87
|
|
93
88
|
# To merely print the contents of the file, use:
|
94
|
-
new_contents1 = text.gsub(";"){rand(2).zero? ? ";" : "
|
95
|
-
new_contents2 = new_contents1.gsub(","){rand(2).zero? ? "," : "
|
89
|
+
new_contents1 = text.gsub(";"){rand(2).zero? ? ";" : ":"}
|
90
|
+
new_contents2 = new_contents1.gsub(","){rand(2).zero? ? "," : " "}
|
96
91
|
new_contents3 = new_contents2.gsub("l"){rand(2).zero? ? "l" : "1"}
|
97
92
|
new_contents4 = new_contents3.gsub("3"){rand(2).zero? ? "3" : "E"}
|
98
93
|
new_contents5 = new_contents4.gsub("s"){rand(2).zero? ? "s" : "5"}
|
@@ -152,10 +147,6 @@ module Yogi
|
|
152
147
|
}}
|
153
148
|
count_hash << pre_count_hash
|
154
149
|
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
150
|
# puts "commas : #{$pre_diff_comma}"
|
160
151
|
# puts "semicolons : #{$pre_diff_semicolon}"
|
161
152
|
# puts "l : #{$pre_diff_l}"
|
@@ -183,6 +174,8 @@ module Yogi
|
|
183
174
|
|
184
175
|
def checker
|
185
176
|
i = 0
|
177
|
+
pre_diff_array = []
|
178
|
+
post_diff_array = []
|
186
179
|
buffer = File.open('.ignoremefile.txt', 'r').read
|
187
180
|
file_sample = JSON.parse(buffer)
|
188
181
|
# puts file_sample.class
|
@@ -190,6 +183,8 @@ module Yogi
|
|
190
183
|
|
191
184
|
file_sample.each do |file_name|
|
192
185
|
text = File.open(file_name, "r"){ |file| file.read }#File.read(file_name)
|
186
|
+
|
187
|
+
|
193
188
|
post_counted_comma = count_em(text,",")
|
194
189
|
post_counted_semicolon = count_em(text,";")
|
195
190
|
post_counted_l = count_em(text,"l")
|
@@ -198,20 +193,9 @@ module Yogi
|
|
198
193
|
post_counted_bracket = count_em(text,"}")
|
199
194
|
post_counted_px = count_em(text,"px")
|
200
195
|
|
201
|
-
# puts "commas : #{post_counted_comma}"
|
202
|
-
# puts "semicolons : #{post_counted_semicolon}"
|
203
|
-
# puts "l : #{post_counted_l}"
|
204
|
-
# puts "3 : #{post_counted_3}"
|
205
|
-
# puts "s : #{post_counted_s}"
|
206
|
-
# puts "} : #{post_counted_bracket}"
|
207
|
-
# puts "px : #{post_counted_px}"
|
208
|
-
|
209
|
-
|
210
|
-
|
211
196
|
json_file = File.read(".ignoreme.json")
|
212
197
|
variable_hash = JSON.parse(json_file)
|
213
198
|
|
214
|
-
puts "test loop"
|
215
199
|
$pre_counted_comma = variable_hash[i][file_name]['pre_counted_comma']
|
216
200
|
$pre_counted_semicolon = variable_hash[i][file_name]['pre_counted_semicolon']
|
217
201
|
$pre_counted_l = variable_hash[i][file_name]['pre_counted_l']
|
@@ -235,62 +219,117 @@ puts "test loop"
|
|
235
219
|
post_diff_bracket = $pre_counted_bracket - post_counted_bracket
|
236
220
|
post_diff_px = $pre_counted_px - post_counted_px
|
237
221
|
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
puts " #{
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
puts " #{
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
puts
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
puts
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
222
|
+
# total changes made in each file
|
223
|
+
total_pre_diff = $pre_diff_comma + $pre_diff_semicolon + $pre_diff_l + $pre_diff_3 + $pre_diff_s + $pre_diff_bracket + $pre_diff_px
|
224
|
+
|
225
|
+
# total changes not fixed
|
226
|
+
total_post_diff = post_diff_comma + post_diff_semicolon + post_diff_l + post_diff_3 + post_diff_s + post_diff_bracket + post_diff_px
|
227
|
+
|
228
|
+
pre_diff_array << total_pre_diff
|
229
|
+
post_diff_array << total_post_diff
|
230
|
+
|
231
|
+
# puts '--------------------------------------------------------------------'
|
232
|
+
# puts "#{file_name}"
|
233
|
+
# puts " total_pre_diff: #{total_pre_diff}"
|
234
|
+
# puts " total_post_diff: #{total_post_diff}"
|
235
|
+
# puts "post commas : #{post_counted_comma}"
|
236
|
+
# puts "post semicolons : #{post_counted_semicolon}"
|
237
|
+
# puts "post l : #{post_counted_l}"
|
238
|
+
# puts "post 3 : #{post_counted_3}"
|
239
|
+
# puts "post s : #{post_counted_s}"
|
240
|
+
# puts "post } : #{post_counted_bracket}"
|
241
|
+
# puts "post px : #{post_counted_px}"
|
242
|
+
# puts "pre_diff_comma: #{$pre_diff_comma} vs post_diff_comma: #{post_diff_comma}"
|
243
|
+
# puts "pre_diff_semicolon: #{$pre_diff_semicolon} vs post_diff_semicolon: #{post_diff_semicolon}"
|
244
|
+
# puts "pre_diff_l: #{$pre_diff_l} vs post_diff_l: #{post_diff_l}"
|
245
|
+
# puts "pre_diff_3: #{$pre_diff_3} vs post_diff_3: #{post_diff_3}"
|
246
|
+
# puts "pre_diff_s: #{$pre_diff_s} vs post_diff_s: #{post_diff_s}"
|
247
|
+
# puts "pre_diff_bracket: #{$pre_diff_bracket} vs post_diff_bracket: #{post_diff_bracket}"
|
248
|
+
# puts "pre_diff_px: #{$pre_diff_px} vs post_diff_px: #{post_diff_px}"
|
249
|
+
# puts "pre_counted_comma: #{$pre_counted_comma} vs post_counted_comma: #{post_counted_comma}"
|
250
|
+
# puts "pre_counted_semicolon: #{$pre_counted_semicolon} vs post_counted_semicolon: #{post_counted_semicolon}"
|
251
|
+
# puts "pre_counted_l: #{$pre_counted_l} vs post_counted_l: #{post_counted_l}"
|
252
|
+
# puts "pre_counted_3: #{$pre_counted_3} vs post_counted_3: #{post_counted_3}"
|
253
|
+
# puts "pre_counted_s: #{$pre_counted_s} vs post_counted_s: #{post_counted_s}"
|
254
|
+
# puts "pre_counted_bracket: #{$pre_counted_bracket} vs post_counted_bracket: #{post_counted_bracket}"
|
255
|
+
# puts "pre_counted_px: #{$pre_counted_px} vs post_counted_px: #{post_counted_px}"
|
256
|
+
# puts '--------------------------------------------------------------------'
|
257
|
+
|
258
|
+
# if $pre_diff_comma == 0
|
259
|
+
# comma_fix = 100
|
260
|
+
# else
|
261
|
+
# comma_fix = (($pre_diff_comma - post_diff_comma)/$pre_diff_comma)*100
|
262
|
+
# end
|
263
|
+
# puts " #{comma_fix}% of comma errors fixed"
|
264
|
+
#
|
265
|
+
# if $pre_diff_semicolon == 0
|
266
|
+
# semicolon_fix = 100
|
267
|
+
# else
|
268
|
+
# semicolon_fix = (($pre_diff_semicolon - post_diff_semicolon)/$pre_diff_semicolon)*100
|
269
|
+
# end
|
270
|
+
# puts " #{semicolon_fix}% of comma errors fixed"
|
271
|
+
#
|
272
|
+
# if $pre_diff_l == 0
|
273
|
+
# l_fix = 100
|
274
|
+
# else
|
275
|
+
# l_fix = (($pre_diff_l - post_diff_l)/$pre_diff_l)*100
|
276
|
+
# end
|
277
|
+
# puts " #{l_fix}% of comma errors fixed"
|
278
|
+
#
|
279
|
+
# if $pre_diff_3 == 0
|
280
|
+
# three_fix = 100
|
281
|
+
# else
|
282
|
+
# three_fix = (($pre_diff_3 - post_diff_3)/$pre_diff_3)*100
|
283
|
+
# end
|
284
|
+
# puts " #{three_fix}% of comma errors fixed"
|
285
|
+
#
|
286
|
+
# if $pre_diff_s == 0
|
287
|
+
# s_fix = 100
|
288
|
+
# else
|
289
|
+
# s_fix = (($pre_diff_s - post_diff_s)/$pre_diff_s)*100
|
290
|
+
# end
|
291
|
+
# puts " #{s_fix}% of comma errors fixed"
|
292
|
+
#
|
293
|
+
# if $pre_diff_bracket == 0
|
294
|
+
# bracket_fix = 100
|
295
|
+
# else
|
296
|
+
# bracket_fix = (($pre_diff_bracket - post_diff_bracket)/$pre_diff_bracket)*100
|
297
|
+
# end
|
298
|
+
# puts " #{bracket_fix}% of comma errors fixed"
|
299
|
+
#
|
300
|
+
# if $pre_diff_px == 0
|
301
|
+
# px_fix = 100
|
302
|
+
# else
|
303
|
+
# px_fix = (($pre_diff_px - post_diff_px)/$pre_diff_px)*100
|
304
|
+
# end
|
305
|
+
# puts " #{px_fix}% of comma errors fixed"
|
306
|
+
end
|
307
|
+
# puts " pre_diff_array: #{pre_diff_array}"
|
308
|
+
# puts " post_diff_array: #{post_diff_array}"
|
309
|
+
|
310
|
+
|
311
|
+
#calulate the total differences to original and errors
|
312
|
+
pre_diff = pre_diff_array.inject(0, :+)
|
313
|
+
# puts "total of pre_diff #{pre_diff}"
|
314
|
+
post_diff = post_diff_array.inject(0, :+)
|
315
|
+
# puts "total of post_diff #{post_diff}"
|
316
|
+
pre_diff = pre_diff.to_f
|
317
|
+
post_diff = post_diff.to_f
|
318
|
+
|
319
|
+
|
320
|
+
if pre_diff == 0
|
321
|
+
puts 'there must have gone something wrong...no errors to begin with'
|
322
|
+
else
|
323
|
+
fix = ((pre_diff - post_diff)/pre_diff)*100
|
324
|
+
fix = fix.round(3)
|
325
|
+
puts "================================="
|
326
|
+
puts " You fixed #{fix}% of all the errors "
|
327
|
+
puts "================================="
|
286
328
|
end
|
287
329
|
end
|
288
330
|
end
|
289
331
|
|
290
332
|
|
291
|
-
|
292
|
-
|
293
|
-
|
294
333
|
class ErrorOut
|
295
334
|
def undo
|
296
335
|
#undo changes originaly made.
|
@@ -298,7 +337,6 @@ puts "test loop"
|
|
298
337
|
next if item == '.' or item == '..'
|
299
338
|
FileUtils.cp_r ".backupFiles/"+ item, "./"
|
300
339
|
# puts item
|
301
|
-
# FileUtils.cp_r file_names, "backupFiles/"
|
302
340
|
end
|
303
341
|
#removes folder backupFiles
|
304
342
|
FileUtils.rm_r '.backupFiles'
|
data/yogi.gemspec
CHANGED
@@ -9,8 +9,10 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Thomas Langnickel"]
|
10
10
|
spec.email = ["Langnickel.thomas@gmail.com"]
|
11
11
|
|
12
|
+
spec.description = %q{The Master of Syntax Error brings you... this debugging exercise
|
13
|
+
type "activate" to start the exercise, happy ...debugging your project
|
14
|
+
type "checkme" for an update on your debugging progress, or if your are sick of it just type "fixme" to fix the errors}
|
12
15
|
spec.summary = %q{practice debugging skills}
|
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
16
|
spec.homepage = "http://github.io/Yogibeer2001/Yogify"
|
15
17
|
spec.license = "MIT"
|
16
18
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yogi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Langnickel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,9 +38,10 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '10.0'
|
41
|
-
description:
|
42
|
-
|
43
|
-
|
41
|
+
description: |-
|
42
|
+
The Master of Syntax Error brings you... this debugging exercise
|
43
|
+
type "activate" to start the exercise, happy ...debugging your project
|
44
|
+
type "checkme" for an update on your debugging progress, or if your are sick of it just type "fixme" to fix the errors
|
44
45
|
email:
|
45
46
|
- Langnickel.thomas@gmail.com
|
46
47
|
executables:
|