flagship 0.6.1 → 0.7.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
- SHA1:
3
- metadata.gz: 43826b370e73a8ae802845d392ce56da04d8bf08
4
- data.tar.gz: 355a8a7542f37584203e500ab70e8904a21e7803
2
+ SHA256:
3
+ metadata.gz: 60210addd43057e1808189582ab298a84f14bb70468c1685e676ceb5481a7a8a
4
+ data.tar.gz: 4f85d9c988e71f2d219938310990757869269cf31e84706e093640f0e07b1326
5
5
  SHA512:
6
- metadata.gz: 760db6f34f3ecb8318f4a264c95aff3d9a8417869fb49ab5e3bbe092b9485caf6e5cf31de257b19aaeae84e055b2c2b4879c4de25eb067f5ae61fcbc6854fbcb
7
- data.tar.gz: 49bd1b50efd688cac93dcce575951544400bbf80e61e425e2d840d402874a0251efb9b98b1f905cab07827e48b7cbf97f2328fe74d2ca9b6c65878c13cca5861
6
+ metadata.gz: 43dd867d1d2a6de1433833709fdd9c251ee095fd088a0d4f024fc802d966067f24c80a4d0615202892663014c03f22ba295dacc4c55610982ed2d5f4316a3c9f
7
+ data.tar.gz: 45152c852249cfa8692da6c234f1d6f246ab30c1111c7458436ea8a99ab792077a0af4608570954bf9a4ea4ab2aff859a09e5067453d0867552acf68b7fc15e2
data/.travis.yml CHANGED
@@ -1,8 +1,9 @@
1
1
  language: ruby
2
2
 
3
3
  rvm:
4
- - 2.2.7
5
- - 2.3.4
6
- - 2.4.1
7
-
8
- before_install: gem install bundler --no-document
4
+ - 2.2.10
5
+ - 2.3.8
6
+ - 2.4.10
7
+ - 2.5.8
8
+ - 2.6.6
9
+ - 2.7.1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Change Log
2
2
 
3
+ ## [0.7.0] - 2020-05-01
4
+
5
+ ### Fixed
6
+
7
+ - Make context thread safe [#32](https://github.com/yuya-takeyama/flagship/pull/32) ([@mtsmfm](https://github.com/mtsmfm))
8
+
3
9
  ## [0.6.1] - 2017-05-17
4
10
 
5
11
  ### Added
data/flagship.gemspec CHANGED
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ["lib"]
23
23
 
24
- spec.add_development_dependency "bundler", "~> 1.13"
24
+ spec.add_development_dependency "bundler", "> 1.13"
25
25
  spec.add_development_dependency "rake", "~> 10.0"
26
26
  spec.add_development_dependency "rspec", "~> 3.5.0"
27
27
  end
@@ -1,18 +1,16 @@
1
+ require 'forwardable'
2
+
1
3
  class Flagship::Context
2
4
  extend Forwardable
3
- def_delegators :@values, :clear
4
-
5
- def initialize
6
- @values = {}
7
- end
5
+ def_delegators :current_values, :clear
8
6
 
9
7
  def __set(key, value)
10
- @values[key.to_sym] = value
8
+ current_values[key.to_sym] = value
11
9
  end
12
10
 
13
11
  def method_missing(name, args = [], &block)
14
- if @values.key?(name)
15
- value = @values[name]
12
+ if current_values.key?(name)
13
+ value = current_values[name]
16
14
 
17
15
  if value.respond_to?(:call)
18
16
  value.call
@@ -25,14 +23,24 @@ class Flagship::Context
25
23
  end
26
24
 
27
25
  def respond_to_missing?(name, include_private = false)
28
- @values.key?(name) or super
26
+ current_values.key?(name) or super
29
27
  end
30
28
 
31
- def with_values(values, &block)
32
- original_values = @values
33
- @values = @values.dup.merge(values)
29
+ def with_values(new_values, &block)
30
+ original_values = current_values
31
+ self.current_values = current_values.dup.merge(new_values)
34
32
  block.call
35
33
  ensure
36
- @values = original_values
34
+ self.current_values = original_values
35
+ end
36
+
37
+ private
38
+
39
+ def current_values
40
+ Thread.current[:__flagship_context_values] ||= {}
41
+ end
42
+
43
+ def current_values=(new_values)
44
+ Thread.current[:__flagship_context_values] = new_values
37
45
  end
38
46
  end
@@ -1,3 +1,3 @@
1
1
  module Flagship
2
- VERSION = "0.6.1"
2
+ VERSION = "0.7.0"
3
3
  end
metadata CHANGED
@@ -1,27 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flagship
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuya Takeyama
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-17 00:00:00.000000000 Z
11
+ date: 2021-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.13'
20
20
  type: :development
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: '1.13'
27
27
  - !ruby/object:Gem::Dependency
@@ -82,7 +82,7 @@ homepage: https://github.com/yuya-takeyama/flagship
82
82
  licenses:
83
83
  - MIT
84
84
  metadata: {}
85
- post_install_message:
85
+ post_install_message:
86
86
  rdoc_options: []
87
87
  require_paths:
88
88
  - lib
@@ -97,9 +97,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
99
  requirements: []
100
- rubyforge_project:
101
- rubygems_version: 2.6.8
102
- signing_key:
100
+ rubygems_version: 3.1.2
101
+ signing_key:
103
102
  specification_version: 4
104
103
  summary: Ship/unship features using flags defined with declarative DSL
105
104
  test_files: []