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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9a0239af1dd4ab424cccacf2426f39cf1a7f10353e23fb4f5ea9c2b4e56b82d8
4
- data.tar.gz: 3179fd9be5d524b3f717dde6a9574e0e91853ef044108b1313dd175783f9711b
3
+ metadata.gz: df6562ae148c6903c357d09a1c8a1f6c97f0e1fa8d769c0a31af29310c171652
4
+ data.tar.gz: f5cea024787571e2d1d80796df0d29343e902b1b2fc656a0a5bfceacfd7c2fea
5
5
  SHA512:
6
- metadata.gz: 5c93c9fc288600344f699d7da409d8075b3584ece02c8719046e772f30018c7cb6bdfb6c9cfd4a36bf70260a8383a1dc488b3a21e669c66369ed1321ad504926
7
- data.tar.gz: e172b0f4d650790714e8ce76ad891dfab9c62fa1416b5b5d8f6696b3413a5dd02c1e2e47817f287e902913853abda64b2b90f5cf1a224117a4e8c9564134adad
6
+ metadata.gz: 7f96bd1a41356ee2ce572c1206a5f490c003ea9ecfd10eea82ac8e041297b5784d479b384ce073169f6d2f344e792a26240cfa9f0250980ba1a0d9f59471ff5f
7
+ data.tar.gz: a38fef07e4db35059c41363f20061a4fe28843f513e508752d148b2f1f1dc157e85087c67fe3468c45c64a1f03a7866c0b380bf33f50c0e1723bc006ec6e92bb
data/CHANGELOG.markdown CHANGED
@@ -1,3 +1,9 @@
1
+ #### v1.1.0
2
+
3
+ * Allow arguments after `--` to be passed to `gem install`
4
+
5
+ > https://github.com/sportngin/brew-gem/pull/67
6
+
1
7
  #### v1.0.0
2
8
 
3
9
  * Fix homebrew ruby path (thanks Kaleb Lape)
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 to_args
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.to_args.shelljoin} #{filename}"
129
+ system "brew #{arguments.to_brew_args.shelljoin} --formula #{filename}"
117
130
  exit $?.exitstatus unless $?.success?
118
131
  end
119
132
  end
@@ -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
 
@@ -1,5 +1,5 @@
1
1
  module Brew
2
2
  module Gem
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
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.0.0
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: 2019-03-29 00:00:00.000000000 Z
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
- rubyforge_project:
116
- rubygems_version: 2.7.4
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: []