rails-audit 0.14.0 → 0.15.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4ebe33368db8592206d864e1adad4c064cbfced5
4
- data.tar.gz: 400e669053370859962fbb743b1fd46aaaed9581
3
+ metadata.gz: ce161897640c1b85ccf195cbe50a7ba9161838bf
4
+ data.tar.gz: baa9a8d48250e0f74dbd7edf6e27de5bd8b36e88
5
5
  SHA512:
6
- metadata.gz: cd3e0a173f10f2e4206b659e5b986286eb5ee438393148bca42f149e183c352a55825a29d00b40a7b89264d37614bafe3017582bd141e427c28cb9a64f070401
7
- data.tar.gz: 3533575bd1af7bf32c92bffbcacd6dd9dece6dbfa67fa86eb8a7abe359a4a4db2dc190bdccf0e9526f47f612d653c0c7b6c882dcec3f94e227ae6a32d512abb0
6
+ metadata.gz: 21d98c3f941b471a3d3b4fdb75b035e93d84cebcd466e654d1818f7f0015199c48a2a0c498e3b62f5b367b6132810013bee67b40e6fbe87f089f00dcf7f18cef
7
+ data.tar.gz: 6759d164a1f578f6ab4f42f504398bb03bfbf8e177d9e2b49fb3651c6555f3fe6801c43c21b3a5c907d4de23ea51aa6419a4adcf74bef26aac6726beb31fe636
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.15.0
4
+
5
+ * New rubocop version 0.15.0
6
+
3
7
  ## 0.14.0
4
8
 
5
9
  * New brakeman version 2.2
data/bin/rails-audit CHANGED
@@ -2,4 +2,4 @@
2
2
 
3
3
  require 'rails-audit'
4
4
 
5
- exit(1) unless RailsAudit.run
5
+ exit(1) unless RailsAudit::Runner.new.run
@@ -1,6 +1,5 @@
1
1
  module RailsAudit
2
2
  class Audit
3
-
4
3
  def self.command(rails)
5
4
  self::COMMAND
6
5
  end
@@ -13,6 +12,5 @@ module RailsAudit
13
12
  def self.get_name
14
13
  name.split('::')[-1]
15
14
  end
16
-
17
15
  end
18
16
  end
@@ -1,58 +1,62 @@
1
1
  require 'yaml'
2
2
 
3
3
  module RailsAudit
4
- def self.load_config
5
- File.exist?('config/audit.yml') && YAML.load_file('config/audit.yml') || {}
6
- end
4
+ class Runner
5
+ def initialize
6
+ @config = { 'Concurrency' => true, 'Rails' => true }
7
+ if File.exist? 'config/audit.yml'
8
+ @config = @config.merge YAML.load_file('config/audit.yml')
9
+ end
10
+ end
7
11
 
8
- def self.get_config(config, name)
9
- c = config[name]
10
- {
11
- rails: config['Rails'].nil? && true || config['Rails'],
12
- params: c && c['Parameters'] || '',
13
- enabled: (c.nil? || c['Enabled'].nil?) && true || c['Enabled']
14
- }
15
- end
12
+ def get_config(name)
13
+ defaults = { 'Parameters' => '', 'Enabled' => true }
14
+ config = defaults.merge(@config[name] || {})
15
+ {
16
+ rails: @config['Rails'],
17
+ params: config['Parameters'],
18
+ enabled: config['Enabled']
19
+ }
20
+ end
16
21
 
17
- def self.run
18
- config = load_config
22
+ def run
23
+ concurrency = @config['Concurrency']
19
24
 
20
- concurrency = config['Concurrency'].nil? && true || config['Concurrency']
25
+ failures = concurrency && run_threads || run_sequence
21
26
 
22
- failures = concurrency && run_threads(config) || run_sequence(config)
27
+ if failures.any?
28
+ puts 'Failed tests:'
29
+ failures.each { |f| puts f }
30
+ end
23
31
 
24
- if failures.any?
25
- puts 'Failed tests:'
26
- failures.each { |f| puts f }
32
+ failures.none?
27
33
  end
28
34
 
29
- failures.none?
30
- end
35
+ def run_sequence
36
+ failures = []
31
37
 
32
- def self.run_sequence(config)
33
- failures = []
38
+ Audits::ALL.each do |audit|
39
+ success = audit.run get_config(audit.get_name)
40
+ failures << audit.get_name unless success
41
+ end
34
42
 
35
- Audits::ALL.each do |audit|
36
- success = audit.run get_config(config, audit.get_name)
37
- failures << audit.get_name unless success
43
+ failures
38
44
  end
39
45
 
40
- failures
41
- end
42
-
43
- def self.run_threads(config)
44
- failures = []
45
- mutex = Mutex.new
46
+ def run_threads
47
+ failures = []
48
+ mutex = Mutex.new
46
49
 
47
- threads = Audits::ALL.map do |audit|
48
- Thread.new do
49
- success = audit.run get_config(config, audit.get_name)
50
- mutex.synchronize { failures << audit.get_name unless success }
50
+ threads = Audits::ALL.map do |audit|
51
+ Thread.new do
52
+ success = audit.run get_config(audit.get_name)
53
+ mutex.synchronize { failures << audit.get_name unless success }
54
+ end
51
55
  end
52
- end
53
56
 
54
- threads.each { |t| t.join }
57
+ threads.each { |t| t.join }
55
58
 
56
- failures
59
+ failures
60
+ end
57
61
  end
58
62
  end
@@ -1,7 +1,7 @@
1
1
  module RailsAudit
2
2
  class Version
3
3
  MAJOR = 0
4
- MINOR = 14
4
+ MINOR = 15
5
5
  PATCH = 0
6
6
 
7
7
  def self.to_s
data/rails-audit.gemspec CHANGED
@@ -33,5 +33,5 @@ Gem::Specification.new do |s|
33
33
  s.add_runtime_dependency 'consistency_fail'
34
34
  s.add_runtime_dependency 'license_finder'
35
35
  s.add_runtime_dependency 'rails_best_practices', '~> 1.14.0'
36
- s.add_runtime_dependency 'rubocop', '0.14.1'
36
+ s.add_runtime_dependency 'rubocop', '0.15.0'
37
37
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-audit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christopher Schramm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-01 00:00:00.000000000 Z
11
+ date: 2013-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -128,14 +128,14 @@ dependencies:
128
128
  requirements:
129
129
  - - '='
130
130
  - !ruby/object:Gem::Version
131
- version: 0.14.1
131
+ version: 0.15.0
132
132
  type: :runtime
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
136
  - - '='
137
137
  - !ruby/object:Gem::Version
138
- version: 0.14.1
138
+ version: 0.15.0
139
139
  description: "\n Runs multiple audit and review tools to ensure quality and security
140
140
  of\n Rails projects\n "
141
141
  email: cschramm@shakaweb.org