gem-silencer 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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: e026caf0bbb80c47e003dce6cbb3673111b1dbe34758b04b132df77215984bf9
4
+ data.tar.gz: b5c0af92a6ca5aa0526781d374507cfa4cb5c33b146eb13f540a4d2f405ad270
5
+ SHA512:
6
+ metadata.gz: 6765316f1827df072bdd83bff491adbf8265ee52af61461adfa497497138517aac0ddfc45d258d1eb17066992344796e4ca7c7ba6ab01074edb9330c44698331
7
+ data.tar.gz: ee2ed37a1525c6ba412670c4ff786368d260ccde4b53e8445678dbe9fd54a502a2e064341aca60ae77e6134070c0a253c13d3401e7999c118799af438657b87f
data/.idea/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
4
+ # Editor-based HTTP Client requests
5
+ /httpRequests/
6
+ # Datasource local storage ignored files
7
+ /dataSources/
8
+ /dataSources.local.xml
data/.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/silencer.iml" filepath="$PROJECT_DIR$/.idea/silencer.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,58 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="ModuleRunConfigurationManager">
4
+ <shared />
5
+ </component>
6
+ <component name="NewModuleRootManager">
7
+ <content url="file://$MODULE_DIR$">
8
+ <sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
9
+ <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
10
+ <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
11
+ </content>
12
+ <orderEntry type="jdk" jdkName="asdf: 3.4.1" jdkType="RUBY_SDK" />
13
+ <orderEntry type="sourceFolder" forTests="false" />
14
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v2.6.2, asdf: 3.4.1) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.5.1, asdf: 3.4.1) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="rake (v13.2.1, asdf: 3.4.1) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v3.13.0, asdf: 3.4.1) [gem]" level="application" />
18
+ <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.13.3, asdf: 3.4.1) [gem]" level="application" />
19
+ <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.13.3, asdf: 3.4.1) [gem]" level="application" />
20
+ <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.13.2, asdf: 3.4.1) [gem]" level="application" />
21
+ <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.13.2, asdf: 3.4.1) [gem]" level="application" />
22
+ <orderEntry type="library" scope="PROVIDED" name="warning (v1.5.0, asdf: 3.4.1) [gem]" level="application" />
23
+ <orderEntry type="library" scope="PROVIDED" name="yaml (v0.4.0, asdf: 3.4.1) [gem]" level="application" />
24
+ </component>
25
+ <component name="RakeTasksCache-v2">
26
+ <option name="myRootTask">
27
+ <RakeTaskImpl id="rake">
28
+ <subtasks>
29
+ <RakeTaskImpl description="Build silencer-0.1.0.gem into the pkg directory" fullCommand="build" id="build" />
30
+ <RakeTaskImpl id="build">
31
+ <subtasks>
32
+ <RakeTaskImpl description="Generate SHA512 checksum of silencer-0.1.0.gem into the checksums directory" fullCommand="build:checksum" id="checksum" />
33
+ </subtasks>
34
+ </RakeTaskImpl>
35
+ <RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
36
+ <RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
37
+ <RakeTaskImpl description="Build and install silencer-0.1.0.gem into system gems" fullCommand="install" id="install" />
38
+ <RakeTaskImpl id="install">
39
+ <subtasks>
40
+ <RakeTaskImpl description="Build and install silencer-0.1.0.gem into system gems without network access" fullCommand="install:local" id="local" />
41
+ </subtasks>
42
+ </RakeTaskImpl>
43
+ <RakeTaskImpl description="Create tag v0.1.0 and build and push silencer-0.1.0.gem to TODO: Set to your gem server 'https://example.com'" fullCommand="release[remote]" id="release[remote]" />
44
+ <RakeTaskImpl description="Run RSpec code examples" fullCommand="spec" id="spec" />
45
+ <RakeTaskImpl description="" fullCommand="default" id="default" />
46
+ <RakeTaskImpl description="" fullCommand="release" id="release" />
47
+ <RakeTaskImpl id="release">
48
+ <subtasks>
49
+ <RakeTaskImpl description="" fullCommand="release:guard_clean" id="guard_clean" />
50
+ <RakeTaskImpl description="" fullCommand="release:rubygem_push" id="rubygem_push" />
51
+ <RakeTaskImpl description="" fullCommand="release:source_control_push" id="source_control_push" />
52
+ </subtasks>
53
+ </RakeTaskImpl>
54
+ </subtasks>
55
+ </RakeTaskImpl>
56
+ </option>
57
+ </component>
58
+ </module>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ </component>
6
+ </project>
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 3.4.1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Hamed Asghari
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # Silencer
2
+
3
+ A gem to silence ruby warnings from other gem dependencies.
4
+
5
+ ## Installation
6
+
7
+ Install the gem and add to the application's Gemfile by executing:
8
+
9
+ ```bash
10
+ bundle add gem-silencer
11
+ ```
12
+
13
+ If bundler is not being used to manage dependencies, install the gem by executing:
14
+
15
+ ```bash
16
+ gem install gem-silencer
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ You need to define a `.silencer.yml` file in the root of your project. The file should contain a list of gems that you
22
+ want to silence warnings from. For example:
23
+
24
+ ```yaml
25
+ httpclient:
26
+ version: 2.8.3
27
+ patterns:
28
+ - literal string will be frozen
29
+ ```
30
+
31
+ When you update any gem listed in the `.silencer.yml` file, this gem will raise an error so you can verify that the
32
+ warning has not been addressed in the updated version. If the warning has been resolved, you can remove the gem from the
33
+ `.silencer.yml` file. If not, you can update the version number in the `.silencer.yml` file to match the new version.
34
+
35
+ ## Development
36
+
37
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can
38
+ also run `bin/console` for an interactive prompt that will allow you to experiment.
39
+
40
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the
41
+ version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version,
42
+ push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
43
+
44
+ ## Contributing
45
+
46
+ Bug reports and pull requests are welcome on GitHub at https://github.com/hasghari/silencer.
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -0,0 +1,3 @@
1
+ require_relative 'silencer'
2
+
3
+ Silencer.ignore_warnings
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Silencer
4
+ VERSION = '0.1.0'
5
+ end
data/lib/silencer.rb ADDED
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'silencer/version'
4
+ require 'warning'
5
+ require 'yaml'
6
+
7
+ module Silencer
8
+ class Error < StandardError
9
+ def initialize(gem, expected, actual)
10
+ super("#{gem} version changed from #{expected} to #{actual}")
11
+ end
12
+ end
13
+
14
+ def self.ignore_warnings(file = '.silencer.yml')
15
+ YAML.load_file(file).each do |name, attrs|
16
+ version = attrs['version']
17
+ spec = Gem::Specification.find_by_name(name)
18
+ raise Error.new(name, version, spec.version.to_s) unless version == spec.version.to_s
19
+ Array(attrs['patterns']).each do |pattern|
20
+ Warning.ignore(Regexp.new(pattern), spec.gem_dir)
21
+ end
22
+ end
23
+ end
24
+ end
data/sig/silencer.rbs ADDED
@@ -0,0 +1,5 @@
1
+ module Silencer
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ def self.ignore_warnings: -> untyped
5
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: gem-silencer
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Hamed Asghari
8
+ bindir: exe
9
+ cert_chain: []
10
+ date: 2025-02-06 00:00:00.000000000 Z
11
+ dependencies:
12
+ - !ruby/object:Gem::Dependency
13
+ name: warning
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '1.0'
19
+ type: :runtime
20
+ prerelease: false
21
+ version_requirements: !ruby/object:Gem::Requirement
22
+ requirements:
23
+ - - "~>"
24
+ - !ruby/object:Gem::Version
25
+ version: '1.0'
26
+ - !ruby/object:Gem::Dependency
27
+ name: yaml
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '0.1'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '0.1'
40
+ email:
41
+ - hasghari@gmail.com
42
+ executables: []
43
+ extensions: []
44
+ extra_rdoc_files: []
45
+ files:
46
+ - ".idea/.gitignore"
47
+ - ".idea/modules.xml"
48
+ - ".idea/silencer.iml"
49
+ - ".idea/vcs.xml"
50
+ - ".rspec"
51
+ - ".tool-versions"
52
+ - LICENSE.txt
53
+ - README.md
54
+ - Rakefile
55
+ - lib/gem-silencer.rb
56
+ - lib/silencer.rb
57
+ - lib/silencer/version.rb
58
+ - sig/silencer.rbs
59
+ homepage: https://github.com/hasghari/silencer
60
+ licenses:
61
+ - MIT
62
+ metadata:
63
+ homepage_uri: https://github.com/hasghari/silencer
64
+ rubygems_mfa_required: 'true'
65
+ rdoc_options: []
66
+ require_paths:
67
+ - lib
68
+ required_ruby_version: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 3.4.0
73
+ required_rubygems_version: !ruby/object:Gem::Requirement
74
+ requirements:
75
+ - - ">="
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ requirements: []
79
+ rubygems_version: 3.6.2
80
+ specification_version: 4
81
+ summary: A gem to silence ruby warnings from other gem dependencies
82
+ test_files: []