bundler-ecology 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +4 -0
- data/lib/bundler/ecology.rb +11 -8
- data/lib/bundler/ecology/handlers/before_install.rb +22 -0
- data/lib/bundler/ecology/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2783cee897240df4b61c014b1c75fb35b4bd4f00527ad92e60c6b8bc43ec59df
|
4
|
+
data.tar.gz: 27159bfaf73cec10747446ac6f037ce0aa5d446d01459a1484ca4be6d78563e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b530048337c5cfb8ca5d462fcdac0b1c25480c9f3ebd68fb644aa321002da72f52d788f864d30661f52efeab7fd5ec2cdb3871ac3af5c23b83cb2e119fd9e578
|
7
|
+
data.tar.gz: 31d41d1c48578a516c3a9af1712b817ce58b142a7cfa553d76c313d4a8214bb44cb4a32729bc7e8b6ade8f3db4e320d181d60f3c5561a2ce4ceb97e2bfa47bbf
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
data/lib/bundler/ecology.rb
CHANGED
@@ -1,21 +1,24 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'bundler/ecology/handlers/before_install'
|
3
4
|
require 'bundler/ecology/version'
|
4
|
-
require 'yaml'
|
5
5
|
|
6
6
|
module Bundler
|
7
7
|
module Ecology
|
8
8
|
def self.register
|
9
|
-
|
10
|
-
config = YAML.safe_load(config_file_content, symbolize_names: true)
|
11
|
-
@gem_names = config[:disallowed].map { |item| item[:name] }
|
9
|
+
before_install_handler = Handlers::BeforeInstall.new(config)
|
12
10
|
|
13
11
|
Bundler::Plugin.add_hook('before-install') do |dependency|
|
14
|
-
|
15
|
-
|
16
|
-
raise Bundler::PluginError,
|
17
|
-
"Gemfile contains a disallowed dependency: #{dependency.name}"
|
12
|
+
before_install_handler.call(dependency)
|
18
13
|
end
|
19
14
|
end
|
15
|
+
|
16
|
+
def self.config
|
17
|
+
config_file_name = '.bundler-ecology.yml'
|
18
|
+
return { disallowed: [] } unless File.exist?(config_file_name)
|
19
|
+
|
20
|
+
config_file_content = File.read(config_file_name)
|
21
|
+
YAML.safe_load(config_file_content, symbolize_names: true)
|
22
|
+
end
|
20
23
|
end
|
21
24
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
module Bundler
|
6
|
+
module Ecology
|
7
|
+
module Handlers
|
8
|
+
class BeforeInstall
|
9
|
+
def initialize(config)
|
10
|
+
@gem_names = config.fetch(:disallowed, []).map { |item| item[:name] }
|
11
|
+
end
|
12
|
+
|
13
|
+
def call(dependency)
|
14
|
+
return unless @gem_names.include?(dependency.name)
|
15
|
+
|
16
|
+
raise Bundler::PluginError,
|
17
|
+
"Gemfile contains a disallowed dependency: #{dependency.name}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bundler-ecology
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Vasily Kolesnikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-01-
|
11
|
+
date: 2019-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: No unwanted gems more in your Gemfile.lock
|
14
14
|
email:
|
@@ -17,8 +17,10 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
+
- CHANGELOG.md
|
20
21
|
- README.md
|
21
22
|
- lib/bundler/ecology.rb
|
23
|
+
- lib/bundler/ecology/handlers/before_install.rb
|
22
24
|
- lib/bundler/ecology/version.rb
|
23
25
|
- plugins.rb
|
24
26
|
homepage: https://github.com/eco-rb/bundler-ecology
|