puppet-moddeps 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YWIwMjA1YzZmN2QyZjlkM2M2YTIxZjlkZDYwOWZkZDU0NjNjYWI2Yg==
4
+ MWY4NmZmNmVlOWY5Yjk5NDIwMmUxZGFjMTg3MDhmMTE2ZjgwN2IyOA==
5
5
  data.tar.gz: !binary |-
6
- YjY3Y2IzNTY5NTA4MGE1YzRkZDdjZmU4MTRiOTY2NmRkNWIyMTVmOQ==
6
+ OTQzOTczYWYzNGRhZDNlN2RmZTljMjAwODZmM2ZiNmViNTEzNjlhMA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZjYxMTY5ODI1OWExZDAxMzVkNThlMzg5Njc2YjM3MjgzMGM3OWJkMzE1Mzc3
10
- YWRiMjljYzk2ODQwZTNhNjE1MzEwZmRiYjBmZjM3MjNhMmU1NGM2NjQyOGFi
11
- ZWYyY2NkMDQ5Mzc5OTE1NmEwZGE4ZThjYTc5NjY2NjYwZGVjMzM=
9
+ ZTQ2ZDE3MmQzYmJkYTYyYjlkNTQ4MWI4ODhlZjU0NjFhYjRjZTU0MmU2OGVh
10
+ MGM5ZDg5ZDZkMjIyZmQyNjc4MjdlZGU0Mzk3MzdjNWQyNGQ3NzVmOTkxYzhm
11
+ ZjdjNzQ3NTgxY2VlMDE0NDgxNWY2YmI5ZDU5MmRmNWU2M2VmOTU=
12
12
  data.tar.gz: !binary |-
13
- MDBhMmZhODBmNzdlZjdlZTZjZmIyZWZkNDQzZTEwYzQ0MDYzNTYyOGIyMjQz
14
- YjhjNmZlMTdlODNjZDI1OGY3YTVmNjAxYzFjODI3NjQzOWMyZDQ4NjA5NWQx
15
- NjY4OWQzNTYzMDA0ZjY5MGY0MmNmYzU1MjU2YTUzN2JlNzEzNjQ=
13
+ MTYyY2Y0MThiZWQ4MDI4NzhmZDAxZjU5NWVlM2UzOGM3NDYwNGY3MzdlYWVj
14
+ ZWQxOGQwZjcyNDViODJmNTQ1YTcwNDRlMDBmOGM4MmEyYWU3YzJiZDAzNjYz
15
+ MjE4NDcxNGU2YjFlMmU2MTA2YzhiZjMxODY0MTVlZWIzNDBlNWY=
data/.gitignore CHANGED
@@ -1,7 +1,7 @@
1
1
  /.bundle/
2
2
  /.vagrant/
3
3
  /.yardoc
4
- #/Gemfile.lock
4
+ /Gemfile.lock
5
5
  /_yardoc/
6
6
  /coverage/
7
7
  /doc/
@@ -22,3 +22,4 @@ mkmf.log
22
22
  /vendor
23
23
 
24
24
  /.c9/
25
+ /.idea/
data/.travis.yml CHANGED
@@ -5,18 +5,8 @@ rvm:
5
5
  - 2.0.0
6
6
  - 2.1.1
7
7
 
8
- before_install:
9
- - wget https://apt.puppetlabs.com/puppetlabs-release-precise.deb
10
- - sudo dpkg -i puppetlabs-release-precise.deb
11
- - sudo apt-get update -qq
12
- - sudo apt-get install -y puppet > /dev/null
13
- - sudo chmod 777 /etc/puppet/modules
14
- - moddir='/etc/puppet/modules/fake_private_module'
15
- - mkdir "$moddir"
16
- - echo '{"dependencies":[' >> "$moddir/metadata.json"
17
- - echo '{"name":"puppetlabs/stdlib","version_requirement":">= 2.4.0"},' >> "$moddir/metadata.json"
18
- - echo '{"name":"puppetlabs/concat","version_requirement":">= 1.1.1"},' >> "$moddir/metadata.json"
19
- - echo '{"name":"puppetlabs/firewall","version_requirement":">= 1.3.0"}]}' >> "$moddir/metadata.json"
8
+ env:
9
+ - PUPPET_VERSION=3.7.3
20
10
 
21
11
  script: 'bundle exec rake'
22
12
 
data/Guardfile CHANGED
@@ -2,11 +2,22 @@
2
2
  # vi: set ft=ruby :
3
3
 
4
4
  guard 'rspec', cmd: 'bundle exec rspec' do
5
+
6
+ # watch /lib files
7
+ watch(%r{^lib/(.+).rb$}) do |m|
8
+ "spec/#{m[1]}_spec.rb"
9
+ end
10
+
5
11
  # watch /lib/puppet files
6
12
  watch(%r{^lib/puppet/(.+).rb$}) do |m|
7
13
  "spec/#{m[1]}_spec.rb"
8
14
  end
9
15
 
16
+ # watch /lib/puppet/moddeps files
17
+ watch(%r{^lib/puppet/moddeps(.+).rb$}) do |m|
18
+ "spec/#{m[1]}_spec.rb"
19
+ end
20
+
10
21
  # watch /spec/ files
11
22
  watch(%r{^spec/(.+).rb$}) do |m|
12
23
  "spec/#{m[1]}.rb"
data/README.md CHANGED
@@ -12,18 +12,17 @@
12
12
  [![Build Status][travis-img-develop]][travis-ci]
13
13
  [![Coverage Status][coveralls-img-develop]][coveralls-develop]
14
14
 
15
- ## I work!
16
-
17
- **This gem DOES run successfully** using the system ruby on CentOS 6 (v1.8.7).
18
- The broken build status is a result of how [RVM][rvm] changes the environment
19
- and is something that is being investigated.
20
-
21
15
  ## Description
22
16
 
23
17
  This gem will allow you to pull in all missing dependencies for a given Puppet
24
18
  module. This is targeted specifically at private modules or modules cloned from
25
19
  GitHub that have a populated `metadata.json` file.
26
20
 
21
+ puppet-moddeps has been extensively tested on CentOS 6 using the system ruby
22
+ (v1.8.7). Due to dependency requirements all development is done on ruby 1.9.3
23
+ or higher. Automated testing of v1.8.7 cannot be done on Travis-CI due to the
24
+ development dependancies..
25
+
27
26
  ## Installation
28
27
 
29
28
  Add this line to your application's Gemfile:
data/Vagrantfile CHANGED
@@ -12,9 +12,8 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
12
12
  dev.vm.synced_folder "./", "/home/vagrant/puppet-moddeps"
13
13
 
14
14
  dev.vm.provision "shell", inline: "yum -y install dos2unix git nano ruby-devel tree vim-enhanced"
15
- dev.vm.provision "shell", inline: "dos2unix /vagrant/scripts/vagrant-user.sh"
16
- dev.vm.provision "shell", inline: "su - vagrant -c '/vagrant/scripts/vagrant-user.sh'"
17
- dev.vm.provision "shell", path: "scripts/pretest.sh"
15
+ dev.vm.provision "shell", inline: "dos2unix /vagrant/scripts/*.sh"
16
+ dev.vm.provision "shell", inline: "su - vagrant -c 'export PUPPET_VERSION=3.7.3; /vagrant/scripts/vagrant-user.sh'"
18
17
 
19
18
  end
20
19
 
data/bin/puppet-moddeps CHANGED
@@ -2,4 +2,5 @@
2
2
 
3
3
  require 'puppet/moddeps'
4
4
 
5
- Puppet::Moddeps.installDeps(ARGV)
5
+ depinstaller = Puppet::Moddeps::InstallDeps.new
6
+ depinstaller.install(ARGV)
@@ -0,0 +1,93 @@
1
+ require 'rubygems'
2
+ require 'json'
3
+
4
+ module Puppet
5
+ module Moddeps
6
+ class InstallDeps
7
+
8
+ attr_reader :module_path, :deps
9
+
10
+ def initialize(path=nil, deps=nil)
11
+ if path and path.is_a?(String)
12
+ @module_path = path
13
+ elsif path
14
+ abort('The provided path was not a string.')
15
+ else
16
+ @module_path = %x(puppet config print modulepath).split(':')[0]
17
+ end
18
+
19
+ if deps and deps.is_a?(Array)
20
+ @deps = deps
21
+ elsif deps
22
+ abort('The provided dependency list was not an array.')
23
+ else
24
+ @deps = []
25
+ end
26
+ end
27
+
28
+ def install(*puppet_module)
29
+
30
+ if puppet_module.size >=1 and puppet_module[0].is_a?(Array)
31
+ args = puppet_module[0]
32
+ else
33
+ args = puppet_module
34
+ end
35
+
36
+ if args.size == 1
37
+ if installed?(args[0])
38
+ self.parse_metadata(args[0])
39
+ self.install_modules
40
+ else
41
+ puts "Can't find #{args[0]} in #{@module_path}"
42
+ end
43
+ else
44
+ self.help
45
+ end
46
+ end
47
+
48
+ def help
49
+ puts 'Usage: puppet-moddeps module'
50
+ puts ' Call puppet-moddeps with the name of one installed module'
51
+ end
52
+
53
+ def installed?(module_name)
54
+ File.directory?("#{@module_path}/#{module_name}")
55
+ end
56
+
57
+ def parse_metadata(module_name)
58
+ metadata = File.read("#{@module_path}/#{module_name}/metadata.json")
59
+ data = JSON.parse(metadata)
60
+ self.parse_deps(data)
61
+ end
62
+
63
+ def parse_deps(data)
64
+ @deps.clear
65
+
66
+ data['dependencies'].each do |dep|
67
+ depname = dep["name"].sub '/', '-'
68
+ @deps.push( depname )
69
+ end
70
+ end
71
+
72
+ def install_modules
73
+ if @deps.size > 0
74
+
75
+ puts "Modules will be installed into #{module_path}"
76
+
77
+ @deps.each do |dep|
78
+ if self.installed?(dep)
79
+ puts "#{dep} is already installed, skipping."
80
+ else
81
+ cmd = "puppet module install #{dep}"
82
+ puts "Running \"#{cmd}\"..."
83
+ %x(#{cmd})
84
+ end
85
+ end
86
+ else
87
+ puts 'No dependencies were marked for installation.'
88
+ end
89
+ end
90
+
91
+ end
92
+ end
93
+ end
@@ -1,5 +1,5 @@
1
1
  module Puppet
2
2
  module Moddeps
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
@@ -1,72 +1,8 @@
1
+ require 'puppet/moddeps/install_deps'
1
2
  require 'puppet/moddeps/version'
2
- require 'rubygems'
3
- require 'json'
4
3
 
5
4
  module Puppet
6
5
  module Moddeps
7
6
 
8
- @@default_module_path = '/etc/puppet/modules'
9
-
10
- def Moddeps.installDeps(*puppet_module)
11
-
12
- if ( puppet_module.size >=1 and puppet_module[0].is_a?(Array) )
13
- args = puppet_module[0]
14
- else
15
- args = puppet_module
16
- end
17
-
18
- if ( args.size == 1 )
19
- if Moddeps.checkIfInstalled(args[0])
20
- Moddeps.parseMetadata(args[0])
21
- Moddeps.installModules
22
- else
23
- puts "Can't find #{args[0]} in #{@@default_module_path}"
24
- end
25
- else
26
- Moddeps.help
27
- end
28
- end
29
-
30
- def Moddeps.help
31
- puts 'Usage: puppet-moddeps module'
32
- puts ' Call puppet-moddeps with the name of one installed module'
33
- end
34
-
35
- def Moddeps.checkIfInstalled(file)
36
- File.directory?("#{@@default_module_path}/#{file}")
37
- end
38
-
39
- def Moddeps.parseMetadata(puppet_module)
40
- metadata = File.read("#{@@default_module_path}/#{puppet_module}/metadata.json")
41
- data = JSON.parse(metadata)
42
- @deps = Moddeps.getDeps(data)
43
- end
44
-
45
- def Moddeps.getDeps(data)
46
- dependencies = []
47
- data['dependencies'].each do |dep|
48
- depname = dep["name"].sub '/', '-'
49
- dependencies.push( depname )
50
- end
51
-
52
- return dependencies
53
- end
54
-
55
- def Moddeps.installModules
56
- if @deps.size > 0
57
- @deps.each do |dep|
58
- if Moddeps.checkIfInstalled(dep)
59
- puts "#{dep} is already installed, skipping."
60
- else
61
- cmd = "/usr/bin/puppet module install #{dep}"
62
- puts "Running \"#{cmd}\"..."
63
- %x(#{cmd})
64
- end
65
- end
66
- else
67
- puts 'No dependencies were marked for installation.'
68
- end
69
- end
70
-
71
7
  end
72
8
  end
@@ -37,5 +37,12 @@ Gem::Specification.new do |spec|
37
37
  spec.add_development_dependency 'rspec', '~> 3.1'
38
38
  spec.add_development_dependency 'rspec-nc', '~> 0.2'
39
39
 
40
+ if ENV.key?('PUPPET_VERSION')
41
+ puppetversion = "= #{ENV['PUPPET_VERSION']}"
42
+ else
43
+ puppetversion = ['>= 3.0', '< 4.0']
44
+ end
45
+ spec.add_development_dependency 'puppet', puppetversion
46
+
40
47
  spec.add_runtime_dependency 'json', '~> 1.8', '>= 1.8.1'
41
48
  end
@@ -0,0 +1,127 @@
1
+ require 'spec_helper'
2
+
3
+ describe Puppet::Moddeps::InstallDeps do
4
+
5
+ before(:all) do
6
+ puts 'Downloading the puppetlabs-apache module...'
7
+ %x(puppet module install puppetlabs-apache --ignore-dependencies)
8
+ @expected_path = %x(puppet config print modulepath).split(':')[0]
9
+ end
10
+
11
+ describe '.initialize(path, deps)' do
12
+
13
+ it 'should set the default module path and deps list' do
14
+ base_obj = Puppet::Moddeps::InstallDeps.new
15
+
16
+ expect(base_obj.module_path).to eq(@expected_path)
17
+ expect(base_obj.deps).to match_array []
18
+ end
19
+
20
+ it 'should use the provided values' do
21
+ base_obj = Puppet::Moddeps::InstallDeps.new('/tmp', ['dep1', 'dep2'])
22
+ expect(base_obj.module_path).to eq('/tmp')
23
+ expect(base_obj.deps).to contain_exactly('dep1', 'dep2')
24
+ end
25
+
26
+ it 'should fail when an array is passed to path' do
27
+ expect { Puppet::Moddeps::InstallDeps.new(['dep1', 'dep2']) }.to raise_error(SystemExit, 'The provided path was not a string.' )
28
+ end
29
+
30
+ it 'should fail when an string is passed to deps' do
31
+ expect { Puppet::Moddeps::InstallDeps.new('arg1', 'arg2') }.to raise_error(SystemExit, 'The provided dependency list was not an array.' )
32
+ end
33
+
34
+ end
35
+
36
+ describe '.install(puppet_module) feedback verification' do
37
+
38
+ before(:each) do
39
+ @base_object = Puppet::Moddeps::InstallDeps.new
40
+ end
41
+
42
+ context 'with no parameters' do
43
+ it 'should print usage info' do
44
+ expect { @base_object.install }.to output(/Usage.*/).to_stdout
45
+ end
46
+ end
47
+
48
+ context 'with two or more parameters' do
49
+ it 'should print usage info' do
50
+ expect { @base_object.install('arg1', 'arg2') }.to output(/Usage.*/).to_stdout
51
+ end
52
+ end
53
+
54
+ context 'with one parameter' do
55
+ it 'should print usage if multiple arguments come in as an array' do
56
+ params = ['arg1', 'arg2']
57
+ expect { @base_object.install(params) }.to output(/Usage.*/).to_stdout
58
+ end
59
+
60
+ it 'should print usage if an empty array is passed in' do
61
+ params = []
62
+ expect { @base_object.install(params) }.to output(/Usage.*/).to_stdout
63
+ end
64
+
65
+ it 'should fail if the parameter is not an installed module' do
66
+ expect { @base_object.install('fake_missing_module') }.to output(/Can\'t find fake_missing_module in.*/).to_stdout
67
+ end
68
+
69
+ end
70
+
71
+ end
72
+
73
+ describe '.parse_metadata' do
74
+
75
+ it "should parse metadata.json" do
76
+ base_object = Puppet::Moddeps::InstallDeps.new
77
+
78
+ base_object.parse_metadata('apache')
79
+
80
+ expect(base_object.deps).to contain_exactly('puppetlabs-stdlib', 'puppetlabs-concat')
81
+ end
82
+
83
+ end
84
+
85
+ describe '.install_modules' do
86
+
87
+ before(:all) do
88
+ @base_object = Puppet::Moddeps::InstallDeps.new
89
+ end
90
+
91
+ it 'should say the module is already installed' do
92
+ @base_object.instance_variable_set(:@deps, ['apache'])
93
+
94
+ expect { @base_object.install_modules }.to output(/apache is already installed.*/).to_stdout
95
+ end
96
+
97
+ it 'should say nothing to install' do
98
+ @base_object.instance_variable_set(:@deps, [])
99
+
100
+ expect { @base_object.install_modules }.to output(/No dependencies were marked for installation.*/).to_stdout
101
+ end
102
+
103
+ end
104
+
105
+ describe '.install actual Puppet modules' do
106
+
107
+ it "should install each module in provided array" do
108
+ base_object = Puppet::Moddeps::InstallDeps.new
109
+
110
+ base_object.install('apache')
111
+
112
+ basedir = base_object.module_path
113
+
114
+ base_object.deps.each do |dep|
115
+ expect(File.directory?("#{basedir}/#{dep.split('-')[1]}")).to eql(true)
116
+ end
117
+
118
+ end
119
+
120
+ end
121
+
122
+ after(:all) do
123
+ puts "Removing all modules from #{@expected_path}"
124
+ %x(rm -rf #{@expected_path}/*)
125
+ end
126
+
127
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-moddeps
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GeneBean
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-29 00:00:00.000000000 Z
11
+ date: 2014-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -164,6 +164,20 @@ dependencies:
164
164
  - - ~>
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0.2'
167
+ - !ruby/object:Gem::Dependency
168
+ name: puppet
169
+ requirement: !ruby/object:Gem::Requirement
170
+ requirements:
171
+ - - '='
172
+ - !ruby/object:Gem::Version
173
+ version: 3.7.3
174
+ type: :development
175
+ prerelease: false
176
+ version_requirements: !ruby/object:Gem::Requirement
177
+ requirements:
178
+ - - '='
179
+ - !ruby/object:Gem::Version
180
+ version: 3.7.3
167
181
  - !ruby/object:Gem::Dependency
168
182
  name: json
169
183
  requirement: !ruby/object:Gem::Requirement
@@ -198,7 +212,6 @@ files:
198
212
  - .gitignore
199
213
  - .travis.yml
200
214
  - Gemfile
201
- - Gemfile.lock
202
215
  - Guardfile
203
216
  - LICENSE
204
217
  - README.md
@@ -206,11 +219,11 @@ files:
206
219
  - Vagrantfile
207
220
  - bin/puppet-moddeps
208
221
  - lib/puppet/moddeps.rb
222
+ - lib/puppet/moddeps/install_deps.rb
209
223
  - lib/puppet/moddeps/version.rb
210
224
  - puppet-moddeps.gemspec
211
- - scripts/pretest.sh
212
225
  - scripts/vagrant-user.sh
213
- - spec/moddeps_spec.rb
226
+ - spec/install_deps_spec.rb
214
227
  - spec/spec_helper.rb
215
228
  homepage: https://github.com/genebean/puppet-moddeps
216
229
  licenses:
@@ -237,5 +250,5 @@ signing_key:
237
250
  specification_version: 4
238
251
  summary: Installs dependencies for a given Puppet module
239
252
  test_files:
240
- - spec/moddeps_spec.rb
253
+ - spec/install_deps_spec.rb
241
254
  - spec/spec_helper.rb
data/Gemfile.lock DELETED
@@ -1,107 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- puppet-moddeps (1.0.0)
5
- json (~> 1.8, >= 1.8.1)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- celluloid (0.16.0)
11
- timers (~> 4.0.0)
12
- codeclimate-test-reporter (0.4.3)
13
- simplecov (>= 0.7.1, < 1.0.0)
14
- coderay (1.1.0)
15
- coveralls (0.7.2)
16
- multi_json (~> 1.3)
17
- rest-client (= 1.6.7)
18
- simplecov (>= 0.7)
19
- term-ansicolor (= 1.2.2)
20
- thor (= 0.18.1)
21
- diff-lcs (1.2.5)
22
- docile (1.1.5)
23
- ffi (1.9.6)
24
- formatador (0.2.5)
25
- guard (2.10.5)
26
- formatador (>= 0.2.4)
27
- listen (~> 2.7)
28
- lumberjack (~> 1.0)
29
- nenv (~> 0.1)
30
- pry (>= 0.9.12)
31
- thor (>= 0.18.1)
32
- guard-compat (1.2.0)
33
- guard-rspec (4.5.0)
34
- guard (~> 2.1)
35
- guard-compat (~> 1.1)
36
- rspec (>= 2.99.0, < 4.0)
37
- hitimes (1.2.2)
38
- json (1.8.1)
39
- listen (2.8.4)
40
- celluloid (>= 0.15.2)
41
- rb-fsevent (>= 0.9.3)
42
- rb-inotify (>= 0.9)
43
- lumberjack (1.0.9)
44
- method_source (0.8.2)
45
- mime-types (2.4.3)
46
- multi_json (1.10.1)
47
- nenv (0.1.1)
48
- pry (0.10.1)
49
- coderay (~> 1.1.0)
50
- method_source (~> 0.8.1)
51
- slop (~> 3.4)
52
- pry-nav (0.2.4)
53
- pry (>= 0.9.10, < 0.11.0)
54
- pry-remote (0.1.8)
55
- pry (~> 0.9)
56
- slop (~> 3.0)
57
- rake (10.4.2)
58
- rb-fsevent (0.9.4)
59
- rb-inotify (0.9.5)
60
- ffi (>= 0.5.0)
61
- rest-client (1.6.7)
62
- mime-types (>= 1.16)
63
- rspec (3.1.0)
64
- rspec-core (~> 3.1.0)
65
- rspec-expectations (~> 3.1.0)
66
- rspec-mocks (~> 3.1.0)
67
- rspec-core (3.1.7)
68
- rspec-support (~> 3.1.0)
69
- rspec-expectations (3.1.2)
70
- diff-lcs (>= 1.2.0, < 2.0)
71
- rspec-support (~> 3.1.0)
72
- rspec-mocks (3.1.3)
73
- rspec-support (~> 3.1.0)
74
- rspec-nc (0.2.0)
75
- rspec (>= 2.9)
76
- terminal-notifier (>= 1.4)
77
- rspec-support (3.1.2)
78
- simplecov (0.9.1)
79
- docile (~> 1.1.0)
80
- multi_json (~> 1.0)
81
- simplecov-html (~> 0.8.0)
82
- simplecov-html (0.8.0)
83
- slop (3.6.0)
84
- term-ansicolor (1.2.2)
85
- tins (~> 0.8)
86
- terminal-notifier (1.6.2)
87
- thor (0.18.1)
88
- timers (4.0.1)
89
- hitimes
90
- tins (0.13.2)
91
-
92
- PLATFORMS
93
- ruby
94
-
95
- DEPENDENCIES
96
- bundler (~> 1.7)
97
- codeclimate-test-reporter (~> 0.4)
98
- coveralls (~> 0.7)
99
- guard (~> 2.10)
100
- guard-rspec (~> 4.5)
101
- pry (~> 0.10)
102
- pry-nav (~> 0.2)
103
- pry-remote (~> 0.1)
104
- puppet-moddeps!
105
- rake (~> 10.4)
106
- rspec (~> 3.1)
107
- rspec-nc (~> 0.2)
data/scripts/pretest.sh DELETED
@@ -1,20 +0,0 @@
1
- #!/bin/bash
2
-
3
- chmod 777 /etc/puppet/modules
4
-
5
- moddir='/etc/puppet/modules/fake_private_module'
6
-
7
- if [ -d "$moddir" ]; then rm -rf "$moddir"; fi
8
-
9
- mkdir "$moddir"
10
-
11
- cat > "$moddir/metadata.json" <<EOF
12
- {
13
- "dependencies": [
14
- {"name":"puppetlabs/stdlib","version_requirement":">= 2.4.0"},
15
- {"name":"puppetlabs/concat","version_requirement":">= 1.1.1"},
16
- {"name":"puppetlabs/firewall","version_requirement":">= 1.3.0"}
17
- ]
18
- }
19
-
20
- EOF
data/spec/moddeps_spec.rb DELETED
@@ -1,56 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Puppet::Moddeps do
4
-
5
- describe '.installDeps(puppet_module)' do
6
-
7
- context 'with no parameters' do
8
- it 'should print usage info' do
9
-
10
- expect { Puppet::Moddeps.installDeps() }.to output(/Usage.*/).to_stdout
11
- end
12
- end
13
-
14
- context 'with two or more parameters' do
15
- it 'should print usage info' do
16
- expect { Puppet::Moddeps.installDeps('arg1', 'arg2') }.to output(/Usage.*/).to_stdout
17
- end
18
- end
19
-
20
- context 'with one parameter' do
21
- it 'should print usage if multiple arguments come in as an array' do
22
- params = ['arg1', 'arg2']
23
- expect { Puppet::Moddeps.installDeps(params) }.to output(/Usage.*/).to_stdout
24
- end
25
-
26
- it 'should print usage if an empty array is passed in' do
27
- params = []
28
- expect { Puppet::Moddeps.installDeps(params) }.to output(/Usage.*/).to_stdout
29
- end
30
-
31
- it 'should fail if the parameter is not an installed module' do
32
- expect { Puppet::Moddeps.installDeps('fake_missing_module') }.to output(/Can\'t find fake_missing_module in.*/).to_stdout
33
- end
34
-
35
- it "should parse metadata.json" do
36
- deps = Puppet::Moddeps.parseMetadata('fake_private_module')
37
- expect(deps).to include('puppetlabs-stdlib', 'puppetlabs-concat', 'puppetlabs-firewall')
38
- end
39
-
40
- it "should install each module in provided array" do
41
- Puppet::Moddeps.installDeps('fake_private_module')
42
- basedir = '/etc/puppet/modules'
43
- expect("#{basedir}/stdlib").to exist
44
- expect("#{basedir}/concat").to exist
45
- expect("#{basedir}/firewall").to exist
46
- end
47
-
48
- end
49
-
50
- end # end describe '.installDeps(puppet_module)'
51
-
52
- #after(:all) do
53
- # %x(sudo rm -rf /etc/puppet/modules/*)
54
- #end
55
-
56
- end