[DRE-commits] [librarian-puppet] 39/97: modulefile dsl

Stig Sandbeck Mathisen ssm at debian.org
Tue Mar 11 12:12:49 UTC 2014


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

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

commit 11ff14fd5db713026b54057692f9e0d48d6b7c4a
Author: hawknewton <hnewton at constantcontact.com>
Date:   Tue Sep 3 17:33:16 2013 -0400

    modulefile dsl
---
 features/install.feature    | 17 +++++++++++++++++
 lib/librarian/puppet/dsl.rb | 13 +++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/features/install.feature b/features/install.feature
index 00d4354..03f4897 100644
--- a/features/install.feature
+++ b/features/install.feature
@@ -234,3 +234,20 @@ Feature: cli/install
     Then the exit status should be 0
     And the file "modules/test/Modulefile" should match /version *'0\.0\.1'/
     And a file named "modules/stdlib/Modulefile" should exist
+
+  @veryslow
+  Scenario: Source dependencies from Modulefile
+    Given a file named "Puppetfile" with:
+    """
+    forge "http://forge.puppetlabs.com"
+
+    modulefile
+    """
+    And a file named "Modulefile" with:
+    """
+    name "random name"
+    dependency "puppetlabs/postgresql", "2.4.1"
+    """
+    When I run `librarian-puppet install`
+    Then the exit status should be 0
+    And the file "modules/postgresql/Modulefile" should match /name *'puppetlabs-postgresql'/
diff --git a/lib/librarian/puppet/dsl.rb b/lib/librarian/puppet/dsl.rb
index 2ab6b81..004c68f 100644
--- a/lib/librarian/puppet/dsl.rb
+++ b/lib/librarian/puppet/dsl.rb
@@ -14,3 +14,16 @@ module Librarian
     end
   end
 end
+
+module Librarian
+  class Dsl
+    class Receiver
+      def modulefile
+        File.read('Modulefile').lines.each do |line|
+          regexp = /\s*dependency\s+('|")([^'"]+)\1\s*(?:,\s*('|")([^'"]+)\3)?/
+          regexp =~ line && mod($2, $4)
+        end
+      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