scaptimony 0.3.0 → 0.3.1

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: 1de7b66071d1a5cdc7b8a35b6e771aa9c1afab00
4
- data.tar.gz: 45ac4cc03c0630a39a5b8f9e1e85e390a3795cf3
3
+ metadata.gz: 174629941484facee505dbde5487c78b99637ed5
4
+ data.tar.gz: 20c9244c166567ba00d4f1c11ca881edffa48ee9
5
5
  SHA512:
6
- metadata.gz: 40b85faa5dca890f6c0935e823ec40110d3107fb7fde70f20cac95cd9d82e90f8c2635af70d8826b35d7e11658b023a771b71996a9110439b0a85c5f69bf9db2
7
- data.tar.gz: 101fec51fa7ae58fd6290866b4103a2f573ecb252278c5a24e49ec1946c6c2a632ca3f5cca9c7f316dca5604259e8ef48039554308f9a3f4e82829f40a971fb9
6
+ metadata.gz: ec63c92e187c0ef6ed66870e9b373000bf79e08a46cc25c1c93f49bbd7f00d5af9f2339e821a8dae3d844925003ca40506345cd136106b73489276b02f78d2c6
7
+ data.tar.gz: 0de79f67e2ca2c2530aeadee65d5f801ab13508ba68d511b58542f24c9ce2f9403864b1678c25b471dca7594c9291c4689f7b2260abb4be4ac7ed91a95d454c8
@@ -56,7 +56,7 @@ module Scaptimony
56
56
  def self.search_by_policy_results(policy_name, &selection)
57
57
  cond = sanitize_sql_for_conditions('scaptimony_policies.name' => policy_name)
58
58
  { :conditions => Scaptimony::ArfReport.arel_table[:id].in(
59
- Scaptimony::ArfReport.select(Scaptimony::ArfReport.arel_table[:id])
59
+ Scaptimony::ArfReport.select(Scaptimony::ArfReport.arel_table[:id])
60
60
  .latest.instance_eval(&selection).joins(:policy).where(cond).ast
61
61
  ).to_sql
62
62
  }
@@ -20,9 +20,9 @@ module Scaptimony
20
20
  end
21
21
 
22
22
  def to_html
23
- if self.scap_content.blank? || self.scap_content_profile.blank?
24
- return warn(_('Cannot generate HTML guide for %{scap_content}/%{profile}') %
25
- { :scap_content => self.scap_content, :profile => self.scap_content_profile })
23
+ if self.scap_content.nil? || self.scap_content.source.nil?
24
+ return (_('<h2>Cannot generate HTML guide for %{scap_content}/%{profile}</h2>') %
25
+ { :scap_content => self.scap_content, :profile => self.scap_content_profile }).html_safe
26
26
  end
27
27
 
28
28
  sds = OpenSCAP::DS::Sds.new self.scap_content.source
@@ -41,6 +41,7 @@ module Scaptimony
41
41
  validates :scap_file, :presence => true
42
42
 
43
43
  after_save :create_profiles
44
+ before_validation :redigest, :if => lambda { |scap_content| scap_content.persisted? && scap_content.scap_file_changed? }
44
45
 
45
46
  scoped_search :on => :title, :complete_value => true
46
47
  scoped_search :on => :original_filename, :complete_value => true, :rename => :filename
@@ -81,5 +82,9 @@ module Scaptimony
81
82
 
82
83
  end
83
84
 
85
+ def redigest
86
+ self[:digest] = Digest::SHA256.hexdigest "#{scap_file}"
87
+ end
88
+
84
89
  end
85
90
  end
@@ -1,6 +1,6 @@
1
1
  class CreateScaptimonyArfReportBreakdowns < ActiveRecord::Migration
2
- def self.up
3
- execute <<-SQL
2
+ def self.up
3
+ execute <<-SQL
4
4
  CREATE VIEW scaptimony_arf_report_breakdowns AS
5
5
  SELECT
6
6
  arf.id as arf_report_id,
@@ -15,6 +15,10 @@ CREATE VIEW scaptimony_arf_report_breakdowns AS
15
15
  arf.id = rule.arf_report_id
16
16
  AND rule.xccdf_result_id = result.id
17
17
  GROUP BY arf.id;
18
- SQL
18
+ SQL
19
+ end
20
+
21
+ def self.down
22
+ execute 'DROP VIEW scaptimony_arf_report_breakdowns' if table_exists? 'scaptimony_arf_report_breakdowns'
19
23
  end
20
24
  end
@@ -1,6 +1,6 @@
1
1
  class ReplaceArfReportBreakdownView < ActiveRecord::Migration
2
- def self.up
3
- execute <<-SQL
2
+ def self.up
3
+ execute <<-SQL
4
4
  CREATE OR REPLACE VIEW scaptimony_arf_report_breakdowns AS
5
5
  SELECT
6
6
  arf.id as arf_report_id,
@@ -15,6 +15,10 @@ CREATE OR REPLACE VIEW scaptimony_arf_report_breakdowns AS
15
15
  LEFT OUTER JOIN scaptimony_xccdf_results result
16
16
  ON rule.xccdf_result_id = result.id
17
17
  GROUP BY arf.id;
18
- SQL
18
+ SQL
19
+ end
20
+
21
+ def self.down
22
+ execute 'DROP VIEW scaptimony_arf_report_breakdowns' if table_exists? 'scaptimony_arf_report_breakdowns'
19
23
  end
20
24
  end
@@ -1,3 +1,3 @@
1
1
  module Scaptimony
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scaptimony
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
- - Šimon Lukašík
7
+ - "Šimon Lukašík"
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-24 00:00:00.000000000 Z
11
+ date: 2015-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 3.2.8
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.2.8
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: openscap
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.4.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.4.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: sqlite3
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  description: |-
@@ -62,111 +62,111 @@ executables: []
62
62
  extensions: []
63
63
  extra_rdoc_files: []
64
64
  files:
65
- - app/views/layouts/scaptimony/application.html.erb
66
- - app/helpers/scaptimony/application_helper.rb
67
- - app/controllers/scaptimony/application_controller.rb
68
- - app/assets/stylesheets/scaptimony/application.css
65
+ - COPYING
66
+ - README.md
67
+ - Rakefile
69
68
  - app/assets/javascripts/scaptimony/application.js
70
- - app/models/scaptimony/xccdf_rule_result.rb
71
- - app/models/scaptimony/scap_content.rb
72
- - app/models/scaptimony/policy.rb
73
- - app/models/scaptimony/policy_revision.rb
69
+ - app/assets/stylesheets/scaptimony/application.css
70
+ - app/controllers/scaptimony/application_controller.rb
71
+ - app/helpers/scaptimony/application_helper.rb
74
72
  - app/models/scaptimony/arf_report.rb
75
- - app/models/scaptimony/xccdf_rule.rb
76
- - app/models/scaptimony/xccdf_result.rb
73
+ - app/models/scaptimony/arf_report_breakdown.rb
74
+ - app/models/scaptimony/arf_report_raw.rb
77
75
  - app/models/scaptimony/asset.rb
78
76
  - app/models/scaptimony/asset_policy.rb
77
+ - app/models/scaptimony/policy.rb
78
+ - app/models/scaptimony/policy_revision.rb
79
+ - app/models/scaptimony/scap_content.rb
79
80
  - app/models/scaptimony/scap_content_profile.rb
80
- - app/models/scaptimony/arf_report_raw.rb
81
- - app/models/scaptimony/arf_report_breakdown.rb
81
+ - app/models/scaptimony/xccdf_result.rb
82
+ - app/models/scaptimony/xccdf_rule.rb
83
+ - app/models/scaptimony/xccdf_rule_result.rb
84
+ - app/views/layouts/scaptimony/application.html.erb
82
85
  - config/routes.rb
83
- - db/migrate/20141116171305_add_profile_to_scaptimony_policies.rb
84
- - db/migrate/20141116170632_remove_xccdf_profile_from_scaptimony_policies.rb
85
- - db/migrate/20141119182606_create_scaptimony_xccdf_rule_results.rb
86
- - db/migrate/20150116083129_add_day_of_month_and_cron_line_to_scaptimony_policy.rb
87
- - db/migrate/20141015115511_add_arf_report_unique_constraint.rb
88
- - db/migrate/20141015092642_create_scaptimony_arf_reports.rb
89
- - db/migrate/20150111085317_polymorph_asset.rb
90
- - db/migrate/20141216154502_rename_scaptimony_asset_policies.rb
91
- - db/migrate/20141119175434_create_scaptimony_xccdf_rules.rb
86
+ - db/migrate/20141013172051_create_scaptimony_policies.rb
92
87
  - db/migrate/20141014105333_create_scaptimony_assets.rb
93
- - db/migrate/20141119164918_create_scaptimony_xccdf_results.rb
94
- - db/migrate/20150112152944_create_scaptimony_arf_report_raws.rb
95
- - db/migrate/20141107091756_add_columns_to_scaptimony_scap_contents.rb
96
- - db/migrate/20141113221054_create_scaptimony_scap_content_profiles.rb
97
- - db/migrate/20141111104519_add_constraint_to_scaptimony_scap_contents.rb
98
- - db/migrate/20141105174834_add_columns_to_scaptimony_policies.rb
88
+ - db/migrate/20141015092642_create_scaptimony_arf_reports.rb
89
+ - db/migrate/20141015115511_add_arf_report_unique_constraint.rb
99
90
  - db/migrate/20141104164201_create_scaptimony_scap_contents.rb
100
- - db/migrate/20141013172051_create_scaptimony_policies.rb
101
- - db/migrate/20141206211151_create_scaptimony_assets_policies.rb
102
- - db/migrate/20141105174625_add_description_to_scaptimony_policy_revisions.rb
103
- - db/migrate/20150115155947_add_scaptimony_scap_content_digest.rb
104
91
  - db/migrate/20141104171545_create_scaptimony_policy_revisions.rb
105
- - db/migrate/20150114210634_rename_scaptimony_arf_report_raw_raw.rb
106
- - db/migrate/20141214112917_add_scap_file_to_scap_content.rb
107
- - db/migrate/20141121120326_create_scaptimony_arf_report_breakdowns.rb
92
+ - db/migrate/20141105174625_add_description_to_scaptimony_policy_revisions.rb
93
+ - db/migrate/20141105174834_add_columns_to_scaptimony_policies.rb
94
+ - db/migrate/20141107091756_add_columns_to_scaptimony_scap_contents.rb
95
+ - db/migrate/20141111104519_add_constraint_to_scaptimony_scap_contents.rb
96
+ - db/migrate/20141113221054_create_scaptimony_scap_content_profiles.rb
97
+ - db/migrate/20141116170632_remove_xccdf_profile_from_scaptimony_policies.rb
98
+ - db/migrate/20141116171305_add_profile_to_scaptimony_policies.rb
108
99
  - db/migrate/20141118142954_add_constraint_to_scaptimony_policies.rb
100
+ - db/migrate/20141119164918_create_scaptimony_xccdf_results.rb
101
+ - db/migrate/20141119175434_create_scaptimony_xccdf_rules.rb
102
+ - db/migrate/20141119182606_create_scaptimony_xccdf_rule_results.rb
103
+ - db/migrate/20141121120326_create_scaptimony_arf_report_breakdowns.rb
109
104
  - db/migrate/20141121164042_replace_arf_report_breakdown_view.rb
105
+ - db/migrate/20141206211151_create_scaptimony_assets_policies.rb
106
+ - db/migrate/20141214112917_add_scap_file_to_scap_content.rb
107
+ - db/migrate/20141216154502_rename_scaptimony_asset_policies.rb
108
+ - db/migrate/20150111085317_polymorph_asset.rb
109
+ - db/migrate/20150112152944_create_scaptimony_arf_report_raws.rb
110
+ - db/migrate/20150114210634_rename_scaptimony_arf_report_raw_raw.rb
111
+ - db/migrate/20150115155947_add_scaptimony_scap_content_digest.rb
112
+ - db/migrate/20150116083129_add_day_of_month_and_cron_line_to_scaptimony_policy.rb
110
113
  - db/seeds.rb
111
114
  - lib/scaptimony.rb
112
- - lib/tasks/scaptimony_tasks.rake
115
+ - lib/scaptimony/arf_reports_helper.rb
113
116
  - lib/scaptimony/engine.rb
114
117
  - lib/scaptimony/version.rb
115
- - lib/scaptimony/arf_reports_helper.rb
116
- - COPYING
117
- - Rakefile
118
- - README.md
119
- - test/dummy/script/rails
118
+ - lib/tasks/scaptimony_tasks.rake
119
+ - test/dummy/README.rdoc
120
120
  - test/dummy/Rakefile
121
- - test/dummy/public/favicon.ico
122
- - test/dummy/public/404.html
123
- - test/dummy/public/500.html
124
- - test/dummy/public/422.html
125
- - test/dummy/app/views/layouts/application.html.erb
126
- - test/dummy/app/helpers/application_helper.rb
127
- - test/dummy/app/controllers/application_controller.rb
128
- - test/dummy/app/assets/stylesheets/application.css
129
121
  - test/dummy/app/assets/javascripts/application.js
130
- - test/dummy/config/boot.rb
122
+ - test/dummy/app/assets/stylesheets/application.css
123
+ - test/dummy/app/controllers/application_controller.rb
124
+ - test/dummy/app/helpers/application_helper.rb
125
+ - test/dummy/app/views/layouts/application.html.erb
126
+ - test/dummy/config.ru
131
127
  - test/dummy/config/application.rb
132
- - test/dummy/config/initializers/secret_token.rb
133
- - test/dummy/config/initializers/mime_types.rb
128
+ - test/dummy/config/boot.rb
129
+ - test/dummy/config/database.yml
130
+ - test/dummy/config/environment.rb
131
+ - test/dummy/config/environments/development.rb
132
+ - test/dummy/config/environments/production.rb
133
+ - test/dummy/config/environments/test.rb
134
134
  - test/dummy/config/initializers/backtrace_silencers.rb
135
- - test/dummy/config/initializers/wrap_parameters.rb
136
135
  - test/dummy/config/initializers/inflections.rb
136
+ - test/dummy/config/initializers/mime_types.rb
137
+ - test/dummy/config/initializers/secret_token.rb
137
138
  - test/dummy/config/initializers/session_store.rb
138
- - test/dummy/config/environments/development.rb
139
- - test/dummy/config/environments/test.rb
140
- - test/dummy/config/environments/production.rb
141
- - test/dummy/config/database.yml
142
- - test/dummy/config/environment.rb
143
- - test/dummy/config/routes.rb
139
+ - test/dummy/config/initializers/wrap_parameters.rb
144
140
  - test/dummy/config/locales/en.yml
145
- - test/dummy/config.ru
146
- - test/dummy/README.rdoc
147
- - test/fixtures/scaptimony/xccdf_rule_results.yml
148
- - test/fixtures/scaptimony/xccdf_results.yml
141
+ - test/dummy/config/routes.rb
142
+ - test/dummy/public/404.html
143
+ - test/dummy/public/422.html
144
+ - test/dummy/public/500.html
145
+ - test/dummy/public/favicon.ico
146
+ - test/dummy/script/rails
147
+ - test/fixtures/scaptimony/arf_reports.yml
148
+ - test/fixtures/scaptimony/assets.yml
149
149
  - test/fixtures/scaptimony/policies.yml
150
- - test/fixtures/scaptimony/xccdf_rules.yml
151
150
  - test/fixtures/scaptimony/policy_revisions.yml
152
- - test/fixtures/scaptimony/arf_reports.yml
153
151
  - test/fixtures/scaptimony/scap_content_profiles.yml
154
- - test/fixtures/scaptimony/assets.yml
155
- - test/scaptimony_test.rb
156
- - test/lib/scaptimony/arf_reports_helper_test.rb
157
- - test/test_helper.rb
152
+ - test/fixtures/scaptimony/xccdf_results.yml
153
+ - test/fixtures/scaptimony/xccdf_rule_results.yml
154
+ - test/fixtures/scaptimony/xccdf_rules.yml
158
155
  - test/integration/navigation_test.rb
159
- - test/models/scaptimony/scap_content_profiles_test.rb
160
- - test/models/scaptimony/policy_revision_test.rb
161
- - test/models/scaptimony/xccdf_rule_test.rb
162
- - test/models/scaptimony/scap_content_test.rb
163
- - test/models/scaptimony/xccdf_result_test.rb
156
+ - test/lib/scaptimony/arf_reports_helper_test.rb
164
157
  - test/models/scaptimony/arf_report_breakdown_test.rb
158
+ - test/models/scaptimony/arf_report_raw_test.rb
165
159
  - test/models/scaptimony/arf_report_test.rb
166
160
  - test/models/scaptimony/asset_test.rb
167
- - test/models/scaptimony/arf_report_raw_test.rb
168
- - test/models/scaptimony/xccdf_rule_result_test.rb
161
+ - test/models/scaptimony/policy_revision_test.rb
169
162
  - test/models/scaptimony/policy_test.rb
163
+ - test/models/scaptimony/scap_content_profiles_test.rb
164
+ - test/models/scaptimony/scap_content_test.rb
165
+ - test/models/scaptimony/xccdf_result_test.rb
166
+ - test/models/scaptimony/xccdf_rule_result_test.rb
167
+ - test/models/scaptimony/xccdf_rule_test.rb
168
+ - test/scaptimony_test.rb
169
+ - test/test_helper.rb
170
170
  homepage: https://github.com/OpenSCAP/scaptimony
171
171
  licenses:
172
172
  - GPL-3.0
@@ -177,17 +177,17 @@ require_paths:
177
177
  - lib
178
178
  required_ruby_version: !ruby/object:Gem::Requirement
179
179
  requirements:
180
- - - '>='
180
+ - - ">="
181
181
  - !ruby/object:Gem::Version
182
182
  version: '0'
183
183
  required_rubygems_version: !ruby/object:Gem::Requirement
184
184
  requirements:
185
- - - '>='
185
+ - - ">="
186
186
  - !ruby/object:Gem::Version
187
187
  version: '0'
188
188
  requirements: []
189
189
  rubyforge_project:
190
- rubygems_version: 2.1.11
190
+ rubygems_version: 2.2.2
191
191
  signing_key:
192
192
  specification_version: 4
193
193
  summary: SCAPtimony is SCAP database and storage server
@@ -243,3 +243,4 @@ test_files:
243
243
  - test/models/scaptimony/arf_report_raw_test.rb
244
244
  - test/models/scaptimony/xccdf_rule_result_test.rb
245
245
  - test/models/scaptimony/policy_test.rb
246
+ has_rdoc: