gem-compiler 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 59169d53e08c6315d2d6dd219c2ca65998cbaf36
4
+ data.tar.gz: 409e30463beab8bc6704d453cb19b47071c71e5c
5
+ SHA512:
6
+ metadata.gz: c9bcc65c52d554ccf58466a524744ef68b0034ceda7dc48c344ad1979ab10c46e644347fcfdeaac4b50d082fbac5d009d71f513e6cd8386c576a2248b7ed646c
7
+ data.tar.gz: 6bc96ffa4aa473e9a5382af54ba1105da3b4f6c043285fc621c38a1f37e7e0ef859286df01d597d5f087b842b57985a3ad7c04e71e2f2b4eb05841c6a2a50ce9
data/History.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # gem-compiler
2
2
 
3
+ ## 0.4.0 (2015-07-18)
4
+
5
+ - Introduce `--prune` option to cleanup gemspecs. Thanks to @androbtech [#13]
6
+ - Test builds on both Travis (Linux) and AppVeyor (Windows) environments.
7
+
3
8
  ## 0.3.0 (2014-04-19)
4
9
 
5
10
  - Support RubyGems 2.2.x thanks to @drbrain
data/README.md CHANGED
@@ -3,7 +3,8 @@
3
3
  A RubyGems plugin that generates binary (pre-compiled) gems.
4
4
 
5
5
  [![Gem Version](https://badge.fury.io/rb/gem-compiler.svg)](http://badge.fury.io/rb/gem-compiler)
6
- [![Build Status](https://travis-ci.org/luislavena/gem-compiler.svg?branch=master)](https://travis-ci.org/luislavena/gem-compiler)
6
+ [![Travis status](https://travis-ci.org/luislavena/gem-compiler.svg?branch=master)](https://travis-ci.org/luislavena/gem-compiler)
7
+ [![AppVeyor status](https://ci.appveyor.com/api/projects/status/2mo41n9ltsoe3rn1/branch/master?svg=true)](https://ci.appveyor.com/project/luislavena/gem-compiler/branch/master)
7
8
  [![Code Climate](http://img.shields.io/codeclimate/github/luislavena/gem-compiler.svg)](https://codeclimate.com/github/luislavena/gem-compiler)
8
9
 
9
10
  - [home](https://github.com/luislavena/gem-compiler)
@@ -69,6 +70,30 @@ This new gem do not require a compiler, as shown when locally installed:
69
70
  Successfully installed yajl-ruby-1.1.0-x86-mingw32
70
71
  1 gem installed
71
72
 
73
+ There are native gems that will invalidate their own specification after
74
+ compile process completes. This will not permit them be repackaged as binary
75
+ gems. To workaround this problem you have the option to *prune* the package
76
+ process:
77
+
78
+ $ gem fetch nokogiri --platform=ruby
79
+
80
+ Fetching: nokogiri-1.6.6.2.gem (100%)
81
+ Downloaded nokogiri-1.6.6.2
82
+
83
+ $ gem compile nokogiri-1.6.6.2.gem --prune
84
+
85
+ Unpacking gem: 'nokogiri-1.6.6.2' in temporary directory...
86
+ Building native extensions. This could take a while...
87
+ Successfully built RubyGem
88
+ Name: nokogiri
89
+ Version: 1.6.6.2
90
+ File: nokogiri-1.6.6.2-x86_64-darwin-12.gem
91
+
92
+ $ gem install --local nokogiri-1.6.6.2-x86_64-darwin-12.gem
93
+
94
+ Successfully installed nokogiri-1.6.6.2-x86_64-darwin-12
95
+ 1 gem installed
96
+
72
97
  ### Compiling from Rake
73
98
 
74
99
  Most of the times, as gem developer, you would like to generate both kind of
data/Rakefile CHANGED
@@ -5,23 +5,32 @@ gemspec = Gem::Specification.load("gem-compiler.gemspec")
5
5
  Gem::PackageTask.new(gemspec) do |pkg|
6
6
  end
7
7
 
8
+ desc "Environment information"
9
+ task :info do
10
+ puts "Ruby: #{RUBY_VERSION}"
11
+ puts "RubyGems: #{Gem::VERSION}"
12
+ puts "$LOAD_PATH: #{$LOAD_PATH.join(File::PATH_SEPARATOR)}"
13
+ puts "---" * 10
14
+ puts "PATH: #{ENV['PATH']}"
15
+ puts "RUBYOPT: #{ENV['RUBYOPT']}"
16
+ puts "RUBYLIB: #{ENV['RUBYLIB']}"
17
+ puts "GEM_HOME: #{ENV['GEM_HOME']}"
18
+ puts "GEM_PATH: #{ENV['GEM_PATH']}"
19
+
20
+ # List any Bundle specific information
21
+ ENV.select { |k, _| k =~ /BUNDLE/ }.each do |key, value|
22
+ puts "#{key}: #{value}"
23
+ end
24
+
25
+ puts "---" * 10
26
+ end
27
+
8
28
  desc "Run tests"
9
- task :test do
29
+ task :test => [:info] do
10
30
  lib_dirs = ["lib", "test"].join(File::PATH_SEPARATOR)
11
31
  test_files = FileList["test/**/test*.rb"].gsub("test/", "")
12
32
 
13
- puts "Ruby #{RUBY_VERSION}"
14
- puts "RubyGems #{Gem::VERSION}"
15
-
16
33
  ruby "-I#{lib_dirs} -e \"ARGV.each { |f| require f }\" #{test_files}"
17
34
  end
18
35
 
19
- desc "Sets up the test environment"
20
- task :setup do
21
- if ENV["USE_RUBYGEMS"]
22
- sh "gem update -q --system #{ENV["USE_RUBYGEMS"]}"
23
- puts "Using RubyGems #{`gem --version`}"
24
- end
25
- end
26
-
27
36
  task :default => [:test]
@@ -4,6 +4,10 @@ class Gem::Commands::CompileCommand < Gem::Command
4
4
  def initialize
5
5
  super "compile", "Create binary pre-compiled gem",
6
6
  :output => Dir.pwd
7
+
8
+ add_option "--prune", "Clean non-existing files during re-packaging" do |value, options|
9
+ options[:prune] = true
10
+ end
7
11
  end
8
12
 
9
13
  def arguments
@@ -38,6 +38,11 @@ class Gem::Compiler
38
38
  # build a new gemspec from the original one
39
39
  gemspec = installer.spec.dup
40
40
 
41
+ # remove any non-existing files
42
+ if @options[:prune]
43
+ gemspec.files.reject! { |f| !File.exist?("#{target_dir}/#{f}") }
44
+ end
45
+
41
46
  # add discovered artifacts
42
47
  artifacts.each do |path|
43
48
  # path needs to be relative to target_dir
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gem
4
4
  class Compiler
5
- VERSION = "0.3.0"
5
+ VERSION = "0.4.0"
6
6
  end
7
7
  end
@@ -1,5 +1,6 @@
1
1
  require "rubygems/test_case"
2
2
  require "rubygems/commands/compile_command"
3
+ require "rubygems/package"
3
4
 
4
5
  class TestGemCommandsCompileCommand < Gem::TestCase
5
6
  def setup
@@ -59,6 +59,34 @@ class TestGemCompiler < Gem::TestCase
59
59
  assert_path_exists File.join(@output_dir, "a-1-x86-mingw32.gem")
60
60
  end
61
61
 
62
+ def test_compile_succeed_using_prune
63
+ name = 'a'
64
+
65
+ artifact = "#{name}.#{RbConfig::CONFIG["DLEXT"]}"
66
+ old_spec = ''
67
+
68
+ gem_file = util_bake_gem(name, 'ports/to_be_deleted_during_ext_build.patch') { |spec|
69
+ old_spec = spec
70
+ util_fake_extension spec, name, <<-EOF
71
+ require 'fileutils'
72
+ FileUtils.rm File.expand_path(File.join(File.dirname(__FILE__), '../../ports/to_be_deleted_during_ext_build.patch'))
73
+ #{util_custom_configure(artifact)}
74
+ EOF
75
+ }
76
+
77
+ compiler = Gem::Compiler.new(gem_file, :output => @output_dir, :prune => true)
78
+ output_gem = nil
79
+
80
+ use_ui @ui do
81
+ output_gem = compiler.compile
82
+ end
83
+
84
+ assert_path_exists File.join(@output_dir, output_gem)
85
+ actual_spec = util_read_spec File.join(@output_dir, output_gem)
86
+
87
+ refute actual_spec.files.include? "ports/to_be_deleted_during_ext_build.patch"
88
+ end
89
+
62
90
  def test_compile_bundle_artifacts
63
91
  util_reset_arch
64
92
 
metadata CHANGED
@@ -1,67 +1,52 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: gem-compiler
3
- version: !ruby/object:Gem::Version
4
- hash: 19
5
- prerelease:
6
- segments:
7
- - 0
8
- - 3
9
- - 0
10
- version: 0.3.0
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.4.0
11
5
  platform: ruby
12
- authors:
6
+ authors:
13
7
  - Luis Lavena
14
8
  autorequire:
15
9
  bindir: bin
16
10
  cert_chain: []
17
-
18
- date: 2014-04-19 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
11
+ date: 2015-07-19 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
21
14
  name: rake
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
24
- none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 11
29
- segments:
30
- - 0
31
- - 9
32
- - 2
33
- - 2
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
34
19
  version: 0.9.2.2
35
20
  type: :development
36
- version_requirements: *id001
37
- - !ruby/object:Gem::Dependency
38
- name: minitest
39
21
  prerelease: false
40
- requirement: &id002 !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: 0.9.2.2
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
43
31
  - - ~>
44
- - !ruby/object:Gem::Version
45
- hash: 27
46
- segments:
47
- - 4
48
- - 0
49
- version: "4.0"
32
+ - !ruby/object:Gem::Version
33
+ version: '4.0'
50
34
  type: :development
51
- version_requirements: *id002
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '4.0'
52
41
  description: |
53
42
  A RubyGems plugin that helps generates binary gems from already existing
54
43
  ones without altering the original source code. It compiles Ruby C
55
44
  extensions and bundles the result into a new gem.
56
-
57
45
  email: luislavena@gmail.com
58
46
  executables: []
59
-
60
47
  extensions: []
61
-
62
48
  extra_rdoc_files: []
63
-
64
- files:
49
+ files:
65
50
  - README.md
66
51
  - History.md
67
52
  - Rakefile
@@ -72,41 +57,27 @@ files:
72
57
  - test/rubygems/test_gem_commands_compile_command.rb
73
58
  - test/rubygems/test_gem_compiler.rb
74
59
  homepage: https://github.com/luislavena/gem-compiler
75
- licenses:
60
+ licenses:
76
61
  - MIT
62
+ metadata: {}
77
63
  post_install_message:
78
64
  rdoc_options: []
79
-
80
- require_paths:
65
+ require_paths:
81
66
  - lib
82
- required_ruby_version: !ruby/object:Gem::Requirement
83
- none: false
84
- requirements:
85
- - - ">="
86
- - !ruby/object:Gem::Version
87
- hash: 57
88
- segments:
89
- - 1
90
- - 8
91
- - 7
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - '>='
70
+ - !ruby/object:Gem::Version
92
71
  version: 1.8.7
93
- required_rubygems_version: !ruby/object:Gem::Requirement
94
- none: false
95
- requirements:
96
- - - ">="
97
- - !ruby/object:Gem::Version
98
- hash: 7
99
- segments:
100
- - 1
101
- - 8
102
- - 24
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - '>='
75
+ - !ruby/object:Gem::Version
103
76
  version: 1.8.24
104
77
  requirements: []
105
-
106
78
  rubyforge_project:
107
- rubygems_version: 1.8.25
79
+ rubygems_version: 2.0.14
108
80
  signing_key:
109
- specification_version: 3
81
+ specification_version: 4
110
82
  summary: A RubyGems plugin that generates binary gems.
111
83
  test_files: []
112
-