split-cli 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +2 -1
- data/README.md +2 -2
- data/bin/split-cli +4 -0
- data/lib/split/cli.rb +1 -0
- data/lib/split/cli/request.rb +12 -0
- data/lib/split/cli/session.rb +10 -3
- data/lib/split/cli/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d9943bac628839750cdb4414d54897cb82843a5
|
4
|
+
data.tar.gz: 469fd82531164ef5ff62ef865d7ba57439539617
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 71276804ef7293fa0ed8346a071206eeb2e348fc6dd9975868f796b6c443631f0c91f1319ae379067dc8c6e40ea6d6b71d0110a2c4d4348c304b8d4b69642d8f
|
7
|
+
data.tar.gz: 97ecee8f8087ad25329c351168790ca00d7e7fdd5f0fae7189fa05ed5304324e655ea1468cdae16497d2b4187ae401258f5893fb6d7a497ecb94d4de698c90a6
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -24,10 +24,10 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
Supported environment variables
|
26
26
|
```shell
|
27
|
+
SPLIT_YAML_CONFIG # required 'path/to.yml'
|
27
28
|
REDIS_URL # default 'localhost:6379'
|
28
|
-
SPLIT_YAML_CONFIG # required
|
29
29
|
SPLIT_MULTI_EXPERIMENT # default true
|
30
|
-
REDIS_NAMESPACE #
|
30
|
+
REDIS_NAMESPACE # default 'split'
|
31
31
|
```
|
32
32
|
|
33
33
|
Basic Usage
|
data/bin/split-cli
CHANGED
@@ -25,6 +25,10 @@ parser = OptionParser.new do |opts|
|
|
25
25
|
opts.on("-n", "--namespace [namespace]", "Redis namespace") do |n|
|
26
26
|
options[:redis_namespace] = n
|
27
27
|
end
|
28
|
+
|
29
|
+
opts.on("-u", "--user-agent [user_agent]", "User Agent String") do |u|
|
30
|
+
options[:user_agent] = u
|
31
|
+
end
|
28
32
|
end
|
29
33
|
|
30
34
|
parser.parse!
|
data/lib/split/cli.rb
CHANGED
data/lib/split/cli/session.rb
CHANGED
@@ -5,28 +5,35 @@ module Split
|
|
5
5
|
class Session
|
6
6
|
include Split::Helper
|
7
7
|
|
8
|
-
attr_accessor :session_id, :options
|
8
|
+
attr_accessor :session_id, :request, :options
|
9
9
|
|
10
10
|
CONFIG_ERROR_MESSAGE = 'Set SPLIT_YAML_CONFIG to a valid path.'.freeze
|
11
11
|
|
12
12
|
def initialize(session_id, options = {})
|
13
13
|
@session_id = session_id
|
14
14
|
@options = options
|
15
|
+
@request = Request.new(options.fetch(:user_agent, 'CLI'))
|
15
16
|
config_split!
|
16
17
|
end
|
17
18
|
|
18
19
|
def ab_test(*args)
|
19
|
-
|
20
|
+
raise_unless_valid_args!(args)
|
20
21
|
super
|
21
22
|
end
|
22
23
|
|
23
24
|
def finished(*args)
|
24
|
-
|
25
|
+
raise_unless_valid_args!(args)
|
25
26
|
super
|
26
27
|
end
|
27
28
|
|
29
|
+
public :is_robot?
|
30
|
+
|
28
31
|
private
|
29
32
|
|
33
|
+
def raise_unless_valid_args!(args)
|
34
|
+
raise(Split::Cli::CommandError, 'No experiment name provided') unless args.any?
|
35
|
+
end
|
36
|
+
|
30
37
|
def config_split!
|
31
38
|
Split.redis = options.fetch :redis_url, ENV.fetch('REDIS_URL', 'localhost:6379')
|
32
39
|
Split.redis.namespace = options.fetch :redis_namespace, ENV.fetch('REDIS_NAMESPACE', 'split')
|
data/lib/split/cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: split-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Craig McNamara
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -100,6 +100,7 @@ files:
|
|
100
100
|
- bin/setup
|
101
101
|
- bin/split-cli
|
102
102
|
- lib/split/cli.rb
|
103
|
+
- lib/split/cli/request.rb
|
103
104
|
- lib/split/cli/session.rb
|
104
105
|
- lib/split/cli/version.rb
|
105
106
|
- split-cli.gemspec
|