Skip to content

Commit

Permalink
Fix #285 Update librarianp to allow overriding dependencies from mult…
Browse files Browse the repository at this point in the history
…iple sources
  • Loading branch information
carlossg committed Mar 6, 2015
1 parent 61377ab commit 9701308
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 77 deletions.
176 changes: 100 additions & 76 deletions features/install.feature
Expand Up @@ -16,7 +16,7 @@ Feature: cli/install
Then the output should match /^Unable to parse json file .*metadata.json: .*$/
And the exit status should be 1

Scenario: Install a module dependency from git and forge should be deterministic
Scenario: Install a module transitive dependency from git and forge should be deterministic
Given a file named "Puppetfile" with:
"""
forge "http://forge.puppetlabs.com"
Expand All @@ -27,8 +27,32 @@ Feature: cli/install
When I run `librarian-puppet install --verbose`
Then the exit status should be 0
And the file "modules/stdlib/Modulefile" should match /version *'3\.0\.0'/
And the output should not contain "Executing puppet module install for puppetlabs/stdlib"
And the output should not contain "Executing puppet module install for puppetlabs-stdlib"
And the output should not match /Executing puppet module install for puppetlabs.stdlib/

Scenario: Install duplicated dependencies from git and forge, last one wins
Given a file named "Puppetfile" with:
"""
forge "http://forge.puppetlabs.com"
metadata
mod 'puppetlabs-stdlib', :git => 'https://github.com/puppetlabs/puppetlabs-stdlib.git', :ref => '3.0.0'
"""
And a file named "metadata.json" with:
"""
{
"name": "random name",
"dependencies": [
{
"name": "puppetlabs/stdlib",
"version_requirement": ">= 0"
}
]
}
"""
When I run `librarian-puppet install --verbose`
Then the exit status should be 0
And the file "modules/stdlib/Modulefile" should match /version *'3\.0\.0'/
And the output should not match /Executing puppet module install for puppetlabs.stdlib/

Scenario: Installing two modules with same name and using exclusions
Given a file named "Puppetfile" with:
Expand Down Expand Up @@ -73,76 +97,76 @@ Feature: cli/install
Unable to parse .*/bad_modulefile/Modulefile, ignoring: Missing version
"""

Scenario: Install a module with the rsync configuration using the --clean flag
Given a file named "Puppetfile" with:
"""
forge "http://forge.puppetlabs.com"
mod 'maestrodev/test'
"""
And a file named ".librarian/puppet/config" with:
"""
---
LIBRARIAN_PUPPET_RSYNC: 'true'
"""
When I run `librarian-puppet config`
Then the exit status should be 0
And the output should contain "rsync: true"
When I run `librarian-puppet install`
Then the exit status should be 0
And a directory named "modules/test" should exist
And the file "modules/test" should have an inode and ctime
When I run `librarian-puppet install --clean`
Then the exit status should be 0
And a directory named "modules/test" should exist
And the file "modules/test" should not have the same inode or ctime as before

Scenario: Install a module with the rsync configuration using the --destructive flag
Given a file named "Puppetfile" with:
"""
forge "http://forge.puppetlabs.com"
mod 'maestrodev/test'
"""
And a file named ".librarian/puppet/config" with:
"""
---
LIBRARIAN_PUPPET_RSYNC: 'true'
"""
When I run `librarian-puppet config`
Then the exit status should be 0
And the output should contain "rsync: true"
When I run `librarian-puppet install`
Then the exit status should be 0
And a directory named "modules/test" should exist
And the file "modules/test" should have an inode and ctime
Given I wait for 1 second
When I run `librarian-puppet install --destructive`
Then the exit status should be 0
And a directory named "modules/test" should exist
And the file "modules/test" should not have the same inode or ctime as before

Scenario: Install a module with the rsync configuration
Given a file named "Puppetfile" with:
"""
forge "http://forge.puppetlabs.com"
mod 'maestrodev/test'
"""
And a file named ".librarian/puppet/config" with:
"""
---
LIBRARIAN_PUPPET_RSYNC: 'true'
"""
When I run `librarian-puppet config`
Then the exit status should be 0
And the output should contain "rsync: true"
When I run `librarian-puppet install`
Then the exit status should be 0
And a directory named "modules/test" should exist
And the file "modules/test" should have an inode and ctime
Given I wait for 1 second
When I run `librarian-puppet install`
Then the exit status should be 0
And a directory named "modules/test" should exist
And the file "modules/test" should have the same inode and ctime as before
Scenario: Install a module with the rsync configuration using the --clean flag
Given a file named "Puppetfile" with:
"""
forge "http://forge.puppetlabs.com"
mod 'maestrodev/test'
"""
And a file named ".librarian/puppet/config" with:
"""
---
LIBRARIAN_PUPPET_RSYNC: 'true'
"""
When I run `librarian-puppet config`
Then the exit status should be 0
And the output should contain "rsync: true"
When I run `librarian-puppet install`
Then the exit status should be 0
And a directory named "modules/test" should exist
And the file "modules/test" should have an inode and ctime
When I run `librarian-puppet install --clean`
Then the exit status should be 0
And a directory named "modules/test" should exist
And the file "modules/test" should not have the same inode or ctime as before

Scenario: Install a module with the rsync configuration using the --destructive flag
Given a file named "Puppetfile" with:
"""
forge "http://forge.puppetlabs.com"
mod 'maestrodev/test'
"""
And a file named ".librarian/puppet/config" with:
"""
---
LIBRARIAN_PUPPET_RSYNC: 'true'
"""
When I run `librarian-puppet config`
Then the exit status should be 0
And the output should contain "rsync: true"
When I run `librarian-puppet install`
Then the exit status should be 0
And a directory named "modules/test" should exist
And the file "modules/test" should have an inode and ctime
Given I wait for 1 second
When I run `librarian-puppet install --destructive`
Then the exit status should be 0
And a directory named "modules/test" should exist
And the file "modules/test" should not have the same inode or ctime as before

Scenario: Install a module with the rsync configuration
Given a file named "Puppetfile" with:
"""
forge "http://forge.puppetlabs.com"
mod 'maestrodev/test'
"""
And a file named ".librarian/puppet/config" with:
"""
---
LIBRARIAN_PUPPET_RSYNC: 'true'
"""
When I run `librarian-puppet config`
Then the exit status should be 0
And the output should contain "rsync: true"
When I run `librarian-puppet install`
Then the exit status should be 0
And a directory named "modules/test" should exist
And the file "modules/test" should have an inode and ctime
Given I wait for 1 second
When I run `librarian-puppet install`
Then the exit status should be 0
And a directory named "modules/test" should exist
And the file "modules/test" should have the same inode and ctime as before
2 changes: 1 addition & 1 deletion librarian-puppet.gemspec
Expand Up @@ -26,7 +26,7 @@ Gem::Specification.new do |s|

s.executables = ['librarian-puppet']

s.add_dependency "librarianp", ">=0.5.1"
s.add_dependency "librarianp", ">=0.6.0"
s.add_dependency "rsync"
s.add_dependency "puppet_forge"

Expand Down

0 comments on commit 9701308

Please sign in to comment.