splitclient-rb 3.1.0.pre.rc12 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.txt +2 -0
- data/Detailed-README.md +406 -0
- data/LICENSE +10 -199
- data/NEWS +1 -0
- data/README.md +30 -342
- data/lib/cache/adapters/memory_adapters/map_adapter.rb +4 -2
- data/lib/cache/adapters/memory_adapters/queue_adapter.rb +12 -4
- data/lib/cache/senders/impressions_formatter.rb +65 -0
- data/lib/cache/senders/impressions_sender.rb +59 -0
- data/lib/engine/api/client.rb +30 -8
- data/lib/engine/api/impressions.rb +34 -0
- data/lib/engine/api/segments.rb +1 -1
- data/lib/engine/api/splits.rb +1 -1
- data/lib/engine/parser/split_adapter.rb +7 -102
- data/lib/splitclient-rb.rb +3 -1
- data/lib/splitclient-rb/localhost_split_factory.rb +19 -1
- data/lib/splitclient-rb/split_config.rb +2 -0
- data/lib/splitclient-rb/split_factory.rb +35 -141
- data/lib/splitclient-rb/split_factory_builder.rb +9 -2
- data/lib/splitclient-rb/version.rb +1 -1
- metadata +8 -5
- data/lib/splitclient-rb/localhost_split_factory_builder.rb +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a5117f6f857f704d74de7ad686f76fe016245794
|
4
|
+
data.tar.gz: 8fdaf54c1819746efc035274ec8cd466f318c6c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 37e6ece18bd94cf91577f11d27d21d14a6d95e41e010b865621b36fb387769b208e1160029a096512d4d35b05a16e04904e3df103e6b47e1f241e699833293d7
|
7
|
+
data.tar.gz: 840b6cc2480523351a7d6f612b641f65309ffcb2cc6a1993acaacb457b89a924d061f87e5ec104af972de70e20b6156509042e5ace91f0f36f84c4fcbfd42171
|
data/CHANGES.txt
CHANGED
@@ -4,6 +4,8 @@
|
|
4
4
|
- add impressions_queue_size to prevent memory leak when Threads pauses due to 'smart' fork.
|
5
5
|
- do not report latencies for get_treatment is array is all zeros
|
6
6
|
- Fix deduplication problem when posting impressions
|
7
|
+
- Change in how factory is construct.
|
8
|
+
- Detach implementation for local factory and regular one.
|
7
9
|
|
8
10
|
3.0.3
|
9
11
|
|
data/Detailed-README.md
ADDED
@@ -0,0 +1,406 @@
|
|
1
|
+
# Split Ruby SDK
|
2
|
+
|
3
|
+
Ruby SDK for Split software, provided as a gem that can be installed to your Ruby application.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
---
|
7
|
+
|
8
|
+
- Once the gem is published you can install it with the following steps:
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'splitclient-rb'
|
14
|
+
```
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle install
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
$ gem install splitclient-rb
|
23
|
+
|
24
|
+
- You can also use the most recent version from github:
|
25
|
+
|
26
|
+
Add these lines to you application's `Gemfile`:
|
27
|
+
```ruby
|
28
|
+
gem 'splitclient-rb', git: 'https://github.com/splitio/ruby-client.git',
|
29
|
+
```
|
30
|
+
You can also use any specific branch if necessary:
|
31
|
+
```ruby
|
32
|
+
gem 'splitclient-rb', git: 'https://github.com/splitio/ruby-client.git', branch: 'development'
|
33
|
+
```
|
34
|
+
And then execute:
|
35
|
+
|
36
|
+
$ bundle install
|
37
|
+
|
38
|
+
## Usage
|
39
|
+
|
40
|
+
### Quick Setup
|
41
|
+
---
|
42
|
+
|
43
|
+
Within your application you need the following:
|
44
|
+
|
45
|
+
Require the Split client:
|
46
|
+
```ruby
|
47
|
+
require 'splitclient-rb'
|
48
|
+
```
|
49
|
+
|
50
|
+
Create a new split client instance with your API key:
|
51
|
+
```ruby
|
52
|
+
factory = SplitIoClient::SplitFactoryBuilder.build('YOUR_API_KEY').client
|
53
|
+
split_client = factory.client
|
54
|
+
```
|
55
|
+
|
56
|
+
For advance use cases you can also obtain a `manager` instance from the factory.
|
57
|
+
```ruby
|
58
|
+
manager = factory.manager
|
59
|
+
```
|
60
|
+
|
61
|
+
#### Localhost mode
|
62
|
+
|
63
|
+
You can run SDK in so called "localhost" mode. In this mode SDK won't hit Split API and return treatments based on ".split" file on your local machine. The format of this file is two columns separated by whitespace. The left column is the Split name, the right column is the treatment name. Here is a sample file:
|
64
|
+
|
65
|
+
```
|
66
|
+
# this is a comment
|
67
|
+
|
68
|
+
# split_client.get_treatment('foo', 'reporting_v2') => 'on'
|
69
|
+
|
70
|
+
reporting_v2 on
|
71
|
+
double_writes_to_cassandra off
|
72
|
+
new-navigation v3
|
73
|
+
|
74
|
+
```
|
75
|
+
|
76
|
+
To use SDK in the localhost mode you should pass `localhost` as an API key like this:
|
77
|
+
|
78
|
+
```ruby
|
79
|
+
factory = SplitIoClient::SplitFactoryBuilder.build('localhost', path: '/where/to-look-for/<file_name>')
|
80
|
+
split_client = factory.client
|
81
|
+
```
|
82
|
+
|
83
|
+
By default SDK will look in your home directory (i.e. `~`) for a `.split` file, but you can specify a different
|
84
|
+
file name (full path) to look for the file (note: you must provide absolute path):
|
85
|
+
|
86
|
+
|
87
|
+
### Ruby on Rails
|
88
|
+
---
|
89
|
+
|
90
|
+
Create an initializer: `config/initializers/splitclient.rb` and then initialize the split client:
|
91
|
+
|
92
|
+
```ruby
|
93
|
+
Rails.configuration.split_client = SplitIoClient::SplitFactoryBuilder.build('YOUR_API_KEY').client
|
94
|
+
```
|
95
|
+
In your controllers, access the client using:
|
96
|
+
|
97
|
+
```ruby
|
98
|
+
Rails.application.config.split_client
|
99
|
+
```
|
100
|
+
|
101
|
+
### Configuration
|
102
|
+
---
|
103
|
+
|
104
|
+
Split client's default configuration should be sufficient for most scenarios. However you can also provide custom configuration when initializing the client using an optional hash of options.
|
105
|
+
|
106
|
+
The following values can be customized:
|
107
|
+
|
108
|
+
**base_uri** : URI for the api endpoints
|
109
|
+
|
110
|
+
*defualt value* = `https://sdk.split.io/api/`
|
111
|
+
|
112
|
+
**connection_timeout** : timeout for network connections in seconds
|
113
|
+
|
114
|
+
*default value* = `5`
|
115
|
+
|
116
|
+
**read_timeout** : timeout for requests in seconds
|
117
|
+
|
118
|
+
*default value* = `5`
|
119
|
+
|
120
|
+
**features_refresh_rate** : The SDK polls Split servers for changes to feature roll-out plans. This parameter controls this polling period in seconds
|
121
|
+
split_client.get_treatment('user_id','feature_name', attr: 'val')
|
122
|
+
*default value* = `30`
|
123
|
+
|
124
|
+
**segments_refresh_rate** : The SDK polls Split servers for changes to segment definitions. This parameter controls this polling period in seconds
|
125
|
+
|
126
|
+
*default value* = `60`
|
127
|
+
|
128
|
+
**metrics_refresh_rate** : The SDK sends diagnostic metrics to Split servers. This parameters controls this metric flush period in seconds
|
129
|
+
|
130
|
+
*default value* = `60`
|
131
|
+
|
132
|
+
**impressions_refresh_rate** : The SDK sends information on who got what treatment at what time back to Split servers to power analytics. This parameter controls how often this data is sent to Split servers in seconds
|
133
|
+
|
134
|
+
**impressions_queue_size** : The size of the impressions queue in case of `cache_adapter == :memory` and the size impressions batch to be fetched from Redis in case of `cache_adapter == :redis`. Use `-1` to disable impressions.
|
135
|
+
|
136
|
+
*default value* = `60`
|
137
|
+
|
138
|
+
**debug_enabled** : Enables extra logging
|
139
|
+
|
140
|
+
*default value* = `false`
|
141
|
+
|
142
|
+
**transport_debug_enabled** : Enables extra transport logging
|
143
|
+
|
144
|
+
*default value* = `false`
|
145
|
+
|
146
|
+
**logger** : default logger for messages and errors
|
147
|
+
|
148
|
+
*default value* = `Logger.new($stdout)`
|
149
|
+
|
150
|
+
**block_until_ready** : The SDK will block your app for provided amount of seconds until it's ready. If timeout expires `SplitIoClient::SDKBlockerTimeoutExpiredException` will be thrown. If `false` provided, then SDK would run in non-blocking mode
|
151
|
+
|
152
|
+
*default value* = `false`
|
153
|
+
|
154
|
+
**mode** : See [SDK modes section](#sdk-modes).
|
155
|
+
|
156
|
+
*default value* = `:standalone`
|
157
|
+
|
158
|
+
#### Cache adapter
|
159
|
+
|
160
|
+
The SDK needs some container to store data, i.e. splits/segments/impressions. By default it will store everything in the application's memory, but you can also use Redis.
|
161
|
+
|
162
|
+
To use Redis, you have to include `redis-rb` in your app's Gemfile.
|
163
|
+
|
164
|
+
**cache_adapter** : Supported options: `:memory`, `:redis`
|
165
|
+
|
166
|
+
*default value* = `memory`
|
167
|
+
|
168
|
+
**redis_url** : Redis URL or hash with configuration for SDK to connect to.
|
169
|
+
|
170
|
+
*default value* = `'redis://127.0.0.1:6379/0'`
|
171
|
+
|
172
|
+
You can also use Sentinel like this:
|
173
|
+
|
174
|
+
```ruby
|
175
|
+
SENTINELS = [{host: '127.0.0.1', port: 26380},
|
176
|
+
{host: '127.0.0.1', port: 26381}]
|
177
|
+
|
178
|
+
redis_connection = { url: 'redis://mymaster', sentinels: SENTINELS, role: :master }
|
179
|
+
|
180
|
+
options = {
|
181
|
+
# Other options here
|
182
|
+
redis_url: redis_connection
|
183
|
+
}
|
184
|
+
```
|
185
|
+
|
186
|
+
Example using Redis
|
187
|
+
```ruby
|
188
|
+
options = {
|
189
|
+
connection_timeout: 10,
|
190
|
+
read_timeout: 5,
|
191
|
+
features_refresh_rate: 120,
|
192
|
+
segments_refresh_rate: 120,
|
193
|
+
metrics_refresh_rate: 360,
|
194
|
+
impressions_refresh_rate: 360,
|
195
|
+
logger: Logger.new('logfile.log'),
|
196
|
+
cache_adapter: :redis,
|
197
|
+
mode: :standalone,
|
198
|
+
redis_url: 'redis://127.0.0.1:6379/0'
|
199
|
+
}
|
200
|
+
begin
|
201
|
+
split_client = SplitIoClient::SplitFactoryBuilder.build('YOUR_API_KEY', options).client
|
202
|
+
rescue SplitIoClient::SDKBlockerTimeoutExpiredException
|
203
|
+
# Some arbitrary actions
|
204
|
+
end
|
205
|
+
```
|
206
|
+
|
207
|
+
#### IMPORTANT
|
208
|
+
|
209
|
+
For now, SDK does not support both `producer` mode and `block_until_ready`. You must either run SDK in `standalone` mode, or do not use `block_until_ready` option.
|
210
|
+
|
211
|
+
This begin-rescue-end block is optional, you might want to use it to catch timeout expired exception and apply some logic.
|
212
|
+
|
213
|
+
### Execution
|
214
|
+
---
|
215
|
+
|
216
|
+
In your application code you just need to call the `get_treatment` method with the required parameters for key and feature name:
|
217
|
+
```ruby
|
218
|
+
split_client.get_treatment('user_id','feature_name', attr: 'val')
|
219
|
+
```
|
220
|
+
|
221
|
+
For example
|
222
|
+
```ruby
|
223
|
+
if split_client.get_treatment('employee_user_01','view_main_list', age: 35)
|
224
|
+
my_app.display_main_list
|
225
|
+
end
|
226
|
+
```
|
227
|
+
|
228
|
+
Also, you can use different keys for actually getting treatment and sending impressions to the server:
|
229
|
+
```ruby
|
230
|
+
split_client.get_treatment(
|
231
|
+
{ matching_key: 'user_id', bucketing_key: 'private_user_id' },
|
232
|
+
'feature_name',
|
233
|
+
attr: 'val'
|
234
|
+
)
|
235
|
+
```
|
236
|
+
When it might be useful? Say, you have a user browsing your website and not signed up yet. You assign some internal id to that user (i.e. bucketing_key) and after user signs up you assign him a matching_key.
|
237
|
+
By doing this you can provide both anonymous and signed up user with the same treatment.
|
238
|
+
|
239
|
+
`bucketing_key` may be `nil` in that case `matching_key` would be used as a key, so calling
|
240
|
+
```ruby
|
241
|
+
split_client.get_treatment(
|
242
|
+
{ matching_key: 'user_id' },
|
243
|
+
'feature_name',
|
244
|
+
attr: 'val'
|
245
|
+
)
|
246
|
+
```
|
247
|
+
Is exactly the same as calling
|
248
|
+
```ruby
|
249
|
+
split_client.get_treatment('user_id' ,'feature_name', attr: 'val')
|
250
|
+
```
|
251
|
+
`bucketing_key` must not be nil
|
252
|
+
|
253
|
+
Also you can use the split manager:
|
254
|
+
|
255
|
+
```ruby
|
256
|
+
split_manager = SplitIoClient::SplitFactoryBuilder.build('your_api_key', options).manager
|
257
|
+
```
|
258
|
+
|
259
|
+
With the manager you can get a list of your splits by doing:
|
260
|
+
|
261
|
+
```ruby
|
262
|
+
manager.splits
|
263
|
+
```
|
264
|
+
|
265
|
+
And you should get something like this:
|
266
|
+
|
267
|
+
```ruby
|
268
|
+
[
|
269
|
+
{
|
270
|
+
name: 'some_feature',
|
271
|
+
traffic_type_name: nil,
|
272
|
+
killed: false,
|
273
|
+
treatments: nil,
|
274
|
+
change_number: 1469134003507
|
275
|
+
},
|
276
|
+
{
|
277
|
+
name: 'another_feature',
|
278
|
+
traffic_type_name: nil,
|
279
|
+
killed: false,
|
280
|
+
treatments: nil,
|
281
|
+
change_number: 1469134003414
|
282
|
+
},
|
283
|
+
{
|
284
|
+
name: 'even_more_features',
|
285
|
+
traffic_type_name: nil,
|
286
|
+
killed: false,
|
287
|
+
treatments: nil,
|
288
|
+
change_number: 1469133991063
|
289
|
+
},
|
290
|
+
{
|
291
|
+
name: 'yet_another_feature',
|
292
|
+
traffic_type_name: nil,
|
293
|
+
killed: false,
|
294
|
+
treatments: nil,
|
295
|
+
change_number: 1469133757521
|
296
|
+
}
|
297
|
+
]
|
298
|
+
```
|
299
|
+
|
300
|
+
### SDK Modes
|
301
|
+
|
302
|
+
By default SDK would run alongside with your application and will be run in `standalone` mode, which includes two modes:
|
303
|
+
- `producer` - storing information from the Splits API in the chosen cache
|
304
|
+
- `consumer` - retrieving data from the cache and providing `get_treatment` interface
|
305
|
+
|
306
|
+
As you might think, you can choose between these 3 modes by providing `mode` option in the config.
|
307
|
+
|
308
|
+
#### Producer mode
|
309
|
+
|
310
|
+
If you have, say, one Redis cache which is used by several Split SDKs at once, e.g.: Python and Ruby, you want to have only one of them to write data to Redis, so it would remain consistent. That's why we have producer mode.
|
311
|
+
|
312
|
+
SDK can be ran in `producer` mode both in the scope of the application (e.g. as a part of the Rails app), and as a separate process. Let's see what steps are needed to run it as a separate process:
|
313
|
+
|
314
|
+
- You need to create a config file with .yml extension. All options specified in the above example section are valid, but you should write them in the YAML format, like this:
|
315
|
+
|
316
|
+
```yaml
|
317
|
+
---
|
318
|
+
:api_key: 'SECRET_API_KEY'
|
319
|
+
:connection_timeout: 10
|
320
|
+
:read_timeout: 5
|
321
|
+
:features_refresh_rate: 120
|
322
|
+
:segments_refresh_rate: 120
|
323
|
+
:metrics_refresh_rate: 360
|
324
|
+
:impressions_refresh_rate: 360
|
325
|
+
:cache_adapter: :redis
|
326
|
+
:mode: :producer
|
327
|
+
:redis_url: 'redis://127.0.0.1:6379/0'
|
328
|
+
```
|
329
|
+
|
330
|
+
- Install binstubs
|
331
|
+
```ruby
|
332
|
+
bundle binstubs splitclient-rb
|
333
|
+
```
|
334
|
+
|
335
|
+
- Run the executable provided by the SDK:
|
336
|
+
```ruby
|
337
|
+
bundle exec bin/splitio -c ~/path/to/config/file.yml
|
338
|
+
```
|
339
|
+
|
340
|
+
That's it!
|
341
|
+
|
342
|
+
## Development
|
343
|
+
|
344
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
345
|
+
|
346
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
347
|
+
|
348
|
+
## Coverage
|
349
|
+
|
350
|
+
The gem uses rspec for unit testing. Under the default `/spec` folder you will find the files for the unit tests and the specs helper file ( spec_helper.rb ). If a new spec file with new unit tests is required you just simply need to create it under the spec folder and all its test will be executed on the next rspec execution.
|
351
|
+
|
352
|
+
To run the suite of unit tests a rake task is provided. It's executed with the following command:
|
353
|
+
|
354
|
+
```bash
|
355
|
+
$ rake spec
|
356
|
+
```
|
357
|
+
|
358
|
+
Also, simplecov is used for coverage reporting. After the execution of the rake task it will create the `/coverage` folder with coverage reports in pretty HTML format.
|
359
|
+
Right now, the code coverage of the gem is at about 95%.
|
360
|
+
|
361
|
+
## Release
|
362
|
+
|
363
|
+
```bash
|
364
|
+
gem build splitclient-rb.gemspec
|
365
|
+
```
|
366
|
+
|
367
|
+
This will generate a file gemspec with the right version, then:
|
368
|
+
|
369
|
+
```bash
|
370
|
+
gem push splitclient-rb-<VERSION>.gem
|
371
|
+
```
|
372
|
+
|
373
|
+
## Contributing
|
374
|
+
|
375
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/splitio/ruby-client.
|
376
|
+
|
377
|
+
## Gem version publish
|
378
|
+
|
379
|
+
To build a new version of the gem, after you have finished the desired changes, documented the CHANGES.txt and the NEWS, as well as named it properly in the version.rb. This steps assume that all of your new cool features and fixes have been merged into development, and into master branches of the ruby-client repo. Once that is ready to go, you will have to run the build command to obtain a .gem file:
|
380
|
+
|
381
|
+
```bash
|
382
|
+
gem build splitclient-rb.gemspec
|
383
|
+
```
|
384
|
+
|
385
|
+
That will generate a splitclient-rb-x.x.x.gem file, with the corresponding version information on it.
|
386
|
+
To publish this new version of the gem at rubygems.org you must run the following command:
|
387
|
+
|
388
|
+
```bash
|
389
|
+
gem push splitclient-rb-x.x.x.gem
|
390
|
+
```
|
391
|
+
|
392
|
+
A valid rubygems username and password will be required.
|
393
|
+
|
394
|
+
After this action, the new splitclient-rb-x.x.x version is available for its use from any ruby app.
|
395
|
+
|
396
|
+
So for instance in a rails app Gemfile, you could add the:
|
397
|
+
|
398
|
+
```ruby
|
399
|
+
gem 'splitclient-rb', '~> x.x.x'
|
400
|
+
```
|
401
|
+
|
402
|
+
line to have the latest version of the gem ready to be used.
|
403
|
+
|
404
|
+
## License
|
405
|
+
|
406
|
+
The gem is available as open source under the terms of the [Apache License](http://www.apache.org/licenses/).
|
data/LICENSE
CHANGED
@@ -1,202 +1,13 @@
|
|
1
|
-
|
2
|
-
Version 2.0, January 2004
|
3
|
-
http://www.apache.org/licenses/
|
1
|
+
Copyright 2016 Split Software, Co.
|
4
2
|
|
5
|
-
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
you may not use this file except in compliance with the License.
|
5
|
+
You may obtain a copy of the License at
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
-
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
-
the copyright owner that is granting the License.
|
14
|
-
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
-
other entities that control, are controlled by, or are under common
|
17
|
-
control with that entity. For the purposes of this definition,
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
19
|
-
direction or management of such entity, whether by contract or
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
-
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
-
exercising permissions granted by this License.
|
25
|
-
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
27
|
-
including but not limited to software source code, documentation
|
28
|
-
source, and configuration files.
|
29
|
-
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
31
|
-
transformation or translation of a Source form, including but
|
32
|
-
not limited to compiled object code, generated documentation,
|
33
|
-
and conversions to other media types.
|
34
|
-
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
36
|
-
Object form, made available under the License, as indicated by a
|
37
|
-
copyright notice that is included in or attached to the work
|
38
|
-
(an example is provided in the Appendix below).
|
39
|
-
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
-
the Work and Derivative Works thereof.
|
47
|
-
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
49
|
-
the original version of the Work and any modifications or additions
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
-
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
64
|
-
subsequently incorporated within the Work.
|
65
|
-
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
72
|
-
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
-
where such license applies only to those patent claims licensable
|
79
|
-
by such Contributor that are necessarily infringed by their
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
82
|
-
institute patent litigation against any entity (including a
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
85
|
-
or contributory patent infringement, then any patent licenses
|
86
|
-
granted to You under this License for that Work shall terminate
|
87
|
-
as of the date such litigation is filed.
|
88
|
-
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
91
|
-
modifications, and in Source or Object form, provided that You
|
92
|
-
meet the following conditions:
|
93
|
-
|
94
|
-
(a) You must give any other recipients of the Work or
|
95
|
-
Derivative Works a copy of this License; and
|
96
|
-
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
98
|
-
stating that You changed the files; and
|
99
|
-
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
102
|
-
attribution notices from the Source form of the Work,
|
103
|
-
excluding those notices that do not pertain to any part of
|
104
|
-
the Derivative Works; and
|
105
|
-
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
108
|
-
include a readable copy of the attribution notices contained
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
111
|
-
of the following places: within a NOTICE text file distributed
|
112
|
-
as part of the Derivative Works; within the Source form or
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
114
|
-
within a display generated by the Derivative Works, if and
|
115
|
-
wherever such third-party notices normally appear. The contents
|
116
|
-
of the NOTICE file are for informational purposes only and
|
117
|
-
do not modify the License. You may add Your own attribution
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
120
|
-
that such additional attribution notices cannot be construed
|
121
|
-
as modifying the License.
|
122
|
-
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
124
|
-
may provide additional or different license terms and conditions
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
128
|
-
the conditions stated in this License.
|
129
|
-
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
133
|
-
this License, without any additional terms or conditions.
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
-
the terms of any separate license agreement you may have executed
|
136
|
-
with Licensor regarding such Contributions.
|
137
|
-
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
140
|
-
except as required for reasonable and customary use in describing the
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
-
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
152
|
-
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
158
|
-
incidental, or consequential damages of any character arising as a
|
159
|
-
result of this License or out of the use or inability to use the
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
162
|
-
other commercial damages or losses), even if such Contributor
|
163
|
-
has been advised of the possibility of such damages.
|
164
|
-
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
-
or other liability obligations and/or rights consistent with this
|
169
|
-
License. However, in accepting such obligations, You may act only
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
174
|
-
of your accepting any such warranty or additional liability.
|
175
|
-
|
176
|
-
END OF TERMS AND CONDITIONS
|
177
|
-
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
179
|
-
|
180
|
-
To apply the Apache License to your work, attach the following
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "{}"
|
182
|
-
replaced with your own identifying information. (Don't include
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
184
|
-
comment syntax for the file format. We also recommend that a
|
185
|
-
file or class name and description of purpose be included on the
|
186
|
-
same "printed page" as the copyright notice for easier
|
187
|
-
identification within third-party archives.
|
188
|
-
|
189
|
-
Copyright {yyyy} {name of copyright owner}
|
190
|
-
|
191
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
-
you may not use this file except in compliance with the License.
|
193
|
-
You may obtain a copy of the License at
|
194
|
-
|
195
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
-
|
197
|
-
Unless required by applicable law or agreed to in writing, software
|
198
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
-
See the License for the specific language governing permissions and
|
201
|
-
limitations under the License.
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
202
8
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
See the License for the specific language governing permissions and
|
13
|
+
limitations under the License.
|