gem-compiler 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.md +5 -0
- data/README.md +4 -25
- data/Rakefile +27 -0
- data/lib/rubygems/compiler.rb +14 -9
- data/lib/rubygems/compiler/version.rb +7 -0
- metadata +67 -47
- data/.gemtest +0 -1
- data/rakefile.rb +0 -58
data/History.md
CHANGED
data/README.md
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
A RubyGems plugin that generates binary (pre-compiled) gems.
|
4
4
|
|
5
|
-
[![Gem Version](https://badge.fury.io/rb/gem-compiler.
|
6
|
-
[![Build Status](https://travis-ci.org/luislavena/gem-compiler.
|
7
|
-
[![Code Climate](
|
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)
|
7
|
+
[![Code Climate](http://img.shields.io/codeclimate/github/luislavena/gem-compiler.svg)](https://codeclimate.com/github/luislavena/gem-compiler)
|
8
8
|
|
9
9
|
- [home](https://github.com/luislavena/gem-compiler)
|
10
10
|
- [bugs](https://github.com/luislavena/gem-compiler/issues)
|
@@ -151,25 +151,4 @@ placing automatic stubs to handle extension loading.
|
|
151
151
|
|
152
152
|
## License
|
153
153
|
|
154
|
-
|
155
|
-
|
156
|
-
Copyright (c) Luis Lavena
|
157
|
-
|
158
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
159
|
-
a copy of this software and associated documentation files (the
|
160
|
-
'Software'), to deal in the Software without restriction, including
|
161
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
162
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
163
|
-
permit persons to whom the Software is furnished to do so, subject to
|
164
|
-
the following conditions:
|
165
|
-
|
166
|
-
The above copyright notice and this permission notice shall be
|
167
|
-
included in all copies or substantial portions of the Software.
|
168
|
-
|
169
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
170
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
171
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
172
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
173
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
174
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
175
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
154
|
+
[The MIT License](LICENSE)
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
require "rubygems/package_task"
|
2
|
+
|
3
|
+
gemspec = Gem::Specification.load("gem-compiler.gemspec")
|
4
|
+
|
5
|
+
Gem::PackageTask.new(gemspec) do |pkg|
|
6
|
+
end
|
7
|
+
|
8
|
+
desc "Run tests"
|
9
|
+
task :test do
|
10
|
+
lib_dirs = ["lib", "test"].join(File::PATH_SEPARATOR)
|
11
|
+
test_files = FileList["test/**/test*.rb"].gsub("test/", "")
|
12
|
+
|
13
|
+
puts "Ruby #{RUBY_VERSION}"
|
14
|
+
puts "RubyGems #{Gem::VERSION}"
|
15
|
+
|
16
|
+
ruby "-I#{lib_dirs} -e \"ARGV.each { |f| require f }\" #{test_files}"
|
17
|
+
end
|
18
|
+
|
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
|
+
task :default => [:test]
|
data/lib/rubygems/compiler.rb
CHANGED
@@ -1,15 +1,14 @@
|
|
1
|
+
require "fileutils"
|
1
2
|
require "rbconfig"
|
2
3
|
require "tmpdir"
|
3
4
|
require "rubygems/installer"
|
4
5
|
|
5
|
-
|
6
|
-
require "rubygems/builder"
|
7
|
-
else
|
6
|
+
if Gem::VERSION >= "2.0.0"
|
8
7
|
require "rubygems/package"
|
8
|
+
else
|
9
|
+
require "rubygems/builder"
|
9
10
|
end
|
10
11
|
|
11
|
-
require "fileutils"
|
12
|
-
|
13
12
|
class Gem::Compiler
|
14
13
|
include Gem::UserInteraction
|
15
14
|
|
@@ -92,21 +91,27 @@ class Gem::Compiler
|
|
92
91
|
def installer
|
93
92
|
return @installer if @installer
|
94
93
|
|
95
|
-
|
94
|
+
installer = Gem::Installer.new(@gemfile, options.dup.merge(:unpack => true))
|
95
|
+
|
96
|
+
# RubyGems 2.2 specifics
|
97
|
+
if installer.spec.respond_to?(:full_gem_path=)
|
98
|
+
installer.spec.full_gem_path = @target_dir
|
99
|
+
installer.spec.extension_dir = File.join(@target_dir, "lib")
|
100
|
+
end
|
96
101
|
|
97
102
|
# Hmm, gem already compiled?
|
98
|
-
if
|
103
|
+
if installer.spec.platform != Gem::Platform::RUBY
|
99
104
|
raise CompilerError,
|
100
105
|
"The gem file seems to be compiled already."
|
101
106
|
end
|
102
107
|
|
103
108
|
# Hmm, no extensions?
|
104
|
-
if
|
109
|
+
if installer.spec.extensions.empty?
|
105
110
|
raise CompilerError,
|
106
111
|
"There are no extensions to build on this gem file."
|
107
112
|
end
|
108
113
|
|
109
|
-
@installer
|
114
|
+
@installer = installer
|
110
115
|
end
|
111
116
|
|
112
117
|
def tmp_dir
|
metadata
CHANGED
@@ -1,92 +1,112 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: gem-compiler
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 3
|
9
|
+
- 0
|
10
|
+
version: 0.3.0
|
6
11
|
platform: ruby
|
7
|
-
authors:
|
12
|
+
authors:
|
8
13
|
- Luis Lavena
|
9
14
|
autorequire:
|
10
15
|
bindir: bin
|
11
16
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
17
|
+
|
18
|
+
date: 2014-04-19 00:00:00 Z
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
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
22
|
prerelease: false
|
24
|
-
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
24
|
none: false
|
26
|
-
requirements:
|
27
|
-
- -
|
28
|
-
- !ruby/object:Gem::Version
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 11
|
29
|
+
segments:
|
30
|
+
- 0
|
31
|
+
- 9
|
32
|
+
- 2
|
33
|
+
- 2
|
29
34
|
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
35
|
type: :development
|
36
|
+
version_requirements: *id001
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: minitest
|
39
39
|
prerelease: false
|
40
|
-
|
40
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
|
-
requirements:
|
42
|
+
requirements:
|
43
43
|
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
|
46
|
-
|
47
|
-
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
hash: 27
|
46
|
+
segments:
|
47
|
+
- 4
|
48
|
+
- 0
|
49
|
+
version: "4.0"
|
50
|
+
type: :development
|
51
|
+
version_requirements: *id002
|
52
|
+
description: |
|
53
|
+
A RubyGems plugin that helps generates binary gems from already existing
|
48
54
|
ones without altering the original source code. It compiles Ruby C
|
49
|
-
|
50
55
|
extensions and bundles the result into a new gem.
|
51
56
|
|
52
|
-
'
|
53
57
|
email: luislavena@gmail.com
|
54
58
|
executables: []
|
59
|
+
|
55
60
|
extensions: []
|
61
|
+
|
56
62
|
extra_rdoc_files: []
|
57
|
-
|
63
|
+
|
64
|
+
files:
|
58
65
|
- README.md
|
59
66
|
- History.md
|
60
|
-
-
|
67
|
+
- Rakefile
|
61
68
|
- lib/rubygems/commands/compile_command.rb
|
69
|
+
- lib/rubygems/compiler/version.rb
|
62
70
|
- lib/rubygems/compiler.rb
|
63
71
|
- lib/rubygems_plugin.rb
|
64
72
|
- test/rubygems/test_gem_commands_compile_command.rb
|
65
73
|
- test/rubygems/test_gem_compiler.rb
|
66
|
-
- .gemtest
|
67
74
|
homepage: https://github.com/luislavena/gem-compiler
|
68
|
-
licenses:
|
75
|
+
licenses:
|
69
76
|
- MIT
|
70
77
|
post_install_message:
|
71
78
|
rdoc_options: []
|
72
|
-
|
79
|
+
|
80
|
+
require_paths:
|
73
81
|
- lib
|
74
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
75
83
|
none: false
|
76
|
-
requirements:
|
77
|
-
- -
|
78
|
-
- !ruby/object:Gem::Version
|
84
|
+
requirements:
|
85
|
+
- - ">="
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
hash: 57
|
88
|
+
segments:
|
89
|
+
- 1
|
90
|
+
- 8
|
91
|
+
- 7
|
79
92
|
version: 1.8.7
|
80
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
93
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
81
94
|
none: false
|
82
|
-
requirements:
|
83
|
-
- -
|
84
|
-
- !ruby/object:Gem::Version
|
95
|
+
requirements:
|
96
|
+
- - ">="
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
hash: 7
|
99
|
+
segments:
|
100
|
+
- 1
|
101
|
+
- 8
|
102
|
+
- 24
|
85
103
|
version: 1.8.24
|
86
104
|
requirements: []
|
105
|
+
|
87
106
|
rubyforge_project:
|
88
107
|
rubygems_version: 1.8.25
|
89
108
|
signing_key:
|
90
109
|
specification_version: 3
|
91
110
|
summary: A RubyGems plugin that generates binary gems.
|
92
111
|
test_files: []
|
112
|
+
|
data/.gemtest
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
|
data/rakefile.rb
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
require "rubygems/package_task"
|
2
|
-
|
3
|
-
gemspec = Gem::Specification.new do |s|
|
4
|
-
# basic
|
5
|
-
s.name = "gem-compiler"
|
6
|
-
s.version = "0.2.0"
|
7
|
-
s.platform = Gem::Platform::RUBY
|
8
|
-
|
9
|
-
# description
|
10
|
-
s.summary = "A RubyGems plugin that generates binary gems."
|
11
|
-
s.description = <<-EOF
|
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
|
-
EOF
|
16
|
-
|
17
|
-
# project info
|
18
|
-
s.homepage = "https://github.com/luislavena/gem-compiler"
|
19
|
-
s.licenses = ["MIT"]
|
20
|
-
s.author = "Luis Lavena"
|
21
|
-
s.email = "luislavena@gmail.com"
|
22
|
-
|
23
|
-
# requirements
|
24
|
-
s.required_ruby_version = ">= 1.8.7"
|
25
|
-
s.required_rubygems_version = ">= 1.8.24"
|
26
|
-
|
27
|
-
# development dependencies
|
28
|
-
s.add_development_dependency 'rake', '~> 0.9.2.2'
|
29
|
-
s.add_development_dependency 'minitest', '~> 3.2'
|
30
|
-
|
31
|
-
# boring part
|
32
|
-
s.files = FileList["README.md", "History.md", "rakefile.rb",
|
33
|
-
"lib/**/*.rb", "test/**/test*.rb", ".gemtest"]
|
34
|
-
end
|
35
|
-
|
36
|
-
Gem::PackageTask.new(gemspec) do |pkg|
|
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]
|