Skip to content

Commit

Permalink
Merge pull request #125 from juniorsysadmin/repo-url-suffix
Browse files Browse the repository at this point in the history
Handle NodeSource Debian URL suffixes
  • Loading branch information
tphoney committed Apr 21, 2015
2 parents 1953546 + 14910f6 commit 84d07b8
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 2 deletions.
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,16 @@ via Chocolatey.
To install Node.js and npm (using the NodeSource repository if possible):

```puppet
class { 'nodejs': }
class { 'nodejs': }
```

If you wish to install a Node.js 0.12.x release from the NodeSource repository
rather than 0.10.x on Debian platforms:

```puppet
class { 'nodejs':
repo_url_suffix => 'node_0.12',
}
```

## Usage
Expand Down Expand Up @@ -396,6 +405,12 @@ Password for the proxy used by the repository, if required.

User for the proxy used by the repository, if required.

#### `repo_url_suffix`

This module defaults to installing the latest NodeSource 0.10.x release on
Debian platforms. If you wish to install a 0.12.x release you will need to
set this parameter to `node_0.12` instead.

#### `use_flags`

The USE flags to use for the Node.js package on Gentoo systems. Defaults to
Expand Down
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
$repo_proxy = $nodejs::params::repo_proxy,
$repo_proxy_password = $nodejs::params::repo_proxy_password,
$repo_proxy_username = $nodejs::params::repo_proxy_username,
$repo_url_suffix = $nodejs::params::repo_url_suffix,
$use_flags = $nodejs::params::use_flags,
) inherits nodejs::params {

Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
$repo_proxy = 'absent'
$repo_proxy_password = 'absent'
$repo_proxy_username = 'absent'
$repo_url_suffix = 'node_0.10'
$use_flags = ['npm', 'snapshot']

# The full path to cmd.exe is required on Windows. The system32 fact is only
Expand Down
1 change: 1 addition & 0 deletions manifests/repo/nodesource.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
$proxy = $nodejs::repo_proxy
$proxy_password = $nodejs::repo_proxy_password
$proxy_username = $nodejs::repo_proxy_username
$url_suffix = $nodejs::repo_url_suffix

case $::osfamily {
'RedHat': {
Expand Down
3 changes: 2 additions & 1 deletion manifests/repo/nodesource/apt.pp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
$enable_src = $nodejs::repo::nodesource::enable_src
$ensure = $nodejs::repo::nodesource::ensure
$pin = $nodejs::repo::nodesource::pin
$url_suffix = $nodejs::repo::nodesource::url_suffix

include ::apt

Expand All @@ -12,7 +13,7 @@
include_src => $enable_src,
key => '1655A0AB68576280',
key_source => 'https://deb.nodesource.com/gpgkey/nodesource.gpg.key',
location => 'https://deb.nodesource.com/node',
location => "https://deb.nodesource.com/${url_suffix}",
pin => $pin,
release => $::lsbdistcodename,
repos => 'main',
Expand Down
14 changes: 14 additions & 0 deletions spec/classes/nodejs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,20 @@
end
end

context 'and repo_url_suffix set to node_0.12' do
let :params do
default_params.merge!({
:repo_url_suffix => 'node_0.12',
})
end

it 'the repo apt::source resource should contain location = https://deb.nodesource.com/node_0.12' do
should contain_apt__source('nodesource').with({
'location' => 'https://deb.nodesource.com/node_0.12'
})
end
end

context 'and repo_ensure set to present' do
let :params do
default_params.merge!({
Expand Down

0 comments on commit 84d07b8

Please sign in to comment.