rakeleak 0.2.1 → 0.3.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.
Files changed (24) hide show
  1. data/README.md +2 -2
  2. data/app/assets/javascripts/rakeleak/tasks.js +1 -1
  3. data/app/assets/stylesheets/rakeleak/tasks.css +21 -3
  4. data/app/controllers/rakeleak/tasks_controller.rb +1 -1
  5. data/app/views/rakeleak/tasks/_task.html.erb +6 -1
  6. data/lib/rakeleak/version.rb +1 -1
  7. data/lib/rakeleak.rb +7 -2
  8. data/test/dummy/log/development.log +6949 -0
  9. data/test/dummy/log/test.log +7741 -0
  10. data/test/dummy/tmp/cache/assets/C5E/440/sprockets%2Fba31529ca20206e11215433ee169332b +0 -0
  11. data/test/dummy/tmp/cache/assets/CE8/240/sprockets%2F777dce4d696645611f0ae85347dc00b7 +0 -0
  12. data/test/dummy/tmp/cache/assets/D0D/370/sprockets%2Feda0592655569205d3738f32c4bdadf0 +0 -0
  13. data/test/dummy/tmp/cache/assets/D7B/DD0/sprockets%2F6f2905cdb5eed396c60140fbe94c9e66 +0 -0
  14. data/test/dummy/tmp/cache/assets/D9E/9F0/sprockets%2F3f8503a3d9bfee0922e881e8a32fccb2 +0 -0
  15. data/test/dummy/tmp/cache/assets/DB1/A30/sprockets%2F2cfcbef803fb9c40270c8846f6f983ef +0 -0
  16. data/test/dummy/tmp/cache/assets/DC5/D40/sprockets%2F7cf78f2e7bf164a14df03fcd0d0bd900 +0 -0
  17. data/test/dummy/tmp/cache/assets/DC8/880/sprockets%2F2ecbee3d3fdfbc150f65064a19ed9225 +0 -0
  18. data/test/dummy/tmp/cache/assets/DDB/EA0/sprockets%2F2395acf962c33e59dc8655cafeab8e3d +0 -0
  19. data/test/dummy/tmp/cache/assets/E29/770/sprockets%2F3f8c60e8d26acb84da06d9aaac3cc7e5 +0 -0
  20. data/test/functional/rakeleak/tasks_controller_test.rb +10 -0
  21. data/test/rakeleak_test.rb +19 -2
  22. metadata +2 -5
  23. data/app/views/rakeleak/tasks/_arg.html.erb +0 -1
  24. data/test/dummy/tmp/pids/server.pid +0 -1
data/README.md CHANGED
@@ -4,7 +4,7 @@ Helps you search & run your Rake tasks from Rails (3.2+) application. It:
4
4
 
5
5
  * Shows all the available Rake tasks;
6
6
  * Allows you to search by task name and description;
7
- * And run any task you want (see TODO for more details);
7
+ * And run any task you want (see TODO for limitations);
8
8
  * Shows the task output if any;
9
9
  * Shows the error message and even stacktrace if the task was failed.
10
10
 
@@ -32,7 +32,7 @@ This is how it feels in action:
32
32
 
33
33
  ## TODO
34
34
 
35
- * Passing parameters (now it's useful only for tasks without arguments)
35
+ * Passing environment variables (like VERSION=0)
36
36
  * Remove explicit mounting?
37
37
 
38
38
  ## License
@@ -50,7 +50,7 @@ $(function() {
50
50
  }
51
51
  });
52
52
 
53
- $("form.button_to").bind("ajax:error", function(xhr, data, status) {
53
+ $("form").bind("ajax:error", function(xhr, data, status) {
54
54
  var response = $.parseJSON(data.responseText);
55
55
  var task = $(this).closest(".task");
56
56
  var result = task.find(".result");
@@ -39,12 +39,13 @@ body {
39
39
  cursor: pointer;
40
40
  background-color: #4d90fe;
41
41
  color: #f7f7f7;
42
- border-radius: 5px;
42
+ border-radius: 3px;
43
43
  -webkit-border-radius: 3px;
44
44
  -moz-border-radius: 3px;
45
45
  padding: 2px 3px;
46
46
  text-transform: uppercase;
47
47
  display: none;
48
+ margin-top: 5px;
48
49
  }
49
50
 
50
51
  .button:hover {
@@ -54,13 +55,26 @@ body {
54
55
  .button:disabled {
55
56
  background-color: gray;
56
57
  cursor: auto;
57
- display: block;
58
+ display: inline-block;
59
+ margin-top: 5px;
58
60
  }
59
61
 
60
62
  input[type="search"] {
61
63
  font-size: 16px;
62
64
  }
63
65
 
66
+ input[type="text"] {
67
+ margin-top: 2px;
68
+ border: 1px solid #cccccc;
69
+ height: 16px;
70
+ padding: 2px;
71
+ border-radius: 3px;
72
+ -webkit-border-radius: 3px;
73
+ -moz-border-radius: 3px;
74
+ color: #555555;
75
+ display: none;
76
+ }
77
+
64
78
  #search_list {
65
79
  list-style: none;
66
80
  margin: 0;
@@ -78,7 +92,11 @@ input[type="search"] {
78
92
  }
79
93
 
80
94
  #search_list li div:hover .button {
81
- display: block;
95
+ display: inline-block;
96
+ }
97
+
98
+ #search_list li div:hover input {
99
+ display: inline-block;
82
100
  }
83
101
 
84
102
  .error {
@@ -9,7 +9,7 @@ module Rakeleak
9
9
  def run
10
10
  respond_to do |format|
11
11
  begin
12
- output = Rakeleak.run(params[:id])
12
+ output = Rakeleak.run(params)
13
13
  format.json { render json: { output: output } }
14
14
  rescue => e
15
15
  response = {
@@ -3,7 +3,12 @@
3
3
  <%= task.name %>
4
4
  </div>
5
5
  <div>
6
- <%= button_to "Run", rakeleak.run_task_path(task.name), remote: true, method: :post, disable_with: 'Running...', class: 'button' %>
6
+ <%= form_tag rakeleak.run_task_path(task.name), remote: true do %>
7
+ <% task.arg_names.each do |arg| %>
8
+ <%= text_field_tag arg, nil, placeholder: arg %>
9
+ <% end %>
10
+ <%= submit_tag 'Run', disable_with: 'Running...', class: 'button' %>
11
+ <% end %>
7
12
  </div>
8
13
  <div class="comment">
9
14
  <%= task.comment %>
@@ -1,3 +1,3 @@
1
1
  module Rakeleak
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
data/lib/rakeleak.rb CHANGED
@@ -5,9 +5,10 @@ module Rakeleak
5
5
  Rake::Task.tasks
6
6
  end
7
7
 
8
- def self.run(task)
8
+ def self.run(params)
9
+ task = params[:id]
9
10
  Rake::Task[task].reenable
10
- capture_stdout { Rake::Task[task].invoke }
11
+ capture_stdout { Rake::Task[task].invoke(*args(params)) }
11
12
  end
12
13
 
13
14
  def self.capture_stdout
@@ -22,4 +23,8 @@ module Rakeleak
22
23
  ensure
23
24
  $stdout = stdout
24
25
  end
26
+
27
+ def self.args(params)
28
+ Rake::Task[params[:id]].arg_names.map{|arg| params[arg] }.reject(&:nil?)
29
+ end
25
30
  end