spek 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d5214993257d1db2b6adcc1238f866d3c2503f81b502c5908a86c8af78b2e93f
4
+ data.tar.gz: ddbf2e1821ceee2b6a7bef915a29a48bd67916d490992d1e3afa4f8ea0283444
5
+ SHA512:
6
+ metadata.gz: b643c307138dd8dfccc0eee6dc3abe7c6493d54ad498af4a8f3191e0392d7ff40cc14328467117bf437a1cdd29557a23662698a5dd0c81aca0ef772080f56fea
7
+ data.tar.gz: ea203a4a31132c75c8d10478ef63f5968753274e1b01e5f0ca083877d2ff7bbfd978f3507e04522899e62f956a05e6acbde9c78ea8b04a5f9d9309271ccccf39
checksums.yaml.gz.sig ADDED
@@ -0,0 +1 @@
1
+ %�Q��������GJr�\ -�l�֍���V�j�u��k��������51�K��v��y���Z�,7(�moz����"�P���2���*q�S���Ԑ�a��'jg�-(tp�s/��
data/LICENSE.adoc ADDED
@@ -0,0 +1,214 @@
1
+ = HIPPOCRATIC LICENSE
2
+
3
+ *Version 3.0, October 2021*
4
+
5
+ https://firstdonoharm.dev
6
+
7
+ *TERMS AND CONDITIONS*
8
+
9
+ TERMS AND CONDITIONS FOR USE, COPY, MODIFICATION, PREPARATION OF DERIVATIVE WORK, REPRODUCTION, AND DISTRIBUTION:
10
+
11
+ == 1. DEFINITIONS
12
+
13
+ _This section defines certain terms used throughout this license agreement._
14
+
15
+ 1.1. "License" means the terms and conditions, as stated herein, for use, copy, modification, preparation of derivative work, reproduction, and distribution of Software (as defined below).
16
+
17
+ 1.2. "Licensor" means the copyright and/or patent owner or entity authorized by the copyright and/or patent owner that is granting the License.
18
+
19
+ 1.3. "Licensee" means the individual or entity exercising permissions granted by this License, including the use, copy, modification, preparation of derivative work, reproduction, and distribution of Software (as defined below).
20
+
21
+ 1.4. "Software" means any copyrighted work, including but not limited to software code, authored by Licensor and made available under this License.
22
+
23
+ 1.5. "Supply Chain" means the sequence of processes involved in the production and/or distribution of a commodity, good, or service offered by the Licensee.
24
+
25
+ 1.6. "Supply Chain Impacted Party" or "Supply Chain Impacted Parties" means any person(s) directly impacted by any of Licensee’s Supply Chain, including the practices of all persons or entities within the Supply Chain prior to a good or service reaching the Licensee.
26
+
27
+ 1.7. "Duty of Care" is defined by its use in tort law, delict law, and/or similar bodies of law closely related to tort and/or delict law, including without limitation, a requirement to act with the watchfulness, attention, caution, and prudence that a reasonable person in the same or similar circumstances would use towards any Supply Chain Impacted Party.
28
+
29
+ 1.8. "Worker" is defined to include any and all permanent, temporary, and agency workers, as well as piece-rate, salaried, hourly paid, legal young (minors), part-time, night, and migrant workers.
30
+
31
+ == 2. INTELLECTUAL PROPERTY GRANTS
32
+
33
+ _This section identifies intellectual property rights granted to a Licensee_.
34
+
35
+ 2.1. _Grant of Copyright License_: Subject to the terms and conditions of this License, Licensor hereby grants to Licensee a worldwide, non-exclusive, no-charge, royalty-free copyright license to use, copy, modify, prepare derivative work, reproduce, or distribute the Software, Licensor authored modified software, or other work derived from the Software.
36
+
37
+ 2.2 _Grant of Patent License_: Subject to the terms and conditions of this License, Licensor hereby grants Licensee a worldwide, non-exclusive, no-charge, royalty-free patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer Software.
38
+
39
+ == 3. ETHICAL STANDARDS
40
+
41
+ _This section lists conditions the Licensee must comply with in order to have rights under this License._
42
+
43
+ The rights granted to the Licensee by this License are expressly made subject to the Licensee’s ongoing compliance with the following conditions:
44
+
45
+ 3.1. The Licensee SHALL NOT, whether directly or indirectly, through agents or assigns:
46
+
47
+ 3.1.1. Infringe upon any person’s right to life or security of person, engage in extrajudicial killings, or commit murder, without lawful cause +
48
+ (See Article 3, _United Nations Universal Declaration of Human Rights_; Article 6, _International Covenant on Civil and Political Rights_)
49
+
50
+ 3.1.2. Hold any person in slavery, servitude, or forced labor +
51
+ (See Article 4, _United Nations Universal Declaration of Human Rights_; Article 8, _International Covenant on Civil and Political Rights_);
52
+
53
+ 3.1.3. Contribute to the institution of slavery, slave trading, forced labor, or unlawful child labor +
54
+ (See Article 4, _United Nations Universal Declaration of Human Rights_; Article 8, _International Covenant on Civil and Political Rights_);
55
+
56
+ 3.1.4. Torture or subject any person to cruel, inhumane, or degrading treatment or punishment +
57
+ (See Article 5, _United Nations Universal Declaration of Human Rights_; Article 7, _International Covenant on Civil and Political Rights_);
58
+
59
+ 3.1.5. Discriminate on the basis of sex, gender, sexual orientation, race, ethnicity, nationality, religion, caste, age, medical disability or impairment, and/or any other like circumstances +
60
+ (See Article 7, _United Nations Universal Declaration of Human Rights_; Article 2, _International Covenant on Economic, Social and Cultural Rights_; Article 26, _International Covenant on Civil and Political Rights_);
61
+
62
+ 3.1.6. Prevent any person from exercising his/her/their right to seek an effective remedy by a competent court or national tribunal (including domestic judicial systems, international courts, arbitration bodies, and other adjudicating bodies) for actions violating the fundamental rights granted to him/her/them by applicable constitutions, applicable laws, or by this License +
63
+ (See Article 8, _United Nations Universal Declaration of Human Rights_; Articles 9 and 14, _International Covenant on Civil and Political Rights_);
64
+
65
+ 3.1.7. Subject any person to arbitrary arrest, detention, or exile +
66
+ (See Article 9, _United Nations Universal Declaration of Human Rights_; Article 9, _International Covenant on Civil and Political Rights_);
67
+
68
+ 3.1.8. Subject any person to arbitrary interference with a person’s privacy, family, home, or correspondence without the express written consent of the person +
69
+ (See Article 12, _United Nations Universal Declaration of Human Rights_; Article 17, _International Covenant on Civil and Political Rights_);
70
+
71
+ 3.1.9. Arbitrarily deprive any person of his/her/their property +
72
+ (See Article 17, _United Nations Universal Declaration of Human Rights_);
73
+
74
+ 3.1.10. Forcibly remove indigenous peoples from their lands or territories or take any action with the aim or effect of dispossessing indigenous peoples from their lands, territories, or resources, including without limitation the intellectual property or traditional knowledge of indigenous peoples, without the free, prior, and informed consent of indigenous peoples concerned +
75
+ (See Articles 8 and 10, _United Nations Declaration on the Rights of Indigenous Peoples_);
76
+
77
+ 3.1.11. Be an individual or entity, or a representative, agent, affiliate, successor, attorney, or assign of an individual or entity, on the FFI Solutions Carbon Underground 200 list;
78
+
79
+ 3.1.12. Commit ecocide:
80
+
81
+ 3.1.12.1 For the purpose of this section, "ecocide" means unlawful or wanton acts committed with knowledge that there is a substantial likelihood of severe and either widespread or long-term damage to the environment being caused by those acts;
82
+
83
+ 3.1.12.2 For the purpose of further defining ecocide and the terms contained in the previous paragraph:
84
+
85
+ 3.1.12.2.1. "Wanton" means with reckless disregard for damage which would be clearly excessive in relation to the social and economic benefits anticipated;
86
+
87
+ 3.1.12.2.2. "Severe" means damage which involves very serious adverse changes, disruption, or harm to any element of the environment, including grave impacts on human life or natural, cultural, or economic resources;
88
+
89
+ 3.1.12.2.3. "Widespread" means damage which extends beyond a limited geographic area, crosses state boundaries, or is suffered by an entire ecosystem or species or a large number of human beings;
90
+
91
+ 3.1.12.2.4. "Long-term" means damage which is irreversible or which cannot be redressed through natural recovery within a reasonable period of time; and
92
+
93
+ 3.1.12.2.5. "Environment" means the earth, its biosphere, cryosphere, lithosphere, hydrosphere, and atmosphere, as well as outer space
94
+
95
+ (See Section II, _Independent Expert Panel for the Legal Definition of Ecocide_, Stop Ecocide Foundation and the Promise Institute for Human Rights at UCLA School of Law, June 2021);
96
+
97
+ 3.1.13. Be an individual or entity, or a representative, agent, affiliate, successor, attorney, or assign of an individual or entity, that engages in fossil fuel or mineral exploration, extraction, development, or sale;
98
+
99
+ 3.1.14. Be an individual or entity, or a representative, agent, affiliate, successor, attorney, or assign of an individual or entity, identified by the Boycott, Divestment, Sanctions ("BDS") movement on its website (https://bdsmovement.net/ and https://bdsmovement.net/get-involved/what-to-boycott) as a target for boycott;
100
+
101
+ 3.1.15. Be an individual or entity that:
102
+
103
+ 3.1.15.1. engages in any commercial transactions with the Taliban; or
104
+
105
+ 3.1.15.2. is a representative, agent, affiliate, successor, attorney, or assign of the Taliban;
106
+
107
+ 3.1.16. Be an individual or entity that:
108
+
109
+ 3.1.16.1. engages in any commercial transactions with the Myanmar/Burmese military junta; or
110
+
111
+ 3.1.16.2. is a representative, agent, affiliate, successor, attorney, or assign of the Myanmar/Burmese government;
112
+
113
+ 3.1.17. Be an individual or entity, or a representative, agent, affiliate, successor, attorney, or assign of any individual or entity, that does business in, purchases goods from, or otherwise benefits from goods produced in the Xinjiang Uygur Autonomous Region of China;
114
+
115
+ 3.1.18. Be an individual or entity:
116
+
117
+ 3.1.18.1. which U.S. Customs and Border Protection (CBP) has currently issued a Withhold Release Order (WRO) or finding against based on reasonable suspicion of forced labor; or
118
+
119
+ 3.1.18.2. that is a representative, agent, affiliate, successor, attorney, or assign of an individual or entity that does business with an individual or entity which currently has a WRO or finding from CBP issued against it based on reasonable suspicion of forced labor;
120
+
121
+ 3.1.19. Be a government agency or multinational corporation, or a representative, agent, affiliate, successor, attorney, or assign of a government or multinational corporation, which participates in mass surveillance programs;
122
+
123
+ 3.1.20. Be an entity or a representative, agent, affiliate, successor, attorney, or assign of an entity which conducts military activities;
124
+
125
+ 3.1.21. Be an individual or entity, or a or a representative, agent, affiliate, successor, attorney, or assign of an individual or entity, that provides good or services to, or otherwise enters into any commercial contracts with, any local, state, or federal law enforcement agency;
126
+
127
+ 3.1.22. Be an individual or entity, or a or a representative, agent, affiliate, successor, attorney, or assign of an individual or entity, that broadcasts messages promoting killing, torture, or other forms of extreme violence;
128
+
129
+ 3.1.23. Interfere with Workers’ free exercise of the right to organize and associate +
130
+ (See Article 20, United Nations Universal Declaration of Human Rights; C087 - Freedom of Association and Protection of the Right to Organise Convention, 1948 (No. 87), International Labour Organization; Article 8, International Covenant on Economic, Social and Cultural Rights); and
131
+
132
+ 3.1.24. Harm the environment in a manner inconsistent with local, state, national, or international law.
133
+
134
+ 3.2. The Licensee SHALL:
135
+
136
+ 3.2.1. Only use social auditing mechanisms that adhere to Worker-Driven Social Responsibility Network’s Statement of Principles (https://wsr-network.org/what-is-wsr/statement-of-principles/) over traditional social auditing mechanisms, to the extent the Licensee uses any social auditing mechanisms at all;
137
+
138
+ 3.2.2. Ensure that if the Licensee has a Board of Directors, 30% of Licensee’s board seats are held by Workers paid no more than 200% of the compensation of the lowest paid Worker of the Licensee;
139
+
140
+ 3.2.3. Provide clear, accessible supply chain data to the public in accordance with the following conditions:
141
+
142
+ 3.2.3.1. All data will be on Licensee’s website and/or, to the extent Licensee is a representative, agent, affiliate, successor, attorney, subsidiary, or assign, on Licensee’s principal’s or parent’s website or some other online platform accessible to the public via an internet search on a common internet search engine; and
143
+
144
+ 3.2.3.2. Data published will include, where applicable, manufacturers, top tier suppliers, subcontractors, cooperatives, component parts producers, and farms;
145
+
146
+ 3.2.4. Provide equal pay for equal work where the performance of such work requires equal skill, effort, and responsibility, and which are performed under similar working conditions, except where such payment is made pursuant to:
147
+
148
+ 3.2.4.1. A seniority system;
149
+
150
+ 3.2.4.2. A merit system;
151
+
152
+ 3.2.4.3. A system which measures earnings by quantity or quality of production; or
153
+
154
+ 3.2.4.4. A differential based on any other factor other than sex, gender, sexual orientation, race, ethnicity, nationality, religion, caste, age, medical disability or impairment, and/or any other like circumstances +
155
+ (See 29 U.S.C.A. § 206(d)(1); Article 23, _United Nations Universal Declaration of Human Rights_; Article 7, _International Covenant on Economic, Social and Cultural Rights_; Article 26, _International Covenant on Civil and Political Rights_); and
156
+
157
+ 3.2.5. Allow for reasonable limitation of working hours and periodic holidays with pay +
158
+ (See Article 24, _United Nations Universal Declaration of Human Rights_; Article 7, _International Covenant on Economic, Social and Cultural Rights_).
159
+
160
+ == 4. SUPPLY CHAIN IMPACTED PARTIES
161
+
162
+ _This section identifies additional individuals or entities that a Licensee could harm as a result of violating the Ethical Standards section, the condition that the Licensee must voluntarily accept a Duty of Care for those individuals or entities, and the right to a private right of action that those individuals or entities possess as a result of violations of the Ethical Standards section._
163
+
164
+ 4.1. In addition to the above Ethical Standards, Licensee voluntarily accepts a Duty of Care for Supply Chain Impacted Parties of this License, including individuals and communities impacted by violations of the Ethical Standards. The Duty of Care is breached when a provision within the Ethical Standards section is violated by a Licensee, one of its successors or assigns, or by an individual or entity that exists within the Supply Chain prior to a good or service reaching the Licensee.
165
+
166
+ 4.2. Breaches of the Duty of Care, as stated within this section, shall create a private right of action, allowing any Supply Chain Impacted Party harmed by the Licensee to take legal action against the Licensee in accordance with applicable negligence laws, whether they be in tort law, delict law, and/or similar bodies of law closely related to tort and/or delict law, regardless if Licensee is directly responsible for the harms suffered by a Supply Chain Impacted Party. Nothing in this section shall be interpreted to include acts committed by individuals outside of the scope of his/her/their employment.
167
+
168
+ == 5. NOTICE
169
+
170
+ _This section explains when a Licensee must notify others of the License._
171
+
172
+ 5.1. _Distribution of Notice_: Licensee must ensure that everyone who receives a copy of or uses any part of Software from Licensee, with or without changes, also receives the License and the copyright notice included with Software (and if included by the Licensor, patent, trademark, and attribution notice). Licensee must ensure that License is prominently displayed so that any individual or entity seeking to download, copy, use, or otherwise receive any part of Software from Licensee is notified of this License and its terms and conditions. Licensee must cause any modified versions of the Software to carry prominent notices stating that Licensee changed the Software.
173
+
174
+ 5.2. _Modified Software_: Licensee is free to create modifications of the Software and distribute only the modified portion created by Licensee, however, any derivative work stemming from the Software or its code must be distributed pursuant to this License, including this Notice provision.
175
+
176
+ 5.3. _Recipients as Licensees_: Any individual or entity that uses, copies, modifies, reproduces, distributes, or prepares derivative work based upon the Software, all or part of the Software’s code, or a derivative work developed by using the Software, including a portion of its code, is a Licensee as defined above and is subject to the terms and conditions of this License.
177
+
178
+ == 6. REPRESENTATIONS AND WARRANTIES
179
+
180
+ 6.1. _Disclaimer of Warranty_: TO THE FULL EXTENT ALLOWED BY LAW, THIS SOFTWARE COMES "AS IS," WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED, AND LICENSOR SHALL NOT BE LIABLE TO ANY PERSON OR ENTITY FOR ANY DAMAGES OR OTHER LIABILITY ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THIS LICENSE, UNDER ANY LEGAL CLAIM.
181
+
182
+ 6.2. _Limitation of Liability_: LICENSEE SHALL HOLD LICENSOR HARMLESS AGAINST ANY AND ALL CLAIMS, DEBTS, DUES, LIABILITIES, LIENS, CAUSES OF ACTION, DEMANDS, OBLIGATIONS, DISPUTES, DAMAGES, LOSSES, EXPENSES, ATTORNEYS’ FEES, COSTS, LIABILITIES, AND ALL OTHER CLAIMS OF EVERY KIND AND NATURE WHATSOEVER, WHETHER KNOWN OR UNKNOWN, ANTICIPATED OR UNANTICIPATED, FORESEEN OR UNFORESEEN, ACCRUED OR UNACCRUED, DISCLOSED OR UNDISCLOSED, ARISING OUT OF OR RELATING TO LICENSEE’S USE OF THE SOFTWARE. NOTHING IN THIS SECTION SHOULD BE INTERPRETED TO REQUIRE LICENSEE TO INDEMNIFY LICENSOR, NOR REQUIRE LICENSOR TO INDEMNIFY LICENSEE.
183
+
184
+ == 7. TERMINATION
185
+
186
+ 7.1. _Violations of Ethical Standards or Breaching Duty of Care_: If Licensee violates the Ethical Standards section or Licensee, or any other person or entity within the Supply Chain prior to a good or service reaching the Licensee, breaches its Duty of Care to Supply Chain Impacted Parties, Licensee must remedy the violation or harm caused by Licensee within 30 days of being notified of the violation or harm. If Licensee fails to remedy the violation or harm within 30 days, all rights in the Software granted to Licensee by License will be null and void as between Licensor and Licensee.
187
+
188
+ 7.2. _Failure of Notice_: If any person or entity notifies Licensee in writing that Licensee has not complied with the Notice section of this License, Licensee can keep this License by taking all practical steps to comply within 30 days after the notice of noncompliance. If Licensee does not do so, Licensee’s License (and all rights licensed hereunder) will end immediately.
189
+
190
+ 7.3. _Judicial Findings_: In the event Licensee is found by a civil, criminal, administrative, or other court of competent jurisdiction, or some other adjudicating body with legal authority, to have committed actions which are in violation of the Ethical Standards or Supply Chain Impacted Party sections of this License, all rights granted to Licensee by this License will terminate immediately.
191
+
192
+ 7.4. _Patent Litigation_: If Licensee institutes patent litigation against any entity (including a cross-claim or counterclaim in a suit) alleging that the Software, all or part of the Software’s code, or a derivative work developed using the Software, including a portion of its code, constitutes direct or contributory patent infringement, then any patent license, along with all other rights, granted to Licensee under this License will terminate as of the date such litigation is filed.
193
+
194
+ 7.5. _Additional Remedies_: Termination of the License by failing to remedy harms in no way prevents Licensor or Supply Chain Impacted Party from seeking appropriate remedies at law or in equity.
195
+
196
+ == 8. MISCELLANEOUS
197
+
198
+ 8.1. _Conditions_: Sections 3, 4.1, 5.1, 5.2, 7.1, 7.2, 7.3, and 7.4 are conditions of the rights granted to Licensee in the License.
199
+
200
+ 8.2. _Equitable Relief_: Licensor and any Supply Chain Impacted Party shall be entitled to equitable relief, including injunctive relief or specific performance of the terms hereof, in addition to any other remedy to which they are entitled at law or in equity.
201
+
202
+ 8.3. _Copyleft_: Modified software, source code, or other derivative work must be licensed, in its entirety, under the exact same conditions as this License.
203
+
204
+ 8.4. _Severability_: If any term or provision of this License is determined to be invalid, illegal, or unenforceable by a court of competent jurisdiction, any such determination of invalidity, illegality, or unenforceability shall not affect any other term or provision of this License or invalidate or render unenforceable such term or provision in any other jurisdiction. If the determination of invalidity, illegality, or unenforceability by a court of competent jurisdiction pertains to the terms or provisions contained in the Ethical Standards section of this License, all rights in the Software granted to Licensee shall be deemed null and void as between Licensor and Licensee.
205
+
206
+ 8.5. _Section Titles_: Section titles are solely written for organizational purposes and should not be used to interpret the language within each section.
207
+
208
+ 8.6. _Citations_: Citations are solely written to provide context for the source of the provisions in the Ethical Standards.
209
+
210
+ 8.7. _Section Summaries_: Some sections have a brief _italicized description_ which is provided for the sole purpose of briefly describing the section and should not be used to interpret the terms of the License.
211
+
212
+ 8.8. _Entire License_: This is the entire License between the Licensor and Licensee with respect to the claims released herein and that the consideration stated herein is the only consideration or compensation to be paid or exchanged between them for this License. This License cannot be modified or amended except in a writing signed by Licensor and Licensee.
213
+
214
+ 8.9. _Successors and Assigns_: This License shall be binding upon and inure to the benefit of the Licensor’s and Licensee’s respective heirs, successors, and assigns.
data/README.adoc ADDED
@@ -0,0 +1,155 @@
1
+ :toc: macro
2
+ :toclevels: 5
3
+ :figure-caption!:
4
+
5
+ = Spek
6
+
7
+ [link=https://www.alchemists.io/projects/code_quality]
8
+ image::https://img.shields.io/badge/code_style-alchemists-brightgreen.svg[Alchemists Style Guide]
9
+ [link=https://circleci.com/gh/bkuhlmann/spek]
10
+ image::https://circleci.com/gh/bkuhlmann/spek.svg?style=svg[Circle CI Status]
11
+
12
+ Spek is short for _specification_ and enhances Ruby gem
13
+ link:https://guides.rubygems.org/specification-reference[specifications] with additional information
14
+ and tooling. You can use this library as foundational support to build on top of with your own
15
+ enhancements.
16
+
17
+ toc::[]
18
+
19
+ == Features
20
+
21
+ * Supports finding gems by name.
22
+ * Supports loading gems by path to specification.
23
+ * Supports picking gems by name with optional version selection.
24
+ * Supports link:https://semver.org[semantic versions] via
25
+ link:https://www.alchemists.io/projects/versionaire[Versionaire].
26
+
27
+ == Requirements
28
+
29
+ . link:https://www.ruby-lang.org[Ruby].
30
+
31
+ == Setup
32
+
33
+ To set up the project, run:
34
+
35
+ [source,bash]
36
+ ----
37
+ bin/setup
38
+ ----
39
+
40
+ == Usage
41
+
42
+ This gem makes interacting with Ruby gems easier by providing foundational objects for which you can
43
+ built on top of. link:https://www.alchemists.io/projects/gemsmith[Gemsmith] is built on top of this
44
+ gem if you need working example.
45
+
46
+ === Presenter
47
+
48
+ This object wraps a `Gem::Specification` for presentation, provides semantic versioning, direct
49
+ access to metadata information, pathnames, and other enriched information. You can obtain an
50
+ instance via the following code:
51
+
52
+ [source,ruby]
53
+ ----
54
+ specification = Gem::Specification.new do |spec|
55
+ spec.name = "test"
56
+ spec.version = "0.0.0"
57
+ spec.authors = "Jill Smith"
58
+ spec.summary = "A test summary."
59
+ end
60
+
61
+ presenter = Spek::Presenter.new specification
62
+ ----
63
+
64
+ The presenter is a read-only object so you'll only have access to _getter_ methods which are mostly
65
+ documented link:https://guides.rubygems.org/specification-reference[here]. Please note that not all
66
+ methods map one-to-one so you'll want to look at the public API of this object for further details.
67
+
68
+ === Loader
69
+
70
+ When given a path to a gem specification file, the loader will load a gem specification for you.
71
+ Example:
72
+
73
+ [source,ruby]
74
+ ----
75
+ presenter = Spek::Loader.call "path/to/my/test.gemspec"
76
+ presenter.class # Spek::Presenter
77
+ ----
78
+
79
+ === Finder
80
+
81
+ The finder will find all gem specifications for a given name. Example:
82
+
83
+ [source,ruby]
84
+ ----
85
+ presenters = Spek::Finder.call "refinements"
86
+ presenters.map(&:class) # [Spek::Presenter]
87
+ ----
88
+
89
+ === Picker
90
+
91
+ When given a gem name, this will allow you pick from a list of gem versions if any. Otherwise, if
92
+ multiple versions don't exist, the first version found will be answered instead. Example:
93
+
94
+ [source,ruby]
95
+ ----
96
+ require "dry/monads"
97
+
98
+ include Dry::Monads[:result]
99
+
100
+ case Spek::Picker.call("refinements")
101
+ in Success(specification) then puts "You selected: #{specification.name}."
102
+ in Failure(error) then puts error
103
+ end
104
+ ----
105
+
106
+ The picker always answers a link:https://dry-rb.org/gems/dry-monads[monad] so you can quickly
107
+ pattern match for further action.
108
+
109
+ === Versioner
110
+
111
+ When given a version and path, the versioner will update the version of your gem specification.
112
+ Example:
113
+
114
+ [source,ruby]
115
+ ----
116
+ specification = Spek::Versioner.call "1.0.0", "path/to/my/test.gemspec"
117
+ specification.version # <struct Versionaire::Version major=1, minor=0, patch=0>
118
+ ----
119
+
120
+ This makes it easier to automate the updating of your gem specification version information.
121
+
122
+ == Development
123
+
124
+ You can also use the IRB console for direct access to all objects:
125
+
126
+ [source,bash]
127
+ ----
128
+ bin/console
129
+ ----
130
+
131
+ == Tests
132
+
133
+ To test, run:
134
+
135
+ [source,bash]
136
+ ----
137
+ bundle exec rake
138
+ ----
139
+
140
+ == link:https://www.alchemists.io/policies/license[License]
141
+
142
+ == link:https://www.alchemists.io/policies/security[Security]
143
+
144
+ == link:https://www.alchemists.io/policies/code_of_conduct[Code of Conduct]
145
+
146
+ == link:https://www.alchemists.io/policies/contributions[Contributions]
147
+
148
+ == link:https://www.alchemists.io/projects/spek/versions[Versions]
149
+
150
+ == link:https://www.alchemists.io/community[Community]
151
+
152
+ == Credits
153
+
154
+ * Built with link:https://www.alchemists.io/projects/gemsmith[Gemsmith].
155
+ * Engineered by link:https://www.alchemists.io/team/brooke_kuhlmann[Brooke Kuhlmann].
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spek
4
+ # Finds multiple versions of an installed gem (if any) and answers found specifications.
5
+ class Finder
6
+ def self.call(path, ...) = new(...).call path
7
+
8
+ def initialize client: ::Gem::Specification, presenter: Presenter
9
+ @client = client
10
+ @presenter = presenter
11
+ end
12
+
13
+ def call(name) = client.find_all_by_name(name).map { |record| presenter.new record }
14
+
15
+ private
16
+
17
+ attr_reader :client, :presenter
18
+ end
19
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Spek
4
+ # Loads a gem's specification.
5
+ class Loader
6
+ def self.call(path, ...) = new(...).call path
7
+
8
+ def initialize client: ::Gem::Specification, presenter: Presenter
9
+ @client = client
10
+ @presenter = presenter
11
+ end
12
+
13
+ def call(path) = client.load(path.to_s).then { |record| presenter.new record }
14
+
15
+ private
16
+
17
+ attr_reader :client, :presenter
18
+ end
19
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "dry/monads"
4
+
5
+ module Spek
6
+ # Picks a gem specification.
7
+ class Picker
8
+ include Dry::Monads[:result]
9
+
10
+ def self.call(name, ...) = new(...).call name
11
+
12
+ def initialize finder: Finder.new, kernel: Kernel
13
+ @finder = finder
14
+ @kernel = kernel
15
+ end
16
+
17
+ def call name
18
+ specifications = finder.call name
19
+
20
+ case specifications.size
21
+ when 1 then Success specifications.first
22
+ when 2.. then Success choose(specifications)
23
+ else Failure "Unknown gem or gem is not installed: #{name}."
24
+ end
25
+ end
26
+
27
+ def choose specifications
28
+ specifications.each.with_index 1 do |specification, index|
29
+ kernel.puts "#{index}. #{specification.named_version}"
30
+ end
31
+
32
+ kernel.puts "\nPlease enter gem selection:"
33
+ ARGV.clear
34
+ specifications[kernel.gets.chomp.to_i - 1]
35
+ end
36
+
37
+ private
38
+
39
+ attr_reader :finder, :kernel
40
+ end
41
+ end
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "forwardable"
4
+ require "refinements/arrays"
5
+ require "refinements/pathnames"
6
+ require "refinements/strings"
7
+ require "versionaire"
8
+
9
+ module Spek
10
+ # Enhances the default Ruby Gems specification.
11
+ class Presenter
12
+ extend Forwardable
13
+
14
+ using Refinements::Arrays
15
+ using Refinements::Strings
16
+ using Refinements::Pathnames
17
+ using Versionaire::Cast
18
+
19
+ delegate %i[
20
+ bindir
21
+ executables
22
+ extra_rdoc_files
23
+ files
24
+ license
25
+ metadata
26
+ name
27
+ platform
28
+ require_paths
29
+ required_ruby_version
30
+ runtime_dependencies
31
+ summary
32
+ ] => :record
33
+
34
+ def initialize record
35
+ @record = record
36
+ end
37
+
38
+ def allowed_push_key = metadata.fetch "allowed_push_key", "rubygems_api_key"
39
+
40
+ def allowed_push_host = metadata.fetch "allowed_push_host", ::Gem::DEFAULT_HOST
41
+
42
+ def authors = Array record.author
43
+
44
+ def certificate_chain = Array(record.cert_chain).map { |path| Pathname path.to_s }
45
+
46
+ def documentation_url = metadata.fetch "documentation_uri", ""
47
+
48
+ def emails = Array record.email
49
+
50
+ def funding_url = metadata.fetch "funding_uri", ""
51
+
52
+ def homepage_url = String record.homepage
53
+
54
+ def issues_url = metadata.fetch "bug_tracker_uri", ""
55
+
56
+ def label = metadata.fetch "label", "Undefined"
57
+
58
+ def labeled_summary(delimiter: " - ") = [label, summary].compress.join delimiter
59
+
60
+ def labeled_version = "#{label} #{version}"
61
+
62
+ def named_version = "#{name} #{version}"
63
+
64
+ def package_path = Pathname("tmp").join package_name
65
+
66
+ def package_name = "#{name}-#{version}.gem"
67
+
68
+ def rubygems_mfa? = metadata.fetch("rubygems_mfa_required", "false").to_bool
69
+
70
+ def signing_key = Pathname record.signing_key.to_s
71
+
72
+ def source_path = Pathname record.full_gem_path
73
+
74
+ def source_url = metadata.fetch "source_code_uri", ""
75
+
76
+ def version = Version record.version.to_s
77
+
78
+ def versions_url = metadata.fetch "changelog_uri", ""
79
+
80
+ private
81
+
82
+ attr_reader :record
83
+ end
84
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "refinements/pathnames"
4
+
5
+ module Spek
6
+ # Updates a gem specification's version.
7
+ class Versioner
8
+ using Refinements::Pathnames
9
+
10
+ def self.call(version, path, ...) = new(...).call version, path
11
+
12
+ def initialize loader: Loader.new
13
+ @loader = loader
14
+ end
15
+
16
+ def call version, path
17
+ Pathname(path).rewrite { |content| content.sub(/version.+\n/, %(version = "#{version}"\n)) }
18
+ loader.call path
19
+ end
20
+
21
+ private
22
+
23
+ attr_reader :loader
24
+ end
25
+ end
data/lib/spek.rb ADDED
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "zeitwerk"
4
+
5
+ Zeitwerk::Loader.for_gem.setup
6
+
7
+ # Main namespace.
8
+ module Spek
9
+ end
data/spek.gemspec ADDED
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ Gem::Specification.new do |spec|
4
+ spec.name = "spek"
5
+ spec.version = "0.0.0"
6
+ spec.authors = ["Brooke Kuhlmann"]
7
+ spec.email = ["brooke@alchemists.io"]
8
+ spec.homepage = "https://www.alchemists.io/projects/spek"
9
+ spec.summary = "Enhances gem specifications with additional information and tooling."
10
+ spec.license = "Hippocratic-3.0"
11
+
12
+ spec.metadata = {
13
+ "bug_tracker_uri" => "https://github.com/bkuhlmann/spek/issues",
14
+ "changelog_uri" => "https://www.alchemists.io/projects/spek/versions",
15
+ "documentation_uri" => "https://www.alchemists.io/projects/spek",
16
+ "label" => "Spek",
17
+ "rubygems_mfa_required" => "true",
18
+ "source_code_uri" => "https://github.com/bkuhlmann/spek"
19
+ }
20
+
21
+ spec.signing_key = Gem.default_key_path
22
+ spec.cert_chain = [Gem.default_cert_path]
23
+
24
+ spec.required_ruby_version = "~> 3.1"
25
+ spec.add_dependency "dry-monads", "~> 1.4"
26
+ spec.add_dependency "refinements", "~> 9.1"
27
+ spec.add_dependency "versionaire", "~> 10.1"
28
+ spec.add_dependency "zeitwerk", "~> 2.5"
29
+
30
+ spec.extra_rdoc_files = Dir["README*", "LICENSE*"]
31
+ spec.files = Dir["*.gemspec", "lib/**/*"]
32
+ end
data.tar.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ U�-r�ڟ�"2W� ����Mi��<���M��H���� *�**�@Y��9�e?ځ��(11;sBf�it\X�F5���{�D�U2l1�[��u³��J�?��QC�I�㙳>y��̓�w{��Rj�����t��,xb2�uh:%P�� 4����O �,�*J��F�����Ę��eX�&�\">�̉h�r�����Uv
2
+ ÷t�tZ6`ɒ6�X���#�Z*�K�*��q�+��$M3�۫;v��]0�BغK��\rp�/
metadata ADDED
@@ -0,0 +1,136 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spek
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Brooke Kuhlmann
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIC/jCCAeagAwIBAgIBBDANBgkqhkiG9w0BAQsFADAlMSMwIQYDVQQDDBpicm9v
14
+ a2UvREM9YWxjaGVtaXN0cy9EQz1pbzAeFw0yMTAzMTkxMjQ4MDZaFw0yMjAzMTkx
15
+ MjQ4MDZaMCUxIzAhBgNVBAMMGmJyb29rZS9EQz1hbGNoZW1pc3RzL0RDPWlvMIIB
16
+ IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA6l1qpXTiomH1RfMRloyw7MiE
17
+ xyVx/x8Yc3EupdH7uhNaTXQGyORN6aOY//1QXXMHIZ9tW74nZLhesWMSUMYy0XhB
18
+ brs+KkurHnc9FnEJAbG7ebGvl/ncqZt72nQvaxpDxvuCBHgJAz+8i5wl6FhLw+oT
19
+ 9z0A8KcGhz67SdcoQiD7qiCjL/2NTeWHOzkpPrdGlt088+VerEEGf5I13QCvaftP
20
+ D5vkU0YlAm1r98BymuJlcQ1qdkVEI1d48ph4kcS0S0nv1RiuyVb6TCAR3Nu3VaVq
21
+ 3fPzZKJLZBx67UvXdbdicWPiUR75elI4PXpLIic3xytaF52ZJYyKZCNZJhNwfQID
22
+ AQABozkwNzAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQU0nzow9vc
23
+ 2CdikiiE3fJhP/gY4ggwDQYJKoZIhvcNAQELBQADggEBAEjpaOXHHp8s/7GL2qCb
24
+ YAs7urOLv9VHSPfQWAwaTMVnSsIf3Sw4xzISOP/mmfEPBPXtz61K5esrE/uTFtgb
25
+ FyjxQk2H0sEWgrRXGGNHBWQRhhEs7LP/TByoC15A0br++xLxRz4r7HBLGAWQQDpg
26
+ 66BJ2TBVjxS6K64tKbq7+ACyrOZGgTfNHACh4M076y0x0oRf/rwBrU39/KRfuhbb
27
+ cm+nNCEtO35gTmZ2bVDHLGvWazi3gJt6+huQjfXTCUUG2YYBxwhu+GPdAGQPxpf9
28
+ lkHilIrX69jq8wMPpBhlaw2mRmeSL50Wv5u6xVBvOHhXFSP1crXM95vfLhLyRYod
29
+ W2A=
30
+ -----END CERTIFICATE-----
31
+ date: 2022-01-29 00:00:00.000000000 Z
32
+ dependencies:
33
+ - !ruby/object:Gem::Dependency
34
+ name: dry-monads
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.4'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '1.4'
47
+ - !ruby/object:Gem::Dependency
48
+ name: refinements
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '9.1'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '9.1'
61
+ - !ruby/object:Gem::Dependency
62
+ name: versionaire
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '10.1'
68
+ type: :runtime
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '10.1'
75
+ - !ruby/object:Gem::Dependency
76
+ name: zeitwerk
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '2.5'
82
+ type: :runtime
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '2.5'
89
+ description:
90
+ email:
91
+ - brooke@alchemists.io
92
+ executables: []
93
+ extensions: []
94
+ extra_rdoc_files:
95
+ - README.adoc
96
+ - LICENSE.adoc
97
+ files:
98
+ - LICENSE.adoc
99
+ - README.adoc
100
+ - lib/spek.rb
101
+ - lib/spek/finder.rb
102
+ - lib/spek/loader.rb
103
+ - lib/spek/picker.rb
104
+ - lib/spek/presenter.rb
105
+ - lib/spek/versioner.rb
106
+ - spek.gemspec
107
+ homepage: https://www.alchemists.io/projects/spek
108
+ licenses:
109
+ - Hippocratic-3.0
110
+ metadata:
111
+ bug_tracker_uri: https://github.com/bkuhlmann/spek/issues
112
+ changelog_uri: https://www.alchemists.io/projects/spek/versions
113
+ documentation_uri: https://www.alchemists.io/projects/spek
114
+ label: Spek
115
+ rubygems_mfa_required: 'true'
116
+ source_code_uri: https://github.com/bkuhlmann/spek
117
+ post_install_message:
118
+ rdoc_options: []
119
+ require_paths:
120
+ - lib
121
+ required_ruby_version: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - "~>"
124
+ - !ruby/object:Gem::Version
125
+ version: '3.1'
126
+ required_rubygems_version: !ruby/object:Gem::Requirement
127
+ requirements:
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: '0'
131
+ requirements: []
132
+ rubygems_version: 3.3.6
133
+ signing_key:
134
+ specification_version: 4
135
+ summary: Enhances gem specifications with additional information and tooling.
136
+ test_files: []
metadata.gz.sig ADDED
@@ -0,0 +1 @@
1
+ �@Q���s������H �cuc��Ѱ�f:A(T�������X�x��b�zU�v�p���Y���L���\�n�-+�]b
2
+ �&�������T�r���$A��{���aL�Y��5�[7<\�,�it��!���p<��8A��, ���5��V��%�/� W�#�p�0�K���iޯv�#5�дe�Yj�-T`�]��W�<OnQ5+s*��T՗�3���: D{#�D�/��a��R��D��WR�q