brew 0.1.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.rubocop.yml +139 -0
- data/Gemfile +3 -4
- data/Gemfile.lock +26 -1
- data/LICENSE +131 -0
- data/README.md +25 -13
- data/Rakefile +8 -6
- data/bin/console +4 -3
- data/brew.gemspec +18 -10
- data/lib/brew/commands/info.rb +88 -0
- data/lib/brew/commands/install.rb +138 -0
- data/lib/brew/commands/list.rb +82 -0
- data/lib/brew/commands/search.rb +101 -0
- data/lib/brew/commands/uninstall.rb +52 -0
- data/lib/brew/commands/update.rb +56 -0
- data/lib/brew/commands/upgrade.rb +93 -0
- data/lib/brew/home_brew.rb +37 -40
- data/lib/brew/utils/string_utils.rb +11 -0
- data/lib/brew/utils/system_runner.rb +35 -0
- data/lib/brew/version.rb +3 -1
- data/lib/brew.rb +23 -1
- metadata +84 -4
- data/.travis.yml +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa063b24e37c68bf9f6c3e02c51ae63e235ca67da91973d7a744659ed421a709
|
4
|
+
data.tar.gz: 69fd9f901b344cac4851e5b2103cca12a6c376ea6e4c42e9c7955240ddd8db93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 67019f2e08c0ac3ab7eaca205ca7ba429432865cc2933a242842653d0bf30d6d75977f1cf40bea97275d38080f0cc46f90278d3111f9f29a0c6d433c96f90e22
|
7
|
+
data.tar.gz: efc571596c50305d9f68892790b219f09db2a09c4b3df690cb9f4993fd3ced0948b6f78ed9dfd227f5cebe4e020e4e158338c0e4d51e168c202117ff0f080c26
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
Style/Documentation:
|
2
|
+
Enabled: False
|
3
|
+
|
4
|
+
Layout/EmptyLinesAroundAttributeAccessor:
|
5
|
+
Enabled: True
|
6
|
+
|
7
|
+
Layout/SpaceAroundMethodCallOperator:
|
8
|
+
Enabled: True
|
9
|
+
|
10
|
+
Lint/BinaryOperatorWithIdenticalOperands:
|
11
|
+
Enabled: True
|
12
|
+
|
13
|
+
Lint/DeprecatedOpenSSLConstant:
|
14
|
+
Enabled: True
|
15
|
+
|
16
|
+
Lint/DuplicateElsifCondition:
|
17
|
+
Enabled: True
|
18
|
+
|
19
|
+
Lint/DuplicateRescueException:
|
20
|
+
Enabled: True
|
21
|
+
|
22
|
+
Lint/EmptyConditionalBody:
|
23
|
+
Enabled: True
|
24
|
+
|
25
|
+
Lint/FloatComparison:
|
26
|
+
Enabled: True
|
27
|
+
|
28
|
+
Lint/MissingSuper:
|
29
|
+
Enabled: True
|
30
|
+
|
31
|
+
Lint/MixedRegexpCaptureTypes:
|
32
|
+
Enabled: True
|
33
|
+
|
34
|
+
Lint/OutOfRangeRegexpRef:
|
35
|
+
Enabled: True
|
36
|
+
|
37
|
+
Lint/RaiseException:
|
38
|
+
Enabled: True
|
39
|
+
|
40
|
+
Lint/SelfAssignment:
|
41
|
+
Enabled: True
|
42
|
+
|
43
|
+
Lint/StructNewOverride:
|
44
|
+
Enabled: True
|
45
|
+
|
46
|
+
Lint/TopLevelReturnWithArgument:
|
47
|
+
Enabled: True
|
48
|
+
|
49
|
+
Lint/UnreachableLoop:
|
50
|
+
Enabled: True
|
51
|
+
|
52
|
+
Metrics/AbcSize:
|
53
|
+
Exclude:
|
54
|
+
- 'lib/brew/commands/*.rb'
|
55
|
+
- 'lib/brew.rb'
|
56
|
+
|
57
|
+
Metrics/CyclomaticComplexity:
|
58
|
+
Exclude:
|
59
|
+
- 'lib/brew/commands/*.rb'
|
60
|
+
- 'lib/brew.rb'
|
61
|
+
|
62
|
+
Metrics/MethodLength:
|
63
|
+
Exclude:
|
64
|
+
- 'lib/brew/commands/*.rb'
|
65
|
+
- 'lib/brew.rb'
|
66
|
+
- 'test/**/*.rb'
|
67
|
+
|
68
|
+
Metrics/PerceivedComplexity:
|
69
|
+
Exclude:
|
70
|
+
- 'lib/brew/commands/*.rb'
|
71
|
+
- 'lib/brew.rb'
|
72
|
+
|
73
|
+
Style/AccessorGrouping:
|
74
|
+
Enabled: True
|
75
|
+
|
76
|
+
Style/ArrayCoercion:
|
77
|
+
Enabled: True
|
78
|
+
|
79
|
+
Style/BisectedAttrAccessor:
|
80
|
+
Enabled: True
|
81
|
+
|
82
|
+
Style/CaseLikeIf:
|
83
|
+
Enabled: True
|
84
|
+
|
85
|
+
Style/ExplicitBlockArgument:
|
86
|
+
Enabled: True
|
87
|
+
|
88
|
+
Style/ExponentialNotation:
|
89
|
+
Enabled: True
|
90
|
+
|
91
|
+
Style/GlobalStdStream:
|
92
|
+
Enabled: True
|
93
|
+
|
94
|
+
Style/HashAsLastArrayItem:
|
95
|
+
Enabled: True
|
96
|
+
|
97
|
+
Style/HashEachMethods:
|
98
|
+
Enabled: True
|
99
|
+
|
100
|
+
Style/HashLikeCase:
|
101
|
+
Enabled: True
|
102
|
+
|
103
|
+
Style/HashTransformKeys:
|
104
|
+
Enabled: True
|
105
|
+
|
106
|
+
Style/HashTransformValues:
|
107
|
+
Enabled: True
|
108
|
+
|
109
|
+
Style/MixinUsage:
|
110
|
+
Exclude:
|
111
|
+
- 'lib/brew.rb'
|
112
|
+
|
113
|
+
Style/OptionalBooleanParameter:
|
114
|
+
Enabled: True
|
115
|
+
|
116
|
+
Style/RedundantAssignment:
|
117
|
+
Enabled: True
|
118
|
+
|
119
|
+
Style/RedundantFetchBlock:
|
120
|
+
Enabled: True
|
121
|
+
|
122
|
+
Style/RedundantFileExtensionInRequire:
|
123
|
+
Enabled: True
|
124
|
+
|
125
|
+
Style/RedundantRegexpCharacterClass:
|
126
|
+
Enabled: True
|
127
|
+
|
128
|
+
Style/RedundantRegexpEscape:
|
129
|
+
Enabled: True
|
130
|
+
|
131
|
+
Style/SingleArgumentDig:
|
132
|
+
Enabled: True
|
133
|
+
|
134
|
+
Style/SlicingWithRange:
|
135
|
+
Enabled: True
|
136
|
+
|
137
|
+
Style/StringConcatenation:
|
138
|
+
Enabled: True
|
139
|
+
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,21 +1,46 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
brew (0.
|
4
|
+
brew (0.2.2)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
+
ast (2.4.1)
|
10
|
+
bump (0.9.0)
|
11
|
+
byebug (11.1.3)
|
9
12
|
minitest (5.14.1)
|
13
|
+
parallel (1.19.2)
|
14
|
+
parser (2.7.1.4)
|
15
|
+
ast (~> 2.4.1)
|
16
|
+
rainbow (3.0.0)
|
10
17
|
rake (12.3.3)
|
18
|
+
regexp_parser (1.7.1)
|
19
|
+
rexml (3.2.5)
|
20
|
+
rubocop (0.89.0)
|
21
|
+
parallel (~> 1.10)
|
22
|
+
parser (>= 2.7.1.1)
|
23
|
+
rainbow (>= 2.2.2, < 4.0)
|
24
|
+
regexp_parser (>= 1.7)
|
25
|
+
rexml
|
26
|
+
rubocop-ast (>= 0.1.0, < 1.0)
|
27
|
+
ruby-progressbar (~> 1.7)
|
28
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
29
|
+
rubocop-ast (0.3.0)
|
30
|
+
parser (>= 2.7.1.4)
|
31
|
+
ruby-progressbar (1.10.1)
|
32
|
+
unicode-display_width (1.7.0)
|
11
33
|
|
12
34
|
PLATFORMS
|
13
35
|
ruby
|
14
36
|
|
15
37
|
DEPENDENCIES
|
16
38
|
brew!
|
39
|
+
bump
|
40
|
+
byebug
|
17
41
|
minitest (~> 5.0)
|
18
42
|
rake (~> 12.0)
|
43
|
+
rubocop
|
19
44
|
|
20
45
|
BUNDLED WITH
|
21
46
|
2.1.4
|
data/LICENSE
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
brew-rb 2020 Austin C. Roos
|
2
|
+
|
3
|
+
Hippocratic License Version Number: 2.1.
|
4
|
+
|
5
|
+
* Purpose. The purpose of this License is for the Licensor named above to
|
6
|
+
permit the Licensee (as defined below) broad permission, if consistent with
|
7
|
+
Human Rights Laws and Human Rights Principles (as each is defined below), to
|
8
|
+
use and work with the Software (as defined below) within the full scope of
|
9
|
+
Licensor's copyright and patent rights, if any, in the Software, while
|
10
|
+
ensuring attribution and protecting the Licensor from liability.
|
11
|
+
|
12
|
+
* Permission and Conditions. The Licensor grants permission by this license
|
13
|
+
("License"), free of charge, to the extent of Licensor's rights under
|
14
|
+
applicable copyright and patent law, to any person or entity (the "Licensee")
|
15
|
+
obtaining a copy of this software and associated documentation files (the
|
16
|
+
"Software"), to do everything with the Software that would otherwise infringe
|
17
|
+
(i) the Licensor's copyright in the Software or (ii) any patent claims to the
|
18
|
+
Software that the Licensor can license or becomes able to license, subject to
|
19
|
+
all of the following terms and conditions:
|
20
|
+
|
21
|
+
* Acceptance. This License is automatically offered to every person and entity
|
22
|
+
subject to its terms and conditions. Licensee accepts this License and agrees
|
23
|
+
to its terms and conditions by taking any action with the Software that, absent
|
24
|
+
this License, would infringe any intellectual property right held by Licensor.
|
25
|
+
|
26
|
+
* Notice. Licensee must ensure that everyone who gets a copy of any part of
|
27
|
+
this Software from Licensee, with or without changes, also receives the License
|
28
|
+
and the above copyright notice (and if included by the Licensor, patent,
|
29
|
+
trademark and attribution notice). Licensee must cause any modified versions of
|
30
|
+
the Software to carry prominent notices stating that Licensee changed the
|
31
|
+
Software. For clarity, although Licensee is free to create modifications of the
|
32
|
+
Software and distribute only the modified portion created by Licensee with
|
33
|
+
additional or different terms, the portion of the Software not modified must be
|
34
|
+
distributed pursuant to this License. If anyone notifies Licensee in writing
|
35
|
+
that Licensee has not complied with this Notice section, Licensee can keep this
|
36
|
+
License by taking all practical steps to comply within 30 days after the
|
37
|
+
notice. If Licensee does not do so, Licensee's License (and all rights
|
38
|
+
licensed hereunder) shall end immediately.
|
39
|
+
|
40
|
+
* Compliance with Human Rights Principles and Human Rights Laws.
|
41
|
+
|
42
|
+
1. Human Rights Principles.
|
43
|
+
|
44
|
+
(a) Licensee is advised to consult the articles of the United Nations
|
45
|
+
Universal Declaration of Human Rights and the United Nations Global Compact
|
46
|
+
that define recognized principles of international human rights (the "Human
|
47
|
+
Rights Principles"). Licensee shall use the Software in a manner consistent
|
48
|
+
with Human Rights Principles.
|
49
|
+
|
50
|
+
(b) Unless the Licensor and Licensee agree otherwise, any dispute,
|
51
|
+
controversy, or claim arising out of or relating to (i) Section 1(a) regarding
|
52
|
+
Human Rights Principles, including the breach of Section 1(a), termination of
|
53
|
+
this License for breach of the Human Rights Principles, or invalidity of
|
54
|
+
Section 1(a) or (ii) a determination of whether any Law is consistent or in
|
55
|
+
conflict with Human Rights Principles pursuant to Section 2, below, shall be
|
56
|
+
settled by arbitration in accordance with the Hague Rules on Business and Human
|
57
|
+
Rights Arbitration (the "Rules"); provided, however, that Licensee may elect
|
58
|
+
not to participate in such arbitration, in which event this License (and all
|
59
|
+
rights licensed hereunder) shall end immediately. The number of arbitrators
|
60
|
+
shall be one unless the Rules require otherwise.
|
61
|
+
|
62
|
+
Unless both the Licensor and Licensee agree to the contrary: (1) All
|
63
|
+
documents and information concerning the arbitration shall be public and may be
|
64
|
+
disclosed by any party; (2) The repository referred to under Article 43 of the
|
65
|
+
Rules shall make available to the public in a timely manner all documents
|
66
|
+
concerning the arbitration which are communicated to it, including all
|
67
|
+
submissions of the parties, all evidence admitted into the record of the
|
68
|
+
proceedings, all transcripts or other recordings of hearings and all orders,
|
69
|
+
decisions and awards of the arbitral tribunal, subject only to the arbitral
|
70
|
+
tribunal's powers to take such measures as may be necessary to safeguard the
|
71
|
+
integrity of the arbitral process pursuant to Articles 18, 33, 41 and 42 of the
|
72
|
+
Rules; and (3) Article 26(6) of the Rules shall not apply.
|
73
|
+
|
74
|
+
2. Human Rights Laws. The Software shall not be used by any person or
|
75
|
+
entity for any systems, activities, or other uses that violate any Human Rights
|
76
|
+
Laws. "Human Rights Laws" means any applicable laws, regulations, or rules
|
77
|
+
(collectively, "Laws") that protect human, civil, labor, privacy, political,
|
78
|
+
environmental, security, economic, due process, or similar rights; provided,
|
79
|
+
however, that such Laws are consistent and not in conflict with Human Rights
|
80
|
+
Principles (a dispute over the consistency or a conflict between Laws and Human
|
81
|
+
Rights Principles shall be determined by arbitration as stated above). Where
|
82
|
+
the Human Rights Laws of more than one jurisdiction are applicable or in
|
83
|
+
conflict with respect to the use of the Software, the Human Rights Laws that
|
84
|
+
are most protective of the individuals or groups harmed shall apply.
|
85
|
+
|
86
|
+
3. Indemnity. Licensee shall hold harmless and indemnify Licensor (and any
|
87
|
+
other contributor) against all losses, damages, liabilities, deficiencies,
|
88
|
+
claims, actions, judgments, settlements, interest, awards, penalties, fines,
|
89
|
+
costs, or expenses of whatever kind, including Licensor's reasonable
|
90
|
+
attorneys' fees, arising out of or relating to Licensee's use of the
|
91
|
+
Software in violation of Human Rights Laws or Human Rights Principles.
|
92
|
+
|
93
|
+
* Failure to Comply. Any failure of Licensee to act according to the terms and
|
94
|
+
conditions of this License is both a breach of the License and an infringement
|
95
|
+
of the intellectual property rights of the Licensor (subject to exceptions
|
96
|
+
under Laws, e.g., fair use). In the event of a breach or infringement, the
|
97
|
+
terms and conditions of this License may be enforced by Licensor under the Laws
|
98
|
+
of any jurisdiction to which Licensee is subject. Licensee also agrees that the
|
99
|
+
Licensor may enforce the terms and conditions of this License against Licensee
|
100
|
+
through specific performance (or similar remedy under Laws) to the extent
|
101
|
+
permitted by Laws. For clarity, except in the event of a breach of this
|
102
|
+
License, infringement, or as otherwise stated in this License, Licensor may not
|
103
|
+
terminate this License with Licensee.
|
104
|
+
|
105
|
+
* Enforceability and Interpretation. If any term or provision of this License
|
106
|
+
is determined to be invalid, illegal, or unenforceable by a court of competent
|
107
|
+
jurisdiction, then such invalidity, illegality, or unenforceability shall not
|
108
|
+
affect any other term or provision of this License or invalidate or render
|
109
|
+
unenforceable such term or provision in any other jurisdiction; provided,
|
110
|
+
however, subject to a court modification pursuant to the immediately following
|
111
|
+
sentence, if any term or provision of this License pertaining to Human Rights
|
112
|
+
Laws or Human Rights Principles is deemed invalid, illegal, or unenforceable
|
113
|
+
against Licensee by a court of competent jurisdiction, all rights in the
|
114
|
+
Software granted to Licensee shall be deemed null and void as between Licensor
|
115
|
+
and Licensee. Upon a determination that any term or provision is invalid,
|
116
|
+
illegal, or unenforceable, to the extent permitted by Laws, the court may
|
117
|
+
modify this License to affect the original purpose that the Software be used in
|
118
|
+
compliance with Human Rights Principles and Human Rights Laws as closely as
|
119
|
+
possible. The language in this License shall be interpreted as to its fair
|
120
|
+
meaning and not strictly for or against any party.
|
121
|
+
|
122
|
+
* Disclaimer. TO THE FULL EXTENT ALLOWED BY LAW, THIS SOFTWARE COMES "AS IS,"
|
123
|
+
WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED, AND LICENSOR AND ANY OTHER
|
124
|
+
CONTRIBUTOR SHALL NOT BE LIABLE TO ANYONE FOR ANY DAMAGES OR OTHER LIABILITY
|
125
|
+
ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THIS LICENSE, UNDER
|
126
|
+
ANY KIND OF LEGAL CLAIM.
|
127
|
+
|
128
|
+
This Hippocratic License is an Ethical Source license
|
129
|
+
(https://ethicalsource.dev) and is offered for use by licensors and licensees
|
130
|
+
at their own risk, on an "AS IS" basis, and with no warranties express or
|
131
|
+
implied, to the maximum extent permitted by Laws.
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
#
|
1
|
+
# brew
|
2
2
|
|
3
|
-
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/brew.svg)](https://badge.fury.io/rb/brew)
|
4
4
|
|
5
|
-
|
5
|
+
A _very_ simple gem to run some [homebrew](https://brew.sh/) commands from your ruby code. If the `brew` executable is not installed, the constructor will throw an exception immediately.
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -13,28 +13,40 @@ gem 'brew'
|
|
13
13
|
```
|
14
14
|
|
15
15
|
And then execute:
|
16
|
+
```shell
|
17
|
+
$ bundle install
|
18
|
+
```
|
19
|
+
|
20
|
+
## Usage
|
16
21
|
|
17
|
-
|
22
|
+
Two steps!
|
18
23
|
|
19
|
-
|
24
|
+
1) Create a client:
|
25
|
+
```ruby
|
26
|
+
homebrew = Brew::HomeBrew.new
|
27
|
+
```
|
28
|
+
(will raise an exception if `brew` is not installed)
|
20
29
|
|
21
|
-
|
30
|
+
2) `brew` to your heart's content!
|
31
|
+
```ruby
|
32
|
+
homebrew.update
|
22
33
|
|
23
|
-
|
34
|
+
homebrew.install('rbenv')
|
24
35
|
|
25
|
-
|
36
|
+
homebrew.upgrade('redis')
|
26
37
|
|
27
|
-
|
38
|
+
homebrew.uninstall('rbenv')
|
39
|
+
```
|
28
40
|
|
29
|
-
|
41
|
+
Available commands are: `info`, `install`, `list`, `uninstall`, `update`, `upgrade`
|
42
|
+
(will raise an exception if any of the commands fail)
|
30
43
|
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
44
|
|
33
45
|
## Contributing
|
34
46
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
47
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/acroos/brew-rb. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct (mentioned below).
|
36
48
|
|
37
49
|
|
38
50
|
## Code of Conduct
|
39
51
|
|
40
|
-
Everyone interacting in the
|
52
|
+
Everyone interacting in the brew-rb project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/acroos/brew-rb/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
CHANGED
@@ -1,10 +1,12 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'rake/testtask'
|
3
5
|
|
4
6
|
Rake::TestTask.new(:test) do |t|
|
5
|
-
t.libs <<
|
6
|
-
t.libs <<
|
7
|
-
t.test_files = FileList[
|
7
|
+
t.libs << 'test'
|
8
|
+
t.libs << 'lib'
|
9
|
+
t.test_files = FileList['test/**/*_test.rb']
|
8
10
|
end
|
9
11
|
|
10
|
-
task :
|
12
|
+
task default: :test
|
data/bin/console
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
|
-
require
|
4
|
-
require
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'brew'
|
5
6
|
|
6
7
|
# You can add fixtures and/or initialization code here to make experimenting
|
7
8
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -10,5 +11,5 @@ require "brew"
|
|
10
11
|
# require "pry"
|
11
12
|
# Pry.start
|
12
13
|
|
13
|
-
require
|
14
|
+
require 'irb'
|
14
15
|
IRB.start(__FILE__)
|
data/brew.gemspec
CHANGED
@@ -1,27 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require_relative 'lib/brew/version'
|
2
4
|
|
3
5
|
Gem::Specification.new do |spec|
|
4
|
-
spec.name =
|
6
|
+
spec.name = 'brew'
|
5
7
|
spec.version = Brew::VERSION
|
6
|
-
spec.authors = [
|
7
|
-
spec.email = [
|
8
|
+
spec.authors = ['Austin C Roos']
|
9
|
+
spec.email = ['acroos@hey.com']
|
8
10
|
|
9
|
-
spec.summary =
|
10
|
-
spec.description =
|
11
|
-
spec.required_ruby_version = Gem::Requirement.new(
|
11
|
+
spec.summary = 'Run some basic brew commands from ruby'
|
12
|
+
spec.description = 'Run some basic brew commands from ruby'
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
|
12
14
|
|
13
15
|
# spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
|
14
16
|
|
15
17
|
# spec.metadata["homepage_uri"] = spec.homepage
|
16
|
-
spec.metadata[
|
18
|
+
spec.metadata['source_code_uri'] = 'https://github.com/acroos/brew-rb'
|
17
19
|
# spec.metadata["changelog_uri"] = "TODO: Put your gem's CHANGELOG.md URL here."
|
18
20
|
|
19
21
|
# Specify which files should be added to the gem when it is released.
|
20
22
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
21
|
-
spec.files
|
23
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
22
24
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
23
25
|
end
|
24
|
-
spec.bindir =
|
26
|
+
spec.bindir = 'exe'
|
25
27
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
26
|
-
spec.require_paths = [
|
28
|
+
spec.require_paths = ['lib']
|
29
|
+
|
30
|
+
spec.add_development_dependency 'bump'
|
31
|
+
spec.add_development_dependency 'byebug'
|
32
|
+
spec.add_development_dependency 'minitest', '~> 5.0'
|
33
|
+
spec.add_development_dependency 'rake', '~> 12.0'
|
34
|
+
spec.add_development_dependency 'rubocop'
|
27
35
|
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'brew/utils/string_utils'
|
4
|
+
require 'brew/utils/system_runner'
|
5
|
+
|
6
|
+
module Brew
|
7
|
+
module Commands
|
8
|
+
class Info
|
9
|
+
attr_reader :brew_path, :formulae, :options, :system_runner
|
10
|
+
|
11
|
+
def initialize(brew_path, *formulae, **kwargs)
|
12
|
+
@brew_path = brew_path
|
13
|
+
@formulae = formulae.join(' ')
|
14
|
+
@options = parse_args(kwargs)
|
15
|
+
@system_runner = SystemRunner.new
|
16
|
+
end
|
17
|
+
|
18
|
+
def execute!
|
19
|
+
info_command = "#{brew_path} info #{options} #{formulae}".squish
|
20
|
+
system_runner.print_output(info_command)
|
21
|
+
rescue StandardError => e
|
22
|
+
raise Brew::ExecutionError, e
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
BOOLEAN_OPTIONS = %i[github json installed all verbose debug].freeze
|
28
|
+
|
29
|
+
ARGUMENT_OPTIONS = %i[analytics days category].freeze
|
30
|
+
|
31
|
+
def parse_args(args)
|
32
|
+
option_list = []
|
33
|
+
|
34
|
+
BOOLEAN_OPTIONS.each do |option|
|
35
|
+
str_option = option.to_s
|
36
|
+
kebab_option = str_option.snake_to_kebab
|
37
|
+
option_list << "--#{kebab_option}" if args[option] || args[str_option] || args[kebab_option]
|
38
|
+
end
|
39
|
+
|
40
|
+
ARGUMENT_OPTIONS.each do |option|
|
41
|
+
str_option = option.to_s
|
42
|
+
kebab_option = str_option.snake_to_kebab
|
43
|
+
if (value = args[option] || args[str_option] || args[kebab_option])
|
44
|
+
option_list << "--#{kebab_option} #{value}"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
option_list.join(' ')
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
# Usage: brew info [options] [formula]
|
55
|
+
|
56
|
+
# Display brief statistics for your Homebrew installation.
|
57
|
+
|
58
|
+
# If formula is provided, show summary of information about formula.
|
59
|
+
|
60
|
+
# --analytics List global Homebrew analytics data or, if
|
61
|
+
# specified, installation and build error
|
62
|
+
# data for formula (provided neither
|
63
|
+
# HOMEBREW_NO_ANALYTICS nor
|
64
|
+
# HOMEBREW_NO_GITHUB_API are set).
|
65
|
+
# --days How many days of analytics data to
|
66
|
+
# retrieve. The value for days must be
|
67
|
+
# 30, 90 or 365. The default is 30.
|
68
|
+
# --category Which type of analytics data to retrieve.
|
69
|
+
# The value for category must be install,
|
70
|
+
# install-on-request or build-error;
|
71
|
+
# cask-install or os-version may be
|
72
|
+
# specified if formula is not. The default
|
73
|
+
# is install.
|
74
|
+
# --github Open the GitHub source page for formula
|
75
|
+
# in a browser. To view formula history
|
76
|
+
# locally: brew log -p formula
|
77
|
+
# --json Print a JSON representation of formula.
|
78
|
+
# Currently the default and only accepted
|
79
|
+
# value for version is v1. See the docs
|
80
|
+
# for examples of using the JSON output:
|
81
|
+
# https://docs.brew.sh/Querying-Brew
|
82
|
+
# --installed Print JSON of formulae that are currently
|
83
|
+
# installed.
|
84
|
+
# --all Print JSON of all available formulae.
|
85
|
+
# -v, --verbose Show more verbose analytics data for
|
86
|
+
# formula.
|
87
|
+
# -d, --debug Display any debugging information.
|
88
|
+
# -h, --help Show this message.
|