npduy 0.2.1 → 0.2.2
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.
- checksums.yaml +4 -4
- data/lib/npduy.rb +30 -11
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 74cf59c7ae461351518ae79f74be595a9666c071
|
|
4
|
+
data.tar.gz: ec9b5a482503ada098757a5281d3de581d4c768e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 39f8ee9f0fe48f4750bc4ab748f8b909434ca86df1602b31e7336497286906fdab83b0b7067ccb9236921dcbe30df6d0b0b89c29fa74215dcdbf9928c0e0890f
|
|
7
|
+
data.tar.gz: 48564ec5e1a14ea0473a93b91e92473be030175ff9e15809510176ea46513df818cc7fc583802a15c88c4ef4f3c821434f0e11930c312a239766e457a153c3d6
|
data/lib/npduy.rb
CHANGED
|
@@ -1,18 +1,37 @@
|
|
|
1
1
|
class Npduy
|
|
2
|
+
# def self.process
|
|
3
|
+
# current_project = `pwd`
|
|
4
|
+
# current_project = current_project.gsub(/\n/,"")
|
|
5
|
+
# content = File.read(current_project + "/app/controllers/api/v1/users_controller.rb")
|
|
6
|
+
# content = content.gsub(/\#\s.*\s*/,"")
|
|
7
|
+
# content = content.gsub(/'/, '"')
|
|
8
|
+
# content = content.gsub(/\s*^group/, "\n\ngroup")
|
|
9
|
+
# content = content.gsub(/\s*^\s+^gem/, "\n\ngem")
|
|
10
|
+
# File.open(current_project + "/app/controllers/api/v1/users_controller.rb", "w") do |file|
|
|
11
|
+
# file.puts content
|
|
12
|
+
# end
|
|
13
|
+
# system "echo", "-e", "\e[92mYour User controller was successfully beautified!"
|
|
14
|
+
# rescue Exception => e
|
|
15
|
+
# system "echo", "-e", "\e[91m#{e.message}"
|
|
16
|
+
# system "echo", "-e", "\e[91mMake sure you're in the right place!"
|
|
17
|
+
# end
|
|
2
18
|
def self.process
|
|
3
19
|
current_project = `pwd`
|
|
20
|
+
files = Dir[current_project + "/app/controllers/api/v1/*.rb"]
|
|
4
21
|
current_project = current_project.gsub(/\n/,"")
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
22
|
+
files.select do |file_name|
|
|
23
|
+
content = File.read(current_project + "/" +file_name)
|
|
24
|
+
content = content.gsub(/\#\s.*\s*/,"")
|
|
25
|
+
content = content.gsub(/'/, '"')
|
|
26
|
+
content = content.gsub(/\s*^group/, "\n\ngroup")
|
|
27
|
+
content = content.gsub(/\s*^\s+^gem/, "\n\ngem")
|
|
28
|
+
File.open(current_project + "/" +file_name, "w") do |file|
|
|
29
|
+
file.puts content
|
|
30
|
+
end
|
|
31
|
+
system "echo", "-e", "\e[92mYour controllers " + file_name +" was successfully beautified!"
|
|
32
|
+
rescue Exception => e
|
|
33
|
+
system "echo", "-e", "\e[91m#{e.message}"
|
|
34
|
+
system "echo", "-e", "\e[91mMake sure you're in the right place!"
|
|
12
35
|
end
|
|
13
|
-
system "echo", "-e", "\e[92mYour User controller was successfully beautified!"
|
|
14
|
-
rescue Exception => e
|
|
15
|
-
system "echo", "-e", "\e[91m#{e.message}"
|
|
16
|
-
system "echo", "-e", "\e[91mMake sure you're in the right place!"
|
|
17
36
|
end
|
|
18
37
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: npduy
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Nguyen Phuoc Duy
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-06-
|
|
11
|
+
date: 2017-06-15 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: This gem help controller clean code
|
|
14
14
|
email: nguyenphuocduy13cntt@gmail.com
|