openscap 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de8f677ade591343896be83be887fb9951ae0dff
4
- data.tar.gz: e970e06de1f035553cc0dca86fcaacf7c0d28bd6
3
+ metadata.gz: 0bd3f590e5876554843cf78f32d92869dcfcad36
4
+ data.tar.gz: 3daf5f1520a8932045a9ba0f43916934d114b66c
5
5
  SHA512:
6
- metadata.gz: e7ff6530f527abe9f131fff313eb937f9e50eaec812eb0e084f57d1f1318fab5e9f778b0e3fb833ec01b39471353bec13e2adb162ac1c2c264ee2e73f58a124d
7
- data.tar.gz: 98c6a0a6a5cb3e9f9dc494ee4e7ba0be5158de74073ccd1ee5aca9e597b2e9b717bf32d82503fd88e53178617994b5f0e23f76e8adbd62857a6139d0898fa2f1
6
+ metadata.gz: abef2aa76207a6ba403dd7ba219672970b3ac51616972d5113ac944f70912ecdb23a143ad90d7d6a699cced9b57c24bd6bf649632f3ec3b8d5a87e0be40faa39
7
+ data.tar.gz: d26290405c9d441ab477730d8e1de22bd95bf3d0a274cc9ad0ac794ca7c9104a570561e924ad5c166ca5b54b96d3f048c33fe0aedb5f9dfdcd6389c1924b62bf
data/README.md CHANGED
@@ -17,6 +17,6 @@ Sample Scanner Implementation
17
17
  s.load
18
18
  s.profile = "xccdf_org.ssgproject.content_profile_common"
19
19
  s.evaluate
20
- s.export_results(rds_file:"results.rds.xml")
20
+ s.export_results(:rds_file => "results.rds.xml")
21
21
  s.destroy
22
22
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.2.0
@@ -26,10 +26,14 @@ module OpenSCAP
26
26
  return OpenSCAP.xccdf_session_is_sds(@s)
27
27
  end
28
28
 
29
- def load(datastream_id:nil, component_id:nil)
29
+ def load(opts = {})
30
+ o = {
31
+ :datastream_id => nil,
32
+ :component_id => nil,
33
+ }.merge(opts)
30
34
  if sds?
31
- OpenSCAP.xccdf_session_set_datastream_id(@s, datastream_id)
32
- OpenSCAP.xccdf_session_set_component_id(@s, component_id)
35
+ OpenSCAP.xccdf_session_set_datastream_id(@s, o[:datastream_id])
36
+ OpenSCAP.xccdf_session_set_component_id(@s, o[:component_id])
33
37
  end
34
38
  if OpenSCAP.xccdf_session_load(@s) != 0
35
39
  OpenSCAP.raise!
@@ -54,14 +58,21 @@ module OpenSCAP
54
58
  OpenSCAP.raise! unless OpenSCAP.xccdf_session_remediate(@s) == 0
55
59
  end
56
60
 
57
- def export_results(rds_file:nil, xccdf_file:nil, report_file:nil,
58
- oval_results:false, oval_variables:false, engines_results:false)
59
- OpenSCAP.raise! unless OpenSCAP.xccdf_session_set_arf_export(@s, rds_file)
60
- OpenSCAP.raise! unless OpenSCAP.xccdf_session_set_xccdf_export(@s, xccdf_file)
61
- OpenSCAP.raise! unless OpenSCAP.xccdf_session_set_report_export(@s, report_file)
62
- OpenSCAP.xccdf_session_set_oval_results_export(@s, oval_results)
63
- OpenSCAP.xccdf_session_set_oval_variables_export(@s, oval_variables)
64
- OpenSCAP.xccdf_session_set_check_engine_plugins_results_export(@s, engines_results)
61
+ def export_results(opts = {})
62
+ o = {
63
+ :rds_file => nil,
64
+ :xccdf_file => nil,
65
+ :report_file => nil,
66
+ :oval_results => false,
67
+ :oval_variables => false,
68
+ :engines_results => false,
69
+ }.merge!(opts)
70
+ OpenSCAP.raise! unless OpenSCAP.xccdf_session_set_arf_export(@s, o[:rds_file])
71
+ OpenSCAP.raise! unless OpenSCAP.xccdf_session_set_xccdf_export(@s, o[:xccdf_file])
72
+ OpenSCAP.raise! unless OpenSCAP.xccdf_session_set_report_export(@s, o[:report_file])
73
+ OpenSCAP.xccdf_session_set_oval_results_export(@s, o[:oval_results])
74
+ OpenSCAP.xccdf_session_set_oval_variables_export(@s, o[:oval_variables])
75
+ OpenSCAP.xccdf_session_set_check_engine_plugins_results_export(@s, o[:engines_results])
65
76
 
66
77
  OpenSCAP.raise! unless OpenSCAP.xccdf_session_export_oval(@s) == 0
67
78
  OpenSCAP.raise! unless OpenSCAP.xccdf_session_export_check_engine_plugins(@s) == 0
data/openscap.gemspec CHANGED
@@ -9,7 +9,7 @@ GEMSPEC = Gem::Specification.new do |gem|
9
9
 
10
10
  gem.author = "Šimon Lukašík"
11
11
  gem.email = "isimluk@fedoraproject.org"
12
- gem.homepage = "https://github.com/isimluk/ruby-openscap"
12
+ gem.homepage = "https://github.com/OpenSCAP/ruby-openscap"
13
13
  gem.license = "GPL-2.0"
14
14
 
15
15
  gem.summary = "A FFI wrapper around the OpenSCAP library"
@@ -21,5 +21,4 @@ GEMSPEC = Gem::Specification.new do |gem|
21
21
 
22
22
  gem.files = `git ls-files`.split("\n")
23
23
  gem.require_path = 'lib'
24
- gem.required_ruby_version = '>= 2.0.0'
25
24
  end
@@ -25,6 +25,9 @@ module OpenSCAP
25
25
 
26
26
  def setup
27
27
  workdir = "test/output"
28
+ if Dir.pwd.end_with? 'test/output'
29
+ cleanup # Older TestCase do not run cleanup method.
30
+ end
28
31
  FileUtils.rm_rf workdir
29
32
  Dir.mkdir workdir
30
33
  Dir.chdir workdir
@@ -36,5 +39,8 @@ module OpenSCAP
36
39
  Dir.chdir "../.."
37
40
  OpenSCAP.raise! if OpenSCAP.error?
38
41
  end
42
+
43
+ def test_x
44
+ end
39
45
  end
40
46
  end
@@ -26,7 +26,7 @@ class TestSessionDS < OpenSCAP::TestCase
26
26
 
27
27
  def test_session_load_ds_comp
28
28
  @s = OpenSCAP::Xccdf::Session.new("../data/sds-complex.xml")
29
- @s.load(datastream_id:"scap_org.open-scap_datastream_tst2", component_id:"scap_org.open-scap_cref_second-xccdf.xml2")
29
+ @s.load(:datastream_id => "scap_org.open-scap_datastream_tst2", :component_id => "scap_org.open-scap_cref_second-xccdf.xml2")
30
30
  @s.evaluate
31
31
  end
32
32
 
@@ -34,7 +34,7 @@ class TestSessionDS < OpenSCAP::TestCase
34
34
  @s = OpenSCAP::Xccdf::Session.new("../data/sds-complex.xml")
35
35
  msg = nil
36
36
  begin
37
- @s.load(datastream_id:"nonexistent")
37
+ @s.load(:datastream_id => "nonexistent")
38
38
  assert false
39
39
  rescue OpenSCAP::OpenSCAPError => e
40
40
  msg = e.to_s
@@ -46,7 +46,7 @@ class TestSessionDS < OpenSCAP::TestCase
46
46
  @s = OpenSCAP::Xccdf::Session.new("../data/sds-complex.xml")
47
47
  msg = nil
48
48
  begin
49
- @s.load(component_id:"nonexistent")
49
+ @s.load(:component_id => "nonexistent")
50
50
  assert false
51
51
  rescue OpenSCAP::OpenSCAPError => e
52
52
  msg = e.to_s
@@ -56,7 +56,7 @@ class TestSessionDS < OpenSCAP::TestCase
56
56
 
57
57
  def test_session_set_profile
58
58
  @s = OpenSCAP::Xccdf::Session.new("../data/sds-complex.xml")
59
- @s.load(component_id:"scap_org.open-scap_cref_second-xccdf.xml")
59
+ @s.load(:component_id => "scap_org.open-scap_cref_second-xccdf.xml")
60
60
  @s.profile = "xccdf_moc.elpmaxe.www_profile_1"
61
61
  @s.evaluate
62
62
  end
@@ -78,40 +78,40 @@ class TestSessionDS < OpenSCAP::TestCase
78
78
  @s = OpenSCAP::Xccdf::Session.new("../data/sds-complex.xml")
79
79
  @s.load
80
80
  @s.evaluate
81
- @s.export_results(rds_file:"report.rds.xml")
81
+ @s.export_results(:rds_file => "report.rds.xml")
82
82
  assert_exported ["report.rds.xml"]
83
83
  end
84
84
 
85
85
  def test_session_export_xccdf_results
86
86
  @s = OpenSCAP::Xccdf::Session.new("../data/sds-complex.xml")
87
- @s.load(component_id:"scap_org.open-scap_cref_second-xccdf.xml")
87
+ @s.load(:component_id => "scap_org.open-scap_cref_second-xccdf.xml")
88
88
  @s.profile = "xccdf_moc.elpmaxe.www_profile_1"
89
89
  @s.evaluate
90
- @s.export_results(xccdf_file:"result.xccdf.xml")
90
+ @s.export_results(:xccdf_file => "result.xccdf.xml")
91
91
  assert_exported ["result.xccdf.xml"]
92
92
  end
93
93
 
94
94
  def test_session_export_html_report
95
95
  @s = OpenSCAP::Xccdf::Session.new("../data/sds-complex.xml")
96
- @s.load(component_id:"scap_org.open-scap_cref_second-xccdf.xml")
96
+ @s.load(:component_id => "scap_org.open-scap_cref_second-xccdf.xml")
97
97
  @s.profile = "xccdf_moc.elpmaxe.www_profile_1"
98
98
  @s.evaluate
99
- @s.export_results(report_file:"report.html", xccdf_file:"result.xccdf.xml")
99
+ @s.export_results(:report_file => "report.html", :xccdf_file => "result.xccdf.xml")
100
100
  assert_exported ["report.html", "result.xccdf.xml"]
101
101
  end
102
102
 
103
103
  def test_session_export_oval_variables
104
104
  @s = OpenSCAP::Xccdf::Session.new("../data/sds-complex.xml")
105
- @s.load(component_id:"scap_org.open-scap_cref_second-xccdf.xml")
105
+ @s.load(:component_id => "scap_org.open-scap_cref_second-xccdf.xml")
106
106
  @s.profile = "xccdf_moc.elpmaxe.www_profile_1"
107
107
  @s.evaluate
108
- @s.export_results(oval_variables:true)
108
+ @s.export_results(:oval_variables => true)
109
109
  assert_exported []
110
110
  end
111
111
 
112
112
  def test_remediate
113
113
  @s = OpenSCAP::Xccdf::Session.new("../data/sds-complex.xml")
114
- @s.load(component_id:"scap_org.open-scap_cref_second-xccdf.xml")
114
+ @s.load(:component_id =>"scap_org.open-scap_cref_second-xccdf.xml")
115
115
  @s.profile = "xccdf_moc.elpmaxe.www_profile_1"
116
116
  @s.evaluate
117
117
  @s.remediate
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openscap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Šimon Lukašík
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-16 00:00:00.000000000 Z
11
+ date: 2014-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -62,7 +62,7 @@ files:
62
62
  - test/openscap_test.rb
63
63
  - test/xccdf/session_ds_test.rb
64
64
  - test/xccdf/session_test.rb
65
- homepage: https://github.com/isimluk/ruby-openscap
65
+ homepage: https://github.com/OpenSCAP/ruby-openscap
66
66
  licenses:
67
67
  - GPL-2.0
68
68
  metadata: {}
@@ -74,7 +74,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
74
74
  requirements:
75
75
  - - '>='
76
76
  - !ruby/object:Gem::Version
77
- version: 2.0.0
77
+ version: '0'
78
78
  required_rubygems_version: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - '>='