Skip to content

Commit

Permalink
Merge branch 'minor-cleanup'
Browse files Browse the repository at this point in the history
  • Loading branch information
luislavena committed Apr 19, 2014
2 parents 7618352 + 1eb2121 commit 05062ff
Show file tree
Hide file tree
Showing 11 changed files with 117 additions and 95 deletions.
1 change: 0 additions & 1 deletion .gemtest

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -3,6 +3,7 @@
.bundle
.config
coverage
Gemfile.lock
InstalledFiles
lib/bundler/man
pkg
Expand Down
7 changes: 4 additions & 3 deletions .travis.yml
@@ -1,16 +1,17 @@
language: ruby
before_script:
- rake setup
- gem install rake -v "~> 0.9.2.2"
- gem install minitest -v "~> 3.2"
rvm:
- 1.8.7
- 1.9.3
- 2.0.0
- 2.1.0
- ruby-head
env:
- USE_RUBYGEMS="1.8.25"
- USE_RUBYGEMS="2.0.3"
- USE_RUBYGEMS="2.2.2"
matrix:
exclude:
- rvm: 2.0.0
env: USE_RUBYGEMS="1.8.25"
env: USE_RUBYGEMS="1.8.25"
3 changes: 3 additions & 0 deletions Gemfile
@@ -0,0 +1,3 @@
source "https://rubygems.org"

gemspec
20 changes: 20 additions & 0 deletions LICENSE
@@ -0,0 +1,20 @@
Copyright (c) Luis Lavena

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 changes: 3 additions & 24 deletions README.md
Expand Up @@ -2,8 +2,8 @@

A RubyGems plugin that generates binary (pre-compiled) gems.

[![Gem Version](https://badge.fury.io/rb/gem-compiler.png)](http://badge.fury.io/rb/gem-compiler)
[![Build Status](https://travis-ci.org/luislavena/gem-compiler.png?branch=master)](https://travis-ci.org/luislavena/gem-compiler)
[![Gem Version](https://badge.fury.io/rb/gem-compiler.svg)](http://badge.fury.io/rb/gem-compiler)
[![Build Status](https://travis-ci.org/luislavena/gem-compiler.svg?branch=master)](https://travis-ci.org/luislavena/gem-compiler)
[![Code Climate](https://codeclimate.com/github/luislavena/gem-compiler.png)](https://codeclimate.com/github/luislavena/gem-compiler)

- [home](https://github.com/luislavena/gem-compiler)
Expand Down Expand Up @@ -151,25 +151,4 @@ placing automatic stubs to handle extension loading.

## License

(The MIT License)

Copyright (c) Luis Lavena

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
[The MIT License](LICENSE)
27 changes: 27 additions & 0 deletions Rakefile
@@ -0,0 +1,27 @@
require "rubygems/package_task"

gemspec = Gem::Specification.load("gem-compiler.gemspec")

Gem::PackageTask.new(gemspec) do |pkg|
end

desc "Run tests"
task :test do
lib_dirs = ["lib", "test"].join(File::PATH_SEPARATOR)
test_files = FileList["test/**/test*.rb"].gsub("test/", "")

puts "Ruby #{RUBY_VERSION}"
puts "RubyGems #{Gem::VERSION}"

ruby "-I#{lib_dirs} -e \"ARGV.each { |f| require f }\" #{test_files}"
end

desc "Sets up the test environment"
task :setup do
if ENV["USE_RUBYGEMS"]
sh "gem update -q --system #{ENV["USE_RUBYGEMS"]}"
puts "Using RubyGems #{`gem --version`}"
end
end

task :default => [:test]
38 changes: 38 additions & 0 deletions gem-compiler.gemspec
@@ -0,0 +1,38 @@
# encoding: utf-8

lib = File.expand_path("../lib", __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "rubygems/compiler/version"

Gem::Specification.new do |spec|
# basic
spec.name = "gem-compiler"
spec.version = Gem::Compiler::VERSION
spec.platform = Gem::Platform::RUBY

# description
spec.summary = "A RubyGems plugin that generates binary gems."
spec.description = <<-EOF
A RubyGems plugin that helps generates binary gems from already existing
ones without altering the original source code. It compiles Ruby C
extensions and bundles the result into a new gem.
EOF

# project info
spec.homepage = "https://github.com/luislavena/gem-compiler"
spec.licenses = ["MIT"]
spec.author = "Luis Lavena"
spec.email = "luislavena@gmail.com"

# files
spec.files = Dir["README.md", "History.md", "Rakefile",
"lib/**/*.rb", "test/**/test*.rb"]

# requirements
spec.required_ruby_version = ">= 1.8.7"
spec.required_rubygems_version = ">= 1.8.24"

# development dependencies
spec.add_development_dependency "rake", ">= 0.9.2.2"
spec.add_development_dependency "minitest", "~> 4.0"
end
23 changes: 14 additions & 9 deletions lib/rubygems/compiler.rb
@@ -1,15 +1,14 @@
require "fileutils"
require "rbconfig"
require "tmpdir"
require "rubygems/installer"

unless Gem::VERSION >= "2.0.0"
require "rubygems/builder"
else
if Gem::VERSION >= "2.0.0"
require "rubygems/package"
else
require "rubygems/builder"
end

require "fileutils"

class Gem::Compiler
include Gem::UserInteraction

Expand Down Expand Up @@ -92,21 +91,27 @@ def debug(msg)
def installer
return @installer if @installer

@installer = Gem::Installer.new(@gemfile, options.dup.merge(:unpack => true))
installer = Gem::Installer.new(@gemfile, options.dup.merge(:unpack => true))

# RubyGems 2.2 specifics
if installer.spec.respond_to?(:full_gem_path=)
installer.spec.full_gem_path = @target_dir
installer.spec.extension_dir = File.join(@target_dir, "lib")
end

# Hmm, gem already compiled?
if @installer.spec.platform != Gem::Platform::RUBY
if installer.spec.platform != Gem::Platform::RUBY
raise CompilerError,
"The gem file seems to be compiled already."
end

# Hmm, no extensions?
if @installer.spec.extensions.empty?
if installer.spec.extensions.empty?
raise CompilerError,
"There are no extensions to build on this gem file."
end

@installer
@installer = installer
end

def tmp_dir
Expand Down
7 changes: 7 additions & 0 deletions lib/rubygems/compiler/version.rb
@@ -0,0 +1,7 @@
# encoding: UTF-8

module Gem
class Compiler
VERSION = "0.2.0"
end
end
58 changes: 0 additions & 58 deletions rakefile.rb

This file was deleted.

0 comments on commit 05062ff

Please sign in to comment.