Sha256: bf454b1f9ac743d5d534a8f69319dcced96394b869390eee6b1549701c5fad18

Contents?: true

Size: 1.11 KB

Versions: 18

Compression:

Stored size: 1.11 KB

Contents

require 'maven/tools/coordinate'

module Maven
  module Tools
    class GemspecDependencies

      def initialize( gemspec )
        if gemspec.is_a? Gem::Specification
          @spec = gemspec
        else
          @spec = Gem::Specification.load( gemspec )
        end
        _setup
      end

      def java_runtime
        _deps( :java_runtime )
      end

      def runtime
        _deps( :runtime )
      end

      def development
        _deps( :development )
      end

      private

      include Coordinate

      def _deps( type )
        @deps ||= {}
        @deps[ type ] ||= []
      end

      def _setup
        @spec.dependencies.each do |dep|
          versions = dep.requirement.requirements.collect do |req|
            # use this construct to get the same result in 1.8.x and 1.9.x
            req.collect{ |i| i.to_s }.join
          end
          _deps( dep.type ) << "rubygems:#{dep.name}:#{to_version( *versions )}"
        end
        @spec.requirements.each do |req|
          coord = to_split_coordinate( req )
          _deps( :java_runtime ) << coord if coord
        end
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
maven-tools-1.0.2 lib/maven/tools/gemspec_dependencies.rb
maven-tools-1.0.1 lib/maven/tools/gemspec_dependencies.rb
maven-tools-1.0.0 lib/maven/tools/gemspec_dependencies.rb
maven-tools-1.0.0.rc6 lib/maven/tools/gemspec_dependencies.rb
maven-tools-1.0.0.rc5 lib/maven/tools/gemspec_dependencies.rb
maven-tools-1.0.0.rc4 lib/maven/tools/gemspec_dependencies.rb
maven-tools-1.0.0.rc3 lib/maven/tools/gemspec_dependencies.rb
maven-tools-0.34.5 lib/maven/tools/gemspec_dependencies.rb
maven-tools-1.0.0.rc2 lib/maven/tools/gemspec_dependencies.rb
maven-tools-0.34.4 lib/maven/tools/gemspec_dependencies.rb
maven-tools-0.34.3 lib/maven/tools/gemspec_dependencies.rb
maven-tools-0.34.2 lib/maven/tools/gemspec_dependencies.rb
maven-tools-0.34.1 lib/maven/tools/gemspec_dependencies.rb
maven-tools-0.34.0 lib/maven/tools/gemspec_dependencies.rb
maven-tools-0.33.5 lib/maven/tools/gemspec_dependencies.rb
maven-tools-0.33.4 lib/maven/tools/gemspec_dependencies.rb
maven-tools-0.33.3 lib/maven/tools/gemspec_dependencies.rb
maven-tools-0.33.2 lib/maven/tools/gemspec_dependencies.rb