semantic_range 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/CONTRIBUTING.md +195 -0
- data/.github/ISSUE_TEMPLATE.md +18 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +10 -0
- data/.github/SUPPORT.md +10 -0
- data/.gitignore +1 -0
- data/.travis.yml +5 -2
- data/lib/semantic_range/comparator.rb +36 -5
- data/lib/semantic_range/range.rb +10 -0
- data/lib/semantic_range/version.rb +1 -1
- data/semantic_range.gemspec +1 -1
- metadata +9 -6
- data/CONTRIBUTING.md +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec95fe31851133a57a3c90992bb3124739ce82c0
|
4
|
+
data.tar.gz: 3a137c6d5e47ab85b4845bb4162d8c5f9253a180
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f50a2b6cdd8dafbc675b0e43b7f6dd74cbdb6f70b88d51350b9c2e1977ca9c6192533863a7c48170ef0f4db580afa9d1de3c7d2810b855d97d497ecc41c44f3a
|
7
|
+
data.tar.gz: '07929eadc26321cdb53da674de931e7449dba9a264e9b8ba007ed47a1cd1469755c4b39ecab0fce43edf61aaf6c28c15c3ab93f9d343904c1797518dcde37bca'
|
@@ -0,0 +1,195 @@
|
|
1
|
+
## Contributing to Libraries.io :heart:
|
2
|
+
Thanks for considering contributing. These guidelines outline how to contribute to the [Libraries.io](http://github.com/librariesio) project.
|
3
|
+
|
4
|
+
## Table of Contents
|
5
|
+
[What is Libraries.io all about?](#whats-librariesio-about)
|
6
|
+
|
7
|
+
[Who is Libraries.io for?](#who-is-librariesio-for)
|
8
|
+
|
9
|
+
[What should I know Before I get started?](#what-should-i-know-before-i-get-started)
|
10
|
+
* [Code of conduct](#code-of-conduct)
|
11
|
+
* [Language](#language)
|
12
|
+
* [Installation and setup](#setup)
|
13
|
+
|
14
|
+
[How can I contribute?](#how-can-i-contribute)
|
15
|
+
* [Reporting bugs](#reporting-bugs)
|
16
|
+
* [Suggesting enhancements](#suggesting-enhancements)
|
17
|
+
* [Suggesting a new feature](#suggesting-new-features)
|
18
|
+
* [Your first contribution](#your-first-contribution)
|
19
|
+
* [Tackling something meatier](#tackling-something-meatier)
|
20
|
+
|
21
|
+
[How can I talk to other contributors?](#how-can-i-talk-to-other-contributors)
|
22
|
+
* [Chat](#chat)
|
23
|
+
* [Video](#video)
|
24
|
+
* [Social media](#twitter)
|
25
|
+
|
26
|
+
[Who Are Libraries.io's Users?](#who-are-librariesios-users)
|
27
|
+
|
28
|
+
[Our workflow](#workflow)
|
29
|
+
|
30
|
+
|
31
|
+
## What's Libraries.io About?
|
32
|
+
_Our goal is to raise the quality of all software._
|
33
|
+
|
34
|
+
By outlining our [mission and strategy](/strategy.md) we hope to give you more power to make decisions and determine how best to spend your time. Specifically we tackle three distinct problems:
|
35
|
+
|
36
|
+
* Discovery: _Helping developers make faster, more informed decisions about the software that they use._
|
37
|
+
* Maintainability: _Helping maintainers understand more about the software they depend upon and the consumers of their software._
|
38
|
+
* Sustainability: _Supporting undervalued software by highlighting shortfalls in contribution and funneling support to them._
|
39
|
+
|
40
|
+
The first of these problems is our foccus for Libraries.io. The other two we are trying to tackle at [Tidelift](https://tidelift.com).
|
41
|
+
|
42
|
+
## Who is Libraries.io For?
|
43
|
+
Libraries.io currently caters for the needs of three distinct user groups:
|
44
|
+
|
45
|
+
* Google: _is hungry for your linked datas so she can serve you up search traffic_
|
46
|
+
* Searcher: _is a developer with a problem, she is looking for something to help solve it._
|
47
|
+
* Maintainer: _has a project that is used within and/or incorporates open dependencies. She needs to ensure her project(s) are working as expected for users._
|
48
|
+
|
49
|
+
These groups have been expanded into [personas](/personas.md) for contributors to reference.
|
50
|
+
|
51
|
+
## What Should I Know Before I Get Started?
|
52
|
+
|
53
|
+
### Code of Conduct
|
54
|
+
Libraries.io is an open and inclusive [community of people](https://github.com/orgs/librariesio/people) working together. We expect contributors to abide by our [contributor code of conduct](CODE_OF_CONDUCT.md) which basically say 'be excellent to each other'. Please report unacceptable behavior to conduct@libraries.io
|
55
|
+
|
56
|
+
### Language
|
57
|
+
We communicate predominately in English. Contributions to the project should be made with English as the first language. We are happy for members of the community to communicate in a language other than English in chat, email and video but be aware that this might be considered exclusive by other members of the community.
|
58
|
+
|
59
|
+
### Documentation
|
60
|
+
Documentation for the project as a whole is available at [docs.libraries.io](https://docs.libraries.io). These pages are generated from the [documentation](https://github.com/librariesio/documentation) repo. Documentation that needs to be in every repo is replicated in [required-files](https://github.com/librariesio/required-files) (currently limited to [GitHub templates](https://github.com/blog/2111-issue-and-pull-request-templates)). Otherwise documentation will be specific to that repo. For example the main [Libraries.io](https://github.com/librariesio/libraries.io) `README.md` contains information about installing and running the main rails application.
|
61
|
+
|
62
|
+
### Setup
|
63
|
+
If you wish to make contributions to Libraries.io then you'll need a local version of the site to test. You can find instructions to install the correct Ruby version, Postgres, and to set up the database in our [README](https://github.com/librariesio/libraries.io/blob/master/README.md#getting-started).
|
64
|
+
|
65
|
+
## How Can I Contribute?
|
66
|
+
|
67
|
+
### Reporting Bugs
|
68
|
+
|
69
|
+
The simplest thing that you can do to help us is by filing good bug reports, so here we go:
|
70
|
+
|
71
|
+
#### Before Submitting a Bug Report
|
72
|
+
|
73
|
+
* Double-check that the bug is persistent. The site is still in it's infancy and sometimes artifacts may appear and disappear.
|
74
|
+
* Double-check the bug hasn't already been reported [on our issue tracker](https://github.com/search?utf8=%E2%9C%93&q=is%3Aopen+is%3Aissue+org%3Alibrariesio), they *should* be labelled `bug` or `bugsnag`.
|
75
|
+
|
76
|
+
If something hasn't been raised, you can go ahead and create a new issue using [the template](/issue_template.md). If you'd like to help investigate further or fix the bug just mention it in your issue and check out our [workflow](#workflow).
|
77
|
+
|
78
|
+
### Suggesting Enhancements
|
79
|
+
|
80
|
+
The next simplest thing you can do to help us is by telling us how we can improve the features we already support, here we go:
|
81
|
+
|
82
|
+
#### Before Submitting an Enhancement
|
83
|
+
|
84
|
+
* Check that the enhancement is not already [in our issue tracker](https://github.com/search?utf8=%E2%9C%93&q=is%3Aopen+is%3Aissue+org%3Alibrariesio), they should be labelled 'enhancement'.
|
85
|
+
|
86
|
+
If there isn't already an issue for feature then go ahead and create a new issue for it using the [template](/issue_template.md). If you'd like to work on the enhancement then just mention it in a comment and check out our [workflow](#workflow).
|
87
|
+
|
88
|
+
### Suggesting New Features
|
89
|
+
|
90
|
+
If you're into this zone then you need to understand a little more about what we're trying to achieve:
|
91
|
+
|
92
|
+
#### Before Suggesting a Feature
|
93
|
+
|
94
|
+
* Check that it aligns with [our strategy](strategy.md) and is specifically not in line with something we have said we will not do (for the moment this is anything to do with ranking *people*).
|
95
|
+
* Check that the feature is not already [in our issue tracker](https://github.com/search?utf8=%E2%9C%93&q=is%3Aopen+is%3Aissue+org%3Alibrariesio), they should be tagged 'feature'.
|
96
|
+
|
97
|
+
If you're still thinking about that killer feature that no one else is thinking about then *please* create an issue for it using the [template](/issue_template.md).
|
98
|
+
|
99
|
+
### Your First Contribution
|
100
|
+
You're in luck! We label issues that are ideal for first time contributors with [`first-pr`](https://github.com/search?l=&q=is%3Aopen+is%3Aissue+org%3Alibrariesio+label%3Afirst-pr&ref=advsearch&type=Issues&utf8=%E2%9C%93). For someone who wants something a little more meaty you might find an issue that needs some assistance with [`help wanted`](https://github.com/search?utf8=%E2%9C%93&q=is%3Aopen+is%3Aissue+org%3Alibrariesio+label%3A%22help+wanted%22&type=Issues). Next you'll want to read our [workflow](#workflow).
|
101
|
+
|
102
|
+
### Tackling Something Meatier
|
103
|
+
|
104
|
+
Tickets are labeled by size, skills required and to indicate workflow. Details can be found in our [labelling policy](/labelling.md).
|
105
|
+
|
106
|
+
To get you started you might want to check out issues concerning [documentation](https://github.com/librariesio/documentation/issues/), [user experience](https://github.com/librariesio/libraries.io/labels/ux), [visual design](https://github.com/librariesio/libraries.io/issues/labels/visual%20design) or perhaps something already [awaiting help](https://github.com/librariesio/libraries.io/labels/help%20wanted). You may find the following useful:
|
107
|
+
|
108
|
+
* Our [strategy](/strategy.md) which outlines what our goals are, how we are going to achieve those goals and what we are specifically going to avoid.
|
109
|
+
* An [overview](/overview.md) of the components that make up the Libraries.io project and run the [https://libraries.io](https://libraries.io) site.
|
110
|
+
|
111
|
+
## How Can I Talk To Other Contributors?
|
112
|
+
|
113
|
+
### Chat
|
114
|
+
We use [Slack](http://slack.io) for chat. There's an open invitation available to anyone who wishes to join the conversation at [http://slack.libraries.io](http://slack.libraries.io).
|
115
|
+
|
116
|
+
We try to use the following channels accordingly:
|
117
|
+
|
118
|
+
* `#general` channel is used for general, water cooler-type conversation, contributor updates and issue discussion.
|
119
|
+
* `#events` is used to share and discuss events that may be of interest to or attended by members of the community
|
120
|
+
* `#activity` contains notifications from the various platforms that we use to keep the Libraries.io project turning. Including notifications from GitHub, Twitter and our servers.
|
121
|
+
|
122
|
+
Members are encouraged to openly discuss their work, their lives, share views and ask for help using chat. It should be considered a *safe space* in which there is *no such thing as a stupid question*. Conversely no one contributor should ever be expected to have read something said in a chat. If someone should know something then it should be written down as an issue and/or documented in an obvious place for others to find.
|
123
|
+
|
124
|
+
### Video
|
125
|
+
[Google Hangouts](http://hangouts.google.com) is our preferred tool for video chat. We operate an [open hangout](http://bit.ly/2kWtYak) for anyone to jump into at any time to discuss issues face to face.
|
126
|
+
|
127
|
+
### Regular updates
|
128
|
+
Contributors are encouraged to share what they're working on. We do this through daily or weekly updates in the `#general` channel on Slack. Updates should take the format 'currently working on X, expecting to move onto Y, blocked on Z' where x, y and z are issues in our [issue tracker](https://github.com/search?utf8=%E2%9C%93&q=is%3Aopen+is%3Aissue+org%3Alibrariesio).
|
129
|
+
|
130
|
+
Additionally we host an [open hangout](http://bit.ly/2kWtYak) for any contributor to join at *5pm BST/GMT on a Tuesday* to discuss their work, the next week's priorities and to ask questions of other contributors regarding any aspect of the project. Again this is considered a *safe space* in which *there is no such thing as a stupid question*.
|
131
|
+
|
132
|
+
### Mail
|
133
|
+
The [core team](https://github.com/orgs/librariesio/teams/core) operate a mailing list for project updates. If you'd like to subscribe you'll find a form in the footer on [Libraries.io](http://libraries.io).
|
134
|
+
|
135
|
+
### Twitter
|
136
|
+
We have an account on Twitter at [@librariesio](http://twitter.com/librariesio). This is predominately used to retweet news, events and musings by contributors rather than as a direct method of communication. Contributors are encouraged to use @librariesio in a tweet when talking about the project, so that we may retweet if appropriate. The account is moderated and protected by the [core team](https://github.com/orgs/librariesio/teams/core).
|
137
|
+
|
138
|
+
### Facebook
|
139
|
+
We have a Facebook page at [@libraries.io](https://www.facebook.com/libraries.io). Again this is predominantly used to gather and reflect news, events and musings by contributors rather than as a direct method of communication. Contributors are encouraged to reference Libraries.io in a post when talking about the project, so that we may reflect this if appropriate. Again the account is moderated and protected by the [core team](https://github.com/orgs/librariesio/teams/core).
|
140
|
+
|
141
|
+
### Medium
|
142
|
+
We have a Medium account at [@librariesio](https://medium.com/@librariesio) and once again it is used to reflect news, events and musings by contributors rather than a direct method of communication. Contributors are encouraged to reference @librariesio in a post when talking about the project, so that we may recommend it if appropriate. Again the account is moderated and protected by the [core team](https://github.com/orgs/librariesio/teams/core).
|
143
|
+
|
144
|
+
## Who Are Libraries.io's Users?
|
145
|
+
Libraries.io focusses on the following personas:
|
146
|
+
|
147
|
+
### Google
|
148
|
+
_Is hungry for linked data so she can serve you up search traffic_
|
149
|
+
|
150
|
+
### 'Searcher'
|
151
|
+
_Is a developer with a problem, she is looking for something to help solve it._
|
152
|
+
|
153
|
+
### 'Extender'
|
154
|
+
_Has her own ideas. She wants access to the raw data so that she can mash up her own service and offer it to the world._
|
155
|
+
|
156
|
+
## Workflow
|
157
|
+
In general we use [GitHub](https://help.github.com/) and [Git](https://git-scm.com/docs/gittutorial) to support our workflow. If you are unfamiliar with those tools then you should check them out until you feel you have a basic understanding of GitHub and a working understanding of Git. Specifically you should understand how forking, branching, committing, PRing and merging works.
|
158
|
+
|
159
|
+
#### Forking
|
160
|
+
We prefer that contributors fork the project in order to contribute.
|
161
|
+
|
162
|
+
#### Branching
|
163
|
+
We *try* to use principles of [GitHub-flow](https://lucamezzalira.com/2014/03/10/git-flow-vs-github-flow/) in our branching model. That is the `master` branch will always be deployable to the live site, and that every branch from that will be used to add a feature, fix a bug, improve something or otherwise represent an atomic unit of work.
|
164
|
+
|
165
|
+
#### Ticketing
|
166
|
+
We *try* to create an issue for everything. That is any bug, feature or enhancement that is worth an open, focussed and documented discussion.
|
167
|
+
|
168
|
+
#### Labelling
|
169
|
+
We constrain labels as they are a key part of our workflow. Tickets will be labeled according to our [labelling policy](/labelling.md).
|
170
|
+
|
171
|
+
#### Templates
|
172
|
+
We use templates to guide contributors toward good practice in [filing bugs, requesting enhancements and features](/issue_template.md) and in [issuing pull-requests](/pull_request_template.md).
|
173
|
+
|
174
|
+
#### Commenting
|
175
|
+
If it is possible to comment your contribution — for instance if you are contributing code — then do so in a way that is simple, clear, concise and lowers the level of understanding necessary for others to comprehend what comes afterward. If you are contributing code it is very likely it will be rejected if it does not contain sufficient comments.
|
176
|
+
|
177
|
+
#### Committing
|
178
|
+
When committing to a branch be sure to use plain, simple language that describes the incremental changes made on the branch toward the overall goal. Avoid unnecessary complexity. Simplify whenever possible. Assume a reasonable but not comprehensive knowledge of the tools, techniques and context of your work.
|
179
|
+
|
180
|
+
#### Testing
|
181
|
+
When adding or fixing functionality, tests should be added to help reduce future regressions and breakage. All tests are ran automatically when new commits are pushed to a branch. Pull requests with broken/missing tests are not likely to be merged.
|
182
|
+
|
183
|
+
#### Submitting for Review
|
184
|
+
Once a piece of work (in a branch) is complete it should be readied for review. This is your last chance to ensure that your contribution is [properly tested](#testing). If you are contributing code it is likely your contribution will be rejected if it would lower the test-coverage. Once this is done you can submit a pull-request following the [template](/pull_request_template.md).
|
185
|
+
|
186
|
+
It is likely that your contributions will need to be checked by at least one member of the [core team](https://github.com/orgs/librariesio/teams/core) prior to merging. It is also incredibly likely that your contribution may need some re-work in order to be accepted. Particularly if it lacks an appropriate level of comments, tests or it is difficult to understand your commits. Please do not take offense if this is the case. We understand that contributors give their time because they want to improve the project but please understand it is another's responsibility to ensure that the project is maintainable, and good practices like these are key to ensuring that is possible.
|
187
|
+
|
188
|
+
#### Reviewing a PR
|
189
|
+
We appreciate that it may be difficult to offer constructive criticism, but it is a necessary part of ensuring the project is maintainable and successful. If it is difficult to understand something, request it is better documented and/or commented. If you do not feel assured of the robustness of a contribution, request it is better tested. If it is unclear what the goal of the piece of work is and how it relates to the [strategy](/strategy.md), request a clarification in the corresponding issue. If a pull-request has no corresponding issue, decreases test coverage or otherwise decreases the quality of the project. Reject it. Otherwise, merge it.
|
190
|
+
|
191
|
+
#### Merging
|
192
|
+
As we keep the `master` branch in a permanent state of 'deployment ready' once-merged your contribution will be live on the next deployment.
|
193
|
+
|
194
|
+
#### Deploying
|
195
|
+
Any member of the [deployers](https://github.com/orgs/librariesio/teams/deployers) team are able to redeploy the site. If you require a deployment then you might find one of them in our `#general` [chat channel on Slack](slack.libraries.io).
|
@@ -0,0 +1,18 @@
|
|
1
|
+
Thanks for taking the time to raise an issue. This template should guide you through the process of submitting a bug, enhancement or feature request. Please erase any part of this template that is not relevant to your issue.
|
2
|
+
|
3
|
+
## Bugs
|
4
|
+
Before submitting a bug report:
|
5
|
+
|
6
|
+
- [ ] Double-check that the bug is persistent,
|
7
|
+
- [ ] Double-check the bug hasn't already been reported [on our issue tracker](https://github.com/issues?utf8=%E2%9C%93&q=is%3Aopen+is%3Aissue+org%3Alibrariesio), they *should* be labelled `bug` or `bugsnag`.
|
8
|
+
|
9
|
+
If you have completed those steps then please replace this section with a description of the steps taken to recreate the bug, the expected behavior and the observed behavior.
|
10
|
+
|
11
|
+
## Enhancements and Features
|
12
|
+
|
13
|
+
Before submitting an enhancement or feature request:
|
14
|
+
|
15
|
+
- [ ] Check that the enhancement is not already [in our issue tracker](https://github.com/issues?utf8=%E2%9C%93&q=is%3Aopen+is%3Aissue+org%3Alibrariesio), they should be labelled 'enhancement'.,
|
16
|
+
- [ ] For large feature requests, check that your request aligns with our strategy http://docs.libraries.io/strategy.
|
17
|
+
|
18
|
+
If you have complete the above step then please replace this section with a description of your proposed enhancement or feature, the motivation for it, an approach and any alternative approaches considered, and whether you are willing and able to create a pull request for it. Note that we may close this issue if it's not something we're planning on working on.
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Thanks taking the time to contribute. This template should help guide you through the process of creating a pull request for review. Please erase any part of this template that is not relevant to your pull request:
|
2
|
+
|
3
|
+
|
4
|
+
- [ ] Have you followed the guidelines for [contributors](http://docs.libraries.io/contributorshandbook)?
|
5
|
+
- [ ] Have you checked to ensure there aren't other open pull requests on the repository for a similar change?
|
6
|
+
- [ ] Is there a corresponding ticket for your pull request?
|
7
|
+
- [ ] Have you written new tests for your changes?
|
8
|
+
- [ ] Have you successfully run the project with your changes locally?
|
9
|
+
|
10
|
+
If so then please replace this section with a link to the ticket(s) it addressed, an explanation of your change and why you think we should include it. Thanks again!
|
data/.github/SUPPORT.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# Libraries.io Support
|
2
|
+
|
3
|
+
If you're looking for support for Libraries.io there are a lot of options, check out:
|
4
|
+
|
5
|
+
* Documentation — https://docs.libraries.io
|
6
|
+
* Email — support@libraries.io
|
7
|
+
* Twitter — https://twitter.com/librariesio
|
8
|
+
* Chat — https://slack.libraries.io
|
9
|
+
|
10
|
+
On Discuss and in the Libraries.io Slack team, there are a bunch of helpful community members that should be willing to point you in the right direction.
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
|
4
|
-
before_install: gem install bundler -v 1.
|
3
|
+
- 2.3.3
|
4
|
+
before_install: gem install bundler -v 1.13.6
|
5
5
|
cache: bundler
|
6
6
|
sudo: false
|
7
|
+
notifications:
|
8
|
+
slack:
|
9
|
+
secure: lT8nj3FTS1JncJ3+lBrztipeeUCT02AWDT+yqNRrYFcHni4nKpxjSMVuT7VJvWzyiCHo5bqqoHMZLrcoA71Qoe6uaO4Gcpe6Go6Rtg2HAh+F2gpEkGCCqKSrhckbgj6gtrBncm4JsbUHoyu0n75LNUTf7+CUZE88mr0cqNkaKUeD6tPvocAt14YN+w3HhtHsnldjv+I8WW2Uai+u3JOlB2Pvje7i8GGQMgjftmbFzcAGZKryKX+VUPqt0OgzeBXop6N+9X3U5Gf0kPSu5JMlsBXlb/bt+z95bw3BAkUdiTXl/HK/qcgLE0nA6e2NZ0H7SyiVl1XrANh/Gy2LrkSv38yqCpnGnAP3mr20DuBK1cytCc+1bHzGwnXz96QWbv2SUGIcWDbW+NLXVDqwQTNYVdjKLErPL08D1DWjSMHMbq7bf8QuNhtoCDs/1Peh1Ju7um5oADesbr+z5Wf5dxiA6RXbUfYGYuKxN2pkbZimHW+Tn2EMEJ4FvQxnpNF6d+l4VlTkhzUEr0b2GZ4hKTrfCMfRJjN2vjuLQjVv48V3FIMRBuYgoT6X9x3E/1oIfTvkZAXhCWPe8RbOKY7DWW1IugCaN2mUqOSl16buYOMzSl60B/iqv8TBnjXYzLeskrAE3Zj5jY6E+DZRNhhOJXczbwyqxWC7QSDh6YHr7QcCrpE=
|
@@ -2,12 +2,9 @@ module SemanticRange
|
|
2
2
|
class Comparator
|
3
3
|
attr_reader :semver, :operator, :value
|
4
4
|
def initialize(comp, loose)
|
5
|
-
if comp.is_a?(Comparator)
|
6
|
-
return comp if comp.loose == loose
|
7
|
-
@comp = comp.value
|
8
|
-
end
|
9
|
-
|
5
|
+
comp = comp.value if comp.is_a?(Comparator)
|
10
6
|
@loose = loose
|
7
|
+
|
11
8
|
parse(comp)
|
12
9
|
|
13
10
|
@value = @semver == ANY ? '' : @operator + @semver.version
|
@@ -32,5 +29,39 @@ module SemanticRange
|
|
32
29
|
|
33
30
|
@semver = !m[2] ? ANY : Version.new(m[2], @loose)
|
34
31
|
end
|
32
|
+
|
33
|
+
def intersects(comp, loose = false, platform = nil)
|
34
|
+
comp = Comparator.new(comp, loose)
|
35
|
+
|
36
|
+
if @operator == ''
|
37
|
+
range_b = Range.new(comp.value, loose, platform)
|
38
|
+
SemanticRange.satisfies(@value, range_b, loose, platform)
|
39
|
+
elsif comp.operator == ''
|
40
|
+
range_a = Range.new(@value, loose, platform)
|
41
|
+
SemanticRange.satisfies(comp.semver, range_a, loose, platform)
|
42
|
+
else
|
43
|
+
same_direction_increasing = (@operator == '>=' || @operator == '>') && (comp.operator == '>=' || comp.operator == '>')
|
44
|
+
same_direction_decreasing = (@operator == '<=' || @operator == '<') && (comp.operator == '<=' || comp.operator == '<')
|
45
|
+
same_version = @semver.raw == comp.semver.raw
|
46
|
+
different_directions_inclusive = (@operator == '>=' || @operator == '<=') && (comp.operator == '>=' || comp.operator == '<=')
|
47
|
+
opposite_directions_lte = SemanticRange.cmp(@semver, '<', comp.semver, loose) &&
|
48
|
+
((@operator == '>=' || @operator == '>') && (comp.operator == '<=' || comp.operator == '<'))
|
49
|
+
opposite_directions_gte = SemanticRange.cmp(@semver, '>', comp.semver, loose) &&
|
50
|
+
((@operator == '<=' || @operator == '<') && (comp.operator == '>=' || comp.operator == '>'))
|
51
|
+
|
52
|
+
same_direction_increasing || same_direction_decreasing || (same_version && different_directions_inclusive) ||
|
53
|
+
opposite_directions_lte || opposite_directions_gte
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def satisfies_range(range, loose = false, platform = nil)
|
58
|
+
range = Range.new(range, loose, platform)
|
59
|
+
|
60
|
+
range.set.any? do |comparators|
|
61
|
+
comparators.all? do |comparator|
|
62
|
+
intersects(comparator, loose, platform)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
35
66
|
end
|
36
67
|
end
|
data/lib/semantic_range/range.rb
CHANGED
@@ -279,5 +279,15 @@ module SemanticRange
|
|
279
279
|
|
280
280
|
"#{from} #{to}".strip
|
281
281
|
end
|
282
|
+
|
283
|
+
def intersects(range, loose = false, platform = nil)
|
284
|
+
range = Range.new(range, loose, platform)
|
285
|
+
|
286
|
+
@set.any? do |comparators|
|
287
|
+
comparators.all? do |comparator|
|
288
|
+
comparator.satisfies_range(range, loose, platform)
|
289
|
+
end
|
290
|
+
end
|
291
|
+
end
|
282
292
|
end
|
283
293
|
end
|
data/semantic_range.gemspec
CHANGED
@@ -19,6 +19,6 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.11"
|
22
|
-
spec.add_development_dependency "rake", "~>
|
22
|
+
spec.add_development_dependency "rake", "~> 12.0"
|
23
23
|
spec.add_development_dependency "rspec", "~> 3.4"
|
24
24
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: semantic_range
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Nesbitt
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-09-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '12.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '12.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,11 +59,14 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
+
- ".github/CONTRIBUTING.md"
|
63
|
+
- ".github/ISSUE_TEMPLATE.md"
|
64
|
+
- ".github/PULL_REQUEST_TEMPLATE.md"
|
65
|
+
- ".github/SUPPORT.md"
|
62
66
|
- ".gitignore"
|
63
67
|
- ".rspec"
|
64
68
|
- ".travis.yml"
|
65
69
|
- CODE_OF_CONDUCT.md
|
66
|
-
- CONTRIBUTING.md
|
67
70
|
- Gemfile
|
68
71
|
- Guardfile
|
69
72
|
- LICENSE.txt
|
@@ -97,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
100
|
version: '0'
|
98
101
|
requirements: []
|
99
102
|
rubyforge_project:
|
100
|
-
rubygems_version: 2.6.
|
103
|
+
rubygems_version: 2.6.13
|
101
104
|
signing_key:
|
102
105
|
specification_version: 4
|
103
106
|
summary: node-semver rewritten in ruby, for comparison and inclusion of semantic versions
|
data/CONTRIBUTING.md
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
# Contributing
|
2
|
-
|
3
|
-
* Fork the project.
|
4
|
-
* Make your feature addition or bug fix.
|
5
|
-
* Add tests for it. This is important so I don't break it in a future version unintentionally.
|
6
|
-
* Send a pull request. Bonus points for topic branches.
|
7
|
-
|
8
|
-
## Code of Conduct
|
9
|
-
|
10
|
-
Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
|