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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/npduy.rb +30 -11
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c93ef794398dbb5952c318ea971b4dc5b932776e
4
- data.tar.gz: cef08eb9a324b7b25a1ed4dc99ce8a3542aba54b
3
+ metadata.gz: 74cf59c7ae461351518ae79f74be595a9666c071
4
+ data.tar.gz: ec9b5a482503ada098757a5281d3de581d4c768e
5
5
  SHA512:
6
- metadata.gz: da74e77ac3fd802ddccd4c97ebd9462aef73913b1970e7a8bcfb6a24b2e94b0a27c393cf8a03e5f659e70dd4a82989efd065ac3e00abeed48f86144871411633
7
- data.tar.gz: 679d8c6d258d59b56814cdd1635b57236892c7e87a6c47164680e8a030b6f0e0de57e8b432bbfa54d10ee5e1361ff713cd86f1d330d203ffc637f9d6cc933d2a
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
- 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
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.1
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-14 00:00:00.000000000 Z
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