flipper-ui 0.2.0.beta5 → 0.7.0.beta4

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
2
  SHA1:
3
- metadata.gz: 141a720a1e4f1252f5f716bdd24301c18444634f
4
- data.tar.gz: 6461aee635cdd966d8bee5869379cb578ca83fbf
3
+ metadata.gz: 3e8385a002087b4445e5d5d167e96741c2c3841f
4
+ data.tar.gz: e03bd3bc018c15f0af45fad684796cd895823376
5
5
  SHA512:
6
- metadata.gz: 5d7dcdac2eb34225dd5613f6c95a5773a8bdfd83cc10d98de511f05c70c456d0c71d49c7ad03a7a7b9f65c9b7e92f2342bb0e8a62d111d59aea18e5822f0423e
7
- data.tar.gz: d3a01e58ca60105b95b68a28cc302e0a1cdc7356b42fadc91a58eec560ee3b3e422549f168cdb22bd23d1c26785d3037cc3093c4ce040bcd4eadd50ac20fbbdd
6
+ metadata.gz: 7495ee2bb82e94423d8a05527cb2abc8f5c516c2dad1009a658c39064996111d9561b9409fe81e76419c50fffeb44327e3ff77856c3edddfad6e05b82cf03970
7
+ data.tar.gz: 3d23541561bed553b8cd878336c4317b7a27cb82c1c7e24665b7f94ca9d8c682b4ee58ce87aaa21cc073576e9ce6d402e495b8bd0729e5fbef0fc6611320eecc
@@ -2,6 +2,14 @@
2
2
 
3
3
  UI for the [Flipper](https://github.com/jnunemaker/flipper) gem.
4
4
 
5
+ ## Screenshots
6
+
7
+ Viewing list of features:
8
+ ![features](images/features.png)
9
+
10
+ Viewing an individual feature:
11
+ ![feature](images/feature.png)
12
+
5
13
  ## Installation
6
14
 
7
15
  Add this line to your application's Gemfile:
@@ -85,7 +93,7 @@ flipper = Flipper.new(adapter)
85
93
  run Flipper::UI.app(flipper, secret: "_your_session_secret")
86
94
  ```
87
95
 
88
- See [examples/basic.ru](https://github.com/jnunemaker/flipper-ui/blob/master/examples/basic.ru) for a more full example
96
+ See [examples/ui/basic.ru](https://github.com/jnunemaker/flipper/blob/master/examples/ui/basic.ru) for a more full example
89
97
 
90
98
  ## Contributing
91
99
 
@@ -1,7 +1,8 @@
1
1
  #
2
2
  # Usage:
3
- # bundle exec rackup examples/basic.ru
4
- # http://localhost:9292/
3
+ # bundle exec rackup examples/ui/basic.ru -p 9999
4
+ # bundle exec shotgun examples/ui/basic.ru -p 9999
5
+ # http://localhost:9999/
5
6
  #
6
7
  require "pp"
7
8
  require "logger"
@@ -1,5 +1,9 @@
1
1
  # -*- encoding: utf-8 -*-
2
- require File.expand_path('../lib/flipper/ui/version', __FILE__)
2
+ require File.expand_path('../lib/flipper/version', __FILE__)
3
+
4
+ flipper_ui_files = lambda { |file|
5
+ file =~ /(docs|examples|flipper)[\/-]ui/
6
+ }
3
7
 
4
8
  Gem::Specification.new do |gem|
5
9
  gem.authors = ["John Nunemaker"]
@@ -7,17 +11,16 @@ Gem::Specification.new do |gem|
7
11
  gem.summary = "UI for the Flipper gem"
8
12
  gem.description = "Rack middleware that provides a fully featured web interface for the flipper gem."
9
13
  gem.license = "MIT"
10
- gem.homepage = "https://github.com/jnunemaker/flipper-ui"
14
+ gem.homepage = "https://github.com/jnunemaker/flipper"
11
15
 
12
- gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
13
- gem.files = `git ls-files`.split("\n")
14
- gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
16
+ gem.files = `git ls-files`.split("\n").select(&flipper_ui_files) + ["lib/flipper/version.rb"]
17
+ gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n").select(&flipper_ui_files)
15
18
  gem.name = "flipper-ui"
16
19
  gem.require_paths = ["lib"]
17
- gem.version = Flipper::UI::VERSION
20
+ gem.version = Flipper::VERSION
18
21
 
19
22
  gem.add_dependency 'rack', '~> 1.4', '< 1.7'
20
23
  gem.add_dependency 'rack-protection', '~> 1.5.3'
21
- gem.add_dependency 'flipper', '~> 0.7.0.beta3'
24
+ gem.add_dependency 'flipper', "~> #{Flipper::VERSION}"
22
25
  gem.add_dependency 'erubis', '~> 2.7.0'
23
26
  end
@@ -1,2 +1 @@
1
- require 'flipper'
2
1
  require 'flipper/ui'
@@ -14,6 +14,7 @@ module Flipper
14
14
  @page_title = "#{@feature.key} // Features"
15
15
  @percentages = [0, 1, 5, 10, 15, 25, 50, 75, 100]
16
16
 
17
+ breadcrumb "Home", "/"
17
18
  breadcrumb "Features", "/features"
18
19
  breadcrumb @feature.key
19
20
 
@@ -33,7 +33,7 @@ module Flipper
33
33
 
34
34
  flipper.adapter.add(flipper[value])
35
35
 
36
- redirect_to "/features"
36
+ redirect_to "/features/#{Rack::Utils.escape_path(value)}"
37
37
  end
38
38
  end
39
39
  end
@@ -23,7 +23,6 @@ module Flipper
23
23
  'id' => name.to_s,
24
24
  'name' => pretty_name,
25
25
  'state' => state.to_s,
26
- 'description' => description,
27
26
  'gates' => gates.map { |gate|
28
27
  Decorators::Gate.new(gate, gate_values[gate.key]).as_json
29
28
  },
@@ -32,164 +32,162 @@
32
32
  </div>
33
33
  </div>
34
34
 
35
- <% unless @feature.on? %>
36
- <div class="container">
37
- <div class="columns">
38
- <div class="column one-half">
39
- <div class="panel panel-default">
40
- <div class="panel-heading">
41
- <h3 class="panel-title">Percentage of Actors</h3>
42
- </div>
43
- <div class="panel-body">
44
- <form action="<%= script_name %>/features/<%= @feature.key %>/percentage_of_actors" method="post">
45
- <%== csrf_input_tag %>
46
- <div class="btn-group">
47
- <% @percentages.each do |number| %>
48
- <input type="submit" name="value" value="<%= number %>%" class="btn" <% if number == @feature.percentage_of_actors_value %>disabled<% end %>>
49
- <% end %>
50
- </div>
51
- </form>
35
+ <div class="container">
36
+ <div class="columns">
37
+ <div class="column one-half">
38
+ <div class="panel panel-default">
39
+ <div class="panel-heading">
40
+ <h3 class="panel-title">Percentage of Actors</h3>
41
+ </div>
42
+ <div class="panel-body">
43
+ <form action="<%= script_name %>/features/<%= @feature.key %>/percentage_of_actors" method="post">
44
+ <%== csrf_input_tag %>
45
+ <div class="btn-group">
46
+ <% @percentages.each do |number| %>
47
+ <input type="submit" name="value" value="<%= number %>%" class="btn" <% if number == @feature.percentage_of_actors_value %>disabled<% end %>>
48
+ <% end %>
49
+ </div>
50
+ </form>
52
51
 
53
- <h4>- or -</h4>
52
+ <h4>- or -</h4>
54
53
 
55
- <form action="<%= script_name %>/features/<%= @feature.key %>/percentage_of_actors" method="post">
56
- <%== csrf_input_tag %>
57
- <input type="text" name="value" <% if @feature.percentage_of_actors_value > 0 %>value="<%= @feature.percentage_of_actors_value %>"<% end %> placeholder="custom (ie: 26, 32, etc.)" class="input-mini">
58
- <input type="submit" name="action" value="Enable" class="btn btn-sm">
59
- </form>
60
- </div>
54
+ <form action="<%= script_name %>/features/<%= @feature.key %>/percentage_of_actors" method="post">
55
+ <%== csrf_input_tag %>
56
+ <input type="text" name="value" <% if @feature.percentage_of_actors_value > 0 %>value="<%= @feature.percentage_of_actors_value %>"<% end %> placeholder="custom (ie: 26, 32, etc.)" class="input-mini">
57
+ <input type="submit" name="action" value="Enable" class="btn btn-sm">
58
+ </form>
61
59
  </div>
62
60
  </div>
63
- <div class="column one-half">
64
- <div class="panel panel-default">
65
- <div class="panel-heading">
66
- <h3 class="panel-title">Percentage of Time</h3>
67
- </div>
68
- <div class="panel-body">
69
- <form action="<%= script_name %>/features/<%= @feature.key %>/percentage_of_time" method="post">
70
- <%== csrf_input_tag %>
71
- <div class="btn-group">
72
- <% @percentages.each do |number| %>
73
- <input type="submit" name="value" value="<%= number %>%" class="btn" <% if number == @feature.percentage_of_time_value %>disabled<% end %>>
74
- <% end %>
75
- </div>
76
- </form>
61
+ </div>
62
+ <div class="column one-half">
63
+ <div class="panel panel-default">
64
+ <div class="panel-heading">
65
+ <h3 class="panel-title">Percentage of Time</h3>
66
+ </div>
67
+ <div class="panel-body">
68
+ <form action="<%= script_name %>/features/<%= @feature.key %>/percentage_of_time" method="post">
69
+ <%== csrf_input_tag %>
70
+ <div class="btn-group">
71
+ <% @percentages.each do |number| %>
72
+ <input type="submit" name="value" value="<%= number %>%" class="btn" <% if number == @feature.percentage_of_time_value %>disabled<% end %>>
73
+ <% end %>
74
+ </div>
75
+ </form>
77
76
 
78
- <h4>- or -</h4>
77
+ <h4>- or -</h4>
79
78
 
80
- <form action="<%= script_name %>/features/<%= @feature.key %>/percentage_of_time" method="post">
81
- <%== csrf_input_tag %>
82
- <input type="text" name="value" <% if @feature.percentage_of_time_value > 0 %>value="<%= @feature.percentage_of_time_value %>"<% end %> placeholder="custom (ie: 26, 32, etc.)" class="input-mini">
83
- <input type="submit" name="action" value="Enable" class="btn btn-sm">
84
- </form>
85
- </div>
79
+ <form action="<%= script_name %>/features/<%= @feature.key %>/percentage_of_time" method="post">
80
+ <%== csrf_input_tag %>
81
+ <input type="text" name="value" <% if @feature.percentage_of_time_value > 0 %>value="<%= @feature.percentage_of_time_value %>"<% end %> placeholder="custom (ie: 26, 32, etc.)" class="input-mini">
82
+ <input type="submit" name="action" value="Enable" class="btn btn-sm">
83
+ </form>
86
84
  </div>
87
85
  </div>
88
86
  </div>
89
87
  </div>
88
+ </div>
90
89
 
91
- <div class="container">
92
- <div class="columns">
93
- <div class="column one-half">
94
- <div class="panel panel-default">
95
- <div class="panel-heading">
96
- <% if @feature.disabled_groups.empty? %>
97
- <p class="right">All groups enabled.</p>
98
- <% else %>
99
- <form action="<%= script_name %>/features/<%= @feature.key %>/groups" method="post" class="right">
100
- <%== csrf_input_tag %>
101
- <input type="hidden" name="operation" value="enable">
102
- <select name="value">
103
- <option value="">Select a group...</option>
104
- <% @feature.disabled_groups.each do |group| %>
105
- <option value="<%= group.name %>"><%= group.name %></option>
106
- <% end %>
107
- </select>
108
- <input type="submit" value="Add Group" class="btn btn-sm">
109
- </form>
110
- <% end %>
111
- <h3 class="panel-title">Groups</h3>
112
- </div>
113
- <% if @feature.groups_value.empty? %>
114
- <div class="blankslate">
115
- <span class="mega-octicon octicon-organization"></span>
116
- <span class="mega-octicon octicon-squirrel"></span>
117
- <span class="mega-octicon octicon-zap"></span>
118
- <h3>No Enabled Groups</h3>
119
- <p>Enable groups using the form above.</p>
120
- </div>
90
+ <div class="container">
91
+ <div class="columns">
92
+ <div class="column one-half">
93
+ <div class="panel panel-default">
94
+ <div class="panel-heading">
95
+ <% if @feature.disabled_groups.empty? %>
96
+ <p class="right">All groups enabled.</p>
121
97
  <% else %>
122
- <ul class="list-group">
123
- <% @feature.groups_value.each do |item| %>
124
- <li class="list-group-item">
125
- <div class="flex-table">
126
- <div class="flex-table-item flex-table-item-primary">
127
- <%= item %>
128
- </div>
129
- <div class="flex-table-item">
130
- <form action="<%= script_name %>/features/<%= @feature.key %>/groups" method="post">
131
- <%== csrf_input_tag %>
132
- <input type="hidden" name="operation" value="disable">
133
- <input type="hidden" name="value" value="<%= item %>">
134
- <button type="submit" value="Disable" class="button-inv danger tooltipped tooltipped-w" aria-label="Disable <%= item %>">
135
- <span class="octicon octicon-trashcan"></span>
136
- </button>
137
- </form>
138
- </div>
139
- </div>
140
- </li>
141
- <% end %>
142
- </ul>
143
- <% end %>
144
- </div>
145
- </div>
146
- <div class="column one-half">
147
- <div class="panel panel-default">
148
- <div class="panel-heading">
149
- <form action="<%= script_name %>/features/<%= @feature.key %>/actors" method="post" class="right">
98
+ <form action="<%= script_name %>/features/<%= @feature.key %>/groups" method="post" class="right">
150
99
  <%== csrf_input_tag %>
151
100
  <input type="hidden" name="operation" value="enable">
152
- <input type="text" name="value" placeholder="ie: User:6" class="input-mini">
153
- <input type="submit" value="Add Actor" class="btn btn-sm">
101
+ <select name="value">
102
+ <option value="">Select a group...</option>
103
+ <% @feature.disabled_groups.each do |group| %>
104
+ <option value="<%= group.name %>"><%= group.name %></option>
105
+ <% end %>
106
+ </select>
107
+ <input type="submit" value="Add Group" class="btn btn-sm">
154
108
  </form>
155
- <h3 class="panel-title">Actors</h3>
109
+ <% end %>
110
+ <h3 class="panel-title">Groups</h3>
111
+ </div>
112
+ <% if @feature.groups_value.empty? %>
113
+ <div class="blankslate">
114
+ <span class="mega-octicon octicon-organization"></span>
115
+ <span class="mega-octicon octicon-squirrel"></span>
116
+ <span class="mega-octicon octicon-zap"></span>
117
+ <h3>No Enabled Groups</h3>
118
+ <p>Enable groups using the form above.</p>
156
119
  </div>
157
- <% if @feature.actors_value.empty? %>
158
- <div class="blankslate">
159
- <span class="mega-octicon octicon-person"></span>
160
- <span class="mega-octicon octicon-squirrel"></span>
161
- <span class="mega-octicon octicon-zap"></span>
162
- <h3>No Enabled Actors</h3>
163
- <p>Enable actors using the form above.</p>
164
- </div>
165
- <% else %>
166
- <ul class="list-group">
167
- <% @feature.actors_value.each do |item| %>
168
- <li class="list-group-item">
169
- <div class="flex-table">
170
- <div class="flex-table-item flex-table-item-primary">
171
- <%= item %>
172
- </div>
173
- <div class="flex-table-item">
174
- <form action="<%= script_name %>/features/<%= @feature.key %>/actors" method="post">
175
- <%== csrf_input_tag %>
176
- <input type="hidden" name="operation" value="disable">
177
- <input type="hidden" name="value" value="<%= item %>">
178
- <button type="submit" value="Disable" class="button-inv danger tooltipped tooltipped-w" aria-label="Disable <%= item %>">
179
- <span class="octicon octicon-trashcan"></span>
180
- </button>
181
- </form>
182
- </div>
120
+ <% else %>
121
+ <ul class="list-group">
122
+ <% @feature.groups_value.each do |item| %>
123
+ <li class="list-group-item">
124
+ <div class="flex-table">
125
+ <div class="flex-table-item flex-table-item-primary">
126
+ <%= item %>
183
127
  </div>
184
- </li>
185
- <% end %>
186
- </ul>
187
- <% end %>
128
+ <div class="flex-table-item">
129
+ <form action="<%= script_name %>/features/<%= @feature.key %>/groups" method="post">
130
+ <%== csrf_input_tag %>
131
+ <input type="hidden" name="operation" value="disable">
132
+ <input type="hidden" name="value" value="<%= item %>">
133
+ <button type="submit" value="Disable" class="button-inv danger tooltipped tooltipped-w" aria-label="Disable <%= item %>">
134
+ <span class="octicon octicon-trashcan"></span>
135
+ </button>
136
+ </form>
137
+ </div>
138
+ </div>
139
+ </li>
140
+ <% end %>
141
+ </ul>
142
+ <% end %>
143
+ </div>
144
+ </div>
145
+ <div class="column one-half">
146
+ <div class="panel panel-default">
147
+ <div class="panel-heading">
148
+ <form action="<%= script_name %>/features/<%= @feature.key %>/actors" method="post" class="right">
149
+ <%== csrf_input_tag %>
150
+ <input type="hidden" name="operation" value="enable">
151
+ <input type="text" name="value" placeholder="ie: User:6" class="input-mini">
152
+ <input type="submit" value="Add Actor" class="btn btn-sm">
153
+ </form>
154
+ <h3 class="panel-title">Actors</h3>
188
155
  </div>
156
+ <% if @feature.actors_value.empty? %>
157
+ <div class="blankslate">
158
+ <span class="mega-octicon octicon-person"></span>
159
+ <span class="mega-octicon octicon-squirrel"></span>
160
+ <span class="mega-octicon octicon-zap"></span>
161
+ <h3>No Enabled Actors</h3>
162
+ <p>Enable actors using the form above.</p>
163
+ </div>
164
+ <% else %>
165
+ <ul class="list-group">
166
+ <% @feature.actors_value.each do |item| %>
167
+ <li class="list-group-item">
168
+ <div class="flex-table">
169
+ <div class="flex-table-item flex-table-item-primary">
170
+ <%= item %>
171
+ </div>
172
+ <div class="flex-table-item">
173
+ <form action="<%= script_name %>/features/<%= @feature.key %>/actors" method="post">
174
+ <%== csrf_input_tag %>
175
+ <input type="hidden" name="operation" value="disable">
176
+ <input type="hidden" name="value" value="<%= item %>">
177
+ <button type="submit" value="Disable" class="button-inv danger tooltipped tooltipped-w" aria-label="Disable <%= item %>">
178
+ <span class="octicon octicon-trashcan"></span>
179
+ </button>
180
+ </form>
181
+ </div>
182
+ </div>
183
+ </li>
184
+ <% end %>
185
+ </ul>
186
+ <% end %>
189
187
  </div>
190
188
  </div>
191
189
  </div>
192
- <% end %>
190
+ </div>
193
191
 
194
192
  <div class="panel panel-danger">
195
193
  <div class="panel-heading">
@@ -0,0 +1,3 @@
1
+ module Flipper
2
+ VERSION = "0.7.0.beta4"
3
+ end
@@ -29,9 +29,9 @@ describe Flipper::UI::Actions::Features do
29
29
  flipper.features.map(&:key).should include("notifications_next")
30
30
  end
31
31
 
32
- it "redirects to features" do
32
+ it "redirects to feature" do
33
33
  last_response.status.should be(302)
34
- last_response.headers["Location"].should eq("/features")
34
+ last_response.headers["Location"].should eq("/features/notifications_next")
35
35
  end
36
36
  end
37
37
  end
@@ -44,10 +44,6 @@ describe Flipper::UI::Decorators::Feature do
44
44
  @result['state'].should eq('off')
45
45
  end
46
46
 
47
- it "includes description" do
48
- @result['description'].should eq('Disabled')
49
- end
50
-
51
47
  it "includes gates" do
52
48
  gates = subject.gates.map { |gate|
53
49
  value = subject.gate_values[gate.key]
@@ -5,13 +5,13 @@ describe Flipper::UI::Util do
5
5
  describe "#blank?" do
6
6
  context "with a string" do
7
7
  it "returns true if blank" do
8
- described_class.blank?(nil).should be_true
9
- described_class.blank?('').should be_true
10
- described_class.blank?(' ').should be_true
8
+ described_class.blank?(nil).should be(true)
9
+ described_class.blank?('').should be(true)
10
+ described_class.blank?(' ').should be(true)
11
11
  end
12
12
 
13
13
  it "returns false if not blank" do
14
- described_class.blank?('nope').should be_false
14
+ described_class.blank?('nope').should be(false)
15
15
  end
16
16
  end
17
17
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flipper-ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0.beta5
4
+ version: 0.7.0.beta4
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Nunemaker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-25 00:00:00.000000000 Z
11
+ date: 2015-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack
@@ -50,14 +50,14 @@ dependencies:
50
50
  requirements:
51
51
  - - "~>"
52
52
  - !ruby/object:Gem::Version
53
- version: 0.7.0.beta3
53
+ version: 0.7.0.beta4
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
57
57
  requirements:
58
58
  - - "~>"
59
59
  - !ruby/object:Gem::Version
60
- version: 0.7.0.beta3
60
+ version: 0.7.0.beta4
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: erubis
63
63
  requirement: !ruby/object:Gem::Requirement
@@ -80,14 +80,10 @@ executables: []
80
80
  extensions: []
81
81
  extra_rdoc_files: []
82
82
  files:
83
- - ".gitignore"
84
- - ".rspec"
85
- - Gemfile
86
- - Guardfile
87
- - LICENSE
88
- - README.md
89
- - Rakefile
90
- - examples/basic.ru
83
+ - docs/ui/README.md
84
+ - docs/ui/images/feature.png
85
+ - docs/ui/images/features.png
86
+ - examples/ui/basic.ru
91
87
  - flipper-ui.gemspec
92
88
  - lib/flipper-ui.rb
93
89
  - lib/flipper/ui.rb
@@ -245,17 +241,13 @@ files:
245
241
  - lib/flipper/ui/public/octicons/octicons.woff
246
242
  - lib/flipper/ui/public/octicons/sprockets-octicons.scss
247
243
  - lib/flipper/ui/util.rb
248
- - lib/flipper/ui/version.rb
249
244
  - lib/flipper/ui/views/add_actor.erb
250
245
  - lib/flipper/ui/views/add_feature.erb
251
246
  - lib/flipper/ui/views/add_group.erb
252
247
  - lib/flipper/ui/views/feature.erb
253
248
  - lib/flipper/ui/views/features.erb
254
249
  - lib/flipper/ui/views/layout.erb
255
- - script/bootstrap
256
- - script/release
257
- - script/server
258
- - script/test
250
+ - lib/flipper/version.rb
259
251
  - spec/flipper/ui/actions/actors_gate_spec.rb
260
252
  - spec/flipper/ui/actions/add_feature_spec.rb
261
253
  - spec/flipper/ui/actions/boolean_gate_spec.rb
@@ -271,8 +263,7 @@ files:
271
263
  - spec/flipper/ui/decorators/gate_spec.rb
272
264
  - spec/flipper/ui/util_spec.rb
273
265
  - spec/flipper/ui_spec.rb
274
- - spec/helper.rb
275
- homepage: https://github.com/jnunemaker/flipper-ui
266
+ homepage: https://github.com/jnunemaker/flipper
276
267
  licenses:
277
268
  - MIT
278
269
  metadata: {}
@@ -312,4 +303,3 @@ test_files:
312
303
  - spec/flipper/ui/decorators/gate_spec.rb
313
304
  - spec/flipper/ui/util_spec.rb
314
305
  - spec/flipper/ui_spec.rb
315
- - spec/helper.rb
data/.gitignore DELETED
@@ -1,20 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
18
- .sass-cache
19
- log
20
- flipper.pstore
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --color
data/Gemfile DELETED
@@ -1,17 +0,0 @@
1
- source 'https://rubygems.org'
2
- gemspec
3
-
4
- gem 'rake', '~> 10.0.3'
5
- gem 'shotgun', '~> 0.9'
6
- gem 'rspec', '~> 2.12'
7
- gem 'rack-test', '~> 0.6.1'
8
- gem 'activesupport', '~> 3.2.13', '< 4.3'
9
-
10
- group(:guard) do
11
- gem 'guard', '~> 1.6.2'
12
- gem 'guard-rspec', '~> 2.4.0'
13
- gem 'guard-bundler', '~> 1.0.0'
14
- gem 'guard-coffeescript', '~> 1.2.1'
15
- gem 'guard-sass', '~> 1.0.2'
16
- gem 'rb-fsevent', '~> 0.9.3'
17
- end
data/Guardfile DELETED
@@ -1,26 +0,0 @@
1
- # A sample Guardfile
2
- # More info at https://github.com/guard/guard#readme
3
-
4
- guard 'bundler' do
5
- watch('Gemfile')
6
- watch(/^.+\.gemspec/)
7
- end
8
-
9
- guard 'rspec' do
10
- watch(%r{^spec/.+_spec\.rb$}) { "spec" }
11
- watch(%r{^lib/(.+)\.rb$}) { "spec" }
12
- watch('spec/helper.rb') { "spec" }
13
- end
14
-
15
- coffee_options = {
16
- :input => 'lib/flipper/ui/assets/javascripts',
17
- :output => 'lib/flipper/ui/public/js',
18
- :all_on_start => false,
19
- }
20
- guard 'coffeescript', coffee_options
21
-
22
- sass_options = {
23
- :input => 'lib/flipper/ui/assets/stylesheets',
24
- :output => 'lib/flipper/ui/public/css',
25
- }
26
- guard 'sass', sass_options
data/LICENSE DELETED
@@ -1,22 +0,0 @@
1
- Copyright (c) 2012 John Nunemaker
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile DELETED
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env rake
2
- require "bundler/gem_tasks"
3
-
4
- require 'rspec/core/rake_task'
5
- RSpec::Core::RakeTask.new
6
-
7
- task :default => :spec
@@ -1,5 +0,0 @@
1
- module Flipper
2
- module UI
3
- VERSION = "0.2.0.beta5"
4
- end
5
- end
@@ -1,21 +0,0 @@
1
- #!/bin/sh
2
- #/ Usage: bootstrap [bundle options]
3
- #/
4
- #/ Bundle install the dependencies.
5
- #/
6
- #/ Examples:
7
- #/
8
- #/ bootstrap
9
- #/ bootstrap --local
10
- #/
11
-
12
- set -e
13
- cd $(dirname "$0")/..
14
-
15
- [ "$1" = "--help" -o "$1" = "-h" -o "$1" = "help" ] && {
16
- grep '^#/' <"$0"| cut -c4-
17
- exit 0
18
- }
19
-
20
- rm -rf .bundle/{binstubs,config}
21
- bundle install --binstubs .bundle/binstubs --path .bundle --quiet "$@"
@@ -1,15 +0,0 @@
1
- #!/bin/sh
2
- #/ Usage: release
3
- #/
4
- #/ Package and release the gem to rubyforge.
5
- #/
6
-
7
- set -e
8
- cd $(dirname "$0")/..
9
-
10
- [ "$1" = "--help" -o "$1" = "-h" -o "$1" = "help" ] && {
11
- grep '^#/' <"$0"| cut -c4-
12
- exit 0
13
- }
14
-
15
- script/bootstrap && bundle exec rake release
@@ -1,19 +0,0 @@
1
- #!/bin/sh
2
- #/ Usage: server
3
- #/
4
- #/ Starts a server for perusing the UI locally.
5
- #/
6
- #/ Examples:
7
- #/
8
- #/ server
9
- #/
10
-
11
- set -e
12
- cd $(dirname "$0")/..
13
-
14
- [ "$1" = "--help" -o "$1" = "-h" -o "$1" = "help" ] && {
15
- grep '^#/' <"$0"| cut -c4-
16
- exit 0
17
- }
18
-
19
- bundle exec rackup examples/basic.ru -p 9999
@@ -1,30 +0,0 @@
1
- #!/bin/sh
2
- #/ Usage: test [individual test file]
3
- #/
4
- #/ Bootstrap and run all tests or an individual test.
5
- #/
6
- #/ Examples:
7
- #/
8
- #/ # run all tests
9
- #/ test
10
- #/
11
- #/ # run individual test
12
- #/ test spec/qu_spec.rb
13
- #/
14
-
15
- set -e
16
- cd $(dirname "$0")/..
17
-
18
- [ "$1" = "--help" -o "$1" = "-h" -o "$1" = "help" ] && {
19
- grep '^#/' <"$0"| cut -c4-
20
- exit 0
21
- }
22
-
23
- specs="spec/"
24
-
25
- if [ $# -gt 0 ]
26
- then
27
- specs=$@
28
- fi
29
-
30
- script/bootstrap && bundle exec rspec $specs
@@ -1,50 +0,0 @@
1
- $:.unshift(File.expand_path('../../lib', __FILE__))
2
-
3
- require 'rubygems'
4
- require 'bundler'
5
- Bundler.setup :default
6
-
7
- require 'flipper-ui'
8
- require 'flipper/instrumentation/log_subscriber'
9
- require 'flipper/adapters/memory'
10
- require 'rack/test'
11
- require 'logger'
12
- require 'json'
13
-
14
- root = Pathname(__FILE__).dirname.join('..').expand_path
15
- log_path = root.join('log')
16
- log_path.mkpath
17
-
18
- logger = Logger.new(log_path.join('test.log'))
19
- logger.formatter = proc { |severity, datetime, progname, msg| "#{msg}\n" }
20
- Flipper::Instrumentation::LogSubscriber.logger = logger
21
-
22
- module SpecHelpers
23
- def self.included(base)
24
- base.let(:flipper) { build_flipper }
25
- base.let(:app) { build_app(flipper) }
26
- end
27
-
28
- def build_app(flipper)
29
- Flipper::UI.app(flipper, secret: "test")
30
- end
31
-
32
- def build_flipper(adapter = build_memory_adapter)
33
- Flipper.new(adapter)
34
- end
35
-
36
- def build_memory_adapter
37
- Flipper::Adapters::Memory.new
38
- end
39
-
40
- def json_response
41
- JSON.load(last_response.body)
42
- end
43
- end
44
-
45
- RSpec.configure do |config|
46
- config.fail_fast = true
47
-
48
- config.include Rack::Test::Methods
49
- config.include SpecHelpers
50
- end