claiss 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/claiss.rb +12 -22
- data/lib/tasks/claiss.rake +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f7b117b78d9275e924380505e1ca1ddb0818490cd1532dd5a31de08b199e1b84
|
4
|
+
data.tar.gz: 39ba11f151fe5ecd59cc291011ef8611e61f4a83cf4d95427bd3589643be7353
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4265f73dadbbae241ca6d6dab87b121f5fc931c9f2044c8a159d52031c1b629eec97c4439dbd7879efbc48ad5bb6c36075d40cd8c7c3a5d12a87117d6b580efa
|
7
|
+
data.tar.gz: b217629b6cc0da245dfe5e1e3b33123a22f52d7037b6c8900688d32291b730a75ef76152be7c059fce5bd2b9d7fb5c932f11fa098bab3355a22a28acb3d92c26
|
data/lib/claiss.rb
CHANGED
@@ -28,9 +28,10 @@ module Claiss
|
|
28
28
|
search = ""
|
29
29
|
replace = ""
|
30
30
|
input = "y"
|
31
|
-
|
32
|
-
|
33
|
-
|
31
|
+
temp_dir = "/refactored-#{Time.now.to_i.to_s}"
|
32
|
+
origin_path = File.expand_path(path)
|
33
|
+
destination_path = File.expand_path("."+ temp_dir)
|
34
|
+
|
34
35
|
if !json_file.nil?
|
35
36
|
jfile = File.read(json_file)
|
36
37
|
dict = JSON.parse(jfile)
|
@@ -46,12 +47,10 @@ module Claiss
|
|
46
47
|
input = STDIN.gets.chomp!
|
47
48
|
end
|
48
49
|
end
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
puts destination
|
54
|
-
text = File.read(file) if !File.directory?(file)
|
50
|
+
source = File.expand_path(origin_path + "/**/*", __FILE__)
|
51
|
+
Dir.glob(source).reject{ |f| File.directory?(f)}.each do |file_name|
|
52
|
+
destination = file_name
|
53
|
+
text = File.read(file_name) if !File.directory?(file_name)
|
55
54
|
|
56
55
|
dict.map do |p, i|
|
57
56
|
destination.gsub!(p, i)
|
@@ -60,20 +59,11 @@ module Claiss
|
|
60
59
|
end
|
61
60
|
end
|
62
61
|
|
63
|
-
FileUtils.mkdir_p(File.dirname(destination))
|
64
|
-
File.
|
65
|
-
|
66
|
-
end
|
67
|
-
end
|
68
|
-
if File.directory?(destination_path)
|
69
|
-
puts "Do you want Move and delete to the original folder? (y/n): "
|
70
|
-
del = STDIN.gets.chomp
|
71
|
-
if del.downcase == "y"
|
72
|
-
FileUtils.rm_r(path)
|
73
|
-
FileUtils.mv destination_path, origin_path
|
74
|
-
puts "Moved from #{destination_path} to #{origin_path}"
|
75
|
-
end
|
62
|
+
FileUtils.mkdir_p(File.dirname(destination))
|
63
|
+
File.write(destination, text) if !File.directory?(file_name)
|
64
|
+
puts "File: #{destination}, OK" if !File.directory?(file_name)
|
76
65
|
end
|
66
|
+
puts "done!"
|
77
67
|
|
78
68
|
end
|
79
69
|
end
|
data/lib/tasks/claiss.rake
CHANGED