rollout_ui2 0.1.1 → 0.2.0
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 +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +17 -0
- data/Gemfile +4 -0
- data/README.md +25 -9
- data/example_rack/Gemfile +1 -1
- data/example_rack/Gemfile.lock +3 -3
- data/gemfiles/rollout_2_0_0.gemfile +10 -0
- data/gemfiles/rollout_2_2_1.gemfile +10 -0
- data/gemfiles/rollout_2_4_0.gemfile +10 -0
- data/lib/rollout_ui2/version.rb +1 -1
- data/lib/rollout_ui2.rb +59 -30
- data/lib/views/index.erb +6 -4
- data/rollout_ui2.gemspec +1 -0
- metadata +20 -4
- data/example_rack/README.md +0 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9a202103c0ae6445adcba865e7fdeb391e4b7cbe
|
4
|
+
data.tar.gz: 7c5de71b01e84d0dbbe004401959509962a24633
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d130d972401708102c4e3678ae5a2d27166d6d577a8970c3f2b0e762fe7c01db991597aed9743e883734a9a7569ce24868c15798b98366afa965b9c0c66c172c
|
7
|
+
data.tar.gz: 152d123daabe0f7af2a594de57254acf9a1aea5c56d8ad2d6b1dd5a1464669e53772f7872c2a252d2479678920aa842f28db03062453093b7745023dfa76cbfb
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
language: ruby
|
2
|
+
sudo: false
|
3
|
+
|
4
|
+
services:
|
5
|
+
- redis
|
6
|
+
|
7
|
+
script: 'rspec'
|
8
|
+
|
9
|
+
rvm:
|
10
|
+
- 2.2.3
|
11
|
+
- ruby-head
|
12
|
+
gemfile:
|
13
|
+
- gemfiles/rollout_2_0_0.gemfile
|
14
|
+
- gemfiles/rollout_2_2_1.gemfile
|
15
|
+
- gemfiles/rollout_2_4_0.gemfile
|
16
|
+
matrix:
|
17
|
+
fast_finish: true
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# RolloutUi2
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
Rollout UI for Rollout 2!
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -20,22 +18,40 @@ Or install it yourself as:
|
|
20
18
|
|
21
19
|
$ gem install rollout_ui2
|
22
20
|
|
21
|
+
|
23
22
|
## Usage
|
24
23
|
|
25
|
-
|
24
|
+
Edit `config.ru` and add this:
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
# config.ru
|
28
|
+
|
29
|
+
require 'rollout_ui2'
|
26
30
|
|
27
|
-
|
31
|
+
require 'redis'
|
32
|
+
RolloutUi2.wrap(Rollout.new(Redis.new))
|
28
33
|
|
29
|
-
|
34
|
+
RolloutUi2::Server.use Rack::Auth::Basic do |user, pass|
|
35
|
+
user == pass
|
36
|
+
end
|
30
37
|
|
31
|
-
|
38
|
+
run Rack::URLMap.new(
|
39
|
+
# "/" => Your::App.new,
|
40
|
+
"/rollout" => RolloutUi2::Server
|
41
|
+
)
|
42
|
+
```
|
43
|
+
|
44
|
+
Execute `rackup` or `rails s` if you are using Rails
|
45
|
+
|
46
|
+
Visit `http://user:user@localhost:9292/rollout`
|
47
|
+
|
48
|
+

|
32
49
|
|
33
50
|
## Contributing
|
34
51
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
52
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/weapp/rollout_ui2.
|
36
53
|
|
37
54
|
|
38
55
|
## License
|
39
56
|
|
40
57
|
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
41
|
-
|
data/example_rack/Gemfile
CHANGED
data/example_rack/Gemfile.lock
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ..
|
3
3
|
specs:
|
4
|
-
rollout_ui2 (0.1.
|
5
|
-
sinatra (~> 1.4.7)
|
4
|
+
rollout_ui2 (0.1.1)
|
5
|
+
sinatra (~> 1.4, >= 1.4.7)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
@@ -23,7 +23,7 @@ PLATFORMS
|
|
23
23
|
|
24
24
|
DEPENDENCIES
|
25
25
|
redis
|
26
|
-
rollout
|
26
|
+
rollout (>= 2.0.0)
|
27
27
|
rollout_ui2!
|
28
28
|
|
29
29
|
BUNDLED WITH
|
data/lib/rollout_ui2/version.rb
CHANGED
data/lib/rollout_ui2.rb
CHANGED
@@ -1,55 +1,84 @@
|
|
1
1
|
require "rollout_ui2/version"
|
2
2
|
require 'sinatra/base'
|
3
|
-
require 'rollout'
|
4
3
|
require 'yaml'
|
5
4
|
|
6
5
|
module RolloutUi2
|
7
|
-
|
8
|
-
|
9
|
-
|
6
|
+
class << self
|
7
|
+
def wrap(rollout)
|
8
|
+
@rollout = rollout
|
9
|
+
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
def store
|
12
|
+
@store ||= begin
|
13
|
+
require 'redis'
|
14
|
+
Redis.new
|
15
|
+
end
|
15
16
|
end
|
16
|
-
end
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
def rollout
|
19
|
+
@rollout ||= begin
|
20
|
+
require 'rollout'
|
21
|
+
Rollout.new(store)
|
22
|
+
end
|
23
|
+
end
|
21
24
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
+
def index
|
26
|
+
rollout.features.empty? ? [] : multi(rollout.features.sort)
|
27
|
+
end
|
25
28
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
+
def get(name)
|
30
|
+
Feature.new(rollout.get(name))
|
31
|
+
end
|
32
|
+
|
33
|
+
def save(feature)
|
34
|
+
rollout.send(:save, feature)
|
35
|
+
end
|
36
|
+
|
37
|
+
def delete(feature)
|
38
|
+
return rollout.delete(feature.name) if rollout.respond_to?(:delete)
|
39
|
+
rollout.deactivate(feature.name)
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
29
43
|
|
30
|
-
|
31
|
-
|
44
|
+
def multi(keys)
|
45
|
+
features = if rollout.respond_to?(:multi_get)
|
46
|
+
rollout.multi_get(*keys)
|
47
|
+
else
|
48
|
+
keys.map { |key| get(key) }
|
49
|
+
end
|
50
|
+
features.map { |f| Feature.new(f) }
|
51
|
+
end
|
32
52
|
end
|
33
53
|
|
34
|
-
|
35
|
-
|
54
|
+
class Feature < SimpleDelegator
|
55
|
+
alias feature __getobj__
|
56
|
+
|
57
|
+
def data
|
58
|
+
CGI::escapeHTML(feature.data.to_yaml.sub(/\A---\s/, '')) if data?
|
59
|
+
end
|
60
|
+
|
61
|
+
def data?
|
62
|
+
feature.respond_to?(:data)
|
63
|
+
end
|
64
|
+
|
65
|
+
def groups
|
66
|
+
feature.groups.to_a
|
67
|
+
end
|
68
|
+
|
69
|
+
def users
|
70
|
+
feature.users.to_a
|
71
|
+
end
|
36
72
|
end
|
37
|
-
end
|
38
73
|
|
39
|
-
module RolloutUi2
|
40
74
|
class Server < Sinatra::Base
|
41
|
-
|
42
75
|
helpers do
|
43
76
|
def all_groups(features)
|
44
77
|
features.reduce([]) { |a, e| a | e.groups }
|
45
78
|
end
|
46
79
|
|
47
80
|
def as_array(param)
|
48
|
-
|
49
|
-
param.split(",")
|
50
|
-
else
|
51
|
-
param
|
52
|
-
end
|
81
|
+
param.respond_to?(:split) ? param.split(",") : param || []
|
53
82
|
end
|
54
83
|
|
55
84
|
def url_path(*path_parts)
|
data/lib/views/index.erb
CHANGED
@@ -66,11 +66,13 @@
|
|
66
66
|
</div>
|
67
67
|
</div>
|
68
68
|
|
69
|
-
|
70
|
-
<div class="
|
71
|
-
<
|
69
|
+
<% if feature.data? %>
|
70
|
+
<div class="form-group form-group-sm">
|
71
|
+
<div class="col-sm-offset-2 col-sm-5">
|
72
|
+
<pre><%= feature.data %></pre>
|
73
|
+
</div>
|
72
74
|
</div>
|
73
|
-
|
75
|
+
<% end %>
|
74
76
|
|
75
77
|
<div class="form-group form-group-sm">
|
76
78
|
<div class="col-sm-offset-2 col-sm-10">
|
data/rollout_ui2.gemspec
CHANGED
@@ -22,6 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.add_development_dependency "bundler", "~> 1.11"
|
23
23
|
spec.add_development_dependency "rake", "~> 10.0"
|
24
24
|
spec.add_development_dependency "rspec", "~> 3.0"
|
25
|
+
spec.add_development_dependency "rack-test"
|
25
26
|
|
26
27
|
spec.add_runtime_dependency 'sinatra', '~> 1.4', '>= 1.4.7'
|
27
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rollout_ui2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Manuel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-12-
|
11
|
+
date: 2016-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rack-test
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: sinatra
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -81,6 +95,7 @@ extra_rdoc_files: []
|
|
81
95
|
files:
|
82
96
|
- ".gitignore"
|
83
97
|
- ".rspec"
|
98
|
+
- ".travis.yml"
|
84
99
|
- Gemfile
|
85
100
|
- LICENSE.txt
|
86
101
|
- README.md
|
@@ -90,8 +105,10 @@ files:
|
|
90
105
|
- example_rack/.bundle/config
|
91
106
|
- example_rack/Gemfile
|
92
107
|
- example_rack/Gemfile.lock
|
93
|
-
- example_rack/README.md
|
94
108
|
- example_rack/config.ru
|
109
|
+
- gemfiles/rollout_2_0_0.gemfile
|
110
|
+
- gemfiles/rollout_2_2_1.gemfile
|
111
|
+
- gemfiles/rollout_2_4_0.gemfile
|
95
112
|
- lib/public/vendor/bootstrap/css/bootstrap-theme.css
|
96
113
|
- lib/public/vendor/bootstrap/css/bootstrap-theme.css.map
|
97
114
|
- lib/public/vendor/bootstrap/css/bootstrap-theme.min.css
|
@@ -143,4 +160,3 @@ signing_key:
|
|
143
160
|
specification_version: 4
|
144
161
|
summary: WebUI for rollout 2
|
145
162
|
test_files: []
|
146
|
-
has_rdoc:
|