clean_files_rb 0.1.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.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/bin/clean_code +3 -0
  3. data/lib/clean_code.rb +23 -0
  4. metadata +46 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 68a3829598fbc5d823645075b542e0eb566a2dc4
4
+ data.tar.gz: c7d06c08f71063e776c8c790bbf28f2f026f45e2
5
+ SHA512:
6
+ metadata.gz: 3b850e805ab885d5230dc3ef25975e0099ddb24a79da99eba015332054ad581068f6f788e58d21ae247734d00a85cfceeea9d7264f503c174120ca1cf24c8c21
7
+ data.tar.gz: b1ec67f312d3c9e2a658f5f302adacb04df3ac4e0c2c2f163f5133c264e72ff58bb9d66177967b6006af353c14e29631fe455fc88de61fe82f72c8e2a0646a3b
data/bin/clean_code ADDED
@@ -0,0 +1,3 @@
1
+ require "clean_code"
2
+
3
+ CleanCode.process
data/lib/clean_code.rb ADDED
@@ -0,0 +1,23 @@
1
+ require "clean_code/version"
2
+
3
+ class CleanCode
4
+ def self.process
5
+ current_project = `pwd`
6
+ rbfiles = File.join("**", "*.rb")
7
+ files = Dir.glob(rbfiles)
8
+ current_project = current_project.gsub(/\n/,"")
9
+ files.each do |file_name|
10
+ content = File.read(current_project + "/" +file_name)
11
+ content = content.gsub(/binding.pry/,"\s")
12
+ content = content.gsub(/byebug/,"\s")
13
+ content = content.gsub!(/[\s]+[\n]+/, "\n")
14
+ File.open(current_project + "/" +file_name, "w") do |file|
15
+ file.puts content
16
+ end
17
+ end
18
+ system "echo", "-e", "\e[92mYour file .rb was successfully beautified!"
19
+ rescue Exception => e
20
+ system "echo", "-e", "\e[91m#{e.message}"
21
+ system "echo", "-e", "\e[91mMake sure you're in the right place!"
22
+ end
23
+ end
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: clean_files_rb
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Nguyen Phuoc Duy
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-06-21 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: This gem help files .rb clean code and binding.pry
14
+ email: nguyenphuocduy13cntt@gmail.com
15
+ executables:
16
+ - clean_code
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - bin/clean_code
21
+ - lib/clean_code.rb
22
+ homepage: https://rubygems.org/gems/clean_files_rb
23
+ licenses:
24
+ - MIT
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubyforge_project:
42
+ rubygems_version: 2.6.8
43
+ signing_key:
44
+ specification_version: 4
45
+ summary: Files .rb Beautify
46
+ test_files: []