ecosystems-bibliothecary 14.2.0 → 15.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 (72) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +48 -0
  3. data/README.md +9 -24
  4. data/bibliothecary.gemspec +5 -9
  5. data/lib/bibliothecary/analyser/analysis.rb +10 -5
  6. data/lib/bibliothecary/analyser/matchers.rb +7 -5
  7. data/lib/bibliothecary/analyser.rb +0 -30
  8. data/lib/bibliothecary/cli.rb +35 -26
  9. data/lib/bibliothecary/configuration.rb +1 -6
  10. data/lib/bibliothecary/dependency.rb +1 -4
  11. data/lib/bibliothecary/file_info.rb +7 -0
  12. data/lib/bibliothecary/parsers/bentoml.rb +0 -2
  13. data/lib/bibliothecary/parsers/bower.rb +0 -1
  14. data/lib/bibliothecary/parsers/cargo.rb +12 -10
  15. data/lib/bibliothecary/parsers/carthage.rb +51 -15
  16. data/lib/bibliothecary/parsers/clojars.rb +14 -18
  17. data/lib/bibliothecary/parsers/cocoapods.rb +100 -19
  18. data/lib/bibliothecary/parsers/cog.rb +0 -2
  19. data/lib/bibliothecary/parsers/conan.rb +156 -0
  20. data/lib/bibliothecary/parsers/conda.rb +0 -3
  21. data/lib/bibliothecary/parsers/cpan.rb +0 -2
  22. data/lib/bibliothecary/parsers/cran.rb +40 -19
  23. data/lib/bibliothecary/parsers/docker.rb +0 -2
  24. data/lib/bibliothecary/parsers/dub.rb +33 -8
  25. data/lib/bibliothecary/parsers/dvc.rb +0 -2
  26. data/lib/bibliothecary/parsers/elm.rb +13 -3
  27. data/lib/bibliothecary/parsers/go.rb +14 -5
  28. data/lib/bibliothecary/parsers/hackage.rb +132 -24
  29. data/lib/bibliothecary/parsers/haxelib.rb +14 -4
  30. data/lib/bibliothecary/parsers/hex.rb +37 -20
  31. data/lib/bibliothecary/parsers/homebrew.rb +0 -2
  32. data/lib/bibliothecary/parsers/julia.rb +0 -2
  33. data/lib/bibliothecary/parsers/maven.rb +35 -25
  34. data/lib/bibliothecary/parsers/meteor.rb +14 -4
  35. data/lib/bibliothecary/parsers/mlflow.rb +0 -2
  36. data/lib/bibliothecary/parsers/npm.rb +47 -59
  37. data/lib/bibliothecary/parsers/nuget.rb +23 -22
  38. data/lib/bibliothecary/parsers/ollama.rb +0 -2
  39. data/lib/bibliothecary/parsers/packagist.rb +0 -3
  40. data/lib/bibliothecary/parsers/pub.rb +0 -2
  41. data/lib/bibliothecary/parsers/pypi.rb +54 -35
  42. data/lib/bibliothecary/parsers/rubygems.rb +92 -27
  43. data/lib/bibliothecary/parsers/shard.rb +0 -1
  44. data/lib/bibliothecary/parsers/swift_pm.rb +77 -29
  45. data/lib/bibliothecary/parsers/vcpkg.rb +68 -17
  46. data/lib/bibliothecary/runner.rb +169 -22
  47. data/lib/bibliothecary/version.rb +1 -1
  48. data/lib/bibliothecary.rb +3 -10
  49. data/lib/dockerfile_parser.rb +1 -1
  50. data/lib/modelfile_parser.rb +8 -8
  51. metadata +2 -108
  52. data/.codeclimate.yml +0 -25
  53. data/.github/CONTRIBUTING.md +0 -195
  54. data/.github/workflows/ci.yml +0 -25
  55. data/.gitignore +0 -10
  56. data/.rspec +0 -2
  57. data/.rubocop.yml +0 -69
  58. data/.ruby-version +0 -1
  59. data/.tidelift +0 -1
  60. data/CODE_OF_CONDUCT.md +0 -74
  61. data/Gemfile +0 -34
  62. data/Rakefile +0 -18
  63. data/bin/console +0 -15
  64. data/bin/setup +0 -8
  65. data/lib/bibliothecary/multi_parsers/bundler_like_manifest.rb +0 -26
  66. data/lib/bibliothecary/multi_parsers/cyclonedx.rb +0 -170
  67. data/lib/bibliothecary/multi_parsers/dependencies_csv.rb +0 -155
  68. data/lib/bibliothecary/multi_parsers/json_runtime.rb +0 -22
  69. data/lib/bibliothecary/multi_parsers/spdx.rb +0 -149
  70. data/lib/bibliothecary/purl_util.rb +0 -37
  71. data/lib/bibliothecary/runner/multi_manifest_filter.rb +0 -92
  72. data/lib/sdl_parser.rb +0 -30
@@ -1,195 +0,0 @@
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).
@@ -1,25 +0,0 @@
1
- name: Bibliothecary CI
2
-
3
- on:
4
- push:
5
- branches: [ main ]
6
- pull_request:
7
- branches: [ main ]
8
-
9
- jobs:
10
- build:
11
- runs-on: ubuntu-latest
12
-
13
- steps:
14
- - uses: actions/checkout@v4
15
-
16
- - name: Set up Ruby
17
- uses: ruby/setup-ruby@v1
18
- with:
19
- ruby-version: 4.0.0
20
-
21
- - name: Install dependencies
22
- run: bundle install
23
-
24
- - name: Run tests
25
- run: bundle exec rake
data/.gitignore DELETED
@@ -1,10 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- *.gem
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --format documentation
2
- --color
data/.rubocop.yml DELETED
@@ -1,69 +0,0 @@
1
- ---
2
-
3
- # Without this, CI might pickup nested dep's rubocop files in vendor/
4
- inherit_mode:
5
- merge:
6
- - Exclude
7
-
8
- AllCops:
9
- NewCops: enable
10
- TargetRubyVersion: 4.0
11
- Exclude:
12
- - spec/fixtures/**/*
13
- - vendor/bundle/**/* # This is actually needed for CI, not for biblio itself
14
-
15
-
16
- Metrics/BlockLength:
17
- Max: 100
18
- Exclude:
19
- - config/routes.rb
20
- - config/initializers/*
21
- - spec/**/*_spec.rb
22
- - spec/factories.rb
23
- - lib/tasks/*.rake
24
-
25
- # metrics and documentation. code is complex as it needs to be,
26
- # and docs shouldn't be required. add them when needed.
27
- Metrics/AbcSize:
28
- Enabled: false
29
- Layout/LineLength:
30
- Enabled: false
31
- Metrics/ClassLength:
32
- Enabled: false
33
- Metrics/MethodLength:
34
- Enabled: false
35
- Metrics/ModuleLength:
36
- Enabled: false
37
- Metrics/CyclomaticComplexity:
38
- Enabled: false
39
- Metrics/PerceivedComplexity:
40
- Enabled: false
41
- Metrics/ParameterLists:
42
- Max: 7
43
- CountKeywordArgs: false
44
- Style/Documentation:
45
- Enabled: false
46
-
47
- # differences from standard ruby style guide.
48
- Style/RegexpLiteral:
49
- Enabled: false
50
- Style/StringLiterals:
51
- EnforcedStyle: double_quotes
52
- Style/TrailingCommaInArrayLiteral:
53
- EnforcedStyleForMultiline: comma
54
- Style/TrailingCommaInHashLiteral:
55
- EnforcedStyleForMultiline: comma
56
- Layout/FirstArrayElementIndentation:
57
- Enabled: false
58
- Layout/MultilineMethodCallIndentation:
59
- EnforcedStyle: indented
60
- Style/NumericPredicate:
61
- Enabled: false
62
- Style/FormatStringToken:
63
- Enabled: false
64
- Style/MultilineBlockChain:
65
- Enabled: false
66
- Style/IfUnlessModifier:
67
- Enabled: false
68
- Layout/BlockAlignment:
69
- EnforcedStyleAlignWith: start_of_block
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 4.0.0
data/.tidelift DELETED
@@ -1 +0,0 @@
1
- TIDELIFT_EXCLUDED_MANIFESTS=spec/fixtures
data/CODE_OF_CONDUCT.md DELETED
@@ -1,74 +0,0 @@
1
- # Contributor Covenant Code of Conduct
2
-
3
- ## Our Pledge
4
-
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- nationality, personal appearance, race, religion, or sexual identity and
10
- orientation.
11
-
12
- ## Our Standards
13
-
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
16
-
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
22
-
23
- Examples of unacceptable behavior by participants include:
24
-
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
28
- * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
31
- * Other conduct which could reasonably be considered inappropriate in a
32
- professional setting
33
-
34
- ## Our Responsibilities
35
-
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
39
-
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
45
-
46
- ## Scope
47
-
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
54
-
55
- ## Enforcement
56
-
57
- Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at andrew@libraries.io. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
63
-
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
67
-
68
- ## Attribution
69
-
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at [http://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: http://contributor-covenant.org
74
- [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile DELETED
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- # Temporarily pegging to HEAD until 0.2.1 is released: https://github.com/piotrmurach/strings-ansi/pull/2
6
- gem "strings-ansi", ref: "35d0c9430cf0a8022dc12bdab005bce296cb9f00", github: "piotrmurach/strings-ansi"
7
-
8
- # Ruby 3.4+ no longer includes these as default gems
9
- gem "base64"
10
- gem "bigdecimal"
11
- gem "csv"
12
- gem "logger"
13
- gem "ostruct"
14
-
15
- # Specify your gem's dependencies in bibliothecary.gemspec
16
- gemspec
17
-
18
- group :development do
19
- gem "pry"
20
- end
21
-
22
- group :development, :test do
23
- gem "rake", "~> 13.0"
24
- gem "rubocop", "~> 1.71"
25
- gem "rubocop-rails"
26
- gem "rubocop-rake" # This is needed by packageurl-ruby, until it reclassifies it as a dev dependency.
27
- end
28
-
29
- group :test do
30
- gem "rspec", "~> 3.0"
31
- gem "simplecov"
32
- gem "super_diff", "~> 0.18.0"
33
- gem "webmock"
34
- end
data/Rakefile DELETED
@@ -1,18 +0,0 @@
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
9
-
10
- desc "Run the linter"
11
- task :lint do
12
- sh "bundle exec rubocop -P"
13
- end
14
-
15
- desc "Run the linter with autofix"
16
- task :fix do
17
- sh "bundle exec rubocop -A"
18
- end
data/bin/console DELETED
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require "bundler/setup"
5
- require "bibliothecary"
6
-
7
- # You can add fixtures and/or initialization code here to make experimenting
8
- # with your gem easier. You can also use a different console, if you like.
9
-
10
- # (If you use this, don't forget to add pry to your Gemfile!)
11
- # require "pry"
12
- # Pry.start
13
-
14
- require "pry"
15
- Pry.start
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Bibliothecary
4
- module MultiParsers
5
- module BundlerLikeManifest
6
- # this takes parsed Bundler and Bundler-like (CocoaPods)
7
- # manifests and turns them into a list of dependencies.
8
- def parse_ruby_manifest(manifest, platform, source = nil)
9
- manifest.dependencies.inject([]) do |deps, dep|
10
- deps.push(Dependency.new(
11
- platform: platform,
12
- name: dep.name,
13
- requirement: dep
14
- .requirement
15
- .requirements
16
- .sort_by(&:last)
17
- .map { |op, version| "#{op} #{version}" }
18
- .join(", "),
19
- type: dep.type.to_s,
20
- source: source
21
- ))
22
- end.uniq
23
- end
24
- end
25
- end
26
- end
@@ -1,170 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "json"
4
- require "ox"
5
-
6
- # packageurl-ruby uses pattern-matching (https://docs.ruby-lang.org/en/2.7.0/NEWS.html#label-Pattern+matching)
7
- # which warns a whole bunch in Ruby 2.7 as being an experimental feature, but has
8
- # been accepted in Ruby 3.0 (https://rubyreferences.github.io/rubychanges/3.0.html#pattern-matching).
9
- Warning[:experimental] = false
10
- require "package_url"
11
- Warning[:experimental] = true
12
-
13
- module Bibliothecary
14
- module MultiParsers
15
- module CycloneDX
16
- include Bibliothecary::Analyser
17
- include Bibliothecary::Analyser::TryCache
18
-
19
- NoComponents = Class.new(StandardError)
20
-
21
- class ManifestEntries
22
- # If a purl type (key) exists, it will be used in a manifest for
23
- # the key's value. If not, it's ignored.
24
- #
25
- # https://github.com/package-url/purl-spec/blob/master/PURL-TYPES.rst
26
- PURL_TYPE_MAPPING = {
27
- "brew" => :homebrew,
28
- "cargo" => :cargo,
29
- "carthage" => :carthage,
30
- "clojars" => :clojars,
31
- "cocoapods" => :cocoapods,
32
- "composer" => :packagist,
33
- "conda" => :conda,
34
- "cpan" => :cpan,
35
- "cran" => :cran,
36
- "docker" => :docker,
37
- "dub" => :dub,
38
- "elm" => :elm,
39
- "gem" => :rubygems,
40
- "golang" => :go,
41
- "hackage" => :hackage,
42
- "haxe" => :haxelib,
43
- "hex" => :hex,
44
- "julia" => :julia,
45
- "maven" => :maven,
46
- "meteor" => :meteor,
47
- "npm" => :npm,
48
- "nuget" => :nuget,
49
- "pub" => :pub,
50
- "pypi" => :pypi,
51
- "swift" => :swift_pm,
52
- }
53
-
54
- attr_reader :manifests
55
-
56
- def initialize(parse_queue:)
57
- @manifests = {}
58
-
59
- # Instead of recursing, we'll work through a queue of components
60
- # to process, letting the different parser add components to the
61
- # queue however they need to pull them from the source document.
62
- @parse_queue = parse_queue.dup
63
- end
64
-
65
- def add(purl, source = nil)
66
- mapping = PurlUtil::PURL_TYPE_MAPPING[purl.type]
67
- return unless mapping
68
-
69
- @manifests[mapping] ||= Set.new
70
- @manifests[mapping] << Dependency.new(
71
- name: PurlUtil.full_name(purl),
72
- requirement: purl.version,
73
- platform: mapping.to_s,
74
- type: "lockfile",
75
- source: source
76
- )
77
- end
78
-
79
- # Iterates over each manifest entry in the parse_queue, and accepts a block which will
80
- # be called on each component. The block has two jobs: 1) add more sub-components
81
- # to parse (if they exist), and 2) return the components purl.
82
- def parse!(source = nil, &block)
83
- until @parse_queue.empty?
84
- component = @parse_queue.shift
85
-
86
- purl_text = block.call(component, @parse_queue)
87
-
88
- next unless purl_text
89
-
90
- purl = PackageURL.parse(purl_text)
91
-
92
- add(purl, source)
93
- end
94
- end
95
-
96
- def [](key)
97
- @manifests[key]&.to_a
98
- end
99
- end
100
-
101
- def self.mapping
102
- {
103
- match_filename("cyclonedx.json") => {
104
- kind: "lockfile",
105
- parser: :parse_cyclonedx_json,
106
- ungroupable: true,
107
- },
108
- match_extension("cdx.json") => {
109
- kind: "lockfile",
110
- parser: :parse_cyclonedx_json,
111
- ungroupable: true,
112
- },
113
- match_filename("cyclonedx.xml") => {
114
- kind: "lockfile",
115
- parser: :parse_cyclonedx_xml,
116
- ungroupable: true,
117
- },
118
- match_extension(".cdx.xml") => {
119
- kind: "lockfile",
120
- parser: :parse_cyclonedx_xml,
121
- ungroupable: true,
122
- },
123
- }
124
- end
125
-
126
- def parse_cyclonedx_json(file_contents, options: {})
127
- manifest = try_cache(options, options[:filename]) do
128
- JSON.parse(file_contents)
129
- end
130
-
131
- raise NoComponents unless manifest["components"]
132
-
133
- entries = ManifestEntries.new(parse_queue: manifest["components"])
134
-
135
- entries.parse!(options.fetch(:filename, nil)) do |component, parse_queue|
136
- parse_queue.concat(component["components"]) if component["components"]
137
-
138
- component["purl"]
139
- end
140
-
141
- ParserResult.new(dependencies: entries[platform_name.to_sym] || [])
142
- end
143
-
144
- def parse_cyclonedx_xml(file_contents, options: {})
145
- manifest = try_cache(options, options[:filename]) do
146
- Ox.parse(file_contents)
147
- end
148
-
149
- root = manifest
150
- if root.respond_to?(:bom)
151
- root = root.bom
152
- end
153
-
154
- raise NoComponents unless root.locate("components").first
155
-
156
- entries = ManifestEntries.new(parse_queue: root.locate("components/*"))
157
-
158
- entries.parse!(options.fetch(:filename, nil)) do |component, parse_queue|
159
- # #locate returns an empty array if nothing is found, so we can
160
- # always safely concatenate it to the parse queue.
161
- parse_queue.concat(component.locate("components/*"))
162
-
163
- component.locate("purl").first&.text
164
- end
165
-
166
- ParserResult.new(dependencies: entries[platform_name.to_sym] || [])
167
- end
168
- end
169
- end
170
- end