rake-ui 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +201 -0
- data/README.md +59 -0
- data/Rakefile +18 -0
- data/app/assets/config/rake_ui_manifest.js +1 -0
- data/app/assets/stylesheets/rake_ui/application.css +15 -0
- data/app/controllers/rake_ui/application_controller.rb +13 -0
- data/app/controllers/rake_ui/rake_task_logs_controller.rb +59 -0
- data/app/controllers/rake_ui/rake_tasks_controller.rb +64 -0
- data/app/helpers/rake_ui/application_helper.rb +6 -0
- data/app/models/rake_ui/rake_task.rb +126 -0
- data/app/models/rake_ui/rake_task_log.rb +166 -0
- data/app/views/layouts/rake_ui/application.html.erb +31 -0
- data/app/views/partials/rake_ui/_table_filterable.html +47 -0
- data/app/views/rake_ui/rake_task_logs/index.html.erb +35 -0
- data/app/views/rake_ui/rake_task_logs/show.html.erb +42 -0
- data/app/views/rake_ui/rake_tasks/index.html.erb +47 -0
- data/app/views/rake_ui/rake_tasks/show.html.erb +62 -0
- data/config/routes.rb +11 -0
- data/lib/rake-ui.rb +6 -0
- data/lib/rake-ui/engine.rb +11 -0
- data/lib/rake-ui/version.rb +5 -0
- data/lib/tasks/rake_ui/tasks.rake +6 -0
- metadata +138 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 218a68e063a489cf4b9f781a1f764fbe01439d8f40ab9a7ec2c887993b1b8cc6
|
4
|
+
data.tar.gz: a76cca82acafcb84c0e2039448eb0c0f0fad464dcfc9ad68a5378a7059abfc32
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b68e5dca03e6235494047686a766cc8a15cecb71d3bde9ac3767859d9d0971a00194527c756ac767434e15b3c7a56f833a46f9a80a99d1084bf43bae5b3f5ddb
|
7
|
+
data.tar.gz: f24ad6edc4612031b9cdf53b5df8046ff93a51451d216ed23cd12c7423a7c71469114d0b09e967061a78017af0268a7b5d2802a6ec15cc552a46f7acab38da2e
|
data/LICENSE
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright {yyyy} {name of copyright owner}
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# RakeUi
|
2
|
+
Rake UI is a Rails engine that enables the discovery and execution rake tasks in a UI.
|
3
|
+
|
4
|
+
## Installation
|
5
|
+
Add this line to your application's Gemfile:
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
group :development do
|
9
|
+
gem 'rake-ui'
|
10
|
+
end
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
```bash
|
15
|
+
$ bundle
|
16
|
+
```
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
```bash
|
20
|
+
$ gem install rake-ui
|
21
|
+
```
|
22
|
+
|
23
|
+
once it is installed, mount the engine
|
24
|
+
```rb
|
25
|
+
Rails.application.routes.draw do
|
26
|
+
# only mounting when defined will allow us only include in development/test
|
27
|
+
if defined? RakeUi::Engine
|
28
|
+
mount RakeUi::Engine => "/rake-ui"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
```
|
32
|
+
|
33
|
+
### Securing RakeUi
|
34
|
+
|
35
|
+
This tool is built to enable developer productivity in development. It exposes rake tasks through a UI.
|
36
|
+
|
37
|
+
This tool will currently not work in production because we add a guard in the root controller to respond not found if the environment is development or test.
|
38
|
+
|
39
|
+
We recommend adding guards in your route to ensure that the proper authentication is in place to ensure that users are authenticated so that if this were ever to be rendered in production, you would be covered. The best way for that is [router constraints](https://guides.rubyonrails.org/routing.html#specifying-constraints)
|
40
|
+
|
41
|
+
## Testing
|
42
|
+
|
43
|
+
`bundle exec rake test`
|
44
|
+
|
45
|
+
To iterate on this fast i normally install nodemon, you can also use guard minitest.
|
46
|
+
|
47
|
+
```
|
48
|
+
# Example with nodemon, you don't have to use this
|
49
|
+
npm install -g nodemon
|
50
|
+
|
51
|
+
# Running a single test whenever models change
|
52
|
+
nodemon -w ./app/models/* -e "rb" --exec "rake test TEST=test/rake_ui/rake_task_log_test.rb"
|
53
|
+
```
|
54
|
+
|
55
|
+
## Contributing
|
56
|
+
Contributing information available in [CONTRIBUTING](./CONTRIBUTING.md)
|
57
|
+
|
58
|
+
## License
|
59
|
+
The gem is available as open source under the terms of the [Apache 2.0 License](./LICENSE).
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require "bundler/setup"
|
2
|
+
|
3
|
+
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
|
4
|
+
load "rails/tasks/engine.rake"
|
5
|
+
|
6
|
+
load "rails/tasks/statistics.rake"
|
7
|
+
|
8
|
+
require "bundler/gem_tasks"
|
9
|
+
|
10
|
+
require "rake/testtask"
|
11
|
+
|
12
|
+
Rake::TestTask.new(:test) do |t|
|
13
|
+
t.libs << "test"
|
14
|
+
t.pattern = "test/**/*_test.rb"
|
15
|
+
t.verbose = false
|
16
|
+
end
|
17
|
+
|
18
|
+
task default: :test
|
@@ -0,0 +1 @@
|
|
1
|
+
//= link_directory ../stylesheets/rake_ui
|
@@ -0,0 +1,15 @@
|
|
1
|
+
/*
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
+
* listed below.
|
4
|
+
*
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
+
*
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
+
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
+
* It is generally better to create a new file per style scope.
|
12
|
+
*
|
13
|
+
*= require_tree .
|
14
|
+
*= require_self
|
15
|
+
*/
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RakeUi
|
4
|
+
class ApplicationController < ActionController::Base
|
5
|
+
before_action :black_hole_production
|
6
|
+
|
7
|
+
private
|
8
|
+
|
9
|
+
def black_hole_production
|
10
|
+
raise ActionController::RoutingError, "Not Found" unless Rails.env.test? || Rails.env.development?
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RakeUi
|
4
|
+
class RakeTaskLogsController < ApplicationController
|
5
|
+
RAKE_TASK_LOG_ATTRS = [:id,
|
6
|
+
:name,
|
7
|
+
:args,
|
8
|
+
:environment,
|
9
|
+
:rake_command,
|
10
|
+
:rake_definition_file,
|
11
|
+
:log_file_name,
|
12
|
+
:log_file_full_path].freeze
|
13
|
+
|
14
|
+
def index
|
15
|
+
@rake_task_logs = RakeUi::RakeTaskLog.all.sort_by(&:id)
|
16
|
+
|
17
|
+
respond_to do |format|
|
18
|
+
format.html
|
19
|
+
format.json do
|
20
|
+
render json: {
|
21
|
+
rake_task_logs: rake_task_logs_as_json(@rake_task_logs)
|
22
|
+
}
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def show
|
28
|
+
@rake_task_log = RakeUi::RakeTaskLog.find_by_id(params[:id])
|
29
|
+
|
30
|
+
@rake_task_log_content = @rake_task_log.file_contents.gsub("\n", "<br />")
|
31
|
+
@rake_task_log_content_url = rake_task_log_path(@rake_task_log.id, format: :json)
|
32
|
+
@is_rake_task_log_finished = @rake_task_log.finished?
|
33
|
+
|
34
|
+
respond_to do |format|
|
35
|
+
format.html
|
36
|
+
format.json do
|
37
|
+
render json: {
|
38
|
+
rake_task_log: rake_task_log_as_json(@rake_task_log),
|
39
|
+
rake_task_log_content: @rake_task_log_content,
|
40
|
+
rake_task_log_content_url: @rake_task_log_content_url,
|
41
|
+
is_rake_task_log_finished: @is_rake_task_log_finished
|
42
|
+
}
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def rake_task_log_as_json(task)
|
50
|
+
RAKE_TASK_LOG_ATTRS.each_with_object({}) do |param, obj|
|
51
|
+
obj[param] = task.send(param)
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def rake_task_logs_as_json(tasks = [])
|
56
|
+
tasks.map { |task| rake_task_log_as_json(task) }
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RakeUi
|
4
|
+
class RakeTasksController < RakeUi::ApplicationController
|
5
|
+
RAKE_TASK_ATTRS = [:id,
|
6
|
+
:name,
|
7
|
+
:name_with_args,
|
8
|
+
:arg_description,
|
9
|
+
:full_comment,
|
10
|
+
:locations,
|
11
|
+
:is_internal_task,
|
12
|
+
:sources].freeze
|
13
|
+
|
14
|
+
def index
|
15
|
+
@rake_tasks = RakeUi::RakeTask.all
|
16
|
+
|
17
|
+
unless params[:show_all]
|
18
|
+
@rake_tasks = @rake_tasks.select(&:internal_task?)
|
19
|
+
end
|
20
|
+
|
21
|
+
respond_to do |format|
|
22
|
+
format.html
|
23
|
+
format.json do
|
24
|
+
render json: {
|
25
|
+
rake_tasks: rake_tasks_as_json(@rake_tasks)
|
26
|
+
}
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def show
|
32
|
+
@rake_task = RakeUi::RakeTask.find_by_id(params[:id])
|
33
|
+
|
34
|
+
respond_to do |format|
|
35
|
+
format.html
|
36
|
+
format.json do
|
37
|
+
render json: {
|
38
|
+
rake_task: rake_task_as_json(@rake_task)
|
39
|
+
}
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def execute
|
45
|
+
@rake_task = RakeUi::RakeTask.find_by_id(params[:id])
|
46
|
+
|
47
|
+
rake_task_log = @rake_task.call(args: params[:args], environment: params[:environment])
|
48
|
+
|
49
|
+
redirect_to rake_task_log_path rake_task_log.id
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
|
54
|
+
def rake_task_as_json(task)
|
55
|
+
RAKE_TASK_ATTRS.each_with_object({}) do |param, obj|
|
56
|
+
obj[param] = task.send(param)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def rake_tasks_as_json(tasks)
|
61
|
+
tasks.map { |task| rake_task_as_json(task) }
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,126 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RakeUi
|
4
|
+
class RakeTask
|
5
|
+
def self.to_safe_identifier(id)
|
6
|
+
CGI.escape(id)
|
7
|
+
end
|
8
|
+
|
9
|
+
def self.from_safe_identifier(id)
|
10
|
+
CGI.unescape(id)
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.load
|
14
|
+
# Enables 'desc' to show up as full_comments
|
15
|
+
if Rake::TaskManager.respond_to? :record_task_metadata
|
16
|
+
Rake::TaskManager.record_task_metadata = true
|
17
|
+
end
|
18
|
+
|
19
|
+
Rails.application.load_tasks
|
20
|
+
Rake::Task.tasks
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.all
|
24
|
+
self.load.map do |task|
|
25
|
+
new(task)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.internal
|
30
|
+
self.load.map { |task|
|
31
|
+
new(task)
|
32
|
+
}.select(&:is_internal_task)
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.find_by_id(id)
|
36
|
+
t = all
|
37
|
+
i = from_safe_identifier(id)
|
38
|
+
|
39
|
+
t.find do |task|
|
40
|
+
task.name == i
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
attr_reader :task
|
45
|
+
delegate :name, :actions, :name_with_args, :arg_description, :full_comment, :locations, :sources, to: :task
|
46
|
+
|
47
|
+
def initialize(task)
|
48
|
+
@task = task
|
49
|
+
end
|
50
|
+
|
51
|
+
def id
|
52
|
+
RakeUi::RakeTask.to_safe_identifier(name)
|
53
|
+
end
|
54
|
+
|
55
|
+
# actions will be something like #<Proc:0x000055a2737fe778@/some/rails/app/lib/tasks/auto_annotate_models.rake:4>
|
56
|
+
def rake_definition_file
|
57
|
+
definition = actions.first || ""
|
58
|
+
|
59
|
+
if definition.respond_to?(:source_location)
|
60
|
+
definition.source_location.join(":")
|
61
|
+
else
|
62
|
+
definition
|
63
|
+
end
|
64
|
+
rescue
|
65
|
+
"unable_to_determine_defining_file"
|
66
|
+
end
|
67
|
+
|
68
|
+
def is_internal_task
|
69
|
+
internal_task?
|
70
|
+
end
|
71
|
+
|
72
|
+
# thinking this is the sanest way to discern application vs gem defined tasks (like rails, devise etc)
|
73
|
+
def internal_task?
|
74
|
+
actions.any? { |a| !a.to_s.include? "/ruby/gems" }
|
75
|
+
|
76
|
+
# this was my initial thought here, leaving for posterity in case we need to or the definition of custom
|
77
|
+
# from initial investigation the actions seemed like the most consistent as locations is sometimes empty
|
78
|
+
# locations.any? do |location|
|
79
|
+
# !location.match(/\/bundle\/gems/)
|
80
|
+
# end
|
81
|
+
end
|
82
|
+
|
83
|
+
def call(args: nil, environment: nil)
|
84
|
+
rake_command = build_rake_command(args: args, environment: environment)
|
85
|
+
|
86
|
+
rake_task_log = RakeUi::RakeTaskLog.build_new_for_command(
|
87
|
+
name: name,
|
88
|
+
args: args,
|
89
|
+
environment: environment,
|
90
|
+
rake_command: rake_command,
|
91
|
+
rake_definition_file: rake_definition_file,
|
92
|
+
raker_id: id
|
93
|
+
)
|
94
|
+
|
95
|
+
puts "[rake_ui] [rake_task] [forked] #{rake_task_log.rake_command_with_logging}"
|
96
|
+
|
97
|
+
fork do
|
98
|
+
system(rake_task_log.rake_command_with_logging)
|
99
|
+
|
100
|
+
system(rake_task_log.command_to_mark_log_finished)
|
101
|
+
end
|
102
|
+
|
103
|
+
rake_task_log
|
104
|
+
end
|
105
|
+
|
106
|
+
# returns an invokable rake command
|
107
|
+
# FOO=bar rake create_something[1,2,3]
|
108
|
+
# rake create_something[1,2,3]
|
109
|
+
# rake create_something
|
110
|
+
def build_rake_command(args: nil, environment: nil)
|
111
|
+
command = ""
|
112
|
+
|
113
|
+
if environment
|
114
|
+
command += "#{environment} "
|
115
|
+
end
|
116
|
+
|
117
|
+
command += "rake #{name}"
|
118
|
+
|
119
|
+
if args
|
120
|
+
command += "[#{args}]"
|
121
|
+
end
|
122
|
+
|
123
|
+
command
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
@@ -0,0 +1,166 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RakeUi
|
4
|
+
class RakeTaskLog < OpenStruct
|
5
|
+
# year-month-day-hour(24hour time)-minute-second-utc
|
6
|
+
ID_DATE_FORMAT = "%Y-%m-%d-%H-%M-%S%z"
|
7
|
+
REPOSITORY_DIR = Rails.root.join("tmp", "rake_ui")
|
8
|
+
FILE_DELIMITER = "____"
|
9
|
+
FINISHED_STRING = "+++++ COMMAND FINISHED +++++"
|
10
|
+
TASK_HEADER_OUTPUT_DELIMITER = "-------------------------------"
|
11
|
+
FILE_ITEM_SEPARATOR = ": "
|
12
|
+
|
13
|
+
def self.create_tmp_file_dir
|
14
|
+
FileUtils.mkdir_p(REPOSITORY_DIR.to_s)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.truncate
|
18
|
+
FileUtils.rm_rf(Dir.glob(REPOSITORY_DIR.to_s + "/*"))
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.build_from_file(log_file_name)
|
22
|
+
log_file_name.split(FILE_DELIMITER)
|
23
|
+
|
24
|
+
new(
|
25
|
+
id: log_file_name.gsub(".txt", ""),
|
26
|
+
log_file_name: log_file_name,
|
27
|
+
log_file_full_path: Rails.root.join(REPOSITORY_DIR, log_file_name).to_s
|
28
|
+
)
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.build_new_for_command(name:, rake_definition_file:, rake_command:, raker_id:, args: nil, environment: nil)
|
32
|
+
create_tmp_file_dir
|
33
|
+
|
34
|
+
date = Time.now.strftime(ID_DATE_FORMAT)
|
35
|
+
id = "#{date}#{FILE_DELIMITER}#{raker_id}"
|
36
|
+
log_file_name = "#{id}.txt"
|
37
|
+
log_file_full_path = REPOSITORY_DIR.join(log_file_name).to_s
|
38
|
+
|
39
|
+
File.open(log_file_full_path, "w+") do |f|
|
40
|
+
f.puts "id#{FILE_ITEM_SEPARATOR}#{id}"
|
41
|
+
f.puts "name#{FILE_ITEM_SEPARATOR}#{name}"
|
42
|
+
f.puts "date#{FILE_ITEM_SEPARATOR}#{date}"
|
43
|
+
f.puts "args#{FILE_ITEM_SEPARATOR}#{args}"
|
44
|
+
f.puts "environment#{FILE_ITEM_SEPARATOR}#{environment}"
|
45
|
+
f.puts "rake_command#{FILE_ITEM_SEPARATOR}#{rake_command}"
|
46
|
+
f.puts "rake_definition_file#{FILE_ITEM_SEPARATOR}#{rake_definition_file}"
|
47
|
+
f.puts "log_file_name#{FILE_ITEM_SEPARATOR}#{log_file_name}"
|
48
|
+
f.puts "log_file_full_path#{FILE_ITEM_SEPARATOR}#{log_file_full_path}"
|
49
|
+
|
50
|
+
f.puts TASK_HEADER_OUTPUT_DELIMITER.to_s
|
51
|
+
f.puts " INVOKED RAKE TASK OUTPUT BELOW"
|
52
|
+
f.puts TASK_HEADER_OUTPUT_DELIMITER.to_s
|
53
|
+
end
|
54
|
+
|
55
|
+
new(id: id,
|
56
|
+
name: name,
|
57
|
+
args: args,
|
58
|
+
environment: environment,
|
59
|
+
rake_command: rake_command,
|
60
|
+
rake_definition_file: rake_definition_file,
|
61
|
+
log_file_name: log_file_name,
|
62
|
+
log_file_full_path: log_file_full_path)
|
63
|
+
end
|
64
|
+
|
65
|
+
def self.all
|
66
|
+
create_tmp_file_dir
|
67
|
+
|
68
|
+
Dir.entries(REPOSITORY_DIR).reject { |file|
|
69
|
+
file == "." || file == ".."
|
70
|
+
}.map do |log|
|
71
|
+
RakeUi::RakeTaskLog.build_from_file(log)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def self.find_by_id(id)
|
76
|
+
all.find do |a|
|
77
|
+
a.id == id || a.id == RakeUi::RakeTask.to_safe_identifier(id)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
def self.for(rake_ui_rake_task)
|
82
|
+
all.select do |history|
|
83
|
+
history.id == rake_ui_rake_task.id
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
def name
|
88
|
+
super || parsed_log_file_name[:name] || parsed_file_contents[:name]
|
89
|
+
end
|
90
|
+
|
91
|
+
def date
|
92
|
+
super || parsed_log_file_name[:date] || parsed_file_contents[:date]
|
93
|
+
end
|
94
|
+
|
95
|
+
def args
|
96
|
+
super || parsed_file_contents[:args]
|
97
|
+
end
|
98
|
+
|
99
|
+
def environment
|
100
|
+
super || parsed_file_contents[:environment]
|
101
|
+
end
|
102
|
+
|
103
|
+
def rake_command
|
104
|
+
super || parsed_file_contents[:rake_command]
|
105
|
+
end
|
106
|
+
|
107
|
+
def rake_definition_file
|
108
|
+
super || parsed_file_contents[:rake_definition_file]
|
109
|
+
end
|
110
|
+
|
111
|
+
def log_file_name
|
112
|
+
super || parsed_file_contents[:log_file_name]
|
113
|
+
end
|
114
|
+
|
115
|
+
def log_file_full_path
|
116
|
+
super || parsed_file_contents[:log_file_full_path]
|
117
|
+
end
|
118
|
+
|
119
|
+
def rake_command_with_logging
|
120
|
+
"#{rake_command} 2>&1 >> #{log_file_full_path}"
|
121
|
+
end
|
122
|
+
|
123
|
+
def file_contents
|
124
|
+
@file_contents ||= File.read(log_file_full_path)
|
125
|
+
end
|
126
|
+
|
127
|
+
def command_to_mark_log_finished
|
128
|
+
"echo #{FINISHED_STRING} >> #{log_file_full_path}"
|
129
|
+
end
|
130
|
+
|
131
|
+
def finished?
|
132
|
+
file_contents.include? FINISHED_STRING
|
133
|
+
end
|
134
|
+
|
135
|
+
private
|
136
|
+
|
137
|
+
# converts standard formatted file id into an object
|
138
|
+
def parsed_log_file_name
|
139
|
+
@parsed_log_file_name ||= {}.tap do |parsed|
|
140
|
+
date, name = id.split(FILE_DELIMITER, 2)
|
141
|
+
parsed[:date] = date
|
142
|
+
parsed[:name] = RakeUi::RakeTask.from_safe_identifier(name)
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
# converts our persisted rake logs files into an object
|
147
|
+
# name: foo
|
148
|
+
# id: baz
|
149
|
+
#
|
150
|
+
# into
|
151
|
+
#
|
152
|
+
# { name: 'foo', id: 'baz' }
|
153
|
+
def parsed_file_contents
|
154
|
+
return @parsed_file_contents if defined? @parsed_file_contents
|
155
|
+
|
156
|
+
@parsed_file_contents = {}.tap do |parsed|
|
157
|
+
File.foreach(log_file_full_path).first(9).each do |line|
|
158
|
+
name, value = line.split(FILE_ITEM_SEPARATOR, 2)
|
159
|
+
next unless name
|
160
|
+
|
161
|
+
parsed[name] = value && value.delete("\n")
|
162
|
+
end
|
163
|
+
end.with_indifferent_access
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Rake ui</title>
|
5
|
+
<%= csrf_meta_tags %>
|
6
|
+
<%= csp_meta_tag %>
|
7
|
+
|
8
|
+
<link rel="stylesheet" href="https://cdn.rawgit.com/doximity/vital/v2.2.1/dist/css/vital.min.css">
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
|
12
|
+
<!-- Nav Menu -->
|
13
|
+
<div class="row header">
|
14
|
+
<div class="section">
|
15
|
+
<nav>
|
16
|
+
<ul class="menu">
|
17
|
+
<li><%= link_to "Logs", rake_task_logs_path %></li>
|
18
|
+
<li><%= link_to "Rake Tasks", rake_tasks_path %></li>
|
19
|
+
</ul>
|
20
|
+
</nav>
|
21
|
+
</div>
|
22
|
+
</div>
|
23
|
+
|
24
|
+
<p id="notice"><%= notice %></p>
|
25
|
+
|
26
|
+
<!-- End Nav Menu -->
|
27
|
+
<div class="contents">
|
28
|
+
<%= yield %>
|
29
|
+
</div>
|
30
|
+
</body>
|
31
|
+
</html>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<script type="application/javascript">
|
2
|
+
function _hideTableElement(elm) {
|
3
|
+
elm.style.display = "none";
|
4
|
+
}
|
5
|
+
|
6
|
+
function _showTableElement(elm) {
|
7
|
+
elm.style.display = "";
|
8
|
+
}
|
9
|
+
|
10
|
+
function _filterTable(value) {
|
11
|
+
var tableRows = document.querySelectorAll('[data-table-filterable]');
|
12
|
+
|
13
|
+
for (var i = 0; i < tableRows.length; i++) {
|
14
|
+
var row = tableRows[i];
|
15
|
+
|
16
|
+
if (value == "") {
|
17
|
+
_showTableElement(row)
|
18
|
+
} else {
|
19
|
+
if (row.dataset.tableFilterable.includes(value)) {
|
20
|
+
_showTableElement(row)
|
21
|
+
} else {
|
22
|
+
_hideTableElement(row)
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
26
|
+
}
|
27
|
+
|
28
|
+
var _tableFilterInput = document.querySelector('[data-table-filter]');
|
29
|
+
|
30
|
+
var _hasFilteredTableInput = false;
|
31
|
+
_tableFilterInput.addEventListener('input', function handleInput(input) {
|
32
|
+
_hasFilteredTableInput = true;
|
33
|
+
_filterTable(input.target.value)
|
34
|
+
})
|
35
|
+
|
36
|
+
_tableFilterInput.addEventListener('input', function handleInput(input) {
|
37
|
+
_hasFilteredTableInput = true;
|
38
|
+
_filterTable(input.target.value)
|
39
|
+
})
|
40
|
+
|
41
|
+
// Handling cases where the browser autofills on a back button navigation due to the bfc
|
42
|
+
window.addEventListener('pageshow', function() {
|
43
|
+
if (!_hasFilteredTableInput && _tableFilterInput) {
|
44
|
+
_filterTable(_tableFilterInput.value)
|
45
|
+
}
|
46
|
+
});
|
47
|
+
</script>
|
@@ -0,0 +1,35 @@
|
|
1
|
+
<div class="row">
|
2
|
+
<div class="section">
|
3
|
+
<h1>Status</h1>
|
4
|
+
|
5
|
+
<hr >
|
6
|
+
|
7
|
+
<div class="section">
|
8
|
+
<p>
|
9
|
+
Filter Table <input data-table-filter placeholder="Enter Text" />
|
10
|
+
</p>
|
11
|
+
</div>
|
12
|
+
|
13
|
+
<table>
|
14
|
+
<thead>
|
15
|
+
<tr>
|
16
|
+
<th>Actions</th>
|
17
|
+
<th>Date Ran</th>
|
18
|
+
<th>Rake Task</th>
|
19
|
+
</tr>
|
20
|
+
</thead>
|
21
|
+
|
22
|
+
<tbody>
|
23
|
+
<% @rake_task_logs.each do |rake_task_log| %>
|
24
|
+
<tr data-table-filterable="<%= rake_task_log.name %>">
|
25
|
+
<td><%= link_to "View Logs", rake_task_log_path(rake_task_log.id), { class: 'btn' } %></td>
|
26
|
+
<td><%= rake_task_log.date %></td>
|
27
|
+
<td><%= link_to rake_task_log.name, rake_task_log_path(rake_task_log.id) %></td>
|
28
|
+
</tr>
|
29
|
+
<% end %>
|
30
|
+
</tbody>
|
31
|
+
</table>
|
32
|
+
</div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<%= render "partials/rake_ui/table_filterable" %>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<div class="row">
|
2
|
+
<div class="section">
|
3
|
+
|
4
|
+
<h1>Rake Task Log</h1>
|
5
|
+
|
6
|
+
<hr />
|
7
|
+
|
8
|
+
<div id="log_content" class="overflow-y: scroll">
|
9
|
+
<%= @rake_task_log_content.html_safe %>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<script type="application/javascript">
|
13
|
+
var interval;
|
14
|
+
var content_url = "<%= @rake_task_log_content_url %>"
|
15
|
+
var is_requesting = false
|
16
|
+
|
17
|
+
function replaceContent(content) {
|
18
|
+
document.getElementById('log_content').innerHTML = content
|
19
|
+
}
|
20
|
+
|
21
|
+
interval = setInterval(function () {
|
22
|
+
if (is_requesting) { return }
|
23
|
+
is_requesting = true;
|
24
|
+
fetch(content_url)
|
25
|
+
.then(function(r) { return r.json() })
|
26
|
+
.then(function (r) {
|
27
|
+
replaceContent(r.rake_task_log_content)
|
28
|
+
|
29
|
+
if (r.is_rake_task_log_finished) {
|
30
|
+
clearInterval(interval)
|
31
|
+
}
|
32
|
+
is_requesting = false
|
33
|
+
})
|
34
|
+
.catch(function(err) {
|
35
|
+
is_requesting = false
|
36
|
+
clearInterval(interval)
|
37
|
+
throw(err)
|
38
|
+
})
|
39
|
+
}, 500)
|
40
|
+
</script>
|
41
|
+
</div>
|
42
|
+
</div>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<div class="row">
|
2
|
+
<div class="section">
|
3
|
+
<h1>Rake Tasks</h1>
|
4
|
+
|
5
|
+
<hr />
|
6
|
+
|
7
|
+
<div class="section">
|
8
|
+
<%= link_to "Show all tasks", rake_tasks_path(show_all: "yes"), { class: 'btn' } %>
|
9
|
+
<%= link_to "Show only internal tasks", rake_tasks_path, { class: 'btn' } %>
|
10
|
+
</div>
|
11
|
+
|
12
|
+
<div class="section">
|
13
|
+
<p>
|
14
|
+
Filter Table <input data-table-filter placeholder="Enter Text" />
|
15
|
+
</p>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<div style="word-break: break-all">
|
19
|
+
<table>
|
20
|
+
<thead>
|
21
|
+
<tr>
|
22
|
+
<th>Actions</th>
|
23
|
+
<th>Name </th>
|
24
|
+
</tr>
|
25
|
+
</thead>
|
26
|
+
|
27
|
+
<tbody>
|
28
|
+
<% @rake_tasks.each do |rake_task| %>
|
29
|
+
<tr data-table-filterable="<%= rake_task.name_with_args %>">
|
30
|
+
<td><%= link_to "Go Here", rake_task_path(rake_task.id), { class: 'btn' } %></td>
|
31
|
+
<td>
|
32
|
+
<%= link_to rake_task.name_with_args, rake_task_path(rake_task.id) %>
|
33
|
+
|
34
|
+
<% if rake_task.full_comment %>
|
35
|
+
<br />
|
36
|
+
<p> Desc: <%= rake_task.full_comment %></p>
|
37
|
+
<% end %>
|
38
|
+
</td>
|
39
|
+
</tr>
|
40
|
+
<% end %>
|
41
|
+
</tbody>
|
42
|
+
</table>
|
43
|
+
</div>
|
44
|
+
</div>
|
45
|
+
</div>
|
46
|
+
|
47
|
+
<%= render "partials/rake_ui/table_filterable" %>
|
@@ -0,0 +1,62 @@
|
|
1
|
+
<div class="row">
|
2
|
+
<div class="section">
|
3
|
+
<h2>Submit Rake Task</h2>
|
4
|
+
<h4>Task: <%= @rake_task.name_with_args %></h4>
|
5
|
+
|
6
|
+
<% if @rake_task.full_comment %>
|
7
|
+
<p>Comments: <%= @rake_task.full_comment %></p>
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
<hr />
|
11
|
+
|
12
|
+
<p data-rake-form-error style="color: red">
|
13
|
+
|
14
|
+
</p>
|
15
|
+
|
16
|
+
<%= form_with url: rake_task_execute_path(@rake_task.id), method: :post, class: 'full-width-forms', data: {"rake-form": true} do |f| %>
|
17
|
+
<label>
|
18
|
+
Rake Arguments
|
19
|
+
<%= f.text_field :args, placeholder: "with no brackets, eg: 1,2,3", data: { "rake-form-input-args": true } %>
|
20
|
+
</label>
|
21
|
+
|
22
|
+
<br />
|
23
|
+
|
24
|
+
<label>
|
25
|
+
Environment Variables Overrides
|
26
|
+
<%= f.text_field :environment, placeholder: "eg: FOO=bar BAZ=biz", data: { "rake-form-input-environment": true } %>
|
27
|
+
</label>
|
28
|
+
|
29
|
+
<p>
|
30
|
+
Skip Argument and Environment Validations: <input type="checkbox" data-rake-form-input-skip-validations="true" />
|
31
|
+
</p>
|
32
|
+
|
33
|
+
<%= f.submit "Submit", class: "btn solid blue" %>
|
34
|
+
<% end %>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
<script type="application/javascript">
|
39
|
+
var _rakeForm = document.querySelector("[data-rake-form]");
|
40
|
+
|
41
|
+
var _skipValidationInput = document.querySelector("[data-rake-form-input-skip-validations]")
|
42
|
+
var _environmentInput = document.querySelector("[data-rake-form-input-environment]")
|
43
|
+
var _argsInput = document.querySelector("[data-rake-form-input-args]")
|
44
|
+
var _formError = document.querySelector("[data-rake-form-error]")
|
45
|
+
|
46
|
+
function _failWithError(event, message) {
|
47
|
+
event.preventDefault()
|
48
|
+
_formError.innerHTML = message;
|
49
|
+
}
|
50
|
+
|
51
|
+
_rakeForm.addEventListener("submit", function handleFormSubmit(event) {
|
52
|
+
if (_skipValidationInput.checked) {
|
53
|
+
return;
|
54
|
+
}
|
55
|
+
|
56
|
+
var argValue = _argsInput.value;
|
57
|
+
if (argValue.includes(" ") || argValue.includes("[") || argValue.includes("]")) {
|
58
|
+
_failWithError(event, "Do not include spaces or brackets in your rake arguments, disable validation if needed")
|
59
|
+
}
|
60
|
+
})
|
61
|
+
|
62
|
+
</script>
|
data/config/routes.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RakeUi::Engine.routes.draw do
|
4
|
+
root to: "rake_tasks#index"
|
5
|
+
|
6
|
+
resources :rake_tasks, only: [:index, :show]
|
7
|
+
|
8
|
+
post "/rake_tasks/:id/execute", to: "rake_tasks#execute", as: "rake_task_execute"
|
9
|
+
|
10
|
+
resources :rake_task_logs, only: [:index, :show]
|
11
|
+
end
|
data/lib/rake-ui.rb
ADDED
metadata
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rake-ui
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Austin Story
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-02-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: actionpack
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: railties
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: standardrb
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: This gem creates a Web Interface for interacting with Rake tasks.
|
84
|
+
email:
|
85
|
+
- lonnieastory@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- LICENSE
|
91
|
+
- README.md
|
92
|
+
- Rakefile
|
93
|
+
- app/assets/config/rake_ui_manifest.js
|
94
|
+
- app/assets/stylesheets/rake_ui/application.css
|
95
|
+
- app/controllers/rake_ui/application_controller.rb
|
96
|
+
- app/controllers/rake_ui/rake_task_logs_controller.rb
|
97
|
+
- app/controllers/rake_ui/rake_tasks_controller.rb
|
98
|
+
- app/helpers/rake_ui/application_helper.rb
|
99
|
+
- app/models/rake_ui/rake_task.rb
|
100
|
+
- app/models/rake_ui/rake_task_log.rb
|
101
|
+
- app/views/layouts/rake_ui/application.html.erb
|
102
|
+
- app/views/partials/rake_ui/_table_filterable.html
|
103
|
+
- app/views/rake_ui/rake_task_logs/index.html.erb
|
104
|
+
- app/views/rake_ui/rake_task_logs/show.html.erb
|
105
|
+
- app/views/rake_ui/rake_tasks/index.html.erb
|
106
|
+
- app/views/rake_ui/rake_tasks/show.html.erb
|
107
|
+
- config/routes.rb
|
108
|
+
- lib/rake-ui.rb
|
109
|
+
- lib/rake-ui/engine.rb
|
110
|
+
- lib/rake-ui/version.rb
|
111
|
+
- lib/tasks/rake_ui/tasks.rake
|
112
|
+
homepage: https://github.com/doximity/rake-ui
|
113
|
+
licenses:
|
114
|
+
- Apache-2.0
|
115
|
+
metadata:
|
116
|
+
homepage_uri: https://github.com/doximity/rake-ui
|
117
|
+
source_code_uri: https://github.com/doximity/rake-ui
|
118
|
+
changelog_uri: https://github.com/doximity/rake-ui/CHANGELOG.md
|
119
|
+
post_install_message:
|
120
|
+
rdoc_options: []
|
121
|
+
require_paths:
|
122
|
+
- lib
|
123
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '0'
|
128
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
requirements: []
|
134
|
+
rubygems_version: 3.1.4
|
135
|
+
signing_key:
|
136
|
+
specification_version: 4
|
137
|
+
summary: A Mountable Rails Engine to manage Rake Tasks through a UI
|
138
|
+
test_files: []
|