ra10ke 1.2.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/ra10ke/syntax.rb CHANGED
@@ -1,18 +1,16 @@
1
1
  module Ra10ke::Syntax
2
2
  def define_task_syntax(*_args)
3
- desc "Syntax check Puppetfile"
3
+ desc 'Syntax check Puppetfile'
4
4
  task :syntax do
5
5
  require 'r10k/action/puppetfile/check'
6
6
 
7
7
  puppetfile = R10K::Action::Puppetfile::Check.new({
8
- :root => @basedir,
9
- :moduledir => @moduledir,
10
- :puppetfile => @puppetfile_path
11
- }, '')
8
+ root: @basedir,
9
+ moduledir: @moduledir,
10
+ puppetfile: @puppetfile_path,
11
+ }, '')
12
12
 
13
- unless puppetfile.call
14
- abort("Puppetfile syntax check failed")
15
- end
13
+ abort('Puppetfile syntax check failed') unless puppetfile.call
16
14
  end
17
15
  end
18
16
  end
@@ -8,7 +8,6 @@ require 'ra10ke/git_repo'
8
8
 
9
9
  module Ra10ke
10
10
  module Validate
11
-
12
11
  GOOD_EMOJI = ENV['GOOD_EMOJI'] || '👍'
13
12
  BAD_EMOJI = ENV['BAD_EMOJI'] || '😨'
14
13
 
@@ -64,7 +63,7 @@ module Ra10ke
64
63
  ref: ref,
65
64
  valid_url?: repo.valid_url?,
66
65
  valid_ref?: valid_ref,
67
- status: valid_ref ? Ra10ke::Validate::GOOD_EMOJI : Ra10ke::Validate::BAD_EMOJI
66
+ status: valid_ref ? Ra10ke::Validate::GOOD_EMOJI : Ra10ke::Validate::BAD_EMOJI,
68
67
  }
69
68
  end
70
69
  end
@@ -1,3 +1,3 @@
1
1
  module Ra10ke
2
- VERSION = "1.2.0"
2
+ VERSION = '3.0.0'
3
3
  end
data/lib/ra10ke.rb CHANGED
@@ -41,13 +41,15 @@ module Ra10ke
41
41
  define_task_duplicates(*args)
42
42
  define_task_install(*args)
43
43
  define_task_validate(*args)
44
+ define_task_print_git_conversion(*args)
44
45
  end
45
46
  end
46
47
 
47
48
  def get_puppetfile
48
49
  R10K::Puppetfile.new(@basedir, @moduledir, @puppetfile_path, @puppetfile_name, @force)
49
50
  rescue ArgumentError # R10k < 2.6.0
50
- R10K::Puppetfile.new(@basedir, @moduledir, @puppetfile_path || File.join(@basedir, @puppetfile_name || 'Puppetfile'))
51
+ R10K::Puppetfile.new(@basedir, @moduledir,
52
+ @puppetfile_path || File.join(@basedir, @puppetfile_name || 'Puppetfile'))
51
53
  end
52
54
  end
53
55
  end
data/ra10ke.gemspec CHANGED
@@ -1,30 +1,30 @@
1
- lib = File.expand_path('../lib', __FILE__)
1
+ lib = File.expand_path('lib', __dir__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
  require 'ra10ke/version'
4
4
 
5
5
  Gem::Specification.new do |spec|
6
- spec.name = "ra10ke"
6
+ spec.name = 'ra10ke'
7
7
  spec.version = Ra10ke::VERSION
8
- spec.authors = ["Theo Chatzimichos", "Vox Pupuli"]
9
- spec.email = ["voxpupuli@groups.io"]
10
- spec.description = %q{R10K and Puppetfile rake tasks}
11
- spec.summary = %q{Syntax check for the Puppetfile, check for outdated installed puppet modules}
12
- spec.homepage = "https://github.com/voxpupuli/ra10ke"
13
- spec.license = "MIT"
8
+ spec.authors = ['Theo Chatzimichos', 'Vox Pupuli']
9
+ spec.email = ['voxpupuli@groups.io']
10
+ spec.description = 'R10K and Puppetfile rake tasks'
11
+ spec.summary = 'Syntax check for the Puppetfile, check for outdated installed puppet modules'
12
+ spec.homepage = 'https://github.com/voxpupuli/ra10ke'
13
+ spec.license = 'MIT'
14
14
 
15
15
  spec.files = `git ls-files`.split($/)
16
- spec.require_paths = ["lib"]
17
- spec.required_ruby_version = '>= 2.4.0'
16
+ spec.require_paths = ['lib']
17
+ spec.required_ruby_version = '>= 2.7.0'
18
18
 
19
- spec.add_dependency "rake"
20
- spec.add_dependency "puppet_forge"
21
- spec.add_dependency "r10k"
22
- spec.add_dependency "git"
23
- spec.add_dependency "solve"
24
- spec.add_dependency 'semverse', '>= 2.0'
19
+ spec.add_dependency 'git', '~> 1.18'
20
+ spec.add_dependency 'puppet_forge', '~> 5.0', '>= 5.0.1'
21
+ spec.add_dependency 'r10k', '>= 2.6.5', '< 5'
22
+ spec.add_dependency 'rake', '~> 13.0', '>= 13.0.6'
23
+ spec.add_dependency 'semverse', '>= 2.0', '< 4'
24
+ spec.add_dependency 'solve', '~> 4.0', '>= 4.0.4'
25
25
  spec.add_dependency 'table_print', '~> 1.5.6'
26
+ spec.add_development_dependency 'pry', '~> 0.14.2'
26
27
  spec.add_development_dependency 'rspec', '~> 3.6'
27
- spec.add_development_dependency 'pry'
28
- spec.add_development_dependency 'simplecov'
28
+ spec.add_development_dependency 'simplecov', '~> 0.22.0'
29
+ spec.add_development_dependency 'voxpupuli-rubocop', '~> 2.0.0'
29
30
  end
30
-
@@ -0,0 +1,78 @@
1
+ # used in profiles
2
+ mod 'puppet/systemd', :latest
3
+ mod 'puppet/lldpd', :latest
4
+ mod 'puppet/ferm', :latest
5
+ mod 'puppet/borg', :latest
6
+ mod 'puppet/wireguard', :latest
7
+ mod 'puppet/bird', :latest
8
+ mod 'puppet/augeasproviders_pam', :latest
9
+ mod 'puppet/augeasproviders_shellvar', :latest
10
+ mod 'puppetlabs/vcsrepo', :latest
11
+ mod 'saz/ssh', :latest
12
+ mod 'puppet/r10k', :latest
13
+ mod 'puppet/dbbackup', :latest
14
+ mod 'puppet/mosquitto', :latest
15
+ mod 'puppet/grafana', :latest
16
+ mod 'puppet/nginx', :latest
17
+ mod 'puppet/ssh_keygen', :latest
18
+ mod 'puppet/unbound', :latest
19
+ mod 'puppetlabs/inifile', :latest
20
+ mod 'puppet/prometheus', :latest
21
+ mod 'theforeman/foreman', :latest
22
+ mod 'theforeman/puppet', :latest
23
+ mod 'theforeman/foreman_proxy', :latest
24
+ mod 'puppet/nftables', :latest
25
+ mod 'puppet/augeasproviders_sysctl', :latest
26
+ mod 'puppet/catalog_diff', :latest
27
+ mod 'puppet/unattended_upgrades', :latest
28
+ mod 'puppet/selinux', :latest
29
+ mod 'choria/choria', :latest
30
+ mod 'puppet/archive', :latest
31
+ mod 'puppet/elasticsearch', :latest
32
+ mod 'jsok/vault',
33
+ git: 'https://github.com/bastelfreak/puppet-vault',
34
+ ref: 'test'
35
+
36
+ # dependencies
37
+ mod 'puppet/augeasproviders_core', :latest
38
+ mod 'puppetlabs/stdlib', :latest
39
+ mod 'choria/mcollective', :latest
40
+ mod 'puppetlabs/concat', :latest
41
+ mod 'puppetlabs/apt', :latest
42
+ mod 'puppetlabs/apache', :latest
43
+ mod 'puppetlabs/postgresql', :latest
44
+ mod 'puppet/extlib', :latest
45
+ mod 'puppet/redis', :latest
46
+ mod 'puppet/epel', :latest
47
+ mod 'theforeman/puppetserver_foreman', :latest
48
+ mod 'richardc/datacat', :latest
49
+ mod 'theforeman/dns', :latest
50
+ mod 'theforeman/dhcp', :latest
51
+ mod 'theforeman/tftp', :latest
52
+ mod 'puppetlabs/xinetd', :latest
53
+ mod 'choria-mcollective_choria', :latest
54
+ mod 'choria/mcollective_agent_puppet', :latest
55
+ mod 'choria/mcollective_agent_package', :latest
56
+ mod 'choria/mcollective_agent_service', :latest
57
+ mod 'choria/mcollective_agent_filemgr', :latest
58
+ mod 'choria/mcollective_agent_shell', :latest
59
+ mod 'choria/mcollective_agent_nettest', :latest
60
+ mod 'choria/mcollective_agent_puppetca', :latest
61
+ mod 'choria/mcollective_agent_bolt_tasks', :latest
62
+ mod 'choria/mcollective_agent_iptables', :latest
63
+ mod 'choria/mcollective_agent_process', :latest
64
+ mod 'choria/mcollective_util_actionpolicy', :latest
65
+ mod 'optiz0r/mcollective_agent_puppet_env', :latest
66
+ mod 'jay7x/mcollective_agent_query', :latest
67
+ mod 'choria/mcollective_data_sysctl', :latest
68
+ mod 'puppet/yum', :latest
69
+ mod 'puppetlabs/java', :latest
70
+ mod 'puppet/elastic_stack', :latest
71
+ mod 'puppet/hashi_stack', :latest
72
+
73
+ # core modules are not vendored on Gentoo
74
+ mod 'puppetlabs-sshkeys_core', :latest
75
+ mod 'puppetlabs-mount_core', :latest
76
+ mod 'puppetlabs-augeas_core', :latest
77
+ mod 'puppetlabs-selinux_core', :latest
78
+ mod 'puppetlabs-yumrepo_core', :latest
@@ -0,0 +1,28 @@
1
+ mod 'choria',
2
+ :git => 'https://github.com/choria-io/puppet-choria',
3
+ :ref => '0.26.2'
4
+
5
+ mod 'inifile',
6
+ :git => 'https://github.com/puppetlabs/puppetlabs-inifile',
7
+ :ref => '2.2.0'
8
+
9
+ mod 'ruby',
10
+ :git => 'https://github.com/puppetlabs/puppetlabs-ruby.git',
11
+ :ref => 'v1.0.1'
12
+
13
+ mod 'stdlib',
14
+ :git => 'https://github.com/puppetlabs/puppetlabs-stdlib',
15
+ :ref => '4.24.0'
16
+
17
+ mod 'concat',
18
+ :git => 'https://github.com/puppetlabs/puppetlabs-concat',
19
+ :ref => '4.0.0'
20
+
21
+ mod 'ntp',
22
+ :git => 'https://github.com/puppetlabs/puppetlabs-ntp',
23
+ :ref => '6.4.1'
24
+
25
+ mod 'archive',
26
+ :git => 'https://github.com/voxpupuli/puppet-archive',
27
+ :ref => 'v3.1.1'
28
+
@@ -1,50 +1,74 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'r10k/puppetfile'
3
4
  require 'spec_helper'
4
5
  require 'ra10ke/dependencies'
6
+ require 'ra10ke'
7
+
5
8
  RSpec::Mocks.configuration.allow_message_expectations_on_nil = true
6
9
 
7
10
  RSpec.describe 'Ra10ke::Dependencies::Verification' do
8
- after(:each) do
9
- # reset version formats
10
- formats = Ra10ke::Dependencies.class_variable_get(:@@version_formats)
11
- Ra10ke::Dependencies.class_variable_set(:@@version_formats, formats.select { |k, _v| k == :semver } )
11
+ let(:instance) do
12
+ pfile = R10K::Puppetfile.new(File.basename(puppetfile), nil, puppetfile, nil, false)
13
+ Ra10ke::Dependencies::Verification.new(pfile)
14
+ end
15
+
16
+ let(:puppetfile) do
17
+ File.join(fixtures_dir, 'Puppetfile')
12
18
  end
13
19
 
14
20
  context 'register_version_format' do
15
21
  it 'default contains semver' do
16
- expect(Ra10ke::Dependencies.class_variable_get(:@@version_formats)).to have_key(:semver)
22
+ expect(Ra10ke::Dependencies::Verification.version_formats).to have_key(:semver)
17
23
  end
24
+
18
25
  it 'add new version format' do
19
- Ra10ke::Dependencies.register_version_format(:test) do |tags|
26
+ Ra10ke::Dependencies::Verification.register_version_format(:test) do |_tags|
20
27
  nil
21
28
  end
22
- expect(Ra10ke::Dependencies.class_variable_get(:@@version_formats)).to have_key(:test)
29
+ expect(Ra10ke::Dependencies::Verification.version_formats).to have_key(:test)
23
30
  end
24
31
  end
25
32
 
26
- context 'get_latest_ref' do
33
+ context 'show output in table format' do
27
34
  let(:instance) do
28
- class DependencyDummy
29
- include Ra10ke::Dependencies
30
- end.new
35
+ pfile = R10K::Puppetfile.new(File.basename(puppetfile), nil, puppetfile, nil, false)
36
+ Ra10ke::Dependencies::Verification.new(pfile)
31
37
  end
32
38
 
39
+ let(:puppetfile) do
40
+ File.join(fixtures_dir, 'Puppetfile')
41
+ end
42
+
43
+ let(:processed_modules) do
44
+ instance.outdated
45
+ end
46
+
47
+ it 'have dependencies array' do
48
+ expect(processed_modules).to be_a Array
49
+ end
50
+
51
+ it 'show dependencies as table' do
52
+ instance.print_table(processed_modules)
53
+ end
54
+ end
55
+
56
+ context 'get_latest_ref' do
33
57
  context 'find latest semver tag' do
34
58
  let(:latest_tag) do
35
- 'v1.1.0'
59
+ 'v1.1.0'
36
60
  end
37
61
  let(:test_tags) do
38
62
  {
39
- 'v1.0.0' => nil,
63
+ 'v1.0.0' => nil,
40
64
  latest_tag => nil,
41
65
  }
42
66
  end
43
67
 
44
68
  it do
45
69
  expect(instance.get_latest_ref({
46
- 'tags' => test_tags,
47
- })).to eq(latest_tag)
70
+ 'tags' => test_tags,
71
+ })).to eq(latest_tag)
48
72
  end
49
73
  end
50
74
 
@@ -54,18 +78,29 @@ RSpec.describe 'Ra10ke::Dependencies::Verification' do
54
78
  end
55
79
  let(:test_tags) do
56
80
  {
57
- 'dev' => nil,
81
+ 'dev' => nil,
58
82
  latest_tag => nil,
59
83
  }
60
84
  end
61
85
 
62
86
  it do
63
- Ra10ke::Dependencies.register_version_format(:number) do |tags|
87
+ Ra10ke::Dependencies::Verification.register_version_format(:number) do |tags|
64
88
  tags.detect { |tag| tag == latest_tag }
65
89
  end
66
90
  expect(instance.get_latest_ref({
67
- 'tags' => test_tags,
68
- })).to eq(latest_tag)
91
+ 'tags' => test_tags,
92
+ })).to eq(latest_tag)
93
+ end
94
+ end
95
+
96
+ context 'convert to ref' do
97
+ it 'run rake task' do
98
+ output_conversion = File.read(File.join(fixtures_dir, 'Puppetfile_git_conversion'))
99
+ require 'ra10ke'
100
+ Ra10ke::RakeTask.new do |t|
101
+ t.basedir = fixtures_dir
102
+ end
103
+ expect { Rake::Task['r10k:print_git_conversion'].invoke }.to output(output_conversion).to_stdout
69
104
  end
70
105
  end
71
106
  end
@@ -14,24 +14,38 @@ RSpec.describe 'Ra10ke::Deprecation::Validation' do
14
14
  end
15
15
 
16
16
  it 'only checks forge modules' do
17
- expect(PuppetForge::Module).to_not receive(:find).with('puppet')
17
+ expect(PuppetForge::Module).not_to receive(:find).with('puppet')
18
18
  allow(PuppetForge::Module).to receive(:find).and_raise(Faraday::ResourceNotFound.new(nil))
19
19
  expect(instance.deprecated_modules.count).to eq(0)
20
20
  end
21
21
 
22
22
  it 'handles deprecated modules' do
23
- expect(PuppetForge::Module).to receive(:find).with('puppetlabs-ruby').and_return(double(slug: 'puppetlabs-ruby', deprecated_at: '2021-04-22 10:29:42 -0700'))
23
+ expect(PuppetForge::Module).to receive(:find).with('puppetlabs-ruby').and_return(double(slug: 'puppetlabs-ruby',
24
+ deprecated_at: '2021-04-22 10:29:42 -0700'))
24
25
  allow(PuppetForge::Module).to receive(:find).and_return(double(slug: 'module-module', deprecated_at: nil))
25
26
 
26
27
  expect(instance.bad_mods?).to eq(true)
27
- expect(instance.deprecated_modules.first).to eq(name: 'puppetlabs-ruby', deprecated_at: Time.parse('2021-04-22 10:29:42 -0700'))
28
+ expect(instance.deprecated_modules.first).to eq(name: 'puppetlabs-ruby',
29
+ deprecated_at: Time.parse('2021-04-22 10:29:42 -0700'))
28
30
  end
29
31
 
30
32
  it 'handles missing modules' do
31
- expect(PuppetForge::Module).to receive(:find).with('choria-choria').and_return(double(slug: 'choria-choria', deprecated_at: nil))
33
+ expect(PuppetForge::Module).to receive(:find).with('choria-choria').and_return(double(slug: 'choria-choria',
34
+ deprecated_at: nil))
32
35
  expect(PuppetForge::Module).to receive(:find).with('puppetlabs-ruby').and_raise(Faraday::ResourceNotFound.new(nil))
33
36
  allow(PuppetForge::Module).to receive(:find).and_return(double(slug: 'module-module', deprecated_at: nil))
34
37
 
35
38
  expect(instance.bad_mods?).to eq(false)
36
39
  end
40
+
41
+ describe 'handles large puppetfile' do
42
+ let(:puppetfile) do
43
+ File.join(fixtures_dir, 'Puppetfile_deprecation_issue')
44
+ end
45
+
46
+ it 'deprecated modules' do
47
+ expect(instance.bad_mods?).to eq(false)
48
+ expect(instance.deprecated_modules.count).to eq(0)
49
+ end
50
+ end
37
51
  end
@@ -10,7 +10,7 @@ RSpec.describe 'Ra10ke::GitRepo' do
10
10
  expect(Ra10ke::GitRepo.new(url)).to be_a Ra10ke::GitRepo
11
11
  end
12
12
 
13
- it 'should not run_command more than once' do
13
+ it 'does not run_command more than once' do
14
14
  i = Ra10ke::GitRepo.new(url)
15
15
  expect(i).to receive(:run_command).with("git ls-remote --symref #{url}").once
16
16
  i.valid_url?
@@ -26,7 +26,7 @@ RSpec.describe 'Ra10ke::GitRepo' do
26
26
 
27
27
  let(:reflist) { File.read(File.join(fixtures_dir, 'refs', 'gitlab.txt')) }
28
28
 
29
- before(:each) do
29
+ before do
30
30
  allow(instance).to receive(:run_command).with("git ls-remote --symref #{url}").and_return([reflist, true])
31
31
  end
32
32
 
@@ -38,6 +38,10 @@ RSpec.describe 'Ra10ke::GitRepo' do
38
38
  expect(instance.remote_refs.first).to eq("1b3322d525e96bf7d0565b08703e2a44c90e7b4a\tHEAD\n")
39
39
  end
40
40
 
41
+ it '#get_ref_like' do
42
+ expect(instance.get_ref_like('8.0.0'))
43
+ end
44
+
41
45
  it '#valid_ref?' do
42
46
  expect(instance.valid_ref?('master')).to be true
43
47
  end
@@ -64,22 +68,22 @@ RSpec.describe 'Ra10ke::GitRepo' do
64
68
  refs = instance.all_refs
65
69
  expect(refs).to be_a Array
66
70
  expect(refs.last).to eq(
67
- { name: 'v5.0.0^{}', ref: 'refs/tags/v5.0.0^{}', sha: '1febd15f90d32e6b3d6c242a70db386b2ef1942c', subtype: nil, type: :tag }
71
+ { name: 'v5.0.0^{}', ref: 'refs/tags/v5.0.0^{}', sha: '1febd15f90d32e6b3d6c242a70db386b2ef1942c', subtype: nil,
72
+ type: :tag, },
68
73
  )
69
74
  end
70
75
  end
71
76
 
72
77
  describe 'bad url' do
73
78
  let(:url) { 'https://github.com/nwops/typo' }
74
-
75
- before(:each) do
76
- allow(instance).to receive(:run_command).with("git ls-remote --symref #{url}").and_return(['', false])
77
- end
78
-
79
79
  let(:instance) do
80
80
  Ra10ke::GitRepo.new(url)
81
81
  end
82
82
 
83
+ before do
84
+ allow(instance).to receive(:run_command).with("git ls-remote --symref #{url}").and_return(['', false])
85
+ end
86
+
83
87
  it '#all_refs' do
84
88
  expect(instance.all_refs).to be_a Array
85
89
  expect(instance.all_refs).to eq []
@@ -2,110 +2,99 @@ require 'spec_helper'
2
2
  require 'ra10ke/puppetfile_parser'
3
3
 
4
4
  RSpec.describe 'Ra10ke::PuppetfileParser' do
5
- include Ra10ke::PuppetfileParser
5
+ include Ra10ke::PuppetfileParser
6
6
 
7
- let(:puppetfile) do
8
- File.join(fixtures_dir, 'Puppetfile')
9
- end
7
+ let(:puppetfile) do
8
+ File.join(fixtures_dir, 'Puppetfile')
9
+ end
10
10
 
11
- let(:puppetfile_modules) do
12
- [{:args=>{:version=>'0.26.2'}, :name=>'choria', :namespace=>nil},
13
- {:args=>{:version=>"2.2.0"}, :name=>"inifile", :namespace=>"puppetlabs"},
14
- {:args=>{:version=>"1.0.1"}, :name=>"ruby", :namespace=>"puppetlabs"},
15
- {:args=>{:version=>"4.24.0"}, :name=>"stdlib", :namespace=>"puppetlabs"},
16
- {:args=>{:version=>"4.0.0"}, :name=>"concat", :namespace=>"puppetlabs"},
17
- {:args=>{:version=>"6.4.1"}, :name=>"ntp", :namespace=>"puppetlabs"},
18
- {:args=>{:version=>"3.1.1"}, :name=>"archive", :namespace=>"puppet"},
19
- {:args=>
20
- {:git=>"https://github.com/vshn/puppet-gitlab",
21
- :ref=>"00397b86dfb3487d9df768cbd3698d362132b5bf"},
22
- :name=>"gitlab",
23
- :namespace=>nil},
24
- {:args=>{:git=>"https://github.com/acidprime/r10k", :tag=>"v3.1.1"},
25
- :name=>"r10k",
26
- :namespace=>nil},
27
- {:args=>
28
- {:branch=>"gitlab_disable_ssl_verify_support",
29
- :git=>"https://github.com/npwalker/abrader-gms"},
30
- :name=>"gms",
31
- :namespace=>nil},
32
- {:args=>
33
- {:git=>"https://github.com/puppetlabs/pltraining-rbac",
34
- :ref=>"2f60e1789a721ce83f8df061e13f8bf81cd4e4ce"},
35
- :name=>"rbac",
36
- :namespace=>"pltraining"},
37
- {:args=>
38
- {:branch=>"master", :git=>"https://github.com/dobbymoodge/puppet-acl.git"},
39
- :name=>"acl",
40
- :namespace=>"puppet"},
41
- {:args=>{:branch=>"master", :git=>"https://github.com/cudgel/deploy.git"},
42
- :name=>"deploy",
43
- :namespace=>nil},
44
- {:args=>
45
- {:branch=>"master", :git=>"https://github.com/cudgel/puppet-dotfiles.git"},
46
- :name=>"dotfiles",
47
- :namespace=>nil},
48
- {:args=>{:branch=>"dev", :git=>"https://github.com/cudgel/splunk.git"},
49
- :name=>"splunk",
50
- :namespace=>nil},
51
- {:args=>{:branch=>"master", :git=>"https://github.com/voxpupuli/puppet-module.git"},
52
- :name=>"puppet",
53
- :namespace=>nil}]
54
- end
11
+ let(:puppetfile_modules) do
12
+ [{ args: { version: '0.26.2' }, name: 'choria', namespace: nil },
13
+ { args: { version: '2.2.0' }, name: 'inifile', namespace: 'puppetlabs' },
14
+ { args: { version: '1.0.1' }, name: 'ruby', namespace: 'puppetlabs' },
15
+ { args: { version: '4.24.0' }, name: 'stdlib', namespace: 'puppetlabs' },
16
+ { args: { version: '4.0.0' }, name: 'concat', namespace: 'puppetlabs' },
17
+ { args: { version: '6.4.1' }, name: 'ntp', namespace: 'puppetlabs' },
18
+ { args: { version: '3.1.1' }, name: 'archive', namespace: 'puppet' },
19
+ { args: { git: 'https://github.com/vshn/puppet-gitlab',
20
+ ref: '00397b86dfb3487d9df768cbd3698d362132b5bf', },
21
+ name: 'gitlab',
22
+ namespace: nil, },
23
+ { args: { git: 'https://github.com/acidprime/r10k', tag: 'v3.1.1' },
24
+ name: 'r10k',
25
+ namespace: nil, },
26
+ { args: { branch: 'gitlab_disable_ssl_verify_support',
27
+ git: 'https://github.com/npwalker/abrader-gms', },
28
+ name: 'gms',
29
+ namespace: nil, },
30
+ { args: { git: 'https://github.com/puppetlabs/pltraining-rbac',
31
+ ref: '2f60e1789a721ce83f8df061e13f8bf81cd4e4ce', },
32
+ name: 'rbac',
33
+ namespace: 'pltraining', },
34
+ { args: { branch: 'master', git: 'https://github.com/dobbymoodge/puppet-acl.git' },
35
+ name: 'acl',
36
+ namespace: 'puppet', },
37
+ { args: { branch: 'master', git: 'https://github.com/cudgel/deploy.git' },
38
+ name: 'deploy',
39
+ namespace: nil, },
40
+ { args: { branch: 'master', git: 'https://github.com/cudgel/puppet-dotfiles.git' },
41
+ name: 'dotfiles',
42
+ namespace: nil, },
43
+ { args: { branch: 'dev', git: 'https://github.com/cudgel/splunk.git' },
44
+ name: 'splunk',
45
+ namespace: nil, },
46
+ { args: { branch: 'master', git: 'https://github.com/voxpupuli/puppet-module.git' },
47
+ name: 'puppet',
48
+ namespace: nil, },]
49
+ end
55
50
 
51
+ it '#modules' do
52
+ expect(modules(puppetfile)).to eq(puppetfile_modules)
53
+ end
56
54
 
57
- it '#modules' do
58
- expect(modules(puppetfile)).to eq(puppetfile_modules)
59
- end
55
+ it '#git_modules' do
56
+ expected = [{ args: { git: 'https://github.com/vshn/puppet-gitlab',
57
+ ref: '00397b86dfb3487d9df768cbd3698d362132b5bf', },
58
+ name: 'gitlab',
59
+ namespace: nil, },
60
+ { args: { git: 'https://github.com/acidprime/r10k', tag: 'v3.1.1' },
61
+ name: 'r10k',
62
+ namespace: nil, },
63
+ { args: { branch: 'gitlab_disable_ssl_verify_support',
64
+ git: 'https://github.com/npwalker/abrader-gms', },
65
+ name: 'gms',
66
+ namespace: nil, },
67
+ { args: { git: 'https://github.com/puppetlabs/pltraining-rbac',
68
+ ref: '2f60e1789a721ce83f8df061e13f8bf81cd4e4ce', },
69
+ name: 'rbac',
70
+ namespace: 'pltraining', },
71
+ { args: { branch: 'master', git: 'https://github.com/dobbymoodge/puppet-acl.git' },
72
+ name: 'acl',
73
+ namespace: 'puppet', },
74
+ { args: { branch: 'master', git: 'https://github.com/cudgel/deploy.git' },
75
+ name: 'deploy',
76
+ namespace: nil, },
77
+ { args: { branch: 'master', git: 'https://github.com/cudgel/puppet-dotfiles.git' },
78
+ name: 'dotfiles',
79
+ namespace: nil, },
80
+ { args: { branch: 'dev', git: 'https://github.com/cudgel/splunk.git' },
81
+ name: 'splunk',
82
+ namespace: nil, },
83
+ { args: { branch: 'master', git: 'https://github.com/voxpupuli/puppet-module.git' },
84
+ name: 'puppet',
85
+ namespace: nil, },]
86
+ expect(git_modules(puppetfile)).to eq(expected)
87
+ end
60
88
 
61
- it '#git_modules' do
62
- expected = [{:args=>
63
- {:git=>"https://github.com/vshn/puppet-gitlab",
64
- :ref=>"00397b86dfb3487d9df768cbd3698d362132b5bf"},
65
- :name=>"gitlab",
66
- :namespace=>nil},
67
- {:args=>{:git=>"https://github.com/acidprime/r10k", :tag=>"v3.1.1"},
68
- :name=>"r10k",
69
- :namespace=>nil},
70
- {:args=>
71
- {:branch=>"gitlab_disable_ssl_verify_support",
72
- :git=>"https://github.com/npwalker/abrader-gms"},
73
- :name=>"gms",
74
- :namespace=>nil},
75
- {:args=>
76
- {:git=>"https://github.com/puppetlabs/pltraining-rbac",
77
- :ref=>"2f60e1789a721ce83f8df061e13f8bf81cd4e4ce"},
78
- :name=>"rbac",
79
- :namespace=>"pltraining"},
80
- {:args=>
81
- {:branch=>"master", :git=>"https://github.com/dobbymoodge/puppet-acl.git"},
82
- :name=>"acl",
83
- :namespace=>"puppet"},
84
- {:args=>{:branch=>"master", :git=>"https://github.com/cudgel/deploy.git"},
85
- :name=>"deploy",
86
- :namespace=>nil},
87
- {:args=>
88
- {:branch=>"master", :git=>"https://github.com/cudgel/puppet-dotfiles.git"},
89
- :name=>"dotfiles",
90
- :namespace=>nil},
91
- {:args=>{:branch=>"dev", :git=>"https://github.com/cudgel/splunk.git"},
92
- :name=>"splunk",
93
- :namespace=>nil},
94
- {:args=>{:branch=>"master", :git=>"https://github.com/voxpupuli/puppet-module.git"},
95
- :name=>"puppet",
96
- :namespace=>nil}]
97
- expect(git_modules(puppetfile)).to eq(expected)
98
- end
89
+ it '#parse_modules_args' do
90
+ data = " 'puppet-acl', :git => 'https://github.com/dobbymoodge/puppet-acl.git', :branch => 'master'"
91
+ expect(parse_module_args(data)).to eq({ args: { branch: 'master',
92
+ git: 'https://github.com/dobbymoodge/puppet-acl.git', },
93
+ name: 'acl', namespace: 'puppet', })
94
+ end
99
95
 
100
- it '#parse_modules_args' do
101
- data = " 'puppet-acl', :git => 'https://github.com/dobbymoodge/puppet-acl.git', :branch => 'master'"
102
- expect(parse_module_args(data)).to eq({:args=>{:branch=>"master",
103
- :git=>"https://github.com/dobbymoodge/puppet-acl.git"},
104
- :name=>"acl", :namespace=>"puppet"})
105
- end
106
-
107
- it '#parse_modules_args when empty' do
108
- data = ""
109
- expect(parse_module_args(data)).to eq({})
110
- end
96
+ it '#parse_modules_args when empty' do
97
+ data = ''
98
+ expect(parse_module_args(data)).to eq({})
99
+ end
111
100
  end