varslist 0.0.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/varslist +3 -0
  3. data/lib/varslist.rb +23 -0
  4. metadata +44 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e8af57f9b0eeff739671c57f91d1ca48b70154fe7d996947377a89b79cd17ab4
4
+ data.tar.gz: 876bc99bed4db05a966be6aec26490c3fe33306e3398fc1e229dc29c095d5216
5
+ SHA512:
6
+ metadata.gz: ace9dc55c40a4fdeb120484b23e1a288221cfb030337b15667ce3d0cc0c723e11cbaba73da179391ba51efbc395e02f4a7a53666d545d0945831f3692c00989d
7
+ data.tar.gz: 7453caadeddbcb7e8b998678bbca1474bfa3e8b161ab49d42ef674b4c93b5898a20542c1a176fb92861a7dd162c126726f8b0f16a2b0cae60465123caaab8e60
data/bin/varslist ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require 'varslist'
3
+ puts Varslist.list_env_variables
data/lib/varslist.rb ADDED
@@ -0,0 +1,23 @@
1
+ class Varslist
2
+ def self.list_env_variables
3
+ watch_list = /\.rb$|\.html\.erb$/
4
+ filelist = Dir['./**/**/*.*']
5
+ filelist.each do |file|
6
+ check_environment(file) if File.basename(file) =~ watch_list
7
+ end
8
+ end
9
+
10
+ def self.check_environment(file_name)
11
+ env_regex = /ENV\[['"]\w+['"]\]|ENV\.fetch/
12
+ File.foreach(file_name).with_index do |line, index|
13
+ next if line.strip.empty? || line.strip.start_with?('#')
14
+
15
+ if line =~ env_regex
16
+ warn "#{file_name}:#{index}"
17
+ puts "\n\t#{line}\n"
18
+ end
19
+ end
20
+ end
21
+
22
+ private_class_method :check_environment
23
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: varslist
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Sumit Pati
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2024-12-09 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ executables:
16
+ - varslist
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - bin/varslist
21
+ - lib/varslist.rb
22
+ homepage:
23
+ licenses: []
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ requirements: []
40
+ rubygems_version: 3.5.20
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: Display the list of created Environment variables
44
+ test_files: []