rubinjam 0.5.1 → 0.6.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: 352528474106c74c5ec74fd6b7fc8785d4ea73d1
4
- data.tar.gz: 32437116794027bd101b3039949f25e28bef582d
3
+ metadata.gz: 16e1a95902b0ae96f7958bcc3bcae3ece2e8e0d5
4
+ data.tar.gz: cb9a318a818923447b55eba4818937da5bbe379a
5
5
  SHA512:
6
- metadata.gz: 3adaf88e521ce70e5b169abbba87f351a845c378691c0129248865e70a2f85616543a5e66dd314999b896f1d4b99848473c3face09cd7cd937bcb3e914a9c88d
7
- data.tar.gz: 7eda2b3a6765e7314d2f5a0b958f1f7f59e0e1e3efc2f2f5bfc7729b39f732ea8f3759d10de11660a827fd76b67bf68822e4cbdbdcae601df0d9656780e8d846
6
+ metadata.gz: 2bbf2dae2a452d2fa1d086a041748b19cda0c015d8114f1576cc806b2c5c77cd396d1191ace604d05166428baeeb00614980cbe2186cb9f5e6dbaa9398630426
7
+ data.tar.gz: 0de50fa021af6a5dd339c8d3c496974c4727870e321b70eab66f420380a7e07faba7de840a0f351a72b5ce92a920763fdb2b1de9eb90c12ffe2e247817f995ae
@@ -1,3 +1,3 @@
1
1
  module Rubinjam
2
- VERSION = "0.5.1"
2
+ VERSION = "0.6.0"
3
3
  end
data/lib/rubinjam.rb CHANGED
@@ -6,6 +6,7 @@ module Rubinjam
6
6
  HEADER = '#!/usr/bin/env ruby'.freeze
7
7
 
8
8
  class << self
9
+ # pack a directory
9
10
  def pack(dir)
10
11
  Dir.chdir(dir) do
11
12
  binaries = Dir["bin/*"]
@@ -16,6 +17,7 @@ module Rubinjam
16
17
  end
17
18
  end
18
19
 
20
+ # pack a gem
19
21
  def pack_gem(gem, version=nil)
20
22
  require "shellwords"
21
23
  require "rubygems/package"
@@ -24,13 +26,13 @@ module Rubinjam
24
26
  Dir.chdir(dir) do
25
27
  # fetch
26
28
  command = "gem fetch #{Shellwords.escape(gem)}"
27
- command << " -v" << version if version
29
+ command << " -v" << Shellwords.escape(version) if version
28
30
  sh(command)
29
31
 
30
32
  # load spec
31
33
  gem_ball = Dir["*.gem"].first
32
34
  spec = Gem::Package.new(gem_ball).spec.to_ruby
33
- sh("gem unpack #{gem_ball}")
35
+ sh("gem unpack #{Shellwords.escape(gem_ball)}")
34
36
 
35
37
  # bundle
36
38
  Dir.chdir(gem_ball.sub(".gem", "")) do
@@ -44,7 +46,9 @@ module Rubinjam
44
46
  private
45
47
 
46
48
  def libraries
47
- libs_from_paths(["lib"]).merge!(gem_libraries).merge!("rubinjam/internal" => internal_code)
49
+ libs_from_paths(["lib"]).
50
+ merge!(gem_libraries).
51
+ merge!("rubinjam/internal" => internal_code)
48
52
  end
49
53
 
50
54
  def internal_code
@@ -55,14 +59,21 @@ module Rubinjam
55
59
  end
56
60
  end
57
61
 
62
+ # unpack dependent gems with bundler so we can pack them
63
+ # this takes a while so we try to avoid if possible
58
64
  def gem_libraries
59
65
  return {} unless gemspec = Dir["*.gemspec"].first
60
- return {} unless File.read(gemspec) =~ /add_(runtime_)?dependency/
66
+
67
+ dependency = "add_(runtime_)?dependency"
68
+ content = File.read(gemspec)
69
+ content.gsub!(/.*#{dependency}.*['"\{\<]json['">\}].*/, '')
70
+ content.gsub!(/.*add_development_dependency.*/, "")
71
+ return {} unless content =~ /#{dependency}/
61
72
 
62
73
  Dir.mktmpdir do |dir|
63
74
  sh "cp -R . #{dir}/"
64
75
  Dir.chdir(dir) do
65
- write gemspec, File.read(gemspec).gsub(/.*add_development_dependency.*/, "")
76
+ write gemspec, content
66
77
  write "Gemfile", <<-RUBY.gsub(/^ /, "")
67
78
  source "https://rubygems.org"
68
79
  gemspec
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubinjam
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-09 00:00:00.000000000 Z
11
+ date: 2017-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -56,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
56
  version: '0'
57
57
  requirements: []
58
58
  rubyforge_project:
59
- rubygems_version: 2.2.2
59
+ rubygems_version: 2.5.1
60
60
  signing_key:
61
61
  specification_version: 4
62
62
  summary: Jam a gem into a universal binary that works with any ruby