yogi 0.1.3 → 0.1.5

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 (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/yogi/version.rb +1 -1
  3. data/lib/yogi.rb +31 -29
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 401a4c97a8b1f128d49de6f97c80a0a41f81e895
4
- data.tar.gz: 3c1a4bf6ff6e7489516145e017cb4be5ab81d1e9
3
+ metadata.gz: f2d720779229dbae85f32fca087dfabd1a200821
4
+ data.tar.gz: fc44a7d7f6f7568fdcebedcbb1a1d3ab29ec0691
5
5
  SHA512:
6
- metadata.gz: 4eff02a10a7f7bc4b64dafd7348c868706740cef542f48ee812587cf76a2fd8c110f9dadc6022814c7cd72d2eb03a5b874b375e9a4f12282ccc22725586bb471
7
- data.tar.gz: dd38d5e6e424a29f7a93620b09da3881f11d3837d21ff53137fe38ef1c44ece0b0762fe2dd3b04927f4e39635ef00542b25c27c61e1dd6ee3455960a72224b3b
6
+ metadata.gz: 5994bd1ad6b4f41e4fcf755b661e6588df4ac3e246a653f8559b3839e573f938124596454436f7f9b5c93a09127c613bc5d8a4a9298af0d9025532b6d5b49668
7
+ data.tar.gz: be47206888b8f9dc9bb09c3860935c82bd3554921a3361d25cc47d00331cd9a7846756b6f89cec3ff6bdf16cc380ef5e3b3b380bc6ac305b7768e48248eefca5
data/lib/yogi/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Yogi
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.5"
3
3
  end
data/lib/yogi.rb CHANGED
@@ -1,20 +1,20 @@
1
1
  require "yogi/version"
2
2
  require 'fileutils'
3
3
 
4
- @@file_names = []
5
- @@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
- @@file_sample = @@file_names.sample(5)
4
+ $file_names = []
5
+ $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
+ $file_sample = $file_names.sample(5)
7
7
 
8
8
  module Yogi
9
9
  class ErrorInside
10
10
  def backup
11
11
  # creating backup directory
12
- FileUtils.mkdir_p 'backupFiles' unless File.exists?('backupFiles')
13
- puts "created folder backupFiles"
12
+ FileUtils.mkdir_p '.backupFiles' unless File.exists?('.backupFiles')
13
+ # puts "created folder backupFiles"
14
14
 
15
15
  #copy backup to backup folder
16
- FileUtils.cp_r "./app", "backupFiles/"
17
- puts "copied files to backupFiles #{@@file_names}"
16
+ FileUtils.cp_r "./app", ".backupFiles/"
17
+ # puts "copied files to backupFiles #{$file_names}"
18
18
 
19
19
  # #rename files in backupFiles folder
20
20
  # backup_file_path = "./backupFiles/"
@@ -26,35 +26,37 @@ module Yogi
26
26
  end
27
27
 
28
28
  def yogify
29
- @@file_sample.each do |file_name|
29
+ $file_sample.each do |file_name|
30
30
  text = File.read(file_name)
31
- puts "editing #{@@file_sample}"
31
+ puts "editing #{$file_sample}"
32
32
 
33
33
  #counting ocurences of the original chars before changes
34
- counted_comma = text.count(",") #counts ocurences in the file
35
- counted_semicolon = text.count(";") #counts ocurences in the file
36
- counted_1 = text.count("1") #counts ocurences in the file
37
- counted_3 = text.count("3") #counts ocurences in the file
38
- counted_5 = text.count("5") #counts ocurences in the file
39
- counted_px = text.count("px") #counts ocurences in the file
40
- puts "commas : #{counted_comma}"
41
- puts "semikolons : #{counted_semicolon}"
42
- puts "1 : #{counted_1}"
43
- puts "3 : #{counted_3}"
44
- puts "5 : #{counted_5}"
45
- puts "px : #{counted_px}"
34
+ # counted_comma = text.count(",") #counts ocurences in the file
35
+ # counted_semicolon = text.count(";") #counts ocurences in the file
36
+ # counted_1 = text.count("1") #counts ocurences in the file
37
+ # counted_3 = text.count("3") #counts ocurences in the file
38
+ # counted_5 = text.count("5") #counts ocurences in the file
39
+ # counted_px = text.count("px") #counts ocurences in the file
40
+ # puts "commas : #{counted_comma}"
41
+ # puts "semikolons : #{counted_semicolon}"
42
+ # puts "1 : #{counted_1}"
43
+ # puts "3 : #{counted_3}"
44
+ # puts "5 : #{counted_5}"
45
+ # puts "px : #{counted_px}"
46
46
 
47
47
  # To merely print the contents of the file, use:
48
48
  new_contents1 = text.gsub(";"){rand(2).zero? ? ";" : ","}
49
49
  new_contents2 = new_contents1.gsub(","){rand(2).zero? ? "," : ";"}
50
- new_contents3 = new_contents2.gsub("1"){rand(2).zero? ? "1" : "l"}
50
+ new_contents3 = new_contents2.gsub("l"){rand(2).zero? ? "l" : "1"}
51
51
  new_contents4 = new_contents3.gsub("3"){rand(2).zero? ? "3" : "E"}
52
- new_contents5 = new_contents4.gsub("5"){rand(2).zero? ? "5" : "S"}
53
- new_contents6 = new_contents5.gsub("px"){rand(2).zero? ? "px" : "xp"}
54
- puts new_contents6
52
+ new_contents5 = new_contents4.gsub("s"){rand(2).zero? ? "s" : "5"}
53
+ new_contents6 = new_contents5.gsub("}"){rand(2).zero? ? "}" : "]"}
54
+ new_contents7 = new_contents6.gsub("px"){rand(2).zero? ? "px" : "xp"}
55
+
56
+ # puts new_contents6
55
57
 
56
58
  # To write changes to the file, use:
57
- File.open(file_name, "w") {|file| file.puts new_contents6 }
59
+ File.open(file_name, "w") {|file| file.puts new_contents7 }
58
60
  end
59
61
  end
60
62
  end
@@ -62,14 +64,14 @@ module Yogi
62
64
  class ErrorOut
63
65
  def undo
64
66
  #undo changes originaly made.
65
- Dir.foreach('backupFiles') do |item|
67
+ Dir.foreach('.backupFiles') do |item|
66
68
  next if item == '.' or item == '..'
67
- FileUtils.cp_r "backupFiles/"+ item, "./"
69
+ FileUtils.cp_r ".backupFiles/"+ item, "./"
68
70
  # puts item
69
71
  # FileUtils.cp_r file_names, "backupFiles/"
70
72
  end
71
73
  #removes folder backupFiles
72
- Dir.rmdir('backupFiles')
74
+ FileUtils.rm_r '.backupFiles'
73
75
  end
74
76
  end
75
77
 
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.1.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas Langnickel