[DRE-commits] [librarian-puppet] 32/153: Issue #242 Get organization from name correctly if name has multiple dashes

Stig Sandbeck Mathisen ssm at debian.org
Wed Jun 1 20:30:37 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 e6b13d94e44c72962d075889d9b05c3a0d3c8c22
Author: Carlos Sanchez <csanchez at maestrodev.com>
Date:   Mon Jul 28 10:12:30 2014 +0200

    Issue #242 Get organization from name correctly if name has multiple dashes
---
 Changelog.md                                 | 10 +++++++++-
 lib/librarian/puppet/source/forge.rb         |  2 +-
 lib/librarian/puppet/source/forge/repo.rb    |  2 +-
 lib/librarian/puppet/source/githubtarball.rb |  2 +-
 lib/librarian/puppet/source/local.rb         |  2 +-
 lib/librarian/puppet/util.rb                 |  5 +++++
 6 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/Changelog.md b/Changelog.md
index ec021e3..690cd9f 100644
--- a/Changelog.md
+++ b/Changelog.md
@@ -2,9 +2,13 @@
 
 ## 1.1.x: Requires Ruby >= 1.9, uses Puppet Forge API v3
 
+### 1.1.4
+
+ * [Issue #242](https://github.com/rodjek/librarian-puppet/issues/242) Get organization from name correctly if name has multiple dashes
+
 ### 1.1.3
 
- * [Issue #237](https://github.com/rodjek/librarian-puppet/issues/237)[Issue #238](https://github.com/rodjek/librarian-puppet/issues/238) Unable to use a custom v3 forge: add flags `--use-v1-api` and `--no-use-v1-api`
+ * [Issue #237](https://github.com/rodjek/librarian-puppet/issues/237) [Issue #238](https://github.com/rodjek/librarian-puppet/issues/238) Unable to use a custom v3 forge: add flags `--use-v1-api` and `--no-use-v1-api`
  * [Issue #239](https://github.com/rodjek/librarian-puppet/issues/239) GitHub tarball: add access_token correctly to url's which are already having query parameters
  * [Issue #234](https://github.com/rodjek/librarian-puppet/issues/234) Use organization-module instead of organization/module by default
 
@@ -26,6 +30,10 @@
 
 ## 1.0.x: Works on Ruby 1.8, using Puppet Forge API v1
 
+### 1.0.6
+
+ * [Issue #242](https://github.com/rodjek/librarian-puppet/issues/242) Get organization from name correctly if name has multiple dashes
+
 ### 1.0.5
 
  * [Issue #237](https://github.com/rodjek/librarian-puppet/issues/237)[Issue #238](https://github.com/rodjek/librarian-puppet/issues/238) Unable to use a custom v3 forge: add flags `--use-v1-api` and `--no-use-v1-api`
diff --git a/lib/librarian/puppet/source/forge.rb b/lib/librarian/puppet/source/forge.rb
index ca9784b..008aeac 100644
--- a/lib/librarian/puppet/source/forge.rb
+++ b/lib/librarian/puppet/source/forge.rb
@@ -121,7 +121,7 @@ module Librarian
         end
 
         def install_path(name)
-          environment.install_path.join(name.split('-').last)
+          environment.install_path.join(organization_name(name))
         end
 
         def fetch_version(name, version_uri)
diff --git a/lib/librarian/puppet/source/forge/repo.rb b/lib/librarian/puppet/source/forge/repo.rb
index 55837b1..f635e9b 100644
--- a/lib/librarian/puppet/source/forge/repo.rb
+++ b/lib/librarian/puppet/source/forge/repo.rb
@@ -59,7 +59,7 @@ module Librarian
               install_path.rmtree
             end
 
-            unpacked_path = version_unpacked_cache_path(version).join(name.split('-').last)
+            unpacked_path = version_unpacked_cache_path(version).join(organization_name(name))
 
             unless unpacked_path.exist?
               raise Error, "#{unpacked_path} does not exist, something went wrong. Try removing it manually"
diff --git a/lib/librarian/puppet/source/githubtarball.rb b/lib/librarian/puppet/source/githubtarball.rb
index 7b6fc2a..2a636eb 100644
--- a/lib/librarian/puppet/source/githubtarball.rb
+++ b/lib/librarian/puppet/source/githubtarball.rb
@@ -98,7 +98,7 @@ module Librarian
         end
 
         def install_path(name)
-          environment.install_path.join(name.split('-').last)
+          environment.install_path.join(organization_name(name))
         end
 
         def fetch_version(name, version_uri)
diff --git a/lib/librarian/puppet/source/local.rb b/lib/librarian/puppet/source/local.rb
index abfee66..3848d38 100644
--- a/lib/librarian/puppet/source/local.rb
+++ b/lib/librarian/puppet/source/local.rb
@@ -30,7 +30,7 @@ module Librarian
             warn { "Invalid module name '#{name}', you should qualify it with 'ORGANIZATION-#{name}' for resolution to work correctly" }
           end
 
-          install_path = environment.install_path.join(name.split('-').last)
+          install_path = environment.install_path.join(organization_name(name))
           if install_path.exist?
             debug { "Deleting #{relative_path_to(install_path)}" }
             install_path.rmtree
diff --git a/lib/librarian/puppet/util.rb b/lib/librarian/puppet/util.rb
index b251719..9c1f566 100644
--- a/lib/librarian/puppet/util.rb
+++ b/lib/librarian/puppet/util.rb
@@ -38,6 +38,11 @@ module Librarian
       def normalize_name(name)
         name.sub('/','-')
       end
+
+      # get the organization name from organization-module
+      def organization_name(name)
+        name.split('-',2).last
+      end
     end
   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