gem-compiler 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +1 -0
- data/History.md +14 -0
- data/README.md +27 -28
- data/lib/rubygems/commands/compile_command.rb +2 -2
- data/lib/rubygems/compiler.rb +68 -30
- data/rakefile.rb +32 -6
- data/test/rubygems/test_gem_commands_compile_command.rb +22 -0
- data/test/rubygems/test_gem_compiler.rb +160 -0
- metadata +44 -8
data/.gemtest
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
|
data/History.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# gem-compiler
|
2
|
+
|
3
|
+
## 0.2.0 (2013-04-28)
|
4
|
+
|
5
|
+
- Support RubyGems 2.0.0 thanks to @mgoggin [#6]
|
6
|
+
|
7
|
+
## 0.1.1 (2012-05-07)
|
8
|
+
|
9
|
+
- Loose requirements to allow installation on Ruby 1.8.7 or greater. You
|
10
|
+
still need RubyGems 1.8.24
|
11
|
+
|
12
|
+
## 0.1.0 (2012-05-06)
|
13
|
+
|
14
|
+
- Initial public release, extracted from internal project.
|
data/README.md
CHANGED
@@ -1,20 +1,24 @@
|
|
1
1
|
# gem-compiler
|
2
2
|
|
3
|
-
A RubyGems plugin that generates binary pre-compiled gems.
|
3
|
+
A RubyGems plugin that generates binary (pre-compiled) gems.
|
4
|
+
|
5
|
+
[![Gem Version](https://badge.fury.io/rb/gem-compiler.png)](http://badge.fury.io/rb/gem-compiler)
|
6
|
+
[![Build Status](https://travis-ci.org/luislavena/gem-compiler.png?branch=master)](https://travis-ci.org/luislavena/gem-compiler)
|
7
|
+
[![Code Climate](https://codeclimate.com/github/luislavena/gem-compiler.png)](https://codeclimate.com/github/luislavena/gem-compiler)
|
4
8
|
|
5
9
|
- [home](https://github.com/luislavena/gem-compiler)
|
6
10
|
- [bugs](https://github.com/luislavena/gem-compiler/issues)
|
7
11
|
|
8
12
|
## Description
|
9
13
|
|
10
|
-
`gem-compiler` is a RubyGems plugin that helps generates binary
|
11
|
-
|
12
|
-
|
14
|
+
`gem-compiler` is a RubyGems plugin that helps generates binary gems from
|
15
|
+
already existing ones without altering the original source code. It compiles
|
16
|
+
Ruby C extensions and bundles the result into a new gem.
|
13
17
|
|
14
18
|
It uses an *outside-in* approach and leverages on existing RubyGems code to
|
15
19
|
do it.
|
16
20
|
|
17
|
-
The result of the compilation is a gem built for your current platform,
|
21
|
+
The result of the compilation is a binary gem built for your current platform,
|
18
22
|
skipping the need of a compiler toolchain when installing it.
|
19
23
|
|
20
24
|
## Installation
|
@@ -26,15 +30,11 @@ To install gem-compiler you need to use RubyGems:
|
|
26
30
|
Which will fetch and install the plugin. After that the `compile` command
|
27
31
|
will be available through `gem`.
|
28
32
|
|
29
|
-
## Features
|
30
|
-
|
31
|
-
gem-compiler is a one trick pony. It adds a single command `compile` to
|
32
|
-
RubyGems.
|
33
|
-
|
34
|
-
Using that command, you can generate a binary from an existing gem.
|
35
|
-
|
36
33
|
## Usage
|
37
34
|
|
35
|
+
As requirement, gem-compiler can only compile local gems, either one you have
|
36
|
+
generated from your projects or previously downloaded.
|
37
|
+
|
38
38
|
### Fetching a gem
|
39
39
|
|
40
40
|
If you don't have the gem locally, you can use `fetch` to retrieve it first:
|
@@ -43,8 +43,8 @@ If you don't have the gem locally, you can use `fetch` to retrieve it first:
|
|
43
43
|
Fetching: yajl-ruby-1.1.0.gem (100%)
|
44
44
|
Downloaded yajl-ruby-1.1.0
|
45
45
|
|
46
|
-
Please note that I was
|
47
|
-
RubyGems attempt to download any existing
|
46
|
+
Please note that I was explicit about which platform to fetch. This will
|
47
|
+
avoid RubyGems attempt to download any existing binary gem for my current
|
48
48
|
platform.
|
49
49
|
|
50
50
|
### Compiling a gem
|
@@ -54,7 +54,7 @@ You need to tell RubyGems the filename of the gem you want to compile:
|
|
54
54
|
$ gem compile yajl-ruby-1.1.0.gem
|
55
55
|
|
56
56
|
The above command will unpack, compile any existing extensions found and
|
57
|
-
|
57
|
+
repackage everything as a binary gem:
|
58
58
|
|
59
59
|
Unpacking gem: 'yajl-ruby-1.1.0' in temporary directory...
|
60
60
|
Building native extensions. This could take a while...
|
@@ -63,8 +63,7 @@ generate a pre-compiled binary:
|
|
63
63
|
Version: 1.1.0
|
64
64
|
File: yajl-ruby-1.1.0-x86-mingw32.gem
|
65
65
|
|
66
|
-
|
67
|
-
build process:
|
66
|
+
This new gem do not require a compiler, as shown when locally installed:
|
68
67
|
|
69
68
|
C:\> gem install --local yajl-ruby-1.1.0-x86-mingw32.gem
|
70
69
|
Successfully installed yajl-ruby-1.1.0-x86-mingw32
|
@@ -72,7 +71,7 @@ build process:
|
|
72
71
|
|
73
72
|
### Compiling from Rake
|
74
73
|
|
75
|
-
Most of the times, as gem developer, you would like to
|
74
|
+
Most of the times, as gem developer, you would like to generate both kind of
|
76
75
|
gems at once. For that purpose, you can add a task for Rake similar to the
|
77
76
|
one below:
|
78
77
|
|
@@ -83,8 +82,8 @@ task "gem:native" => ["gem"] do
|
|
83
82
|
end
|
84
83
|
```
|
85
84
|
|
86
|
-
Of course, that assumes you have a task `gem` that generates the gem
|
87
|
-
|
85
|
+
Of course, that assumes you have a task `gem` that generates the base gem
|
86
|
+
required.
|
88
87
|
|
89
88
|
## Requirements
|
90
89
|
|
@@ -107,8 +106,8 @@ right one.
|
|
107
106
|
### If you're using Windows
|
108
107
|
|
109
108
|
For those using RubyInstaller-based builds, you will need to download the
|
110
|
-
DevKit from
|
111
|
-
follow the [installation instructions](https://github.com/oneclick/rubyinstaller/wiki/Development-Kit).
|
109
|
+
DevKit from their [downloads page](http://rubyinstaller.org/downloads)
|
110
|
+
and follow the [installation instructions](https://github.com/oneclick/rubyinstaller/wiki/Development-Kit).
|
112
111
|
|
113
112
|
To be sure your installation of Ruby is based on RubyInstaller, execute at
|
114
113
|
the command prompt:
|
@@ -141,13 +140,13 @@ projects by snapping your fingers :wink:
|
|
141
140
|
The following are the list of features I would like to implement at some
|
142
141
|
point:
|
143
142
|
|
144
|
-
|
143
|
+
- Cross compile gems to any platform that Ruby can run
|
145
144
|
(e.g. from Linux/OSX to Windows, x86 to x64, x86 Linux to ARM Linux, etc)
|
146
145
|
|
147
|
-
|
146
|
+
- Create multiple gems from the same build
|
148
147
|
(e.g. target both x86-mswin32-60 and x86-mingw32)
|
149
148
|
|
150
|
-
|
149
|
+
- Ability to build fat-binaries targeting both Ruby 1.8 and 1.9.x,
|
151
150
|
placing automatic stubs to handle extension loading.
|
152
151
|
|
153
152
|
## License
|
@@ -155,7 +154,7 @@ placing automatic stubs to handle extension loading.
|
|
155
154
|
(The MIT License)
|
156
155
|
|
157
156
|
Copyright (c) Luis Lavena
|
158
|
-
|
157
|
+
|
159
158
|
Permission is hereby granted, free of charge, to any person obtaining
|
160
159
|
a copy of this software and associated documentation files (the
|
161
160
|
'Software'), to deal in the Software without restriction, including
|
@@ -163,10 +162,10 @@ placing automatic stubs to handle extension loading.
|
|
163
162
|
distribute, sublicense, and/or sell copies of the Software, and to
|
164
163
|
permit persons to whom the Software is furnished to do so, subject to
|
165
164
|
the following conditions:
|
166
|
-
|
165
|
+
|
167
166
|
The above copyright notice and this permission notice shall be
|
168
167
|
included in all copies or substantial portions of the Software.
|
169
|
-
|
168
|
+
|
170
169
|
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
171
170
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
172
171
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
@@ -20,12 +20,12 @@ class Gem::Commands::CompileCommand < Gem::Command
|
|
20
20
|
# no gem, no binary
|
21
21
|
unless gemfile
|
22
22
|
raise Gem::CommandLineError,
|
23
|
-
"Please specify a gem file on the command line (e.g. #{program_name} foo-0.1.0.gem"
|
23
|
+
"Please specify a gem file on the command line (e.g. #{program_name} foo-0.1.0.gem)"
|
24
24
|
end
|
25
25
|
|
26
26
|
require "rubygems/compiler"
|
27
27
|
|
28
|
-
compiler = Gem::Compiler.new(gemfile, options
|
28
|
+
compiler = Gem::Compiler.new(gemfile, options)
|
29
29
|
compiler.compile
|
30
30
|
end
|
31
31
|
end
|
data/lib/rubygems/compiler.rb
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
require "rbconfig"
|
2
2
|
require "tmpdir"
|
3
3
|
require "rubygems/installer"
|
4
|
-
|
4
|
+
|
5
|
+
unless Gem::VERSION >= "2.0.0"
|
6
|
+
require "rubygems/builder"
|
7
|
+
else
|
8
|
+
require "rubygems/package"
|
9
|
+
end
|
10
|
+
|
5
11
|
require "fileutils"
|
6
12
|
|
7
13
|
class Gem::Compiler
|
@@ -10,34 +16,16 @@ class Gem::Compiler
|
|
10
16
|
# raise when there is a error
|
11
17
|
class CompilerError < Gem::InstallError; end
|
12
18
|
|
13
|
-
|
19
|
+
attr_reader :tmp_dir, :target_dir, :options
|
20
|
+
|
21
|
+
def initialize(gemfile, _options = {})
|
14
22
|
@gemfile = gemfile
|
15
|
-
@output_dir =
|
23
|
+
@output_dir = _options.delete(:output)
|
24
|
+
@options = _options
|
16
25
|
end
|
17
26
|
|
18
27
|
def compile
|
19
|
-
|
20
|
-
|
21
|
-
# Hmm, gem already compiled?
|
22
|
-
if installer.spec.platform != Gem::Platform::RUBY
|
23
|
-
raise CompilerError,
|
24
|
-
"The gem file seems to be compiled already."
|
25
|
-
end
|
26
|
-
|
27
|
-
# Hmm, no extensions?
|
28
|
-
if installer.spec.extensions.empty?
|
29
|
-
raise CompilerError,
|
30
|
-
"There are no extensions to build on this gem file."
|
31
|
-
end
|
32
|
-
|
33
|
-
tmpdir = Dir.mktmpdir
|
34
|
-
basename = File.basename(@gemfile, '.gem')
|
35
|
-
target_dir = File.join(tmpdir, basename)
|
36
|
-
|
37
|
-
# unpack gem sources into target_dir
|
38
|
-
# We need the basename to keep the unpack happy
|
39
|
-
say "Unpacking gem: '#{basename}' in temporary directory..." if Gem.configuration.verbose
|
40
|
-
installer.unpack(target_dir)
|
28
|
+
unpack
|
41
29
|
|
42
30
|
# build extensions
|
43
31
|
installer.build_extensions
|
@@ -56,7 +44,7 @@ class Gem::Compiler
|
|
56
44
|
# path needs to be relative to target_dir
|
57
45
|
file = path.gsub("#{target_dir}/", "")
|
58
46
|
|
59
|
-
|
47
|
+
debug "Adding '#{file}' to gemspec"
|
60
48
|
gemspec.files.push file
|
61
49
|
end
|
62
50
|
|
@@ -70,8 +58,11 @@ class Gem::Compiler
|
|
70
58
|
output_gem = nil
|
71
59
|
|
72
60
|
Dir.chdir target_dir do
|
73
|
-
|
74
|
-
|
61
|
+
output_gem = if defined?(Gem::Builder)
|
62
|
+
Gem::Builder.new(gemspec).build
|
63
|
+
else
|
64
|
+
Gem::Package.build(gemspec)
|
65
|
+
end
|
75
66
|
end
|
76
67
|
|
77
68
|
unless output_gem
|
@@ -82,10 +73,57 @@ class Gem::Compiler
|
|
82
73
|
# move the built gem to the original output directory
|
83
74
|
FileUtils.mv File.join(target_dir, output_gem), @output_dir
|
84
75
|
|
85
|
-
|
86
|
-
FileUtils.rm_rf tmpdir
|
76
|
+
cleanup
|
87
77
|
|
88
78
|
# return the path of the gem
|
89
79
|
output_gem
|
90
80
|
end
|
81
|
+
|
82
|
+
private
|
83
|
+
|
84
|
+
def info(msg)
|
85
|
+
say msg if Gem.configuration.verbose
|
86
|
+
end
|
87
|
+
|
88
|
+
def debug(msg)
|
89
|
+
say msg if Gem.configuration.really_verbose
|
90
|
+
end
|
91
|
+
|
92
|
+
def installer
|
93
|
+
return @installer if @installer
|
94
|
+
|
95
|
+
@installer = Gem::Installer.new(@gemfile, options.dup.merge(:unpack => true))
|
96
|
+
|
97
|
+
# Hmm, gem already compiled?
|
98
|
+
if @installer.spec.platform != Gem::Platform::RUBY
|
99
|
+
raise CompilerError,
|
100
|
+
"The gem file seems to be compiled already."
|
101
|
+
end
|
102
|
+
|
103
|
+
# Hmm, no extensions?
|
104
|
+
if @installer.spec.extensions.empty?
|
105
|
+
raise CompilerError,
|
106
|
+
"There are no extensions to build on this gem file."
|
107
|
+
end
|
108
|
+
|
109
|
+
@installer
|
110
|
+
end
|
111
|
+
|
112
|
+
def tmp_dir
|
113
|
+
@tmp_dir ||= Dir.mktmpdir
|
114
|
+
end
|
115
|
+
|
116
|
+
def unpack
|
117
|
+
basename = File.basename(@gemfile, '.gem')
|
118
|
+
@target_dir = File.join(tmp_dir, basename)
|
119
|
+
|
120
|
+
# unpack gem sources into target_dir
|
121
|
+
# We need the basename to keep the unpack happy
|
122
|
+
info "Unpacking gem: '#{basename}' in temporary directory..."
|
123
|
+
installer.unpack(@target_dir)
|
124
|
+
end
|
125
|
+
|
126
|
+
def cleanup
|
127
|
+
FileUtils.rm_rf tmp_dir
|
128
|
+
end
|
91
129
|
end
|
data/rakefile.rb
CHANGED
@@ -3,15 +3,15 @@ require "rubygems/package_task"
|
|
3
3
|
gemspec = Gem::Specification.new do |s|
|
4
4
|
# basic
|
5
5
|
s.name = "gem-compiler"
|
6
|
-
s.version = "0.
|
6
|
+
s.version = "0.2.0"
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
8
|
|
9
9
|
# description
|
10
|
-
s.summary = "A RubyGems plugin that generates binary
|
10
|
+
s.summary = "A RubyGems plugin that generates binary gems."
|
11
11
|
s.description = <<-EOF
|
12
|
-
A RubyGems plugin that helps generates binary
|
13
|
-
|
14
|
-
|
12
|
+
A RubyGems plugin that helps generates binary gems from already existing
|
13
|
+
ones without altering the original source code. It compiles Ruby C
|
14
|
+
extensions and bundles the result into a new gem.
|
15
15
|
EOF
|
16
16
|
|
17
17
|
# project info
|
@@ -24,9 +24,35 @@ EOF
|
|
24
24
|
s.required_ruby_version = ">= 1.8.7"
|
25
25
|
s.required_rubygems_version = ">= 1.8.24"
|
26
26
|
|
27
|
+
# development dependencies
|
28
|
+
s.add_development_dependency 'rake', '~> 0.9.2.2'
|
29
|
+
s.add_development_dependency 'minitest', '~> 3.2'
|
30
|
+
|
27
31
|
# boring part
|
28
|
-
s.files = FileList["README.md", "
|
32
|
+
s.files = FileList["README.md", "History.md", "rakefile.rb",
|
33
|
+
"lib/**/*.rb", "test/**/test*.rb", ".gemtest"]
|
29
34
|
end
|
30
35
|
|
31
36
|
Gem::PackageTask.new(gemspec) do |pkg|
|
32
37
|
end
|
38
|
+
|
39
|
+
desc "Run tests"
|
40
|
+
task :test do
|
41
|
+
lib_dirs = ["lib", "test"].join(File::PATH_SEPARATOR)
|
42
|
+
test_files = FileList["test/**/test*.rb"].gsub("test/", "")
|
43
|
+
|
44
|
+
puts "Ruby #{RUBY_VERSION}"
|
45
|
+
puts "RubyGems #{Gem::VERSION}"
|
46
|
+
|
47
|
+
ruby "-I#{lib_dirs} -e \"ARGV.each { |f| require f }\" #{test_files}"
|
48
|
+
end
|
49
|
+
|
50
|
+
desc "Sets up the test environment"
|
51
|
+
task :setup do
|
52
|
+
if ENV["USE_RUBYGEMS"]
|
53
|
+
sh "gem update -q --system #{ENV["USE_RUBYGEMS"]}"
|
54
|
+
puts "Using RubyGems #{`gem --version`}"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
task :default => [:test]
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require "rubygems/test_case"
|
2
|
+
require "rubygems/commands/compile_command"
|
3
|
+
|
4
|
+
class TestGemCommandsCompileCommand < Gem::TestCase
|
5
|
+
def setup
|
6
|
+
super
|
7
|
+
|
8
|
+
@cmd = Gem::Commands::CompileCommand.new
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_execute_no_gem
|
12
|
+
@cmd.options[:args] = []
|
13
|
+
|
14
|
+
e = assert_raises Gem::CommandLineError do
|
15
|
+
use_ui @ui do
|
16
|
+
@cmd.execute
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
assert_match /Please specify a gem file on the command line/, e.message
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,160 @@
|
|
1
|
+
require "rubygems/test_case"
|
2
|
+
require "rubygems/compiler"
|
3
|
+
|
4
|
+
class TestGemCompiler < Gem::TestCase
|
5
|
+
def setup
|
6
|
+
super
|
7
|
+
|
8
|
+
@output_dir = File.join @tempdir, 'output'
|
9
|
+
FileUtils.mkdir_p @output_dir
|
10
|
+
end
|
11
|
+
|
12
|
+
def test_compile_no_extensions
|
13
|
+
gem_file = util_bake_gem
|
14
|
+
|
15
|
+
compiler = Gem::Compiler.new(gem_file, :output => @output_dir)
|
16
|
+
|
17
|
+
e = assert_raises Gem::Compiler::CompilerError do
|
18
|
+
use_ui @ui do
|
19
|
+
compiler.compile
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
assert_equal "There are no extensions to build on this gem file.",
|
24
|
+
e.message
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_compile_non_ruby
|
28
|
+
gem_file = util_bake_gem { |s| s.platform = Gem::Platform::CURRENT }
|
29
|
+
|
30
|
+
compiler = Gem::Compiler.new(gem_file, :output => @output_dir)
|
31
|
+
|
32
|
+
e = assert_raises Gem::Compiler::CompilerError do
|
33
|
+
use_ui @ui do
|
34
|
+
compiler.compile
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
assert_equal "The gem file seems to be compiled already.", e.message
|
39
|
+
end
|
40
|
+
|
41
|
+
def test_compile_succeed
|
42
|
+
util_set_arch "i386-mingw32"
|
43
|
+
|
44
|
+
gem_file = util_bake_gem { |spec|
|
45
|
+
util_fake_extension spec
|
46
|
+
}
|
47
|
+
|
48
|
+
compiler = Gem::Compiler.new(gem_file, :output => @output_dir)
|
49
|
+
|
50
|
+
use_ui @ui do
|
51
|
+
compiler.compile
|
52
|
+
end
|
53
|
+
|
54
|
+
out = @ui.output.split "\n"
|
55
|
+
|
56
|
+
assert_match %r|Unpacking gem: 'a-1' in temporary directory...|,
|
57
|
+
out.shift
|
58
|
+
|
59
|
+
assert_path_exists File.join(@output_dir, "a-1-x86-mingw32.gem")
|
60
|
+
end
|
61
|
+
|
62
|
+
def test_compile_bundle_artifacts
|
63
|
+
util_reset_arch
|
64
|
+
|
65
|
+
artifact = "foo.#{RbConfig::CONFIG["DLEXT"]}"
|
66
|
+
|
67
|
+
gem_file = util_bake_gem("foo") { |s|
|
68
|
+
util_fake_extension s, "foo", util_custom_configure(artifact)
|
69
|
+
}
|
70
|
+
|
71
|
+
compiler = Gem::Compiler.new(gem_file, :output => @output_dir)
|
72
|
+
output_gem = nil
|
73
|
+
|
74
|
+
use_ui @ui do
|
75
|
+
output_gem = compiler.compile
|
76
|
+
end
|
77
|
+
|
78
|
+
assert_path_exists File.join(@output_dir, output_gem)
|
79
|
+
spec = util_read_spec File.join(@output_dir, output_gem)
|
80
|
+
|
81
|
+
assert_includes spec.files, "lib/#{artifact}"
|
82
|
+
end
|
83
|
+
|
84
|
+
##
|
85
|
+
# Reset RubyGems platform to original one. Useful when testing platform
|
86
|
+
# specific features (like compiled extensions)
|
87
|
+
|
88
|
+
def util_reset_arch
|
89
|
+
util_set_arch @orig_arch
|
90
|
+
end
|
91
|
+
|
92
|
+
##
|
93
|
+
# Create a real gem and return the path to it.
|
94
|
+
|
95
|
+
def util_bake_gem(name = "a", *extra, &block)
|
96
|
+
files = ["lib/#{name}.rb"].concat(extra)
|
97
|
+
|
98
|
+
spec = new_spec name, "1", nil, files, &block
|
99
|
+
|
100
|
+
File.join @tempdir, "gems", "#{spec.full_name}.gem"
|
101
|
+
end
|
102
|
+
|
103
|
+
##
|
104
|
+
# Add a fake extension to provided spec and accept an optional script.
|
105
|
+
# Default to no-op if none is provided.
|
106
|
+
|
107
|
+
def util_fake_extension(spec, name = "a", script = nil)
|
108
|
+
mkrf_conf = File.join("ext", name, "mkrf_conf.rb")
|
109
|
+
|
110
|
+
spec.extensions << mkrf_conf
|
111
|
+
|
112
|
+
dir = spec.gem_dir
|
113
|
+
FileUtils.mkdir_p dir
|
114
|
+
|
115
|
+
Dir.chdir dir do
|
116
|
+
FileUtils.mkdir_p File.dirname(mkrf_conf)
|
117
|
+
File.open mkrf_conf, "w" do |f|
|
118
|
+
if script
|
119
|
+
f.write script
|
120
|
+
else
|
121
|
+
f.write <<-EOF
|
122
|
+
File.open 'Rakefile', 'w' do |rf| rf.puts "task :default" end
|
123
|
+
EOF
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
##
|
130
|
+
# Constructor of custom configure script to be used with
|
131
|
+
# +util_fake_extension+
|
132
|
+
#
|
133
|
+
# Provided +target+ will be used to fake an empty file at default task
|
134
|
+
|
135
|
+
def util_custom_configure(target)
|
136
|
+
<<-EO_MKRF
|
137
|
+
File.open("Rakefile", "w") do |f|
|
138
|
+
f.puts <<-EOF
|
139
|
+
task :default do
|
140
|
+
lib_dir = ENV["RUBYARCHDIR"] || ENV["RUBYLIBDIR"]
|
141
|
+
touch File.join(lib_dir, #{target.inspect})
|
142
|
+
end
|
143
|
+
EOF
|
144
|
+
end
|
145
|
+
EO_MKRF
|
146
|
+
end
|
147
|
+
|
148
|
+
##
|
149
|
+
# Return the metadata (spec) from the supplied filename. IO from filename
|
150
|
+
# is closed automatically
|
151
|
+
|
152
|
+
def util_read_spec(filename)
|
153
|
+
unless Gem::VERSION >= "2.0.0"
|
154
|
+
io = File.open(filename, "rb")
|
155
|
+
Gem::Package.open(io, "r") { |x| x.metadata }
|
156
|
+
else
|
157
|
+
Gem::Package.new(filename).spec
|
158
|
+
end
|
159
|
+
end
|
160
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem-compiler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,13 +9,45 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
13
|
-
dependencies:
|
14
|
-
|
12
|
+
date: 2013-04-28 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.9.2.2
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.9.2.2
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: minitest
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '3.2'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '3.2'
|
46
|
+
description: ! 'A RubyGems plugin that helps generates binary gems from already existing
|
15
47
|
|
16
|
-
|
48
|
+
ones without altering the original source code. It compiles Ruby C
|
17
49
|
|
18
|
-
|
50
|
+
extensions and bundles the result into a new gem.
|
19
51
|
|
20
52
|
'
|
21
53
|
email: luislavena@gmail.com
|
@@ -24,10 +56,14 @@ extensions: []
|
|
24
56
|
extra_rdoc_files: []
|
25
57
|
files:
|
26
58
|
- README.md
|
59
|
+
- History.md
|
27
60
|
- rakefile.rb
|
28
61
|
- lib/rubygems/commands/compile_command.rb
|
29
62
|
- lib/rubygems/compiler.rb
|
30
63
|
- lib/rubygems_plugin.rb
|
64
|
+
- test/rubygems/test_gem_commands_compile_command.rb
|
65
|
+
- test/rubygems/test_gem_compiler.rb
|
66
|
+
- .gemtest
|
31
67
|
homepage: https://github.com/luislavena/gem-compiler
|
32
68
|
licenses:
|
33
69
|
- MIT
|
@@ -49,8 +85,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
49
85
|
version: 1.8.24
|
50
86
|
requirements: []
|
51
87
|
rubyforge_project:
|
52
|
-
rubygems_version: 1.8.
|
88
|
+
rubygems_version: 1.8.25
|
53
89
|
signing_key:
|
54
90
|
specification_version: 3
|
55
|
-
summary: A RubyGems plugin that generates binary
|
91
|
+
summary: A RubyGems plugin that generates binary gems.
|
56
92
|
test_files: []
|