[DRE-commits] [librarian-puppet] 85/153: Use librarianp gem, fork of librarian

Stig Sandbeck Mathisen ssm at debian.org
Wed Jun 1 20:30:47 UTC 2016


This is an automated email from the git hooks/post-receive script.

ssm pushed a commit to branch master
in repository librarian-puppet.

commit 3123b1d8f84bc46740df4d23b22fcd96065627eb
Author: Carlos Sanchez <carlos at apache.org>
Date:   Tue Feb 24 13:59:19 2015 +0100

    Use librarianp gem, fork of librarian
---
 lib/librarian/puppet/extension.rb | 200 --------------------------------------
 librarian-puppet.gemspec          |   2 +-
 spec/manifest_version_spec.rb     |  94 ------------------
 spec/requirement_spec.rb          |  19 ----
 4 files changed, 1 insertion(+), 314 deletions(-)

diff --git a/lib/librarian/puppet/extension.rb b/lib/librarian/puppet/extension.rb
index a69ba6d..414311f 100644
--- a/lib/librarian/puppet/extension.rb
+++ b/lib/librarian/puppet/extension.rb
@@ -24,206 +24,6 @@ module Librarian
       @manifests = nil
     end
 
-    class Requirement
-      def initialize(*args)
-        args = initialize_normalize_args(args)
-        self.backing = Gem::Requirement.create(puppet_to_gem_versions(args))
-      end
-
-      def puppet_to_gem_versions(args)
-        args.map do |arg|
-          case arg
-          when Array
-            arg.map { |v| Librarian::Puppet::Requirement.new(v).gem_requirement }
-          when String
-            Librarian::Puppet::Requirement.new(arg).gem_requirement
-          else
-            # Gem::Requirement, convert to string (ie. =1.0) so we can concat later
-            # Gem::Requirements can not be concatenated
-            arg.requirements.map{|x,y| "#{x}#{y}"}
-          end
-        end.flatten
-      end
-    end
-
-    alias :eql? :==
-
-    def hash
-      self.to_s.hash
-    end
-  end
-
-  # Fixes for librarian not yet released in their gem
-  module Mock
-    module Source
-      class Mock
-        alias :eql? :==
-
-        def hash
-          self.to_s.hash
-        end
-      end
-    end
-  end
-  module Source
-    class Git
-      alias :eql? :==
-
-      def hash
-        self.to_s.hash
-      end
-    end
-
-    class Path
-      alias :eql? :==
-
-      def hash
-        self.to_s.hash
-      end
-    end
   end
 
-  class ManifestSet
-    include Librarian::Puppet::Util
-
-    private
-
-    # Check if module doesn't exist and fail fast
-    def dependencies_of(names)
-      names = Array === names ? names.dup : names.to_a
-      assert_strings!(names)
-
-      deps = Set.new
-      until names.empty?
-        name = normalize_name(names.shift)
-        next if deps.include?(name)
-
-        deps << name
-        raise(Error, "Unable to find module #{name}. Your Puppetfile may be out of sync with the lock, try running 'librarian-puppet install' first") if index[name].nil?
-        names.concat index[name].dependencies.map(&:name)
-      end
-      deps.to_a
-    end
-  end
-
-  class Manifest
-    class PreReleaseVersion
-
-      # Compares pre-release component ids using Semver 2.0.0 spec
-      def self.compare_components(this_id,other_id)
-        case # Strings have higher precedence than numbers
-          when (this_id.is_a?(Integer) and other_id.is_a?(String))
-            -1
-          when (this_id.is_a?(String) and other_id.is_a?(Integer))
-            1
-          else
-            this_id <=> other_id
-        end
-      end
-
-      # Parses pre-release components `a.b.c` into an array ``[a,b,c]`
-      # Converts numeric components into +Integer+
-      def self.parse(prerelease)
-        if prerelease.nil?
-          []
-        else
-          prerelease.split('.').collect do |id|
-            id = Integer(id) if /^[0-9]+$/ =~ id
-            id
-          end
-        end
-      end
-
-      include Comparable
-
-      attr_reader :components
-
-      def initialize(prerelease)
-        @prerelease = prerelease
-        @components = PreReleaseVersion.parse(prerelease)
-      end
-
-      def to_s
-        @prerelease
-      end
-
-      def <=>(other)
-        # null-fill zip array to prevent loss of components
-        z = Array.new([components.length,other.components.length])
-
-        # Compare each component against the other
-        comp = z.zip(components,other.components).collect do |ids|
-          case # All components being equal, the version with more of them takes precedence
-            when ids[1].nil? # Self has less elements, other wins
-              -1
-            when ids[2].nil? # Other has less elements, self wins
-              1
-            else
-              PreReleaseVersion.compare_components(ids[1],ids[2])
-          end
-        end
-        # Chose the first non-zero comparison or return 0
-        comp.delete_if {|c| c == 0}[0] || 0
-      end
-    end
-    class Version
-      @@SEMANTIC_VERSION_PATTERN = /^([0-9]+\.[0-9]+(?:\.[0-9]+)?)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?$/
-      def self.parse_semver(version_string)
-        parsed = @@SEMANTIC_VERSION_PATTERN.match(version_string.strip)
-        if parsed
-          {
-            :full_version => parsed[0],
-            :version => parsed[1],
-            :prerelease => (PreReleaseVersion.new(parsed[2]) if parsed[2]),
-            :build => parsed[3]
-          }
-        end
-      end
-
-      attr_reader :prerelease
-
-      def initialize(*args)
-        args = initialize_normalize_args(args)
-        semver = Version.parse_semver(*args)
-        if semver
-          self.backing  = Gem::Version.new(semver[:version])
-          @prerelease   = semver[:prerelease]
-          @full_version = semver[:full_version]
-        else
-          self.backing  = Gem::Version.new(*args)
-          @full_version = to_gem_version.to_s
-        end
-      end
-
-      def <=>(other)
-        cmp = to_gem_version <=> other.to_gem_version
-
-        # Should compare pre-release versions?
-        if cmp == 0 and not (prerelease.nil? and other.prerelease.nil?)
-          case # Versions without prerelease take precedence
-            when (prerelease.nil? and not other.prerelease.nil?)
-              1
-            when (not prerelease.nil? and other.prerelease.nil?)
-              -1
-            else
-              prerelease <=> other.prerelease
-          end
-        else
-          cmp
-        end
-      end
-
-      def to_s
-        @full_version
-      end
-    end
-  end
-
-  class Logger
-    def warn(string = nil, &block)
-      return unless ui
-
-      ui.warn(string || yield)
-    end
-  end
 end
diff --git a/librarian-puppet.gemspec b/librarian-puppet.gemspec
index b00ed6f..8fed901 100644
--- a/librarian-puppet.gemspec
+++ b/librarian-puppet.gemspec
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
 
   s.executables = ['librarian-puppet']
 
-  s.add_dependency "librarian", ">=0.1.2"
+  s.add_dependency "librarianp", ">=0.2.0"
   s.add_dependency "rsync"
   s.add_dependency "puppet_forge"
 
diff --git a/spec/manifest_version_spec.rb b/spec/manifest_version_spec.rb
deleted file mode 100644
index f3830c9..0000000
--- a/spec/manifest_version_spec.rb
+++ /dev/null
@@ -1,94 +0,0 @@
-require "librarian/manifest"
-
-describe Librarian::Manifest::Version do
-
-  describe "version comparison" do
-
-    context "when version has only two components" do
-      it "creates a new version with only 2 version components" do
-        v1 = described_class.new("1.0")
-      end
-    end
-
-    context "when neither version has pre-release items" do
-      it "compares 1.0.0 < 2.0.0" do
-        v1 = described_class.new("1.0.0")
-        v2 = described_class.new("2.0.0")
-        expect(v1 <=> v2).to eq(-1)
-      end
-      it "compares 2.0.0 < 2.1.0" do
-        v1 = described_class.new("2.0.0")
-        v2 = described_class.new("2.1.0")
-        expect(v1 <=> v2).to eq(-1)
-      end
-      it "compares 2.1.0 < 2.1.1" do
-        v1 = described_class.new("2.1.0")
-        v2 = described_class.new("2.1.1")
-        expect(v1 <=> v2).to eq(-1)
-      end
-    end
-
-    context "when versions have pre-release information" do
-      it "compares 1.0.0-alpha < 1.0.0-alpha1" do
-        v1 = described_class.new("1.0.0-alpha")
-        v2 = described_class.new("1.0.0-alpha.1")
-        expect(v1 <=> v2).to eq(-1)
-      end
-      it "compares 1.0.0-alpha.1 < 1.0.0-alpha.beta" do
-        v1 = described_class.new("1.0.0-alpha.1")
-        v2 = described_class.new("1.0.0-alpha.beta")
-        expect(v1 <=> v2).to eq(-1)
-      end
-      it "compares 1.0.0-alpha.beta < 1.0.0-beta" do
-        v1 = described_class.new("1.0.0-alpha.beta")
-        v2 = described_class.new("1.0.0-beta")
-        expect(v1 <=> v2).to eq(-1)
-      end
-      it "compares 1.0.0-beta < 1.0.0-beta.2" do
-        v1 = described_class.new("1.0.0-beta")
-        v2 = described_class.new("1.0.0-beta.2")
-        expect(v1 <=> v2).to eq(-1)
-      end
-      it "compares 1.0.0-beta.2 < 1.0.0-beta.11" do
-        v1 = described_class.new("1.0.0-beta.2")
-        v2 = described_class.new("1.0.0-beta.11")
-        expect(v1 <=> v2).to eq(-1)
-      end
-      it "compares 1.0.0-beta.11 < 1.0.0-rc.1" do
-        v1 = described_class.new("1.0.0-beta.11")
-        v2 = described_class.new("1.0.0-rc.1")
-        expect(v1 <=> v2).to eq(-1)
-      end
-      it "compares 1.0.0-rc.1 < 1.0.0" do
-        v1 = described_class.new("1.0.0-rc.1")
-        v2 = described_class.new("1.0.0")
-        expect(v1 <=> v2).to eq(-1)
-      end
-    end
-
-    context "when an invalid version number is provided" do
-      it "raises" do
-        expect { described_class.new("invalidversion") }.
-            to raise_error(ArgumentError)
-      end
-    end
-
-    context "when a version is converted to string" do
-      it "should be the full semver" do
-        version = "1.0.0-beta.11+200.1.2"
-        v1 = described_class.new(version)
-        expect(v1.to_s).to eq(version)
-      end
-      it "should be the full gem version" do
-        version = "1.0.0.a"
-        v1 = described_class.new(version)
-        expect(v1.to_s).to eq(version)
-      end
-      it "should be the two-component version" do
-        version = "1.0"
-        v1 = described_class.new(version)
-        expect(v1.to_s).to eq(version)
-      end
-    end
-  end
-end
\ No newline at end of file
diff --git a/spec/requirement_spec.rb b/spec/requirement_spec.rb
deleted file mode 100644
index 0d1993b..0000000
--- a/spec/requirement_spec.rb
+++ /dev/null
@@ -1,19 +0,0 @@
-require 'spec_helper'
-
-describe Librarian::Puppet::Requirement do
-
-  it 'should handle .x versions' do
-    described_class.new('1.x').gem_requirement.should eq('~> 1.0')
-    described_class.new('1.0.x').gem_requirement.should eq('~> 1.0.0')
-  end
-
-  it 'should handle version ranges' do
-    described_class.new('>=1.1.0 <2.0.0').gem_requirement.should eq(['>=1.1.0', '<2.0.0'])
-  end
-
-  it 'should print to_s' do
-    described_class.new('1.x').to_s.should eq('~> 1.0')
-    expected = RUBY_VERSION =~ /^1\.8\./ ? ">=1.1.0<2.0.0" : "[\">=1.1.0\", \"<2.0.0\"]"
-    described_class.new('>=1.1.0 <2.0.0').to_s.should eq(expected)
-  end
-end

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ruby-extras/librarian-puppet.git



More information about the Pkg-ruby-extras-commits mailing list