strong_actions 0.0.8 → 0.0.9

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: ec98b307601e5b612378cdf15bb408ecd46d8d3e
4
- data.tar.gz: c83e0369fc8ad26013a4aa038ad136bc98365eac
3
+ metadata.gz: 2cb9467219528ebebcfced8aba69697ccce65389
4
+ data.tar.gz: 968f1316ff553ee8f9075acb4797e8d875f0a467
5
5
  SHA512:
6
- metadata.gz: d62efe31e6643ac089a48ba3afc40a43392e712b191a23e616e610d9625a78ae0da61ed39002770a694444ead9a52c2872464f1a95c066e7387908aa6642c240
7
- data.tar.gz: 38cc34be27b1ab9edf7c61f9b85992c8585501a47a6d66e4e06e89660fc44c19b984f4a9dc39ae9dd880ccce9a8a49fd49545f5b52673e26980a5be50d5f6c7f
6
+ metadata.gz: 4a6a0c9caf21a3d6d95a3a3cdaeb4f75c1fdce95f9ca2ed5cf8965b0c365097d7080f4a9338fd804c55c133b3755ad5be23a4b63fc2f7525728ae7f5c62467b3
7
+ data.tar.gz: 2b72b1197594bda0b7cdbb9f0b5a58504922999f0214405eb073ab5e72b0011b3ec3ac6ef350579e64e94cde3bbbb5cd4e23db54cd9a955c2b12d48e79d46281
data/.travis.yml CHANGED
@@ -2,8 +2,8 @@ sudo: false
2
2
  language: ruby
3
3
  cache: bundler
4
4
  rvm:
5
+ - 2.4.0
5
6
  - 2.3.3
6
7
  - 2.2.6
7
- - 2.1.9
8
8
  script:
9
9
  - bundle exec rake test
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- strong_actions (0.0.8)
4
+ strong_actions (0.0.9)
5
5
  actionpack (>= 4.1, < 5.1)
6
6
  activesupport (>= 4.1, < 5.1)
7
7
  railties (>= 4.1, < 5.1)
@@ -9,34 +9,34 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actionpack (5.0.1)
13
- actionview (= 5.0.1)
14
- activesupport (= 5.0.1)
12
+ actionpack (5.0.2)
13
+ actionview (= 5.0.2)
14
+ activesupport (= 5.0.2)
15
15
  rack (~> 2.0)
16
16
  rack-test (~> 0.6.3)
17
17
  rails-dom-testing (~> 2.0)
18
18
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
19
- actionview (5.0.1)
20
- activesupport (= 5.0.1)
19
+ actionview (5.0.2)
20
+ activesupport (= 5.0.2)
21
21
  builder (~> 3.1)
22
22
  erubis (~> 2.7.0)
23
23
  rails-dom-testing (~> 2.0)
24
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
25
- activesupport (5.0.1)
24
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
25
+ activesupport (5.0.2)
26
26
  concurrent-ruby (~> 1.0, >= 1.0.2)
27
27
  i18n (~> 0.7)
28
28
  minitest (~> 5.1)
29
29
  tzinfo (~> 1.1)
30
30
  builder (3.2.3)
31
- concurrent-ruby (1.0.4)
31
+ concurrent-ruby (1.0.5)
32
32
  erubis (2.7.0)
33
- i18n (0.8.0)
33
+ i18n (0.8.1)
34
34
  loofah (2.0.3)
35
35
  nokogiri (>= 1.5.9)
36
36
  method_source (0.8.2)
37
37
  mini_portile2 (2.1.0)
38
38
  minitest (5.10.1)
39
- nokogiri (1.7.0.1)
39
+ nokogiri (1.7.1)
40
40
  mini_portile2 (~> 2.1.0)
41
41
  rack (2.0.1)
42
42
  rack-test (0.6.3)
@@ -46,16 +46,16 @@ GEM
46
46
  nokogiri (~> 1.6)
47
47
  rails-html-sanitizer (1.0.3)
48
48
  loofah (~> 2.0)
49
- railties (5.0.1)
50
- actionpack (= 5.0.1)
51
- activesupport (= 5.0.1)
49
+ railties (5.0.2)
50
+ actionpack (= 5.0.2)
51
+ activesupport (= 5.0.2)
52
52
  method_source
53
53
  rake (>= 0.8.7)
54
54
  thor (>= 0.18.1, < 2.0)
55
- rake (10.5.0)
55
+ rake (12.0.0)
56
56
  thor (0.19.4)
57
- thread_safe (0.3.5)
58
- tzinfo (1.2.2)
57
+ thread_safe (0.3.6)
58
+ tzinfo (1.2.3)
59
59
  thread_safe (~> 0.1)
60
60
 
61
61
  PLATFORMS
@@ -64,7 +64,7 @@ PLATFORMS
64
64
  DEPENDENCIES
65
65
  bundler (~> 1.7)
66
66
  minitest
67
- rake (~> 10.0)
67
+ rake (~> 12.0)
68
68
  strong_actions!
69
69
 
70
70
  BUNDLED WITH
data/HISTORY.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # History
2
2
 
3
+ ## 0.0.9
4
+ * fixed thread safety issue on multi-thread environment.
5
+
3
6
  ## 0.0.8
4
7
  * drop support for rails-4.0
5
8
  * add support for rails-5.0
@@ -7,6 +7,7 @@ module StrongActions
7
7
 
8
8
  def initialize
9
9
  @config_files ||= ['config/acl.yml']
10
+ @mutex = Mutex.new
10
11
  end
11
12
 
12
13
  def config_files
@@ -28,18 +29,32 @@ module StrongActions
28
29
  private
29
30
 
30
31
  def definitions
31
- if @acl.nil? or Rails.env.development?
32
- @acl = {}
33
- config_files.each do |config_file|
34
- yml = YAML.load_file(config_file)
35
- yml.each do |role, values|
36
- raise "role #{role} is already defined." if @acl.has_key?(role)
37
- @acl[role] = values
32
+ if should_load?
33
+ with_mutex do
34
+ if should_load?
35
+ @acl = {}
36
+ config_files.each do |config_file|
37
+ yml = YAML.load_file(config_file)
38
+ yml.each do |role, values|
39
+ raise "role #{role} is defined multiple times. config files are [#{config_files.join(', ')}]" if @acl.has_key?(role)
40
+ @acl[role] = values
41
+ end
42
+ end
38
43
  end
39
44
  end
40
45
  end
41
46
  @acl
42
47
  end
43
48
 
49
+ def should_load?
50
+ @acl.nil? or Rails.env.development?
51
+ end
52
+
53
+ def with_mutex
54
+ @mutex.synchronize do
55
+ yield
56
+ end
57
+ end
58
+
44
59
  end
45
60
  end
@@ -1,3 +1,3 @@
1
1
  module StrongActions
2
- VERSION = '0.0.8'
2
+ VERSION = '0.0.9'
3
3
  end
@@ -25,5 +25,5 @@ Gem::Specification.new do |spec|
25
25
 
26
26
  spec.add_development_dependency "bundler", "~> 1.7"
27
27
  spec.add_development_dependency "minitest"
28
- spec.add_development_dependency "rake", "~> 10.0"
28
+ spec.add_development_dependency "rake", "~> 12.0"
29
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: strong_actions
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - ichy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-07 00:00:00.000000000 Z
11
+ date: 2017-04-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -104,14 +104,14 @@ dependencies:
104
104
  requirements:
105
105
  - - "~>"
106
106
  - !ruby/object:Gem::Version
107
- version: '10.0'
107
+ version: '12.0'
108
108
  type: :development
109
109
  prerelease: false
110
110
  version_requirements: !ruby/object:Gem::Requirement
111
111
  requirements:
112
112
  - - "~>"
113
113
  - !ruby/object:Gem::Version
114
- version: '10.0'
114
+ version: '12.0'
115
115
  description: access control for rails controller/action
116
116
  email:
117
117
  - ichylinux@gmail.com