brew-gem 0.7.3 → 0.8.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
  SHA1:
3
- metadata.gz: 0b98d4bf81184caf4b20bbd22da2e1330ab15af4
4
- data.tar.gz: 1b71b15e529c93502d8c15b536748bd0137a54bc
3
+ metadata.gz: ff47bde472a2c913a8fd3db706664b2175077952
4
+ data.tar.gz: 85fb227c6650b78ff73c3652b9ddd58c5f91b73d
5
5
  SHA512:
6
- metadata.gz: 3514488a6d2300184867f2a5a71f0fc4e915149fccef20733ffb60b87f14b79eae2746d5486b43eb7e3adfe2b0a0e82d226642bb13e33f4a4b63701547f26d60
7
- data.tar.gz: 02e8d8d7c198fbfb06bd83a435a19d49936be6716792d660c4882313aedeec85af511f4625b9fd50a7babeef717098064f18f2b3ff6be57921b46a88dc2a0a14
6
+ metadata.gz: 6c010deb7ea8d23ccad502bbd57da4894e06bef318e3bb070033cb50d98986bcd634c2d11dbfc7c9629b33d9ed425df819c131f86ef0b0e3d3772c70ba0facf1
7
+ data.tar.gz: 4c6aa78d44f6af619e6d1598ee9f111c4eca4e62a9008e49de90ce3d32272a2bb8ebcac1ed8cd7e517a6abc0a9d7f7ffb82ae4eb7f667e1a2a7d5158a851df93
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ *.gem
@@ -0,0 +1 @@
1
+ brew-gem
data/Gemfile CHANGED
@@ -1,4 +1,5 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in brew-gem.gemspec
4
+ gem 'rake', '~>11.0'
4
5
  gemspec
data/README.md CHANGED
@@ -59,11 +59,19 @@ Usage
59
59
  To install a specific version:
60
60
 
61
61
  brew gem install heroku 3.8.3
62
-
62
+
63
+ To install using a brew installed ruby(/usr/local/bin/ruby):
64
+
65
+ brew gem install heroku --homebrew-ruby
66
+
67
+ And with a specific version:
68
+
69
+ brew gem install heroku 3.8.3 --homebrew-ruby
70
+
63
71
  To upgrade:
64
72
 
65
73
  brew gem upgrade heroku
66
-
74
+
67
75
  To uninstall:
68
76
 
69
77
  brew gem uninstall heroku
@@ -16,7 +16,7 @@ Gem::Specification.new do |spec|
16
16
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
17
17
  # to allow pushing to a single host or delete this section to allow pushing to any host.
18
18
  if spec.respond_to?(:metadata)
19
- spec.metadata['allowed_push_host'] = "https://rubygems.org/"
19
+ spec.metadata['allowed_push_host'] = "https://rubygems.org"
20
20
  else
21
21
  raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
22
22
  end
@@ -38,10 +38,10 @@ module Brew::Gem::CLI
38
38
  exit 0
39
39
  end
40
40
 
41
- args[0..2]
41
+ args[0..3]
42
42
  end
43
43
 
44
- def expand_formula(name, version)
44
+ def expand_formula(name, version, use_homebrew_ruby=false)
45
45
  klass = 'Gem' + name.capitalize.gsub(/[-_.\s]([a-zA-Z0-9])/) { $1.upcase }.gsub('+', 'x')
46
46
  user_gemrc = "#{ENV['HOME']}/.gemrc"
47
47
  template_file = File.expand_path('../formula.rb.erb', __FILE__)
@@ -49,11 +49,11 @@ module Brew::Gem::CLI
49
49
  template.result(binding)
50
50
  end
51
51
 
52
- def with_temp_formula(name, version)
52
+ def with_temp_formula(name, version, use_homebrew_ruby)
53
53
  filename = File.join Dir.tmpdir, "gem-#{name}.rb"
54
54
 
55
55
  open(filename, 'w') do |f|
56
- f.puts expand_formula(name, version)
56
+ f.puts expand_formula(name, version, use_homebrew_ruby)
57
57
  end
58
58
 
59
59
  yield filename
@@ -62,11 +62,18 @@ module Brew::Gem::CLI
62
62
  end
63
63
 
64
64
  def run(args = ARGV)
65
- command, name, supplied_version = process_args(args)
65
+ command, name, supplied_version, homebrew_ruby = process_args(args)
66
+ homebrew_ruby_flag = "--homebrew-ruby"
67
+ if supplied_version == homebrew_ruby_flag
68
+ supplied_version = nil
69
+ homebrew_ruby = homebrew_ruby_flag
70
+ end
71
+
72
+ use_homebrew_ruby = homebrew_ruby == homebrew_ruby_flag
66
73
 
67
74
  version = fetch_version(name, supplied_version)
68
75
 
69
- with_temp_formula(name, version) do |filename|
76
+ with_temp_formula(name, version, use_homebrew_ruby) do |filename|
70
77
  system "brew #{command} #{filename}"
71
78
  end
72
79
  end
@@ -36,7 +36,11 @@ class <%= klass %> < Formula
36
36
  # they might not be there if, say, we change to a different rvm gemset
37
37
  ENV['GEM_HOME']="#{prefix}"
38
38
  ENV['GEM_PATH']="#{prefix}"
39
- system "gem", "install", cached_download,
39
+
40
+ rubybindir = '<%= use_homebrew_ruby ? "/usr/local/bin" : "/usr/bin" %>'
41
+ gem_path = "#{rubybindir}/gem"
42
+ ruby_path = "#{rubybindir}/ruby"
43
+ system gem_path, "install", cached_download,
40
44
  "--no-ri",
41
45
  "--no-rdoc",
42
46
  "--no-wrapper",
@@ -67,7 +71,7 @@ class <%= klass %> < Formula
67
71
  file = Pathname.new("#{brew_gem_prefix}/#{gemspec.bindir}/#{exe}")
68
72
  (bin+file.basename).open('w') do |f|
69
73
  f << <<-RUBY
70
- #!/usr/bin/ruby
74
+ #!#{ruby_path}
71
75
  ENV['GEM_HOME']="#{prefix}"
72
76
  ENV['GEM_PATH']="#{prefix}"
73
77
  $:.unshift(#{ruby_libs.map(&:inspect).join(",")})
@@ -1,5 +1,5 @@
1
1
  module Brew
2
2
  module Gem
3
- VERSION = "0.7.3"
3
+ VERSION = "0.8.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: 0.7.3
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Sieger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-18 00:00:00.000000000 Z
11
+ date: 2016-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -78,6 +78,7 @@ files:
78
78
  - ".gitignore"
79
79
  - ".octopolo.yml"
80
80
  - ".rspec"
81
+ - ".ruby-gemset"
81
82
  - ".ruby-version"
82
83
  - ".travis.yml"
83
84
  - Gemfile
@@ -93,7 +94,7 @@ files:
93
94
  homepage: https://github.com/sportngin/brew-gem
94
95
  licenses: []
95
96
  metadata:
96
- allowed_push_host: https://rubygems.org/
97
+ allowed_push_host: https://rubygems.org
97
98
  post_install_message:
98
99
  rdoc_options: []
99
100
  require_paths: