clean_code 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 +24 -0
  4. metadata +47 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9fad0f2b7cf22867814081e392ac2536fd506a6e
4
+ data.tar.gz: c294e92fdc499b798902eb692754595f95d9acd4
5
+ SHA512:
6
+ metadata.gz: f06f2410e1d1fc492fe2d4436e59f029bd4a3377e0aa1b8a2785a297a5bc65ecbf5b7ed9c57af28d2e2ec99039ec5d5c9d29d6d9685109f0682f1e10dd591e5c
7
+ data.tar.gz: d47897fd63d6fbb1db6a5228637838c263ebd3ba3c481a5222deeda806de4d5dd064c20c09334d7bfe2f3664c151f58240b066894f4d54fb4d728883a735d4e6
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,24 @@
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
24
+
metadata ADDED
@@ -0,0 +1,47 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: clean_code
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Duy Nguyen P.
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 clear binding.pry, byebug
14
+ email:
15
+ - duy.nguyen@asiantech.vn
16
+ executables:
17
+ - clean_code
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - bin/clean_code
22
+ - lib/clean_code.rb
23
+ homepage: https://rubygems.org/gems/clean_code
24
+ licenses:
25
+ - MIT
26
+ metadata: {}
27
+ post_install_message:
28
+ rdoc_options: []
29
+ require_paths:
30
+ - lib
31
+ required_ruby_version: !ruby/object:Gem::Requirement
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ requirements: []
42
+ rubyforge_project:
43
+ rubygems_version: 2.6.8
44
+ signing_key:
45
+ specification_version: 4
46
+ summary: Files .rb beautiful and clean
47
+ test_files: []