admin_tools_ennder 1.3.20

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/Changelog +158 -0
  3. data/MIT-LICENSE +20 -0
  4. data/README.md +89 -0
  5. data/Rakefile +2 -0
  6. data/TODO +0 -0
  7. data/app/controllers/admin_dev_infos_controller.rb +46 -0
  8. data/app/controllers/admin_gems_controller.rb +24 -0
  9. data/app/controllers/admin_inflexions_controller.rb +6 -0
  10. data/app/controllers/admin_menu_controller.rb +2 -0
  11. data/app/controllers/admin_routes_controller.rb +21 -0
  12. data/app/controllers/admin_send_file_controller.rb +8 -0
  13. data/app/controllers/admin_translations_controller.rb +21 -0
  14. data/app/controllers/admin_url_infos_controller.rb +7 -0
  15. data/app/controllers/application_controller.rb +10 -0
  16. data/app/controllers/commands_controller.rb +152 -0
  17. data/app/controllers/gmm_controller.rb +27 -0
  18. data/app/controllers/processus_controller.rb +8 -0
  19. data/app/helpers/application_helper.rb +11 -0
  20. data/app/metal/metal_processus_liste.rb +13 -0
  21. data/app/models/command.rb +5 -0
  22. data/app/views/admin_dev_infos/index.html.erb +7 -0
  23. data/app/views/admin_dev_infos/show.html.erb +43 -0
  24. data/app/views/admin_gems/_gem_infos.html.erb +46 -0
  25. data/app/views/admin_gems/index.html.erb +3 -0
  26. data/app/views/admin_inflexions/index.html.erb +41 -0
  27. data/app/views/admin_menu/index.html.erb +29 -0
  28. data/app/views/admin_routes/index.html.erb +64 -0
  29. data/app/views/admin_send_file/index.html.erb +7 -0
  30. data/app/views/admin_translations/index.html.erb +128 -0
  31. data/app/views/admin_url_infos/index.html.erb +91 -0
  32. data/app/views/commands/_execute_results.html.erb +10 -0
  33. data/app/views/commands/execute.html.erb +10 -0
  34. data/app/views/commands/executed.html.erb +12 -0
  35. data/app/views/commands/index.html.erb +24 -0
  36. data/app/views/commands/new.html.erb +15 -0
  37. data/app/views/commands/show.html.erb +10 -0
  38. data/app/views/common/_error_messages.html.erb +10 -0
  39. data/app/views/common/_top_menu.html.erb +2 -0
  40. data/app/views/gmm/index.html.erb +34 -0
  41. data/app/views/processus/index.html.erb +9 -0
  42. data/config/routes.rb +75 -0
  43. data/db/migrate/20100422173622_create_commands.rb +13 -0
  44. data/db/migrate/rails_before_5/20100422173622_create_commands.rb +13 -0
  45. data/lib/admin_tools_ennder.rb +77 -0
  46. data/lib/admin_tools_ennder/engine.rb +7 -0
  47. data/lib/gtm.rb +75 -0
  48. data/lib/tasks/admin_tools_ennder_tasks.rake +11 -0
  49. data/test/admin_tools_ennder_test.rb +8 -0
  50. data/test/test_helper.rb +3 -0
  51. metadata +95 -0
@@ -0,0 +1,27 @@
1
+ class GmmController < ApplicationController
2
+ def index
3
+ unless defined?(@all_models)
4
+ @@all_models = {}
5
+ # Load any model classes
6
+ Dir[Rails.root.to_s + '/app/models/**/*.rb'].each do |file|
7
+ begin
8
+ Rails.logger.info "GTM: loading #{file}"
9
+ require file
10
+ rescue
11
+ Rails.logger.error "GTM: Error loading #{file}"
12
+ end
13
+
14
+ # Store it in a class object
15
+ ActiveRecord::Base.descendants.each{|m|
16
+ @@all_models[m.name] = {
17
+ :has_many => m.reflect_on_all_associations(:has_many),
18
+ :has_one => m.reflect_on_all_associations(:has_one),
19
+ :belongs_to => m.reflect_on_all_associations(:belongs_to)
20
+ }
21
+ }
22
+ end
23
+ end
24
+
25
+ @all_models = @@all_models
26
+ end
27
+ end
@@ -0,0 +1,8 @@
1
+ class ProcessusController < ApplicationController
2
+ def index
3
+ end
4
+
5
+ def index_static
6
+ render :text => Time.new.strftime("%Y-%m-%d_%H:%M:%S") + '<br/>' + `ps -edfH`
7
+ end
8
+ end
@@ -0,0 +1,11 @@
1
+ module ApplicationHelper
2
+ if Rails::VERSION::MAJOR >= 3
3
+ def periodically_call_remote(options = {})
4
+ frequency = options[:frequency] || 10 # every ten seconds by default
5
+
6
+ code = "new PeriodicalExecuter(function() {#{remote_function(options)}}, #{frequency})"
7
+
8
+ javascript_tag(code)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,13 @@
1
+ # -*- coding: utf-8 -*-
2
+ # Allow the metal piece to run in isolation
3
+ require(File.dirname(__FILE__) + "/../../config/environment") unless defined?(Rails)
4
+
5
+ class MetalProcessusListe
6
+ def self.call(env)
7
+ if env["PATH_INFO"] =~ /^\/admin\/metal_processus_liste/
8
+ [200, {"Content-Type" => "text/html"}, [Time.new.strftime("%Y-%m-%d_%H:%M:%S") + '<br/>' + `ps -edfH`]]
9
+ else
10
+ [404, {"Content-Type" => "text/html"}, ["Pas Trouvé"]]
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ class Command < ActiveRecord::Base
2
+ #Pour will_paginate
3
+ cattr_reader :per_page
4
+ @@per_page = 10
5
+ end
@@ -0,0 +1,7 @@
1
+ <%= render :partial => 'common/top_menu' %>
2
+
3
+ <% form_tag :action => 'show', :id => @l_objet do %>
4
+ <fieldset>
5
+ <p>Nom de la classe <b>constante</b> : <%= text_field_tag :nom_objet %>&nbsp;<%= submit_tag 'Inspecter' %></p>
6
+ </fieldset>
7
+ <% end %>
@@ -0,0 +1,43 @@
1
+ <%= link_to 'Retour au menu', :controller => :admin_menu %><br/>
2
+ <br/>
3
+
4
+ <% if defined? @l_objet %>
5
+ <h1>Infos sur <%= @l_objet.class.name %> (ancêtre : <%= @l_objet.class.superclass %>)</h1>
6
+
7
+
8
+ <table border="2">
9
+ <thead>
10
+ <th>ancêtres (<%= @l_objet.class.ancestors.size %>)</th>
11
+ </thead>
12
+
13
+ <% @l_objet.class.ancestors.each { |ancetre| %>
14
+ <tr>
15
+ <td><%= ancetre %></td>
16
+ </tr>
17
+ <% } %>
18
+
19
+
20
+ <thead>
21
+ <th>méthodes publiques (<%= @l_objet.public_methods.size %>)</th>
22
+ </thead>
23
+
24
+ <% @l_objet.public_methods.sort.each { |methode| %>
25
+ <%
26
+ methode_3_fin = methode[-4..-1]
27
+ if methode_3_fin == '_ids' then
28
+ b_deb = '<b>'
29
+ b_fin = '</b> (méthode dynamique)'
30
+ else
31
+ b_deb = ''
32
+ b_fin = ''
33
+ end
34
+ %>
35
+ <tr>
36
+ <td><%= b_deb + methode + b_fin %></td>
37
+ </tr>
38
+ <% } %>
39
+ </table>
40
+ <% else %>
41
+ L'objet <%= params[:nom_objet] %> n'existe PAS !
42
+ <% end %>
43
+
@@ -0,0 +1,46 @@
1
+ <h3>Chemin des Gems</h3>
2
+
3
+ <table border="2">
4
+ <thead>
5
+ <tr><th>n°</th><th>chemin</th></tr>
6
+ </thead>
7
+ <%
8
+ if Rails::VERSION::MAJOR < 3
9
+ %>
10
+ <%
11
+ Gem.path.each_with_index do |_chemin, i|
12
+ %>
13
+ <tr><td><%= i %></td><td><%= _chemin %></td></tr>
14
+ <%
15
+ end
16
+ else
17
+ %>
18
+ <tr><td></td><td>Gem.path Marche que pour Rails 2.</td></tr>
19
+ <%
20
+ end
21
+ %>
22
+ </table>
23
+ <br/>
24
+
25
+
26
+ <h3>Liste des gems chargés dans l'application :</h3>
27
+
28
+ <table border="2">
29
+ <thead>
30
+ <tr><th>No</th><th>Nom</th><th>Version</th></tr>
31
+ </thead>
32
+ <%
33
+ @application_gems.each_with_index do |g, i|
34
+ %>
35
+ <tr>
36
+ <td><%= i %></td>
37
+ <td id="gem_name_<%= g[0] %>"><%= g[0] %></td>
38
+ <td><%= g[1] %></td>
39
+ </tr>
40
+ <%
41
+ end
42
+ %>
43
+ </table>
44
+
45
+ <h3>Liste des gems disponibles :</h3>
46
+ Pas encore développé.
@@ -0,0 +1,3 @@
1
+ <%= render :partial => 'common/top_menu' %>
2
+
3
+ <%= render :partial => 'gem_infos' %>
@@ -0,0 +1,41 @@
1
+ <%= render :partial => 'common/top_menu' %>
2
+
3
+ <h1>Liste des inflexions</h1>
4
+
5
+ <u>Exemples:</u><br/>
6
+ pluriel de categorie: <%= "categorie".pluralize %><br/>
7
+ singulier de categories: <%= "categories".singularize %><br/>
8
+ <br/>
9
+
10
+ <table border="2">
11
+ <thead>
12
+ <th>r&egrave;gle</th><th>remplacement</th>
13
+ </thead>
14
+
15
+ <tr>
16
+ <th colspan="2" id="pluriels">[<%= @inflections_plur.size %>] pluriel(s)</th>
17
+ </tr>
18
+ <% @inflections_plur.each { |(rule, replacement)| %>
19
+ <tr>
20
+ <td><%= rule %></td><td><%= replacement %></td>
21
+ </tr>
22
+ <% } %>
23
+ </table>
24
+
25
+ <br/>
26
+
27
+ <table border="2">
28
+ <thead>
29
+ <th>r&egrave;gle</th><th>remplacement</th>
30
+ </thead>
31
+ <tr>
32
+ <th colspan="2" id="singuliers">[<%= @inflections_sing.size %>] singulier(s)</th>
33
+ </tr>
34
+ <% @inflections_sing.each { |(rule, replacement)| %>
35
+ <tr>
36
+ <td><%= rule %></td><td><%= replacement %></td>
37
+ </tr>
38
+ <% } %>
39
+
40
+ </table>
41
+
@@ -0,0 +1,29 @@
1
+ <!-- inclus => pas besoin du body -->
2
+ Version de Rails: <span id="rails_version"><b><%= Rails::VERSION::STRING %></b></span><br/>
3
+ Version de Ruby: <span id="ruby_version"><b><%= RUBY_VERSION %> p<%= RUBY_PATCHLEVEL %></b></span><br/>
4
+ <br/>
5
+
6
+ <h2>Listes :</h2>
7
+
8
+ <%= link_to 'Liste des inflexions', admin_inflexions_path %><br/>
9
+ <%= link_to 'Liste des traductions', admin_translations_path %><br/>
10
+ <%= link_to 'Liste des routes', admin_routes_path %><br/>
11
+ <%= link_to 'Liste des gems', admin_gems_path %><br/>
12
+ <br/>
13
+
14
+ <h2>Processus :</h2>
15
+
16
+ <%= link_to 'Liste des processus du serveur', '/admin/processus_liste' %><br/>
17
+ <%= link_to 'Liste des processus du serveur (metal)', '/admin/metal_processus_liste' %><br/>
18
+ <br/>
19
+
20
+ <h2>Infos de dev :</h2>
21
+
22
+ <%= link_to 'Infos de developpement', admin_dev_infos_path %><br/>
23
+ <%= link_to 'Infos Url', admin_url_infos_path %><br/>
24
+ <br/>
25
+
26
+ <h2>Outils :</h2>
27
+ <%= link_to 'Execution de commandes shell', admin_commands_path %><br/>
28
+ <%= link_to 'Télécharger un fichier sur le serveur', admin_send_file_path %><br/>
29
+ <%= link_to 'Generic Models Management (GMM)', admin_gmm_path %><br/>
@@ -0,0 +1,64 @@
1
+ <%= render :partial => 'common/top_menu' %>
2
+
3
+ <h2>Non-Nommées</h2>
4
+
5
+ <table border="2">
6
+ <thead>
7
+ <th colspan="2">Routes</th>
8
+ </thead>
9
+ <%
10
+ @routes_hash.each_with_index { |r, i|
11
+ %>
12
+ <tr>
13
+ <td><%= i %></td>
14
+ <td>
15
+ defaults : <%= r.defaults %><br/>
16
+ constraints : <%= r.constraints %><br/>
17
+ precedence : <%= r.precedence %><br/>
18
+ <u>pattern</u> : <br/>
19
+ &nbsp;&nbsp;pattern.ast : <%= r.path.ast %><br/>
20
+ &nbsp;&nbsp;pattern.names : <%= r.path.names %><br/>
21
+ &nbsp;&nbsp;pattern.source : <%= r.path.source %><br/>
22
+ </td>
23
+ </tr>
24
+ <% } %>
25
+ </table>
26
+ <br/>
27
+
28
+ <h2>Nommées</h2>
29
+
30
+ <table border="2">
31
+ <thead>
32
+ <th colspan="3">Routes nommées</th>
33
+ </thead>
34
+ <%
35
+ @routes_hash.each_with_index { |nr, i|
36
+ if nr.is_a?(Array)
37
+ r = nr[1]
38
+ nom_route = nr[0]
39
+ else
40
+ r = nr
41
+ nom_route = r.name
42
+ end
43
+ %>
44
+ <tr>
45
+ <td>
46
+ <%= i %>
47
+ </td>
48
+ <td>
49
+ <%= nom_route %>
50
+ </td>
51
+ <td>
52
+ defaults : <%= r.defaults %><br/>
53
+ constraints : <%= r.constraints %><br/>
54
+ precedence : <%= r.precedence %><br/>
55
+ <u>pattern</u> : <br/>
56
+ &nbsp;&nbsp;pattern.ast : <%= r.path.ast %><br/>
57
+ &nbsp;&nbsp;pattern.names : <%= r.path.names %><br/>
58
+ &nbsp;&nbsp;pattern.source : <%= r.path.source %><br/>
59
+ </td>
60
+ </tr>
61
+ <%
62
+ }
63
+ %>
64
+ </table>
@@ -0,0 +1,7 @@
1
+ <%= render :partial => 'common/top_menu' %>
2
+
3
+ <% form_tag :action => 'download' do %>
4
+ <fieldset>
5
+ <p>Chemin du fichier à télécharger : <%= text_field_tag :chemin %>&nbsp;<%= submit_tag 'Télécharger' %></p>
6
+ </fieldset>
7
+ <% end %>
@@ -0,0 +1,128 @@
1
+ <%= render :partial => 'common/top_menu' %>
2
+
3
+ <h1>Liste des traductions</h1>
4
+
5
+
6
+ Locale(s) disponible(s) [<%= I18n.available_locales.size %>] :<%= @locales_list.html_safe %><br/>
7
+ <br/>
8
+
9
+ <table border="2">
10
+ <thead>
11
+ <th>clé</th><th>traduction (<%= @traductions_all.size %>)</th>
12
+ </thead>
13
+
14
+ <%
15
+ #Pour chaque locale
16
+ @traductions_all.each { |_locale, _traductions_locale|
17
+ %>
18
+ <tr>
19
+ <th colspan="2">&nbsp;</th>
20
+ </tr>
21
+ <tr>
22
+ <th colspan="2" style="text-align: left"><%= _traductions_locale.size %> traduction(s) pour <%= _locale %></th>
23
+ </tr>
24
+ <%
25
+ #Bloc de traduction pour la locale
26
+ _traductions_locale.each { |_bloc, _traductions_bloc|
27
+ %>
28
+ <tr>
29
+ <th colspan="2" style="text-align: left">Bloc <%= _bloc %> [<%= _traductions_bloc.size %>] Traduction(s)</th>
30
+ </tr>
31
+ <%
32
+ if _traductions_bloc.is_a?(Hash)
33
+ #Un bloc contenant une table de hachage
34
+
35
+ _traductions_bloc.each { |_sous_bloc, _traductions_sous_bloc|
36
+
37
+ if _traductions_sous_bloc.is_a?(Hash)
38
+ #Un sous-bloc contenant une table de hachage
39
+
40
+ %>
41
+ <tr>
42
+ <th colspan="2" style="text-align: left">&nbsp;&nbsp;> Sous-Bloc <%= _sous_bloc %> [<%= _traductions_sous_bloc.size %>] Traduction(s)</th>
43
+ </tr>
44
+ <%
45
+ _traductions_sous_bloc.each { |_sous_sous_bloc, _traductions_sous_sous_bloc|
46
+
47
+ if _traductions_sous_sous_bloc.is_a?(Hash)
48
+ #Un sous-sous-bloc contenant une table de hachage
49
+ %>
50
+ <tr>
51
+ <th colspan="2" style="text-align: left">&nbsp;&nbsp;&nbsp;&nbsp;>> Sous-Sous-Bloc <%= _sous_sous_bloc %> [<%= _traductions_sous_sous_bloc.size %>] Traduction(s)</th>
52
+ </tr>
53
+ <%
54
+ _traductions_sous_sous_bloc.each { |_sous_sous_sous_bloc, _traductions_sous_sous_sous_bloc|
55
+
56
+ if _traductions_sous_sous_sous_bloc.is_a?(Hash)
57
+ #Un sous-sous-sous-bloc contenant une table de hachage
58
+ %>
59
+ <tr>
60
+ <th colspan="2" style="text-align: left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;>>> Sous-Sous-Sous-Bloc <%= _sous_sous_sous_bloc %> [<%= _traductions_sous_sous_sous_bloc.size %>] Traduction(s)</th>
61
+ </tr>
62
+ <%
63
+ _traductions_sous_sous_sous_bloc.each { |_cle, _traduction|
64
+ %>
65
+ <tr>
66
+ <td><%= _cle %></td><td><%= _traduction %></td>
67
+ </tr>
68
+ <%
69
+ }
70
+ elsif _traductions_sous_sous_sous_bloc.is_a?(Array)
71
+ #Un sous-sous-sous-bloc contenant un tableau
72
+ %>
73
+ <tr>
74
+ <td><%= _sous_sous_sous_bloc %></td><td><%= _traductions_sous_sous_sous_bloc.join('<br/>') %></td>
75
+ </tr>
76
+ <%
77
+ else
78
+ #Un sous-sous-sous-bloc contenant une traduction simple
79
+ %>
80
+ <tr>
81
+ <td><%= _sous_sous_sous_bloc %></td><td><%= _traductions_sous_sous_sous_bloc %></td>
82
+ </tr>
83
+ <%
84
+ end
85
+ } #FIN - sous-sous-sous-bloc
86
+ elsif _traductions_sous_sous_bloc.is_a?(Array)
87
+ #Un sous-sous-bloc contenant un tableau
88
+ %>
89
+ <tr>
90
+ <td><%= _sous_sous_bloc %></td><td><%= _traductions_sous_sous_bloc.join('<br/>') %></td>
91
+ </tr>
92
+ <%
93
+ else
94
+ #Un sous-sous-bloc contenant une traduction simple
95
+ %>
96
+ <tr>
97
+ <td><%= _sous_sous_bloc %></td><td><%= _traductions_sous_sous_bloc %></td>
98
+ </tr>
99
+ <%
100
+ end
101
+ } #FIN - sous-sous-bloc
102
+ elsif _traductions_sous_bloc.is_a?(Array)
103
+ #Un sous-bloc contenant un tableau
104
+ %>
105
+ <tr>
106
+ <td><%= _sous_bloc %></td><td><%= _traductions_sous_bloc.join('<br/>') %></td>
107
+ </tr>
108
+ <%
109
+ else
110
+ #Un sous-bloc contenant une traduction simple
111
+ %>
112
+ <tr>
113
+ <td><%= _sous_bloc %></td><td><%= _traductions_sous_bloc %></td>
114
+ </tr>
115
+ <%
116
+ end
117
+ } #FIN - sous-bloc
118
+ else
119
+ %>
120
+ <tr>
121
+ <td><%= _bloc %></td><td><%= _traductions_bloc %></td>
122
+ </tr>
123
+ <%
124
+ end
125
+ } #FIN - bloc
126
+ } #FIN - Pour chaque locale
127
+ %>
128
+ </table>