flipper-cloud 0.14.0 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/examples/cloud/import.rb +24 -0
- data/lib/flipper/cloud/configuration.rb +2 -2
- data/lib/flipper/version.rb +1 -1
- data/spec/flipper/cloud/configuration_spec.rb +3 -3
- data/spec/flipper/cloud_spec.rb +2 -2
- metadata +6 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8d4258f0f31b69a1aa4ba0a48ae12f50b569865
|
4
|
+
data.tar.gz: 44d4900440fec5582a6b2974843990c61ba26cc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4392a8441376e533ace5bf72bd2d61908b8415574121b8c73e9adc4be62be312677c2addbc8fc2288527becd2ae559fc134167725a81281d4b5154e9453b8721
|
7
|
+
data.tar.gz: 4e8cbfe2d07cf7bcd02eaca3c99f93e039b6e3234f9c81d630fbf9ef203c2d48e2c371c4feb10c48087a9cd78d74f3ad871199916269d9452b129102413eb550
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# Usage (from the repo root):
|
2
|
+
# env TOKEN=<token> bundle exec ruby examples/cloud/basic.rb
|
3
|
+
require 'pathname'
|
4
|
+
require 'logger'
|
5
|
+
root_path = Pathname(__FILE__).dirname.join('..').expand_path
|
6
|
+
lib_path = root_path.join('lib')
|
7
|
+
$:.unshift(lib_path)
|
8
|
+
|
9
|
+
require 'flipper'
|
10
|
+
require 'flipper/adapters/memory'
|
11
|
+
require 'flipper/cloud'
|
12
|
+
|
13
|
+
memory_adapter = Flipper::Adapters::Memory.new
|
14
|
+
memory_flipper = Flipper.new(memory_adapter)
|
15
|
+
|
16
|
+
memory_flipper.enable(:test)
|
17
|
+
memory_flipper.enable(:search)
|
18
|
+
memory_flipper.enable_actor(:stats, Flipper::Actor.new("jnunemaker"))
|
19
|
+
memory_flipper.enable_percentage_of_time(:logging, 5)
|
20
|
+
|
21
|
+
flipper = Flipper::Cloud.new(ENV.fetch('TOKEN'))
|
22
|
+
|
23
|
+
# wipes cloud clean and makes it identical to memory flipper
|
24
|
+
flipper.import(memory_flipper)
|
@@ -7,9 +7,9 @@ module Flipper
|
|
7
7
|
module Cloud
|
8
8
|
class Configuration
|
9
9
|
# The default url should be the one, the only, the website.
|
10
|
-
DEFAULT_URL = "https://www.
|
10
|
+
DEFAULT_URL = "https://www.flippercloud.io/adapter".freeze
|
11
11
|
|
12
|
-
# Public: The token corresponding to an environment on
|
12
|
+
# Public: The token corresponding to an environment on flippercloud.io.
|
13
13
|
attr_accessor :token
|
14
14
|
|
15
15
|
# Public: The url for http adapter (default: Flipper::Cloud::DEFAULT_URL).
|
data/lib/flipper/version.rb
CHANGED
@@ -35,7 +35,7 @@ RSpec.describe Flipper::Cloud::Configuration do
|
|
35
35
|
|
36
36
|
it "passes sync_interval into sync adapter" do
|
37
37
|
# The initial sync of http to local invokes this web request.
|
38
|
-
stub_request(:get, /
|
38
|
+
stub_request(:get, /flippercloud\.io/).to_return(status: 200, body: "{}")
|
39
39
|
|
40
40
|
instance = described_class.new(required_options.merge(sync_interval: 1))
|
41
41
|
expect(instance.adapter.synchronizer.interval).to be(1)
|
@@ -48,7 +48,7 @@ RSpec.describe Flipper::Cloud::Configuration do
|
|
48
48
|
|
49
49
|
it "defaults adapter block" do
|
50
50
|
# The initial sync of http to local invokes this web request.
|
51
|
-
stub_request(:get, /
|
51
|
+
stub_request(:get, /flippercloud\.io/).to_return(status: 200, body: "{}")
|
52
52
|
|
53
53
|
instance = described_class.new(required_options)
|
54
54
|
expect(instance.adapter).to be_instance_of(Flipper::Adapters::Sync)
|
@@ -56,7 +56,7 @@ RSpec.describe Flipper::Cloud::Configuration do
|
|
56
56
|
|
57
57
|
it "can override adapter block" do
|
58
58
|
# The initial sync of http to local invokes this web request.
|
59
|
-
stub_request(:get, /
|
59
|
+
stub_request(:get, /flippercloud\.io/).to_return(status: 200, body: "{}")
|
60
60
|
|
61
61
|
instance = described_class.new(required_options)
|
62
62
|
instance.adapter do |adapter|
|
data/spec/flipper/cloud_spec.rb
CHANGED
@@ -5,7 +5,7 @@ require 'flipper/instrumenters/memory'
|
|
5
5
|
|
6
6
|
RSpec.describe Flipper::Cloud do
|
7
7
|
before do
|
8
|
-
stub_request(:get, /
|
8
|
+
stub_request(:get, /flippercloud\.io/).to_return(status: 200, body: "{}")
|
9
9
|
end
|
10
10
|
|
11
11
|
context "initialize with token" do
|
@@ -30,7 +30,7 @@ RSpec.describe Flipper::Cloud do
|
|
30
30
|
it 'sets up correct url' do
|
31
31
|
uri = @http_client.instance_variable_get('@uri')
|
32
32
|
expect(uri.scheme).to eq('https')
|
33
|
-
expect(uri.host).to eq('www.
|
33
|
+
expect(uri.host).to eq('www.flippercloud.io')
|
34
34
|
expect(uri.path).to eq('/adapter')
|
35
35
|
end
|
36
36
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flipper-cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Nunemaker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: flipper
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.15.0
|
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
|
-
version: 0.
|
26
|
+
version: 0.15.0
|
27
27
|
description: FeatureFlipper.com adapter for Flipper
|
28
28
|
email:
|
29
29
|
- nunemaker@gmail.com
|
@@ -33,6 +33,7 @@ extra_rdoc_files: []
|
|
33
33
|
files:
|
34
34
|
- examples/cloud/basic.rb
|
35
35
|
- examples/cloud/cached_in_memory.rb
|
36
|
+
- examples/cloud/import.rb
|
36
37
|
- examples/cloud/local_adapter.rb
|
37
38
|
- flipper-cloud.gemspec
|
38
39
|
- lib/flipper-cloud.rb
|
@@ -61,7 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
61
62
|
version: '0'
|
62
63
|
requirements: []
|
63
64
|
rubyforge_project:
|
64
|
-
rubygems_version: 2.
|
65
|
+
rubygems_version: 2.4.5.4
|
65
66
|
signing_key:
|
66
67
|
specification_version: 4
|
67
68
|
summary: FeatureFlipper.com adapter for Flipper
|