gem-compiler 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/History.md +9 -0
- data/README.md +0 -3
- data/Rakefile +12 -4
- data/lib/rubygems/commands/compile_command.rb +1 -1
- data/lib/rubygems/compiler.rb +20 -13
- data/lib/rubygems/compiler/version.rb +1 -1
- data/test/rubygems/test_gem_commands_compile_command.rb +1 -1
- data/test/rubygems/test_gem_compiler.rb +6 -4
- metadata +6 -6
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: ae2be2c71e44ef97d540eeba1f926ff4aadddc00
         | 
| 4 | 
            +
              data.tar.gz: 6f4bea5bc8c090ec4158e47260810032c2920a69
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: c85477e45ef9912d6dd81fb77e4cb3a3e1aef35f309d122b1418910d115244b661b42b6ff38a6eccadaf91fa666796963ef61589c0291976c31e0ab219ed91f2
         | 
| 7 | 
            +
              data.tar.gz: 7b4fb2ca8ccb0f9a186e9872420f8f438c21b87b13d61bdd1e9c1ea7071c6ba0d4c000865295fe424b4bd0b9baf11e63de97fc404c054ce9abcc012457c68d53
         | 
    
        data/History.md
    CHANGED
    
    | @@ -1,5 +1,14 @@ | |
| 1 1 | 
             
            # gem-compiler
         | 
| 2 2 |  | 
| 3 | 
            +
            ## Unreleased
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            ## 0.6.0 (2017-06-25)
         | 
| 6 | 
            +
             | 
| 7 | 
            +
            - Drop support for any Ruby version prior to 2.1.0
         | 
| 8 | 
            +
            - Solve RubyGems 2.5 deprecation warnings
         | 
| 9 | 
            +
            - Use Travis to automate new releases
         | 
| 10 | 
            +
            - CI: Update test matrix (Travis and AppVeyor)
         | 
| 11 | 
            +
             | 
| 3 12 | 
             
            ## 0.5.0 (2016-04-24)
         | 
| 4 13 |  | 
| 5 14 | 
             
            - Drop support for any Ruby version prior to 2.0.0
         | 
    
        data/README.md
    CHANGED
    
    | @@ -76,12 +76,10 @@ gems. To workaround this problem you have the option to *prune* the package | |
| 76 76 | 
             
            process:
         | 
| 77 77 |  | 
| 78 78 | 
             
                $ gem fetch nokogiri --platform=ruby
         | 
| 79 | 
            -
             | 
| 80 79 | 
             
                Fetching: nokogiri-1.6.6.2.gem (100%)
         | 
| 81 80 | 
             
                Downloaded nokogiri-1.6.6.2
         | 
| 82 81 |  | 
| 83 82 | 
             
                $ gem compile nokogiri-1.6.6.2.gem --prune
         | 
| 84 | 
            -
             | 
| 85 83 | 
             
                Unpacking gem: 'nokogiri-1.6.6.2' in temporary directory...
         | 
| 86 84 | 
             
                Building native extensions.  This could take a while...
         | 
| 87 85 | 
             
                  Successfully built RubyGem
         | 
| @@ -90,7 +88,6 @@ process: | |
| 90 88 | 
             
                  File: nokogiri-1.6.6.2-x86_64-darwin-12.gem
         | 
| 91 89 |  | 
| 92 90 | 
             
                $ gem install --local nokogiri-1.6.6.2-x86_64-darwin-12.gem
         | 
| 93 | 
            -
             | 
| 94 91 | 
             
                Successfully installed nokogiri-1.6.6.2-x86_64-darwin-12
         | 
| 95 92 | 
             
                1 gem installed
         | 
| 96 93 |  | 
    
        data/Rakefile
    CHANGED
    
    | @@ -26,11 +26,19 @@ task :info do | |
| 26 26 | 
             
            end
         | 
| 27 27 |  | 
| 28 28 | 
             
            desc "Run tests"
         | 
| 29 | 
            -
            task : | 
| 29 | 
            +
            task test: [:info] do
         | 
| 30 30 | 
             
              lib_dirs = ["lib", "test"].join(File::PATH_SEPARATOR)
         | 
| 31 | 
            -
              test_files = FileList["test/**/test*.rb"].gsub("test/", "")
         | 
| 32 31 |  | 
| 33 | 
            -
               | 
| 32 | 
            +
              filters = (ENV["FILTER"] || ENV["TESTOPTS"] || "").dup
         | 
| 33 | 
            +
              filters << " -n #{ENV["N"]}" if ENV["N"]
         | 
| 34 | 
            +
             | 
| 35 | 
            +
              test_files = ["rubygems"]
         | 
| 36 | 
            +
              test_files << "minitest/autorun"
         | 
| 37 | 
            +
              test_files << FileList["test/**/test_*.rb"].gsub("test/", "")
         | 
| 38 | 
            +
              test_files.flatten!
         | 
| 39 | 
            +
              test_files.map! { |f| %(require "#{f}") }
         | 
| 40 | 
            +
             | 
| 41 | 
            +
              ruby "-w -I#{lib_dirs} --disable-gems -e '#{test_files.join("; ")}' -- #{filters}"
         | 
| 34 42 | 
             
            end
         | 
| 35 43 |  | 
| 36 | 
            -
            task : | 
| 44 | 
            +
            task default: [:test]
         | 
| @@ -3,7 +3,7 @@ require "rubygems/command" | |
| 3 3 | 
             
            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 7 |  | 
| 8 8 | 
             
                add_option "--prune", "Clean non-existing files during re-packaging" do |value, options|
         | 
| 9 9 | 
             
                  options[:prune] = true
         | 
    
        data/lib/rubygems/compiler.rb
    CHANGED
    
    | @@ -15,12 +15,12 @@ class Gem::Compiler | |
| 15 15 | 
             
              # raise when there is a error
         | 
| 16 16 | 
             
              class CompilerError < Gem::InstallError; end
         | 
| 17 17 |  | 
| 18 | 
            -
              attr_reader : | 
| 18 | 
            +
              attr_reader :target_dir, :options
         | 
| 19 19 |  | 
| 20 20 | 
             
              def initialize(gemfile, _options = {})
         | 
| 21 | 
            -
                @gemfile | 
| 21 | 
            +
                @gemfile = gemfile
         | 
| 22 22 | 
             
                @output_dir = _options.delete(:output)
         | 
| 23 | 
            -
                @options | 
| 23 | 
            +
                @options = _options
         | 
| 24 24 | 
             
              end
         | 
| 25 25 |  | 
| 26 26 | 
             
              def compile
         | 
| @@ -61,7 +61,6 @@ class Gem::Compiler | |
| 61 61 |  | 
| 62 62 | 
             
              def build_extensions
         | 
| 63 63 | 
             
                # run pre_install hooks
         | 
| 64 | 
            -
             | 
| 65 64 | 
             
                if installer.respond_to?(:run_pre_install_hooks)
         | 
| 66 65 | 
             
                  installer.run_pre_install_hooks
         | 
| 67 66 | 
             
                end
         | 
| @@ -75,7 +74,7 @@ class Gem::Compiler | |
| 75 74 |  | 
| 76 75 | 
             
              def collect_artifacts
         | 
| 77 76 | 
             
                # determine build artifacts from require_paths
         | 
| 78 | 
            -
                dlext | 
| 77 | 
            +
                dlext = RbConfig::CONFIG["DLEXT"]
         | 
| 79 78 | 
             
                lib_dirs = installer.spec.require_paths.join(",")
         | 
| 80 79 |  | 
| 81 80 | 
             
                Dir.glob("#{target_dir}/{#{lib_dirs}}/**/*.#{dlext}")
         | 
| @@ -90,9 +89,17 @@ class Gem::Compiler | |
| 90 89 | 
             
              end
         | 
| 91 90 |  | 
| 92 91 | 
             
              def installer
         | 
| 93 | 
            -
                 | 
| 92 | 
            +
                @installer ||= prepare_installer
         | 
| 93 | 
            +
              end
         | 
| 94 94 |  | 
| 95 | 
            -
             | 
| 95 | 
            +
              def prepare_installer
         | 
| 96 | 
            +
                # RubyGems 2.5 specifics
         | 
| 97 | 
            +
                unpack_options = options.dup.merge(unpack: true)
         | 
| 98 | 
            +
                if Gem::Installer.respond_to?(:at)
         | 
| 99 | 
            +
                  installer = Gem::Installer.at(@gemfile, unpack_options)
         | 
| 100 | 
            +
                else
         | 
| 101 | 
            +
                  installer = Gem::Installer.new(@gemfile, options.dup.merge(unpack: true))
         | 
| 102 | 
            +
                end
         | 
| 96 103 |  | 
| 97 104 | 
             
                # RubyGems 2.2 specifics
         | 
| 98 105 | 
             
                if installer.spec.respond_to?(:full_gem_path=)
         | 
| @@ -122,7 +129,7 @@ class Gem::Compiler | |
| 122 129 | 
             
                        "There are no extensions to build on this gem file."
         | 
| 123 130 | 
             
                end
         | 
| 124 131 |  | 
| 125 | 
            -
                 | 
| 132 | 
            +
                installer
         | 
| 126 133 | 
             
              end
         | 
| 127 134 |  | 
| 128 135 | 
             
              def repackage(gemspec)
         | 
| @@ -143,10 +150,10 @@ class Gem::Compiler | |
| 143 150 |  | 
| 144 151 | 
             
                Dir.chdir target_dir do
         | 
| 145 152 | 
             
                  output_gem = if defined?(Gem::Builder)
         | 
| 146 | 
            -
             | 
| 147 | 
            -
             | 
| 148 | 
            -
             | 
| 149 | 
            -
             | 
| 153 | 
            +
                                 Gem::Builder.new(gemspec).build
         | 
| 154 | 
            +
                               else
         | 
| 155 | 
            +
                                 Gem::Package.build(gemspec)
         | 
| 156 | 
            +
                               end
         | 
| 150 157 | 
             
                end
         | 
| 151 158 |  | 
| 152 159 | 
             
                unless output_gem
         | 
| @@ -166,7 +173,7 @@ class Gem::Compiler | |
| 166 173 | 
             
              end
         | 
| 167 174 |  | 
| 168 175 | 
             
              def unpack
         | 
| 169 | 
            -
                basename | 
| 176 | 
            +
                basename = File.basename(@gemfile, ".gem")
         | 
| 170 177 | 
             
                @target_dir = File.join(tmp_dir, basename)
         | 
| 171 178 |  | 
| 172 179 | 
             
                # unpack gem sources into target_dir
         | 
| @@ -5,6 +5,9 @@ class TestGemCompiler < Gem::TestCase | |
| 5 5 | 
             
              def setup
         | 
| 6 6 | 
             
                super
         | 
| 7 7 |  | 
| 8 | 
            +
                # unset GEM_PATH so `rake` is found during compilation of extensions
         | 
| 9 | 
            +
                ENV.delete("GEM_PATH")
         | 
| 10 | 
            +
             | 
| 8 11 | 
             
                @output_dir = File.join @tempdir, 'output'
         | 
| 9 12 | 
             
                FileUtils.mkdir_p @output_dir
         | 
| 10 13 | 
             
              end
         | 
| @@ -21,7 +24,7 @@ class TestGemCompiler < Gem::TestCase | |
| 21 24 | 
             
                end
         | 
| 22 25 |  | 
| 23 26 | 
             
                assert_equal "There are no extensions to build on this gem file.",
         | 
| 24 | 
            -
             | 
| 27 | 
            +
                             e.message
         | 
| 25 28 | 
             
              end
         | 
| 26 29 |  | 
| 27 30 | 
             
              def test_compile_non_ruby
         | 
| @@ -89,7 +92,7 @@ class TestGemCompiler < Gem::TestCase | |
| 89 92 | 
             
                end
         | 
| 90 93 |  | 
| 91 94 | 
             
                assert_equal "old_rubygems requires RubyGems version < 0. " +
         | 
| 92 | 
            -
             | 
| 95 | 
            +
                               "Try 'gem update --system' to update RubyGems itself.", e.message
         | 
| 93 96 | 
             
              end
         | 
| 94 97 |  | 
| 95 98 | 
             
              def test_compile_succeed
         | 
| @@ -108,7 +111,7 @@ class TestGemCompiler < Gem::TestCase | |
| 108 111 | 
             
                out = @ui.output.split "\n"
         | 
| 109 112 |  | 
| 110 113 | 
             
                assert_match %r|Unpacking gem: 'a-1' in temporary directory...|,
         | 
| 111 | 
            -
             | 
| 114 | 
            +
                             out.shift
         | 
| 112 115 |  | 
| 113 116 | 
             
                assert_path_exists File.join(@output_dir, "a-1-x86-mingw32.gem")
         | 
| 114 117 | 
             
              end
         | 
| @@ -250,7 +253,6 @@ class TestGemCompiler < Gem::TestCase | |
| 250 253 | 
             
              def test_compile_no_lock_ruby_abi
         | 
| 251 254 | 
             
                util_reset_arch
         | 
| 252 255 |  | 
| 253 | 
            -
                ruby_abi = RbConfig::CONFIG["ruby_version"]
         | 
| 254 256 | 
             
                artifact = "foo.#{RbConfig::CONFIG["DLEXT"]}"
         | 
| 255 257 |  | 
| 256 258 | 
             
                gem_file = util_bake_gem("foo") { |s|
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: gem-compiler
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.6.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Luis Lavena
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2017-06-25 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: rake
         | 
| @@ -30,14 +30,14 @@ dependencies: | |
| 30 30 | 
             
                requirements:
         | 
| 31 31 | 
             
                - - "~>"
         | 
| 32 32 | 
             
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            -
                    version: ' | 
| 33 | 
            +
                    version: '4.7'
         | 
| 34 34 | 
             
              type: :development
         | 
| 35 35 | 
             
              prerelease: false
         | 
| 36 36 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 37 37 | 
             
                requirements:
         | 
| 38 38 | 
             
                - - "~>"
         | 
| 39 39 | 
             
                  - !ruby/object:Gem::Version
         | 
| 40 | 
            -
                    version: ' | 
| 40 | 
            +
                    version: '4.7'
         | 
| 41 41 | 
             
            description: |
         | 
| 42 42 | 
             
              A RubyGems plugin that helps generates binary gems from already existing
         | 
| 43 43 | 
             
              ones without altering the original source code. It compiles Ruby C
         | 
| @@ -68,7 +68,7 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 68 68 | 
             
              requirements:
         | 
| 69 69 | 
             
              - - ">="
         | 
| 70 70 | 
             
                - !ruby/object:Gem::Version
         | 
| 71 | 
            -
                  version: 2. | 
| 71 | 
            +
                  version: 2.1.0
         | 
| 72 72 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 73 73 | 
             
              requirements:
         | 
| 74 74 | 
             
              - - ">="
         | 
| @@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 76 76 | 
             
                  version: 1.8.24
         | 
| 77 77 | 
             
            requirements: []
         | 
| 78 78 | 
             
            rubyforge_project: 
         | 
| 79 | 
            -
            rubygems_version: 2.4.5 | 
| 79 | 
            +
            rubygems_version: 2.4.5
         | 
| 80 80 | 
             
            signing_key: 
         | 
| 81 81 | 
             
            specification_version: 4
         | 
| 82 82 | 
             
            summary: A RubyGems plugin that generates binary gems.
         |