strong_versions 0.2.1 → 0.3.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 +4 -4
- data/README.md +17 -21
- data/bin/strong_versions +15 -0
- data/doc/images/strong-versions-example.png +0 -0
- data/lib/strong_versions/dependencies.rb +3 -1
- data/lib/strong_versions/version.rb +1 -1
- data/plugins.rb +5 -0
- data/strong_versions.gemspec +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c22d65fb8950d91b5f8303c8f5eba7842a39d6ea9410b70071ccd7cf5944a0c
|
4
|
+
data.tar.gz: 840a9a7c0dd86371ca55a2b8884a7a7b86688342c1cadd038d501ffd864f6166
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 460734cdc1a68bdc008f7bb496895da1f0735e9e4b29db2a1f816f41895717cae236ae27e14242ca92f25d0fe5346ff1cdb1532115a8997f63f86dfcee0e10ab
|
7
|
+
data.tar.gz: 634139436aec6caa3d9be60723a6fea378c702799046ffc6929d84e38a61d1927cf8c5f3820dc79c5f67c4e2628c0238da7caeb0fd71b57536b4cea897d5555a
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@ Is right here inside us
|
|
8
8
|
|
9
9
|
# Overview
|
10
10
|
|
11
|
-
_StrongVersions_
|
11
|
+
_StrongVersions_ enforces a strict policy on your `Gemfile` requirements:
|
12
12
|
|
13
13
|
* The pessimistic `~>` operator must be used for all gem requirement definitions.
|
14
14
|
* If the gem version is greater than 1, the requirement format must be `major.minor`, e.g. `'~> 2.5`'
|
@@ -17,18 +17,18 @@ _StrongVersions_ is a _Bundler_ plugin that enforces a strict policy on your `Ge
|
|
17
17
|
* All gems with a `path` or `git` source are ignored, e.g. `path: '/path/to/gem'`, `git: 'https://github.com/bobf/strong_versions'`
|
18
18
|
* All gems specified in the [ignore list](#ignore) are ignored.
|
19
19
|
|
20
|
-
Any gems that do not satisfy these rules will
|
20
|
+
Any gems that do not satisfy these rules will be included in included in the _StrongVersions_ output with details on why they did not meet the standard.
|
21
21
|
|
22
|
-
The benefit of applying this standard is that
|
22
|
+
The benefit of applying this standard is that, if all gems follow [Semantic Versioning](https://semver.org/) always be relatively safe to run `bundle update` to upgrade to the latest compatible versions of all dependencies. Running `bundle update` often brings advantages both in terms of bug fixes and security updates.
|
23
23
|
|
24
24
|

|
25
25
|
|
26
26
|
## Installation
|
27
27
|
|
28
|
-
Add the
|
28
|
+
Add the gem to your `Gemfile`
|
29
29
|
|
30
30
|
```ruby
|
31
|
-
|
31
|
+
gem 'strong_versions', '~> 0.3.0'
|
32
32
|
```
|
33
33
|
|
34
34
|
And rebuild your bundle:
|
@@ -37,15 +37,24 @@ And rebuild your bundle:
|
|
37
37
|
$ bundle install
|
38
38
|
```
|
39
39
|
|
40
|
+
Or install yourself:
|
41
|
+
```bash
|
42
|
+
$ gem install strong_versions -v '0.3.0'
|
43
|
+
```
|
44
|
+
|
40
45
|
## Usage
|
41
46
|
|
42
|
-
_StrongVersions_
|
47
|
+
_StrongVersions_ is invoked with a provided executable:
|
43
48
|
|
44
|
-
|
49
|
+
```bash
|
50
|
+
$ bundle exec strong_versions
|
51
|
+
```
|
52
|
+
|
53
|
+
The executable will output all non-passing gems and will return an exit code of `1` on failure, `0` on success (i.e. all gems passing).
|
45
54
|
|
46
55
|
### Exclusions
|
47
56
|
|
48
|
-
<a name="ignore"></a>You can
|
57
|
+
<a name="ignore"></a>You can tell _StrongVersions_ to ignore any of your gems (e.g. those that don't follow _semantic versioning_) by adding them to the `ignore` section of `.strong_versions.yml` in your project root, e.g.:
|
49
58
|
|
50
59
|
```yaml
|
51
60
|
# .strong_versions.yml
|
@@ -53,19 +62,6 @@ ignore:
|
|
53
62
|
- rails
|
54
63
|
```
|
55
64
|
|
56
|
-
### Raise or Warn
|
57
|
-
|
58
|
-
<a name="raise_or_warn"></a>_StrongVersions_ can be configured to raise an exception (default) or output a warning when the standard is not met.
|
59
|
-
|
60
|
-
Warning instead of raising is especially useful when you want to add new dependencies to your `Gemfile` as you can initially set them with loose requirements and then update the `Gemfile` with more precise values based on your new `Gemfile.lock`.
|
61
|
-
|
62
|
-
Set `on_failure` in `.strong_versions.yml` to either `raise` or `warn`:
|
63
|
-
|
64
|
-
```yaml
|
65
|
-
# .strong_versions.yml
|
66
|
-
on_failure: warn
|
67
|
-
```
|
68
|
-
|
69
65
|
## Contributing
|
70
66
|
|
71
67
|
Fork and create a pull request.
|
data/bin/strong_versions
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'strong_versions'
|
4
|
+
|
5
|
+
config_path = Bundler.root.join('.strong_versions.yml')
|
6
|
+
config = StrongVersions::Config.new(config_path)
|
7
|
+
dependencies = Bundler.definition.dependencies
|
8
|
+
|
9
|
+
valid = StrongVersions::Dependencies.new(dependencies).validate!(
|
10
|
+
except: config.exceptions,
|
11
|
+
on_failure: 'warn'
|
12
|
+
)
|
13
|
+
|
14
|
+
exit 0 if valid
|
15
|
+
exit 1
|
Binary file
|
@@ -10,7 +10,7 @@ module StrongVersions
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def validate!(options = {})
|
13
|
-
return if validate(options)
|
13
|
+
return true if validate(options)
|
14
14
|
|
15
15
|
on_failure = options.fetch(:on_failure, 'raise')
|
16
16
|
case on_failure
|
@@ -19,6 +19,8 @@ module StrongVersions
|
|
19
19
|
when 'warn'
|
20
20
|
warn_failure
|
21
21
|
end
|
22
|
+
|
23
|
+
false
|
22
24
|
end
|
23
25
|
|
24
26
|
def validate(options = {})
|
data/plugins.rb
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# XXX: StrongVersions was intended to be a Bundler plugin but, unfortunately,
|
4
|
+
# the plugin system is still in its infancy and has many issues which make it
|
5
|
+
# not fit for purpose. If those issues get resolved then I will re-add
|
6
|
+
# documentation for use as a plugin.
|
7
|
+
|
3
8
|
require 'strong_versions'
|
4
9
|
|
5
10
|
Bundler::Plugin.add_hook('before-install-all') do |dependencies|
|
data/strong_versions.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: strong_versions
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bob Farrell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -111,7 +111,8 @@ dependencies:
|
|
111
111
|
description: Ensure your gems are appropriately versioned
|
112
112
|
email:
|
113
113
|
- robertanthonyfarrell@gmail.com
|
114
|
-
executables:
|
114
|
+
executables:
|
115
|
+
- strong_versions
|
115
116
|
extensions: []
|
116
117
|
extra_rdoc_files: []
|
117
118
|
files:
|
@@ -129,6 +130,7 @@ files:
|
|
129
130
|
- bin/rspec
|
130
131
|
- bin/rubocop
|
131
132
|
- bin/setup
|
133
|
+
- bin/strong_versions
|
132
134
|
- config/locales/en.yml
|
133
135
|
- doc/images/strong-versions-example.png
|
134
136
|
- lib/strong_versions.rb
|