claiss 1.0.5 → 1.0.7
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 +35 -21
- data/lib/tasks/claiss.rake +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a27c84097fb8adb9ce3e2351651821770f6973b000557e8566b79c24428b66c
|
4
|
+
data.tar.gz: 74a986701d5b7031cd6f0fdfc9a93d18df2801bd6f1474138a30200fad9c7c73
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05af17263512ea15e08d4742d9e2ac8d0db3f2f1d2796f805372ce3afb76d3419b79d37c6566a857da75723e606fa402324baa89c8985df528eb0d8236d1ce8d
|
7
|
+
data.tar.gz: aa9387b2cf6f4bf87cdcb9424564c31a34af908fa5664fee85c4211f29d26dad09af20068fa08e50f957152adc57a2e4e07ed6309bb174675ce01478513bc41b
|
data/lib/claiss.rb
CHANGED
@@ -13,7 +13,7 @@ module Claiss
|
|
13
13
|
|
14
14
|
def call(*)
|
15
15
|
spec = Gem::Specification::load("claiss.gemspec")
|
16
|
-
puts "#{spec.
|
16
|
+
puts "#{spec.description}"
|
17
17
|
puts "Version: #{spec.version}"
|
18
18
|
end
|
19
19
|
end
|
@@ -28,8 +28,10 @@ module Claiss
|
|
28
28
|
search = ""
|
29
29
|
replace = ""
|
30
30
|
input = "y"
|
31
|
-
|
32
|
-
|
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
|
+
|
33
35
|
|
34
36
|
if !json_file.nil?
|
35
37
|
jfile = File.read(json_file)
|
@@ -46,12 +48,13 @@ module Claiss
|
|
46
48
|
input = STDIN.gets.chomp!
|
47
49
|
end
|
48
50
|
end
|
49
|
-
puts dict.inspect
|
50
51
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
52
|
+
dict = {origin_path => destination_path}.merge(dict)
|
53
|
+
dict[origin_path] = destination_path
|
54
|
+
source = File.expand_path(origin_path + "/**/*", __FILE__)
|
55
|
+
Dir.glob(source).reject{ |f| File.directory?(f)}.each do |file_name|
|
56
|
+
destination = file_name
|
57
|
+
text = File.read(file_name) if !File.directory?(file_name)
|
55
58
|
|
56
59
|
dict.map do |p, i|
|
57
60
|
destination.gsub!(p, i)
|
@@ -60,24 +63,35 @@ module Claiss
|
|
60
63
|
end
|
61
64
|
end
|
62
65
|
|
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
|
66
|
+
FileUtils.mkdir_p(File.dirname(destination))
|
67
|
+
File.write(destination, text) if !File.directory?(file_name)
|
68
|
+
puts "File: #{destination}, OK" if !File.directory?(file_name)
|
76
69
|
end
|
77
70
|
|
71
|
+
puts "done! your project is in the #{temp_dir} folder"
|
78
72
|
end
|
79
73
|
end
|
80
74
|
|
75
|
+
class FixRubyPermissions < Dry::CLI::Command
|
76
|
+
argument :path, required: true, desc: "The path of your ruby project"
|
77
|
+
|
78
|
+
def call(path: nil, **)
|
79
|
+
if path.nil?
|
80
|
+
path = File.basename(Dir.getwd)
|
81
|
+
end
|
82
|
+
|
83
|
+
# Run shell scripts to set permissions.
|
84
|
+
directories = `chmod 755 $(find #{path} -type d)`
|
85
|
+
files = `chmod 644 $(find #{path} -type f)`
|
86
|
+
bundle = `chmod 755 #{path+'/bin/bundle'}`
|
87
|
+
rails = `chmod 755 #{path+'/bin/rails'}`
|
88
|
+
rake = `chmod 755 #{path+'/bin/rake'}`
|
89
|
+
spring = `chmod 755 #{path+'/bin/spring'}`
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
93
|
+
|
81
94
|
register "version", Version, aliases: ["v", "-v", "--version"]
|
82
95
|
register "refactor",Refactor
|
96
|
+
register "fix_ruby_permissions",FixRubyPermissions
|
83
97
|
end
|
data/lib/tasks/claiss.rake
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: claiss
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Júlio Papel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-07-
|
11
|
+
date: 2023-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-cli
|