boilerman 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/Rakefile +34 -0
  4. data/app/assets/javascripts/application.js +9 -0
  5. data/app/assets/javascripts/boilerman/application.js +16 -0
  6. data/app/assets/javascripts/boilerman/controllers.js +23 -0
  7. data/app/assets/stylesheets/application.css +0 -0
  8. data/app/assets/stylesheets/boilerman/application.scss +79 -0
  9. data/app/assets/stylesheets/boilerman/controllers.css +5 -0
  10. data/app/controllers/boilerman/application_controller.rb +4 -0
  11. data/app/controllers/boilerman/controllers_controller.rb +35 -0
  12. data/app/helpers/boilerman/application_helper.rb +4 -0
  13. data/app/helpers/boilerman/controllers_helper.rb +4 -0
  14. data/app/views/boilerman/controllers/_action_filter.html.erb +54 -0
  15. data/app/views/boilerman/controllers/_application_statistics.html.erb +8 -0
  16. data/app/views/boilerman/controllers/_callback_breakdown.html.erb +22 -0
  17. data/app/views/boilerman/controllers/_controller_filter.html.erb +30 -0
  18. data/app/views/boilerman/controllers/_controller_list.html.erb +9 -0
  19. data/app/views/boilerman/controllers/index.html.erb +63 -0
  20. data/app/views/layouts/boilerman/application.html.erb +27 -0
  21. data/config/locales/en.bootstrap.yml +23 -0
  22. data/config/routes.rb +5 -0
  23. data/lib/boilerman.rb +24 -0
  24. data/lib/boilerman/engine.rb +8 -0
  25. data/lib/boilerman/version.rb +3 -0
  26. data/lib/generators/boilerman/install_generator.rb +18 -0
  27. data/lib/tasks/boilerman_tasks.rake +4 -0
  28. data/test/boilerman_test.rb +7 -0
  29. data/test/controllers/boilerman/controllers_controller_test.rb +11 -0
  30. data/test/dummy/README.rdoc +28 -0
  31. data/test/dummy/Rakefile +6 -0
  32. data/test/dummy/app/assets/javascripts/application.js +13 -0
  33. data/test/dummy/app/assets/stylesheets/application.css +15 -0
  34. data/test/dummy/app/controllers/application_controller.rb +5 -0
  35. data/test/dummy/app/helpers/application_helper.rb +2 -0
  36. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  37. data/test/dummy/bin/bundle +3 -0
  38. data/test/dummy/bin/rails +4 -0
  39. data/test/dummy/bin/rake +4 -0
  40. data/test/dummy/config.ru +4 -0
  41. data/test/dummy/config/application.rb +23 -0
  42. data/test/dummy/config/boot.rb +5 -0
  43. data/test/dummy/config/database.yml +25 -0
  44. data/test/dummy/config/environment.rb +5 -0
  45. data/test/dummy/config/environments/development.rb +37 -0
  46. data/test/dummy/config/environments/production.rb +78 -0
  47. data/test/dummy/config/environments/test.rb +39 -0
  48. data/test/dummy/config/initializers/assets.rb +8 -0
  49. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  50. data/test/dummy/config/initializers/cookies_serializer.rb +3 -0
  51. data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  52. data/test/dummy/config/initializers/inflections.rb +16 -0
  53. data/test/dummy/config/initializers/mime_types.rb +4 -0
  54. data/test/dummy/config/initializers/session_store.rb +3 -0
  55. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  56. data/test/dummy/config/locales/en.yml +23 -0
  57. data/test/dummy/config/routes.rb +4 -0
  58. data/test/dummy/config/secrets.yml +22 -0
  59. data/test/dummy/public/404.html +67 -0
  60. data/test/dummy/public/422.html +67 -0
  61. data/test/dummy/public/500.html +66 -0
  62. data/test/dummy/public/favicon.ico +0 -0
  63. data/test/helpers/boilerman/controllers_helper_test.rb +6 -0
  64. data/test/integration/navigation_test.rb +10 -0
  65. data/test/test_helper.rb +19 -0
  66. metadata +203 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 27350fa1f60685bdfa4c093ab1fddf720c0b1f39
4
+ data.tar.gz: 21a7440fe7bafda3031eece03eeeb9eb074ad563
5
+ SHA512:
6
+ metadata.gz: 1b2171fd92a33bf4b9d7b3b22223abdc2f0d80f09bcdaf049a8138ef76c60a231cd4f66977724ab6a5c69bf43791b556dd91b3a8908115dde78a571dc14eafaa
7
+ data.tar.gz: 9aeb3e998c4202a1cbd59c6fab07e8eec0d996b47e503a1729f401d88620b2e46b04d1b975b0540ab92bdbff978719c5247e4cd6a5227e4bd17cdd44ce6d7d2d
@@ -0,0 +1,20 @@
1
+ Copyright 2015 YOURNAME
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,34 @@
1
+ begin
2
+ require 'bundler/setup'
3
+ rescue LoadError
4
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
5
+ end
6
+
7
+ require 'rdoc/task'
8
+
9
+ RDoc::Task.new(:rdoc) do |rdoc|
10
+ rdoc.rdoc_dir = 'rdoc'
11
+ rdoc.title = 'Boilerman'
12
+ rdoc.options << '--line-numbers'
13
+ rdoc.rdoc_files.include('README.rdoc')
14
+ rdoc.rdoc_files.include('lib/**/*.rb')
15
+ end
16
+
17
+ APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
18
+ load 'rails/tasks/engine.rake'
19
+
20
+
21
+
22
+ Bundler::GemHelper.install_tasks
23
+
24
+ require 'rake/testtask'
25
+
26
+ Rake::TestTask.new(:test) do |t|
27
+ t.libs << 'lib'
28
+ t.libs << 'test'
29
+ t.pattern = 'test/**/*_test.rb'
30
+ t.verbose = false
31
+ end
32
+
33
+
34
+ task default: :test
@@ -0,0 +1,9 @@
1
+ // This is a manifest file that'll be compiled into including all the files listed below.
2
+ // Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
3
+ // be included in the compiled file accessible from http://example.com/assets/application.js
4
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
5
+ // the compiled file.
6
+ //
7
+ //= require jquery
8
+ //= require jquery_ujs
9
+ //= require_tree .
@@ -0,0 +1,16 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // compiled file.
9
+ //
10
+ // Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
11
+ // about supported directives.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require bootstrap-sprockets
16
+ //= require_tree .
@@ -0,0 +1,23 @@
1
+ function clearLocalFilters() {
2
+ var x;
3
+ if (confirm("Are you sure you want to clear your saved filters?") == true) {
4
+ alert(gon.controllers);
5
+ console.log("Clearing local storage");
6
+ }
7
+ }
8
+
9
+ function removeWithoutActionItem() {
10
+ //TODO: Implement this
11
+ console.log("TODO: IMPLEMENT removeWithoutActionItem()");
12
+ }
13
+
14
+
15
+ function removeWithActionItem() {
16
+ //TODO: Implement this
17
+ console.log("TODO: IMPLEMENT removeWithActionItem()");
18
+ }
19
+
20
+ function removeController() {
21
+ //TODO: Implement this
22
+ console.log("TODO: IMPLEMENT removeController()");
23
+ }
File without changes
@@ -0,0 +1,79 @@
1
+ @import "bootstrap-sprockets";
2
+ @import "bootstrap";
3
+ /* universal */
4
+
5
+ body {
6
+ padding-top: 60px;
7
+ }
8
+
9
+ section {
10
+ overflow: auto;
11
+ }
12
+
13
+ textarea {
14
+ resize: vertical;
15
+ }
16
+
17
+ .center {
18
+ text-align: center;
19
+ }
20
+
21
+ .center h1 {
22
+ margin-bottom: 10px;
23
+ }
24
+
25
+ /* typography */
26
+
27
+ h1, h2, h3, h4, h5, h6 {
28
+ line-height: 1;
29
+ }
30
+
31
+ /*h1 {*/
32
+ /*font-size: 3em;*/
33
+ /*letter-spacing: -2px;*/
34
+ /*margin-bottom: 30px;*/
35
+ /*}*/
36
+
37
+ /*h2 {*/
38
+ /*font-size: 1.2em;*/
39
+ /*letter-spacing: -1px;*/
40
+ /*margin-bottom: 30px;*/
41
+ /*font-weight: normal;*/
42
+ /*color: #777;*/
43
+ /*}*/
44
+
45
+ p {
46
+ font-size: 1.1em;
47
+ line-height: 1.7em;
48
+ }
49
+
50
+ #logo {
51
+ float: left;
52
+ margin-right: 10px;
53
+ font-size: 1.7em;
54
+ color: #fff;
55
+ text-transform: uppercase;
56
+ letter-spacing: -1px;
57
+ padding-top: 9px;
58
+ font-weight: bold;
59
+ }
60
+
61
+ #logo:hover {
62
+ color: #fff;
63
+ text-decoration: none;
64
+ }
65
+
66
+ table {
67
+ table-layout: fixed;
68
+ word-wrap: break-word;
69
+ }
70
+
71
+ .top-buffer { margin-top:20px; }
72
+
73
+ .list-group-span {
74
+ display: none;
75
+ }
76
+
77
+ a:hover .list-group-span{
78
+ display: block;
79
+ }
@@ -0,0 +1,5 @@
1
+ /*
2
+ Place all the styles related to the matching controller here.
3
+ They will automatically be included in application.css.
4
+ */
5
+
@@ -0,0 +1,4 @@
1
+ module Boilerman
2
+ class ApplicationController < ActionController::Base
3
+ end
4
+ end
@@ -0,0 +1,35 @@
1
+ require_dependency "boilerman/application_controller"
2
+
3
+ module Boilerman
4
+ class ControllersController < ApplicationController
5
+ def index
6
+ @action_with_filters = [:require_admin, :require_staff]
7
+ @action_without_filters = [:verify_authenticity_token]
8
+ @controller_filters = ["ApplicationController"]
9
+
10
+ @controllers = filtered_controllers
11
+ @controllers_and_callbacks = @controllers.map do |controller|
12
+ callbacks = controller._process_action_callbacks
13
+ [controller, callbacks.select{|callback| callback.kind == :before}.map(&:filter)]
14
+ end
15
+
16
+ gon.controllers = @controllers.map{|x| x.to_s}
17
+ end
18
+
19
+ private
20
+
21
+ def filtered_controllers
22
+ # Process only controllers with callbacks and do not include
23
+ # Boilerman's own controllers
24
+ controllers = ActionController::Metal.descendants.reject do |controller|
25
+ controller.parent == Boilerman || !controller.respond_to?(:_process_action_callbacks)
26
+ end
27
+
28
+ if params[:include_namespace]
29
+ controllers.select!{|controller| params[:include_namespace].include?(controller.parent.to_s)}
30
+ end
31
+
32
+ controllers.sort_by{|c| c.to_s}
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,4 @@
1
+ module Boilerman
2
+ module ApplicationHelper
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Boilerman
2
+ module ControllersHelper
3
+ end
4
+ end
@@ -0,0 +1,54 @@
1
+ <h4>Actions</h4>
2
+
3
+ <div class="row">
4
+ <div class="col-lg-6">
5
+ <div class="input-group">
6
+ <span class="input-group-btn">
7
+ <button class="btn btn-success" type="button">
8
+ <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
9
+ With
10
+ </button>
11
+ </span>
12
+ <input type="text" class="form-control" placeholder="(e.g. require_admin)">
13
+ </div><!-- /input-group -->
14
+
15
+ <ul class="list-group top-buffer" id="with-actions">
16
+ <% if @action_with_filters.empty? %>
17
+ <li class="list-group-item">No action filters currently set</li>
18
+ <% else %>
19
+ <% @action_with_filters.each do |action_filter| %>
20
+ <a href="#" onclick="removeWithActionItem()" class="list-group-item">
21
+ <%= action_filter %>
22
+ <span class="glyphicon glyphicon-remove pull-right list-group-span" aria-hidden="true"></span>
23
+ </a>
24
+ <% end %>
25
+ <% end %>
26
+ </ul>
27
+
28
+ </div><!-- /.col-lg-6 -->
29
+ <div class="col-lg-6">
30
+ <div class="input-group">
31
+ <span class="input-group-btn">
32
+ <button class="btn btn-danger" type="button">
33
+ <span class="glyphicon glyphicon-minus" aria-hidden="true"></span>
34
+ Without
35
+ </button>
36
+ </span>
37
+ <input type="text" class="form-control" placeholder="(e.g. verify_authenticity_token)">
38
+ </div><!-- /input-group -->
39
+
40
+ <ul class="list-group top-buffer" id="without-actions">
41
+ <% if @action_without_filters.empty? %>
42
+ <li class="list-group-item">No action filters currently set</li>
43
+ <% else %>
44
+ <% @action_without_filters.each do |action_filter| %>
45
+ <a href="#" onclick="removeWithoutActionItem()" class="list-group-item">
46
+ <%= action_filter %>
47
+ <span class="glyphicon glyphicon-remove pull-right list-group-span" aria-hidden="true"></span>
48
+ </a>
49
+ <% end %>
50
+ <% end %>
51
+ </ul>
52
+ </div><!-- /.col-lg-6 -->
53
+ </div><!-- /.row -->
54
+
@@ -0,0 +1,8 @@
1
+ <div>
2
+ <p>Number of Controllers: <%= @controllers.count %></p>
3
+
4
+ <h3>Namespace Breakdown</h3>
5
+ <p>Devise: 13 controllers</p>
6
+ <p>Admin: 17 controllers</p>
7
+
8
+ </div>
@@ -0,0 +1,22 @@
1
+ <table class="table">
2
+ <thead>
3
+ <th>Controller</th>
4
+ <th>Filters</th>
5
+ </thead>
6
+ <tbody>
7
+ <% @controllers_and_callbacks.each do |controller, callbacks| %>
8
+ <tr>
9
+ <td><%= controller %></td>
10
+ <td>
11
+ <table>
12
+ <% callbacks.each do |callback| %>
13
+ <tr>
14
+ <td><%= callback %></td>
15
+ </tr>
16
+ <% end %>
17
+ </table>
18
+ </td>
19
+ </tr>
20
+ <% end %>
21
+ </tbody>
22
+ </table>
@@ -0,0 +1,30 @@
1
+ <h4>Controllers</h4>
2
+
3
+ <div class="row">
4
+ <div class="col-lg-6">
5
+ <div class="input-group">
6
+ <span class="input-group-btn">
7
+ <button class="btn btn-success" type="button">
8
+ <span class="glyphicon glyphicon-plus" aria-hidden="true"></span>
9
+ Include
10
+ </button>
11
+ </span>
12
+ <input type="text" class="form-control" placeholder="Filters by controller name...">
13
+ </div><!-- /input-group -->
14
+ </div><!-- /.col-lg-6 -->
15
+
16
+ <div class="col-lg-6">
17
+ <ul class="list-group" id="include-controllers">
18
+ <% if @controller_filters.empty? %>
19
+ <li class="list-group-item">No controller filters currently set</li>
20
+ <% else %>
21
+ <% @controller_filters.each do |controller_filter| %>
22
+ <a href="#" onclick="removeController()" class="list-group-item">
23
+ <%= controller_filter %>
24
+ <span class="glyphicon glyphicon-remove pull-right list-group-span" aria-hidden="true"></span>
25
+ </a>
26
+ <% end %>
27
+ <% end %>
28
+ </ul>
29
+ </div><!-- /.col-lg-6 -->
30
+ </div><!-- /.row -->
@@ -0,0 +1,9 @@
1
+ <table class="table">
2
+ <% @controllers.each_slice(5) do |controller_slice| %>
3
+ <tr>
4
+ <% controller_slice.each do |controller| %>
5
+ <td><%= controller %></td>
6
+ <% end %>
7
+ </tr>
8
+ <% end %>
9
+ </table>
@@ -0,0 +1,63 @@
1
+ <div class="row">
2
+ <div class="panel panel-primary">
3
+ <div class="panel-heading">
4
+ <h3 class="panel-title">Filter</h3>
5
+ </div>
6
+ <div class="panel-body">
7
+
8
+ <%= render "controller_filter" %>
9
+ <%= render "action_filter" %>
10
+
11
+ <button onclick="clearLocalFilters()" class="btn btn-warning pull-right">Clear Filters</button>
12
+ </div>
13
+ </div>
14
+
15
+ </div>
16
+
17
+ <div class="row">
18
+ <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
19
+ <div class="panel panel-default">
20
+ <div class="panel-heading" role="tab" id="headingOne">
21
+ <h4 class="panel-title">
22
+ <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
23
+ Application Statistics
24
+ </a>
25
+ </h4>
26
+ </div>
27
+ <div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
28
+ <div class="panel-body">
29
+ <%= render "application_statistics" %>
30
+ </div>
31
+ </div>
32
+ </div>
33
+ <div class="panel panel-default">
34
+ <div class="panel-heading" role="tab" id="headingTwo">
35
+ <h4 class="panel-title">
36
+ <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
37
+ Controller List
38
+ </a>
39
+ </h4>
40
+ </div>
41
+ <div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
42
+ <div class="panel-body">
43
+ <%= render "controller_list" %>
44
+ </div>
45
+ </div>
46
+ </div>
47
+ <div class="panel panel-default">
48
+ <div class="panel-heading" role="tab" id="headingThree">
49
+ <h4 class="panel-title">
50
+ <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
51
+ Callback Breakdown
52
+ </a>
53
+ </h4>
54
+ </div>
55
+ <div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
56
+ <div class="panel-body">
57
+ <%= render "callback_breakdown" %>
58
+ </div>
59
+ </div>
60
+ </div>
61
+ </div>
62
+ </div>
63
+