npduy 0.0.2 → 0.2.0
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 +11 -9
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 329795aa8b7c5885042d0429b77a69562d40befd
|
|
4
|
+
data.tar.gz: d0d5e1d44ed4b00124c3cfa14eab78b9250540ea
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 74fe4beb21df8d6f590f0ffbe04a6f0f4bc6fabaf75d18c357f6c200762349d633f532a3e11efd2d885ab1102503c3c4e472ba94d331988d348101f47e5e9788
|
|
7
|
+
data.tar.gz: a40547d1e57ad18091bcfab994362c59d0afbca719f121ab29b654b2d81152029f48a9458846f973d57636b31a4887f6d161c048a3076819224f64b32adeab66
|
data/lib/npduy.rb
CHANGED
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
class Npduy
|
|
2
2
|
def self.process
|
|
3
3
|
current_project = `pwd`
|
|
4
|
+
files = Dir[current_project + "/app/controllers/api/v1/*.rb"]
|
|
4
5
|
current_project = current_project.gsub(/\n/,"")
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
files.each do |file_name|
|
|
7
|
+
content = File.read(current_project + "/" +file_name)
|
|
8
|
+
content = content.gsub(/\#\s.*\s*/,"")
|
|
9
|
+
content = content.gsub(/'/, '"')
|
|
10
|
+
content = content.gsub(/\s*^group/, "\n\ngroup")
|
|
11
|
+
content = content.gsub(/\s*^\s+^gem/, "\n\ngem")
|
|
12
|
+
File.open(current_project + "/" +file_name, "w") do |file|
|
|
13
|
+
file.puts content
|
|
14
|
+
end
|
|
12
15
|
end
|
|
13
|
-
system "echo", "-e", "\e[92mYour
|
|
16
|
+
system "echo", "-e", "\e[92mYour controllers was successfully beautified!"
|
|
14
17
|
rescue Exception => e
|
|
15
18
|
system "echo", "-e", "\e[91m#{e.message}"
|
|
16
19
|
system "echo", "-e", "\e[91mMake sure you're in the right place!"
|
|
17
20
|
end
|
|
18
|
-
|
|
19
21
|
end
|
metadata
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: npduy
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0
|
|
4
|
+
version: 0.2.0
|
|
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-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
|
-
description: This gem help
|
|
13
|
+
description: This gem help controller clean code
|
|
14
14
|
email: nguyenphuocduy13cntt@gmail.com
|
|
15
15
|
executables:
|
|
16
16
|
- npduy
|
|
@@ -42,5 +42,5 @@ rubyforge_project:
|
|
|
42
42
|
rubygems_version: 2.6.8
|
|
43
43
|
signing_key:
|
|
44
44
|
specification_version: 4
|
|
45
|
-
summary:
|
|
45
|
+
summary: Controller Beautify
|
|
46
46
|
test_files: []
|