immosquare-cleaner 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e341bf1067e21b5e4389372799dd8b1c0a3d7def5c9519b979a482be2d03c0f3
|
4
|
+
data.tar.gz: b315cff9a2a3f3a8d9d60db7b496b54c1cded48ddd9740b5c944f883da507903
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b25f01dfba4c066a21021fb5c72f7449eefbb0b5831b910e347494435bcb197dad37c6ec02ec6bfc1d38ac18bb80a38f1257c70be3e44ade9c60702218e5a451
|
7
|
+
data.tar.gz: 6d3945a01c4480d90b58f711e30763cdb5ee90c37e994bfad538644e4872c3e7ad9c98cc5b6bc269d8feee2deec794c5f57f96ac1c23c62e9cd3f6f20474e262
|
data/bin/immosquare-cleaner
CHANGED
@@ -1,7 +1,13 @@
|
|
1
|
-
require "
|
1
|
+
require "English"
|
2
2
|
require_relative "immosquare-cleaner/configuration"
|
3
|
-
require_relative "immosquare-
|
4
|
-
|
3
|
+
require_relative "immosquare-cleaner/railtie" if defined?(Rails)
|
4
|
+
|
5
|
+
##===========================================================================##
|
6
|
+
## Importing the 'English' library allows us to use more human-readable
|
7
|
+
## global variables, such as $INPUT_RECORD_SEPARATOR instead of $/,
|
8
|
+
## which enhances code clarity and makes it easier to understand
|
9
|
+
## the purpose of these variables in our code.
|
10
|
+
##===========================================================================##
|
5
11
|
module ImmosquareCleaner
|
6
12
|
class << self
|
7
13
|
|
@@ -72,7 +78,7 @@ module ImmosquareCleaner
|
|
72
78
|
end if !cmd.empty?
|
73
79
|
rescue StandardError => e
|
74
80
|
puts(e.message)
|
75
|
-
|
81
|
+
puts(e.backtrace)
|
76
82
|
end
|
77
83
|
end
|
78
84
|
|
@@ -105,21 +111,23 @@ module ImmosquareCleaner
|
|
105
111
|
## The total number of lines in the normalized file.
|
106
112
|
##===========================================================================##
|
107
113
|
def normalize_last_line(file_path)
|
114
|
+
end_of_line = $INPUT_RECORD_SEPARATOR
|
108
115
|
##============================================================##
|
109
116
|
## Read all lines from the file
|
110
117
|
## https://gist.github.com/guilhermesimoes/d69e547884e556c3dc95
|
111
118
|
##============================================================##
|
112
119
|
content = File.read(file_path)
|
113
120
|
|
121
|
+
|
114
122
|
##===========================================================================##
|
115
123
|
## Remove all trailing empty lines at the end of the file
|
116
|
-
content.gsub!(/#{Regexp.escape($INPUT_RECORD_SEPARATOR)}+\z/, "")
|
117
124
|
##===========================================================================##
|
125
|
+
content.gsub!(/#{Regexp.escape(end_of_line)}+\z/, "")
|
118
126
|
|
119
127
|
##===========================================================================##
|
120
|
-
## Append
|
121
|
-
|
122
|
-
content
|
128
|
+
## Append an EOL at the end to maintain the file structure
|
129
|
+
##===========================================================================##
|
130
|
+
content << end_of_line
|
123
131
|
|
124
132
|
##===========================================================================##
|
125
133
|
## Write the modified lines back to the file
|
@@ -4,7 +4,14 @@ namespace :immosquare_cleaner do
|
|
4
4
|
##============================================================##
|
5
5
|
desc "Clean translation files in rails app"
|
6
6
|
task :clean => :environment do
|
7
|
-
Dir.glob("#{Rails.root}
|
7
|
+
file_paths = Dir.glob("#{Rails.root}/**/*").reject do |file_path|
|
8
|
+
test1 = file_path.gsub("#{Rails.root}/", "")
|
9
|
+
File.directory?(file_path) ||
|
10
|
+
test1.start_with?("node_modules", "tmp", "public", "log", "app/assets/builds", "app/assets/fonts", "app/assets/images") ||
|
11
|
+
file_path.end_with?(".lock", ".lockb")
|
12
|
+
end
|
13
|
+
file_paths.each do |file|
|
14
|
+
puts file
|
8
15
|
ImmosquareCleaner.clean(file)
|
9
16
|
end
|
10
17
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: immosquare-cleaner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- IMMO SQUARE
|
@@ -77,10 +77,10 @@ extensions: []
|
|
77
77
|
extra_rdoc_files: []
|
78
78
|
files:
|
79
79
|
- bin/immosquare-cleaner
|
80
|
+
- lib/immosquare-cleaner.rb
|
80
81
|
- lib/immosquare-cleaner/configuration.rb
|
81
82
|
- lib/immosquare-cleaner/railtie.rb
|
82
83
|
- lib/immosquare-cleaner/version.rb
|
83
|
-
- lib/immosquare_cleaner.rb
|
84
84
|
- lib/tasks/immosquare-cleaner.rake
|
85
85
|
- linters/erb-lint.yml
|
86
86
|
- linters/prettier.yml
|