used_env 0.0.2 → 0.0.4
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/used_env.rb +5 -2
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: bfb7bc42f93b20481374701267a7ee943fb5042abe4e3eca80922bdc70d79c67
|
|
4
|
+
data.tar.gz: f3ba7f5df8f6331847eadaeb44214859e94063e2e8b9154dbdf7f79afd3b54a4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 22490ea9f9ccbdae319fed8ac213a068d1e2669ce7f17b41c91ab0499617bfd4c9adcce85ba47f76069cf84a0328206ba35b91aaede847555180da6f6837f623
|
|
7
|
+
data.tar.gz: c825412f0cc8c7ac2442f1316b5681d22fee2e0d5a06c2a88a55216fa667fffc8c04845bc525ebd8a9e2f87549d9f5ce54a784cc2c5c9d4c9abdae8ea6b99e1f
|
data/lib/used_env.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
class UsedEnv
|
|
2
2
|
def self.find_ruby_files
|
|
3
|
-
Dir.glob("./**/**/**/*.rb")
|
|
3
|
+
# Dir.glob("./**/**/**/*.{rb,html,erb}")
|
|
4
|
+
Dir["./**/*.{rb,html,erb}"]
|
|
4
5
|
end
|
|
5
6
|
|
|
6
7
|
def self.find_env_variables
|
|
@@ -14,7 +15,7 @@ class UsedEnv
|
|
|
14
15
|
matches = line.scan(/ENV\[["'](.*?)["']\]|ENV\.fetch\(["'](.*?)["']\)/)
|
|
15
16
|
|
|
16
17
|
matches.flatten.compact.each do |env_var|
|
|
17
|
-
env_vars << {
|
|
18
|
+
env_vars << { env_variable: env_var, file: file, line: line_num + 1 }
|
|
18
19
|
end
|
|
19
20
|
end
|
|
20
21
|
end
|
|
@@ -22,3 +23,5 @@ class UsedEnv
|
|
|
22
23
|
end
|
|
23
24
|
end
|
|
24
25
|
|
|
26
|
+
|
|
27
|
+
|
metadata
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: used_env
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Habi Pyatha
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-12-
|
|
11
|
+
date: 2024-12-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: |
|
|
14
14
|
A gem to list all the environment variables used in a Ruby project.
|
|
15
15
|
|
|
16
16
|
Example usage:
|
|
17
17
|
results = UsedEnv.find_env_variables
|
|
18
|
+
|
|
18
19
|
results.each do |entry|
|
|
19
20
|
puts "ENV_Variable: #{entry[:variable]} | File_path: #{entry[:file]} | Line: #{entry[:line]}"
|
|
20
21
|
end
|