simp-metadata 0.4.4 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +494 -0
  3. data/Rakefile +19 -22
  4. data/exe/simp-install +1 -1
  5. data/exe/simp-media +1 -1
  6. data/exe/simp-metadata +1 -1
  7. data/lib/simp/install/command.rb +34 -35
  8. data/lib/simp/media.rb +0 -1
  9. data/lib/simp/media/command.rb +34 -35
  10. data/lib/simp/media/engine.rb +29 -35
  11. data/lib/simp/media/type.rb +1 -2
  12. data/lib/simp/media/type/base.rb +12 -4
  13. data/lib/simp/media/type/control-repo.rb +96 -107
  14. data/lib/simp/media/type/internet.rb +8 -8
  15. data/lib/simp/media/type/iso.rb +0 -1
  16. data/lib/simp/media/type/local.rb +18 -19
  17. data/lib/simp/media/type/tar.rb +37 -37
  18. data/lib/simp/metadata.rb +240 -258
  19. data/lib/simp/metadata/bootstrap_source.rb +93 -89
  20. data/lib/simp/metadata/buildinfo.rb +23 -23
  21. data/lib/simp/metadata/command.rb +60 -58
  22. data/lib/simp/metadata/commands.rb +1 -1
  23. data/lib/simp/metadata/commands/base.rb +28 -25
  24. data/lib/simp/metadata/commands/clone.rb +3 -5
  25. data/lib/simp/metadata/commands/component.rb +128 -90
  26. data/lib/simp/metadata/commands/delete.rb +4 -5
  27. data/lib/simp/metadata/commands/pry.rb +1 -3
  28. data/lib/simp/metadata/commands/release.rb +22 -23
  29. data/lib/simp/metadata/commands/releases.rb +1 -3
  30. data/lib/simp/metadata/commands/save.rb +10 -13
  31. data/lib/simp/metadata/commands/script.rb +11 -14
  32. data/lib/simp/metadata/commands/search.rb +15 -20
  33. data/lib/simp/metadata/commands/set-write-url.rb +1 -3
  34. data/lib/simp/metadata/commands/set-write.rb +1 -3
  35. data/lib/simp/metadata/commands/update.rb +9 -10
  36. data/lib/simp/metadata/component.rb +310 -154
  37. data/lib/simp/metadata/components.rb +15 -16
  38. data/lib/simp/metadata/engine.rb +31 -39
  39. data/lib/simp/metadata/fake_uri.rb +2 -0
  40. data/lib/simp/metadata/location.rb +99 -105
  41. data/lib/simp/metadata/locations.rb +19 -21
  42. data/lib/simp/metadata/release.rb +30 -39
  43. data/lib/simp/metadata/releases.rb +14 -15
  44. data/lib/simp/metadata/source.rb +69 -79
  45. data/lib/simp/metadata/version.rb +9 -0
  46. data/spec/simp/media/command_spec.rb +4 -5
  47. data/spec/simp/media/engine_spec.rb +14 -14
  48. data/spec/simp/media/type/control_repo_spec.rb +10 -12
  49. data/spec/simp/media/type/internet_spec.rb +11 -11
  50. data/spec/simp/media/type/iso_spec.rb +6 -7
  51. data/spec/simp/media/type/local_spec.rb +6 -8
  52. data/spec/simp/media/type/tar_spec.rb +6 -8
  53. data/spec/simp/metadata/buildinfo_spec.rb +19 -17
  54. data/spec/simp/metadata/commands/clone_spec.rb +4 -3
  55. data/spec/simp/metadata/component_spec.rb +43 -54
  56. data/spec/simp/metadata/engine_spec.rb +38 -41
  57. data/spec/simp/metadata/release_spec.rb +72 -79
  58. data/spec/simp/metadata/source_spec.rb +8 -6
  59. data/spec/simp/metadata_spec.rb +95 -98
  60. data/spec/spec_helper.rb +33 -21
  61. metadata +5 -3
@@ -1,101 +1,94 @@
1
- require 'spec_helper'
1
+ require_relative '../../spec_helper'
2
2
  require 'simp/metadata'
3
3
  require 'simp/metadata/commands/clone'
4
4
 
5
5
  describe Simp::Metadata::Release do
6
6
  describe '#puppetfile' do
7
- context "when type == nil" do
8
-
9
- it "should return a String" do
10
- engine = Simp::Metadata::Engine.new
11
- release = engine.releases['test-stub']
12
- puppetfile = release.puppetfile()
13
- expect(puppetfile.class.to_s).to eql("String")
14
- engine.cleanup()
15
- engine = nil
16
- end
7
+ context 'when type == nil' do
8
+ it 'should return a String' do
9
+ engine = Simp::Metadata::Engine.new
10
+ release = engine.releases['test-stub']
11
+ puppetfile = release.puppetfile
12
+ expect(puppetfile.class.to_s).to eql('String')
13
+ engine.cleanup
14
+ engine = nil
15
+ end
17
16
 
18
- it "should return a valid Puppetfile" do
19
- engine = Simp::Metadata::Engine.new
20
- release = engine.releases['test-stub']
21
- puppetfile = release.puppetfile()
22
- expect(puppetfile.split("\n").size).to be > 2
23
- expect(puppetfile).to match(/^mod.*\'.*\',/)
24
- expect(puppetfile).to match(/^ :git => .*\'.*\',/)
25
- expect(puppetfile).to match(/^ :ref => .*\'.*\'/)
26
- engine.cleanup()
27
- engine = nil
17
+ it 'should return a valid Puppetfile' do
18
+ engine = Simp::Metadata::Engine.new
19
+ release = engine.releases['test-stub']
20
+ puppetfile = release.puppetfile
21
+ expect(puppetfile.split("\n").size).to be > 2
22
+ expect(puppetfile).to match(/^mod.*'.*',/)
23
+ expect(puppetfile).to match(/^\s{2}:git => 'https:\/\/github.com.*',/)
24
+ expect(puppetfile).to match(/^\s{2}:tag => '[0-9]+.[0-9]+.[0-9]+'/)
25
+ engine.cleanup
26
+ engine = nil
27
+ end
28
28
  end
29
- end
30
-
31
- context "when type == 'simp-core'" do
32
29
 
33
- it "should return a String" do
34
- engine = Simp::Metadata::Engine.new
35
- release = engine.releases['test-stub']
36
- puppetfile = release.puppetfile('simp-core')
37
- expect(puppetfile.class.to_s).to eql("String")
38
- engine.cleanup()
39
- engine = nil
40
- end
30
+ context "when type == 'simp-core'" do
31
+ it 'should return a String' do
32
+ engine = Simp::Metadata::Engine.new
33
+ release = engine.releases['test-stub']
34
+ puppetfile = release.puppetfile('simp-core')
35
+ expect(puppetfile.class.to_s).to eql('String')
36
+ engine.cleanup
37
+ engine = nil
38
+ end
41
39
 
42
- it "should return a valid Puppetfile" do
43
- engine = Simp::Metadata::Engine.new
44
- release = engine.releases['test-stub']
45
- puppetfile = release.puppetfile('simp-core')
46
- expect(puppetfile.split("\n").size).to be > 2
47
- expect(puppetfile).to match(/^mod.*\'.*\',/)
48
- expect(puppetfile).to match(/^ :git => .*\'.*\',/)
49
- expect(puppetfile).to match(/^ :ref => .*\'.*\'/)
50
- engine.cleanup()
51
- engine = nil
40
+ it 'should return a valid Puppetfile' do
41
+ engine = Simp::Metadata::Engine.new
42
+ release = engine.releases['test-stub']
43
+ puppetfile = release.puppetfile('simp-core')
44
+ expect(puppetfile.split("\n").size).to be > 2
45
+ expect(puppetfile).to match(/^mod.*'.*',/)
46
+ expect(puppetfile).to match(/^\s{2}:git => 'https:\/\/github.com.*',/)
47
+ expect(puppetfile).to match(/^\s{2}:tag => '[0-9]+.[0-9]+.[0-9]+'/)
48
+ engine.cleanup
49
+ engine = nil
50
+ end
52
51
  end
53
52
  end
54
- end
55
- describe "#diff" do
53
+ describe '#diff' do
56
54
  context 'when attribute is nil' do
57
-
58
- it "should return all differences" do
59
- release1 = 'test-stub'
60
- release2 = 'test-diff'
55
+ it 'should return all differences' do
61
56
  attribute = nil
62
- test = release_diff_instance(release1, release2, attribute)
57
+ test = release_diff_instance(attribute)
63
58
  expect(test).to eql(
64
- "pupmod-simp-activemq" => {
65
- "branch"=>{
66
- "original" => "master",
67
- "changed"=>"develop"
68
- },
69
- "tag"=>{
70
- "original"=>"1.1.1",
71
- "changed"=>"1.1.2"
72
- },
73
- "ref"=>{
74
- "original"=>"488f5a0d5b53063c125b93a596626193b71aaa08",
75
- "changed"=>"3987ra0d5b53063f493b93a596626193b71dddd4"
76
- },
77
- "version"=>{
78
- "original"=>"1.1.1",
79
- "changed"=>"1.1.2"
80
- }
81
- }
82
- )
59
+ 'pupmod-simp-activemq' => {
60
+ 'branch' => {
61
+ 'original' => 'master',
62
+ 'changed' => 'develop'
63
+ },
64
+ 'tag' => {
65
+ 'original' => '1.1.1',
66
+ 'changed' => '1.1.2'
67
+ },
68
+ 'ref' => {
69
+ 'original' => '488f5a0d5b53063c125b93a596626193b71aaa08',
70
+ 'changed' => '3987ra0d5b53063f493b93a596626193b71dddd4'
71
+ },
72
+ 'version' => {
73
+ 'original' => '1.1.1',
74
+ 'changed' => '1.1.2'
75
+ }
76
+ }
77
+ )
83
78
  end
84
79
  end
85
80
  context 'when attribute is "version"' do
86
- it "should return only version" do
87
- release1 = 'test-stub'
88
- release2 = 'test-diff'
81
+ it 'should return only version' do
89
82
  attribute = 'version'
90
- test = release_diff_instance(release1, release2, attribute)
83
+ test = release_diff_instance(attribute)
91
84
  expect(test).to eql(
92
- "pupmod-simp-activemq" => {
93
- "version"=>{
94
- "original"=>"1.1.1",
95
- "changed"=>"1.1.2"
96
- }
97
- }
98
- )
85
+ 'pupmod-simp-activemq' => {
86
+ 'version' => {
87
+ 'original' => '1.1.1',
88
+ 'changed' => '1.1.2'
89
+ }
90
+ }
91
+ )
99
92
  end
100
93
  end
101
94
  end
@@ -1,10 +1,12 @@
1
- require 'spec_helper'
1
+ require_relative '../../spec_helper'
2
2
  require 'simp/metadata'
3
+
4
+ # Need to fix test
3
5
  describe Simp::Metadata::Source do
4
- it "should require a URL to be specified" do
5
- expect {
6
- source = Simp::Metadata::Source.new()
7
- }.to raise_error(ArgumentError)
6
+ it 'should require a URL to be specified' do
7
+ expect do
8
+ source = Simp::Metadata::Source.new
9
+ end.to raise_error(ArgumentError)
8
10
  end
9
11
  # it "should instantiate when passed a valid metadata source" do
10
12
  # expect {
@@ -22,4 +24,4 @@ describe Simp::Metadata::Source do
22
24
  # FileUtils.rmtree(tempdir)
23
25
  # }.not_to raise_error
24
26
  # end
25
- end
27
+ end
@@ -1,174 +1,171 @@
1
- require 'spec_helper'
1
+ require_relative '../spec_helper'
2
2
  require 'simp/metadata'
3
3
 
4
- shared_examples_for "log_wrapper" do |method_name|
5
- it "should not throw an error" do
4
+ shared_examples_for 'log_wrapper' do |method_name|
5
+ it 'should not throw an error' do
6
6
  $simp_metadata_debug_level = 'debug2'
7
- tempdir = Dir.mktmpdir("simp-media-rspec")
8
- expect { Simp::Metadata.send(method_name, "test")}.not_to raise_error
7
+ tempdir = Dir.mktmpdir('simp-media-rspec')
8
+ expect { Simp::Metadata.send(method_name, 'test') }.not_to raise_error
9
9
  FileUtils.rmtree(tempdir)
10
- end
11
- it "should not throw an error if logging is disabled" do
12
- tempdir = Dir.mktmpdir("simp-media-rspec")
10
+ end
11
+ it 'should not throw an error if logging is disabled' do
12
+ tempdir = Dir.mktmpdir('simp-media-rspec')
13
13
  $simp_metadata_debug_level = 'disabled'
14
- expect { Simp::Metadata.send(method_name, "test")}.not_to raise_error
14
+ expect { Simp::Metadata.send(method_name, 'test') }.not_to raise_error
15
15
  FileUtils.rmtree(tempdir)
16
16
  $simp_metadata_debug_level = 'debug2'
17
17
  end
18
- it "should not throw an error if logging is left default" do
19
- tempdir = Dir.mktmpdir("simp-media-rspec")
20
- $simp_metadata_debug_level = 'ssss'
21
- expect { Simp::Metadata.send(method_name, "test")}.not_to raise_error
18
+ it 'should not throw an error if logging is left default' do
19
+ tempdir = Dir.mktmpdir('simp-media-rspec')
20
+ $simp_metadata_debug_level = 'warning'
21
+ expect { Simp::Metadata.send(method_name, 'test') }.not_to raise_error
22
22
  FileUtils.rmtree(tempdir)
23
23
  $simp_metadata_debug_level = 'debug2'
24
24
  end
25
25
  end
26
26
 
27
- shared_examples_for "download_component" do |component|
28
-
29
- it "should not throw an error" do
30
- tempdir = Dir.mktmpdir("simp-media-rspec")
31
- expect { Simp::Metadata.download_component(component, {"target" => tempdir})}.not_to raise_error
27
+ shared_examples_for 'download_component' do |component|
28
+ it 'should not throw an error' do
29
+ tempdir = Dir.mktmpdir('simp-media-rspec')
30
+ expect { Simp::Metadata.download_component(component, 'target' => tempdir) }.not_to raise_error
32
31
  FileUtils.rmtree(tempdir)
33
32
  end
34
- it "should return a hash" do
35
- tempdir = Dir.mktmpdir("simp-media-rspec")
36
- retval = Simp::Metadata.download_component(component, {"target" => tempdir})
37
- expect(retval.class.to_s).to eql("Hash")
33
+ it 'should return a hash' do
34
+ tempdir = Dir.mktmpdir('simp-media-rspec')
35
+ retval = Simp::Metadata.download_component(component, 'target' => tempdir)
36
+ expect(retval.class.to_s).to eql('Hash')
38
37
  FileUtils.rmtree(tempdir)
39
38
  end
40
- it "should return a path key" do
41
- tempdir = Dir.mktmpdir("simp-media-rspec")
42
- retval = Simp::Metadata.download_component(component, {"target" => tempdir})
43
- expect(retval.key?("path")).to eql(true)
39
+ it 'should return a path key' do
40
+ tempdir = Dir.mktmpdir('simp-media-rspec')
41
+ retval = Simp::Metadata.download_component(component, 'target' => tempdir)
42
+ expect(retval.key?('path')).to eql(true)
44
43
  FileUtils.rmtree(tempdir)
45
44
  end
46
- it "should return a path key that is within the tempdir" do
47
- tempdir = Dir.mktmpdir("simp-media-rspec")
48
- retval = Simp::Metadata.download_component(component, {"target" => tempdir})
49
- expect(retval["path"]).to match(/^#{tempdir}/)
45
+ it 'should return a path key that is within the tempdir' do
46
+ tempdir = Dir.mktmpdir('simp-media-rspec')
47
+ retval = Simp::Metadata.download_component(component, 'target' => tempdir)
48
+ expect(retval['path']).to match(/^#{tempdir}/)
50
49
  FileUtils.rmtree(tempdir)
51
50
  end
52
51
  end
53
52
  describe Simp::Metadata do
54
- describe "Simp::Metadata.debug2" do
55
- it_should_behave_like "log_wrapper", :debug2
53
+ describe 'Simp::Metadata.debug2' do
54
+ it_should_behave_like 'log_wrapper', :debug2
56
55
  end
57
- describe "Simp::Metadata.debug1" do
58
- it_should_behave_like "log_wrapper", :debug1
56
+ describe 'Simp::Metadata.debug1' do
57
+ it_should_behave_like 'log_wrapper', :debug1
59
58
  end
60
- describe "Simp::Metadata.info" do
61
- it_should_behave_like "log_wrapper", :info
59
+ describe 'Simp::Metadata.info' do
60
+ it_should_behave_like 'log_wrapper', :info
62
61
  end
63
- describe "Simp::Metadata.warning" do
64
- it_should_behave_like "log_wrapper", :warning
62
+ describe 'Simp::Metadata.warning' do
63
+ it_should_behave_like 'log_wrapper', :warning
65
64
  end
66
- describe "Simp::Metadata.error" do
67
- it_should_behave_like "log_wrapper", :error
65
+ describe 'Simp::Metadata.error' do
66
+ it_should_behave_like 'log_wrapper', :error
68
67
  end
69
- describe "Simp::Metadata.critical" do
70
- it_should_behave_like "log_wrapper", :critical
68
+ describe 'Simp::Metadata.critical' do
69
+ it_should_behave_like 'log_wrapper', :critical
71
70
  end
72
- describe "Simp::Metadata.run" do
73
- it "should run a command with no errors" do
71
+ describe 'Simp::Metadata.run' do
72
+ it 'should run a command with no errors' do
74
73
  # Create an output capture system.
75
74
  errorcode = Simp::Metadata.run("echo 'successful'")
76
75
  expect(errorcode.success?).to eql(true)
77
76
  end
78
- it "should return an error on a non-zero exit code" do
77
+ it 'should return an error on a non-zero exit code' do
79
78
  # Create an output capture system.
80
- errorcode = Simp::Metadata.run("false")
79
+ errorcode = Simp::Metadata.run('false')
81
80
  expect(errorcode.success?).to eql(false)
82
81
  end
83
82
  end
84
- describe "Simp::Metadata.get_license_data" do
85
-
86
- it "should return a filename and a data stream" do
83
+ describe 'Simp::Metadata.get_license_data' do
84
+ it 'should return a filename and a data stream' do
87
85
  # Create an output capture system.
88
86
  filename, data = Simp::Metadata.get_license_data(nil)
89
- expect(filename.class.to_s).to eql("String")
90
- expect(data.class.to_s).to eql("String")
91
- expect(File.exists?(filename)).to eql(true)
87
+ expect(filename.class.to_s).to eql('String')
88
+ expect(data.class.to_s).to eql('String')
89
+ expect(File.exist?(filename)).to eql(true)
92
90
  end
93
91
  end
94
- describe "Simp::Metadata.download_component" do
95
- it "should throw an error if target is not specified" do
96
- expect { Simp::Metadata.download_component(nil, {})}.to raise_error(RuntimeError, "Must specify 'target'")
92
+ describe 'Simp::Metadata.download_component' do
93
+ it 'should throw an error if target is not specified' do
94
+ expect { Simp::Metadata.download_component(nil, {}) }.to raise_error(RuntimeError, "Must specify 'target'")
97
95
  end
98
- it "should throw an error if component is nil" do
99
- tempdir = Dir.mktmpdir("simp-media-rspec")
100
- expect { Simp::Metadata.download_component(nil, {"target" => tempdir})}.to raise_error(RuntimeError, "component.class=NilClass, NilClass is not in ['String', 'Simp::Metadata::Component']")
96
+ it 'should throw an error if component is nil' do
97
+ tempdir = Dir.mktmpdir('simp-media-rspec')
98
+ expect { Simp::Metadata.download_component(nil, 'target' => tempdir) }.to raise_error(RuntimeError, "component.class=NilClass, NilClass is not in ['String', 'Simp::Metadata::Component']")
101
99
  FileUtils.rmtree(tempdir)
102
100
  end
103
- it "should throw an error if component is not a string or Simp::Metadata::Component" do
104
- tempdir = Dir.mktmpdir("simp-media-rspec")
105
- expect { Simp::Metadata.download_component([], {"target" => tempdir})}.to raise_error(RuntimeError, "component.class=Array, Array is not in ['String', 'Simp::Metadata::Component']")
101
+ it 'should throw an error if component is not a string or Simp::Metadata::Component' do
102
+ tempdir = Dir.mktmpdir('simp-media-rspec')
103
+ expect { Simp::Metadata.download_component([], 'target' => tempdir) }.to raise_error(RuntimeError, "component.class=Array, Array is not in ['String', 'Simp::Metadata::Component']")
106
104
  FileUtils.rmtree(tempdir)
107
105
  end
108
106
  describe "when component == 'simp-metadata'" do
109
- it_should_behave_like "download_component", 'simp-metadata'
107
+ it_should_behave_like 'download_component', 'simp-metadata'
110
108
  end
111
- describe "when component is a Simp::Metadata::Component" do
112
- engine = Simp::Metadata::Engine.new()
113
- component = engine.components["pupmod-simp-activemq"]
114
- it_should_behave_like "download_component", component
109
+ describe 'when component is a Simp::Metadata::Component' do
110
+ engine = Simp::Metadata::Engine.new
111
+ component = engine.components['pupmod-simp-activemq']
112
+ it_should_behave_like 'download_component', component
115
113
  end
116
- if (ENV.fetch("SIMP_LICENSE_KEY", nil) != nil)
114
+ if ENV.fetch('SIMP_LICENSE_KEY', nil) != nil
117
115
  describe "when component == 'enterprise-metadata'" do
118
- it_should_behave_like "download_component", 'enterprise-metadata'
116
+ it_should_behave_like 'download_component', 'enterprise-metadata'
119
117
  end
120
118
  end
121
119
  end
122
120
 
123
- describe "Simp::Metadata.fetch_from_url" do
124
-
121
+ describe 'Simp::Metadata.fetch_from_url' do
125
122
  it "should throw an error when urlspec is a 'ftp' String" do
126
- tempdir = Dir.mktmpdir("simp-media-rspec")
127
- expect { Simp::Metadata.fetch_from_url("ftp://github.com/simp/simp-metadata/archive/master.zip","#{tempdir}/master.zip",'simp-metadata', {"target" => tempdir})}.to raise_error(RuntimeError, "unsupported url type ftp")
123
+ tempdir = Dir.mktmpdir('simp-media-rspec')
124
+ expect { Simp::Metadata.fetch_from_url('ftp://github.com/simp/simp-metadata/archive/master.zip', "#{tempdir}/master.zip", 'simp-metadata', 'target' => tempdir) }.to raise_error(RuntimeError, 'unsupported url type ftp')
128
125
  FileUtils.rmtree(tempdir)
129
126
  end
130
- it "should not throw an error when urlspec is an https String" do
131
- tempdir = Dir.mktmpdir("simp-media-rspec")
132
- expect { Simp::Metadata.fetch_from_url("https://github.com/simp/simp-metadata/archive/master.zip","#{tempdir}/master.zip",'simp-metadata', {"target" => tempdir})}.not_to raise_error
127
+ it 'should not throw an error when urlspec is an https String' do
128
+ tempdir = Dir.mktmpdir('simp-media-rspec')
129
+ expect { Simp::Metadata.fetch_from_url('https://github.com/simp/simp-metadata/archive/master.zip', "#{tempdir}/master.zip", 'simp-metadata', 'target' => tempdir) }.not_to raise_error
133
130
  FileUtils.rmtree(tempdir)
134
131
  end
135
- it "should not throw an error when urlspec is an http String" do
136
- tempdir = Dir.mktmpdir("simp-media-rspec")
137
- expect { Simp::Metadata.fetch_from_url("http://github.com/simp/simp-metadata/archive/master.zip","#{tempdir}/master.zip",'simp-metadata', {"target" => tempdir})}.not_to raise_error
132
+ it 'should not throw an error when urlspec is an http String' do
133
+ tempdir = Dir.mktmpdir('simp-media-rspec')
134
+ expect { Simp::Metadata.fetch_from_url('http://github.com/simp/simp-metadata/archive/master.zip', "#{tempdir}/master.zip", 'simp-metadata', 'target' => tempdir) }.not_to raise_error
138
135
  FileUtils.rmtree(tempdir)
139
136
  end
140
137
  it "should not throw an error when urlspec is a hash with just a 'url' element" do
141
- tempdir = Dir.mktmpdir("simp-media-rspec")
142
- expect { Simp::Metadata.fetch_from_url({"url" => "https://github.com/simp/simp-metadata/archive/master.zip"},"#{tempdir}/master.zip",'simp-metadata', {"target" => tempdir})}.not_to raise_error
138
+ tempdir = Dir.mktmpdir('simp-media-rspec')
139
+ expect { Simp::Metadata.fetch_from_url({ 'url' => 'https://github.com/simp/simp-metadata/archive/master.zip' }, "#{tempdir}/master.zip", 'simp-metadata', 'target' => tempdir) }.not_to raise_error
143
140
  FileUtils.rmtree(tempdir)
144
141
  end
145
- it "should not throw an error when type == file" do
146
- tempdir = Dir.mktmpdir("simp-media-rspec")
147
- expect { Simp::Metadata.fetch_from_url({"type" => "file", "url" => "https://github.com/simp/simp-metadata/archive/master.zip"},"#{tempdir}/master.zip",'simp-metadata', {"target" => tempdir})}.not_to raise_error
142
+ it 'should not throw an error when type == file' do
143
+ tempdir = Dir.mktmpdir('simp-media-rspec')
144
+ expect { Simp::Metadata.fetch_from_url({ 'type' => 'file', 'url' => 'https://github.com/simp/simp-metadata/archive/master.zip' }, "#{tempdir}/master.zip", 'simp-metadata', 'target' => tempdir) }.not_to raise_error
148
145
  FileUtils.rmtree(tempdir)
149
146
  end
150
- it "should not throw an error when type == git" do
151
- tempdir = Dir.mktmpdir("simp-media-rspec")
152
- expect { Simp::Metadata.fetch_from_url({"type" => "git", "url" => "https://github.com/simp/simp-metadata"},"#{tempdir}/simp-metadata",'simp-metadata', {"target" => tempdir})}.not_to raise_error
147
+ it 'should not throw an error when type == git' do
148
+ tempdir = Dir.mktmpdir('simp-media-rspec')
149
+ expect { Simp::Metadata.fetch_from_url({ 'type' => 'git', 'url' => 'https://github.com/simp/simp-metadata' }, "#{tempdir}/simp-metadata", 'simp-metadata', 'target' => tempdir) }.not_to raise_error
153
150
  # Test git pull origin code path as well
154
- expect { Simp::Metadata.fetch_from_url({"type" => "git", "url" => "https://github.com/simp/simp-metadata"},"#{tempdir}/simp-metadata",'simp-metadata', {"target" => tempdir})}.not_to raise_error
151
+ expect { Simp::Metadata.fetch_from_url({ 'type' => 'git', 'url' => 'https://github.com/simp/simp-metadata' }, "#{tempdir}/simp-metadata", 'simp-metadata', 'target' => tempdir) }.not_to raise_error
155
152
  FileUtils.rmtree(tempdir)
156
153
  end
157
154
  end
158
155
 
159
- describe "Simp::Metadata.fetch_simp_enterprise" do
160
- it "should not throw an error when location is a location" do
161
- tempdir = Dir.mktmpdir("simp-media-rspec")
162
- engine = Simp::Metadata::Engine.new()
163
- component = engine.components["pupmod-simp-activemq"]
164
- expect { Simp::Metadata.fetch_simp_enterprise(component.primary.url,"#{tempdir}/simp-metadata",component, component.primary, {"target" => tempdir})}.not_to raise_error
156
+ describe 'Simp::Metadata.fetch_simp_enterprise' do
157
+ it 'should not throw an error when location is a location' do
158
+ tempdir = Dir.mktmpdir('simp-media-rspec')
159
+ engine = Simp::Metadata::Engine.new
160
+ component = engine.components['pupmod-simp-activemq']
161
+ expect { Simp::Metadata.fetch_simp_enterprise(component.primary.url, "#{tempdir}/simp-metadata", component, component.primary, 'target' => tempdir) }.not_to raise_error
165
162
  FileUtils.rmtree(tempdir)
166
163
  end
167
- xit "should not throw an error when downloading a simp-metadata url" do
168
- tempdir = Dir.mktmpdir("simp-media-rspec")
169
- engine = Simp::Metadata::Engine.new(nil, nil, "enterprise")
170
- component = engine.components["enterprise-metadata"]
171
- expect { Simp::Metadata.fetch_simp_enterprise(component.primary.url,"#{tempdir}/simp-metadata",component, component.primary, {"target" => tempdir})}.not_to raise_error
164
+ xit 'should not throw an error when downloading a simp-metadata url' do
165
+ tempdir = Dir.mktmpdir('simp-media-rspec')
166
+ engine = Simp::Metadata::Engine.new(nil, nil, 'enterprise')
167
+ component = engine.components['enterprise-metadata']
168
+ expect { Simp::Metadata.fetch_simp_enterprise(component.primary.url, "#{tempdir}/simp-metadata", component, component.primary, 'target' => tempdir) }.not_to raise_error
172
169
  FileUtils.rmtree(tempdir)
173
170
  end
174
171
  end