rollout_admin 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/README.md ADDED
@@ -0,0 +1,47 @@
1
+ # RolloutAdmin
2
+
3
+ Gem to controll your rollout features via a webinterface. This is the first "not yet clean" version. Please do not use in production environment.
4
+
5
+ ![Image](app/assets/images/rollout_admin/screen.png?raw=true)
6
+
7
+ ## INSTALL
8
+
9
+ Add rollout_admin to your Gemfile. Then bundle install. Make sure you have rollout installed as well from nedeco git because rollout_admin relies on the IP address extension. This can be found here:
10
+
11
+ git@github.com:nedeco/rollout.git
12
+
13
+ Make sure to use the branch "workable".
14
+
15
+ rollout_admin expects that:
16
+
17
+ - you have a User model with the attributes "id", "name", "email".
18
+ - Rollout must be initialized and available via $rollout variable.
19
+
20
+
21
+ To mount the engine within your project add the following line to your routes.rb:
22
+
23
+ mount RolloutAdmin::Engine => "/rollout_admin"
24
+
25
+ You will be asked for a username and password when accessing the page for the first time. This is "foo/bar".
26
+
27
+ **Special hint when using an API**
28
+
29
+ It turned out that in one of our own projects we wrapped the users object to be accessed via an API. Within our main application controller the API calls got some additional headers for API Key which where not accessable within the rollout_admin engine. Therefor there is an option RolloutAdmin.user_url you can configure to provide the URL used for getting a users list within the RolloutAdmin interface.
30
+
31
+ Just define an initializer and paste the following:
32
+
33
+ # Rollout Admin configuration
34
+ #
35
+ RolloutAdmin.user_url = "/just/something/boring.json"
36
+
37
+ ## TODO
38
+
39
+ - make detailed install instructions
40
+ - add configuration for authentication
41
+ - make ip feature configurable
42
+ - make User model dependency more generic
43
+ - check for failing Ajax calls
44
+
45
+ ## Credits
46
+
47
+ Thanks to jamesgolick for providing rollout gem. Great work.
@@ -2,6 +2,13 @@
2
2
  # import the routes from the engine router to be aware
3
3
  # of the mount path when doing javascript ajax calls
4
4
  url = RolloutAdmin::Engine.routes.url_helpers
5
+
6
+
7
+ if RolloutAdmin.user_url.nil?
8
+ user_url=url.get_users_path(:format => :json )
9
+ else
10
+ user_url=RolloutAdmin.user_url
11
+ end
5
12
  %>
6
13
 
7
14
  $(function(){
@@ -66,7 +73,7 @@ $(function(){
66
73
  $('.feature_name').html(context);
67
74
  $that = $(this);
68
75
 
69
- $.getJSON('<%= url.get_users_path(:format => :json )%>', function(json) {
76
+ $.getJSON('<%= user_url%>', function(json) {
70
77
  userlist='<h5>Select users to add</h5><form id="userlist"><ul class="unstyled">';
71
78
  $.each(json, function() {
72
79
  userlist += '<li><input type="checkbox", value="'+this.id+'" data-username="'+this.Name+'"> '+this.Name+', '+this.email+'</li>';
@@ -33,8 +33,12 @@ module RolloutAdmin
33
33
  end
34
34
 
35
35
  def get_users
36
- @users=User.all
37
- render :json => @users
36
+ if Object.const_defined?('User')
37
+ @users=User.all
38
+ render :json => @users
39
+ else
40
+ render :json => {'error' => 'no users defined'}
41
+ end
38
42
  end
39
43
 
40
44
  def add
@@ -10,7 +10,13 @@
10
10
  <ul class="unstyled">
11
11
  <% if feature.users.count > 0 %>
12
12
  <% feature.users.each {|user| %>
13
- <li><i class="icon-minus delete_user"></i><%#=User.find(user.to_i).Name%></li>
13
+ <li><i class="icon-minus delete_user"></i>
14
+ <%if Object.const_defined?('User') %>
15
+ <%=User.find(user.to_i).Name%>
16
+ <% else %>
17
+ no User model defined
18
+ <% end %>
19
+ </li>
14
20
  <% } %>
15
21
  <% else %>
16
22
  <li>No members</li>
@@ -3,5 +3,10 @@ module RolloutAdmin
3
3
  isolate_namespace RolloutAdmin
4
4
  require 'jquery-ui-rails'
5
5
  require 'less-rails-bootstrap'
6
+
7
+ initializer "rollout_admin.init_task", :before=> :load_config_initializers do |app|
8
+ puts "running the initializer"
9
+ end
10
+
6
11
  end
7
12
  end
@@ -1,3 +1,3 @@
1
1
  module RolloutAdmin
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/lib/rollout_admin.rb CHANGED
@@ -1,4 +1,6 @@
1
1
  require "rollout_admin/engine"
2
2
 
3
3
  module RolloutAdmin
4
+ mattr_accessor :user_url
5
+
4
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rollout_admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -133,6 +133,7 @@ files:
133
133
  - app/assets/images/rollout_admin/head_bg.jpg
134
134
  - app/assets/images/rollout_admin/icon_todos50x50.png
135
135
  - app/assets/images/rollout_admin/main_bg.jpg
136
+ - app/assets/images/rollout_admin/screen.png
136
137
  - app/assets/javascripts/rollout_admin/admin.js.erb
137
138
  - app/assets/javascripts/rollout_admin/application.js
138
139
  - app/assets/javascripts/rollout_admin/failures.js
@@ -154,7 +155,7 @@ files:
154
155
  - lib/tasks/rollout_admin_tasks.rake
155
156
  - MIT-LICENSE
156
157
  - Rakefile
157
- - README.rdoc
158
+ - README.md
158
159
  - test/dummy/app/assets/javascripts/application.js
159
160
  - test/dummy/app/assets/stylesheets/application.css
160
161
  - test/dummy/app/controllers/application_controller.rb
data/README.rdoc DELETED
@@ -1,23 +0,0 @@
1
- = RolloutAdmin
2
-
3
- Gem to controll your rollout features via a webinterface. This is the first "not yet clean" version. Please do not use in production environment.
4
-
5
- == INSTALL
6
-
7
- Add rollout_admin to your Gemfile. Then bundle install. Make sure you have rollout installed as well from nedeco git because rollout_admin relies on the IP address extension.
8
-
9
- rollout_admin expects that you have a User model with the attributes "id", "name", "email". Rollout must be initialized and available viw $rollout variable.
10
-
11
- Add the following line to your routes.rb:
12
-
13
- mount RolloutAdmin::Engine => "/rollout_admin"
14
-
15
- You will be asked for a username and password. This is "foo/bar".
16
-
17
- == TODO
18
-
19
- - check dependencies
20
- - make detailed install instructions
21
- - add configuration for authentication
22
- - make ip feature configurable
23
- - make User model dependency more generic