brew-gem 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.markdown +6 -0
- data/lib/brew/gem/cli.rb +20 -7
- data/lib/brew/gem/formula.rb.erb +2 -1
- data/lib/brew/gem/version.rb +1 -1
- metadata +6 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df6562ae148c6903c357d09a1c8a1f6c97f0e1fa8d769c0a31af29310c171652
|
4
|
+
data.tar.gz: f5cea024787571e2d1d80796df0d29343e902b1b2fc656a0a5bfceacfd7c2fea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7f96bd1a41356ee2ce572c1206a5f490c003ea9ecfd10eea82ac8e041297b5784d479b384ce073169f6d2f344e792a26240cfa9f0250980ba1a0d9f59471ff5f
|
7
|
+
data.tar.gz: a38fef07e4db35059c41363f20061a4fe28843f513e508752d148b2f1f1dc157e85087c67fe3468c45c64a1f03a7866c0b380bf33f50c0e1723bc006ec6e92bb
|
data/CHANGELOG.markdown
CHANGED
data/lib/brew/gem/cli.rb
CHANGED
@@ -40,8 +40,21 @@ module Brew::Gem::CLI
|
|
40
40
|
@args_without_flags[2]
|
41
41
|
end
|
42
42
|
|
43
|
-
def
|
44
|
-
@args.reject {|a| a == gem || a == supplied_version }
|
43
|
+
def flags
|
44
|
+
@flags ||= @args.reject {|a| a == gem || a == supplied_version }
|
45
|
+
end
|
46
|
+
|
47
|
+
def to_gem_args
|
48
|
+
if start = flags.index('--')
|
49
|
+
flags[start..-1]
|
50
|
+
else
|
51
|
+
[]
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def to_brew_args
|
56
|
+
stop_index = (flags.index('--') || 0) - 1
|
57
|
+
flags[0..stop_index]
|
45
58
|
end
|
46
59
|
end
|
47
60
|
|
@@ -79,7 +92,7 @@ module Brew::Gem::CLI
|
|
79
92
|
ENV['HOMEBREW_PREFIX'] || `brew --prefix`.chomp
|
80
93
|
end
|
81
94
|
|
82
|
-
def expand_formula(name, version, use_homebrew_ruby=false)
|
95
|
+
def expand_formula(name, version, use_homebrew_ruby = false, gem_arguments = [])
|
83
96
|
klass = 'Gem' + name.capitalize.gsub(/[-_.\s]([a-zA-Z0-9])/) { $1.upcase }.gsub('+', 'x')
|
84
97
|
user_gemrc = "#{ENV['HOME']}/.gemrc"
|
85
98
|
template_file = File.expand_path('../formula.rb.erb', __FILE__)
|
@@ -87,11 +100,11 @@ module Brew::Gem::CLI
|
|
87
100
|
template.result(binding)
|
88
101
|
end
|
89
102
|
|
90
|
-
def with_temp_formula(name, version, use_homebrew_ruby)
|
103
|
+
def with_temp_formula(name, version, use_homebrew_ruby, gem_arguments)
|
91
104
|
filename = File.join Dir.tmpdir, "gem-#{name}.rb"
|
92
105
|
|
93
106
|
open(filename, 'w') do |f|
|
94
|
-
f.puts expand_formula(name, version, use_homebrew_ruby)
|
107
|
+
f.puts expand_formula(name, version, use_homebrew_ruby, gem_arguments)
|
95
108
|
end
|
96
109
|
|
97
110
|
yield filename
|
@@ -108,12 +121,12 @@ module Brew::Gem::CLI
|
|
108
121
|
arguments = process_args(args)
|
109
122
|
name = arguments.gem
|
110
123
|
version = fetch_version(name, arguments.supplied_version)
|
111
|
-
with_temp_formula(name, version, homebrew_ruby?(arguments.ruby_flag)) do |filename|
|
124
|
+
with_temp_formula(name, version, homebrew_ruby?(arguments.ruby_flag), arguments.to_gem_args) do |filename|
|
112
125
|
case arguments.command
|
113
126
|
when "formula"
|
114
127
|
$stdout.puts File.read(filename)
|
115
128
|
else
|
116
|
-
system "brew #{arguments.
|
129
|
+
system "brew #{arguments.to_brew_args.shelljoin} --formula #{filename}"
|
117
130
|
exit $?.exitstatus unless $?.success?
|
118
131
|
end
|
119
132
|
end
|
data/lib/brew/gem/formula.rb.erb
CHANGED
@@ -4,6 +4,7 @@ require 'formula'
|
|
4
4
|
require 'fileutils'
|
5
5
|
|
6
6
|
USE_HOMEBREW_RUBY = <%= use_homebrew_ruby ? "true" : "false" %>
|
7
|
+
GEM_ARGUMENTS = <%= gem_arguments.inspect %>
|
7
8
|
|
8
9
|
module RubyBin
|
9
10
|
def ruby_bin
|
@@ -73,7 +74,7 @@ class <%= klass %> < Formula
|
|
73
74
|
"--no-wrapper",
|
74
75
|
"--no-user-install",
|
75
76
|
"--install-dir", prefix,
|
76
|
-
"--bindir", bin
|
77
|
+
"--bindir", bin, *GEM_ARGUMENTS
|
77
78
|
|
78
79
|
raise "gem install '<%= name %>' failed with status #{$?.exitstatus}" unless $?.success?
|
79
80
|
|
data/lib/brew/gem/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: brew-gem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Sieger
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -97,7 +97,7 @@ homepage: https://github.com/sportngin/brew-gem
|
|
97
97
|
licenses: []
|
98
98
|
metadata:
|
99
99
|
allowed_push_host: https://rubygems.org
|
100
|
-
post_install_message:
|
100
|
+
post_install_message:
|
101
101
|
rdoc_options: []
|
102
102
|
require_paths:
|
103
103
|
- lib
|
@@ -112,9 +112,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
112
|
- !ruby/object:Gem::Version
|
113
113
|
version: '0'
|
114
114
|
requirements: []
|
115
|
-
|
116
|
-
|
117
|
-
signing_key:
|
115
|
+
rubygems_version: 3.0.3
|
116
|
+
signing_key:
|
118
117
|
specification_version: 4
|
119
118
|
summary: Generate Homebrew formulas to install standalone ruby gems.
|
120
119
|
test_files: []
|