rake-ui 0.0.1 → 0.1.1
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.
- checksums.yaml +4 -4
- data/README.md +21 -5
- data/app/controllers/rake_ui/application_controller.rb +3 -1
- data/app/models/rake_ui/rake_task.rb +25 -2
- data/app/models/rake_ui/rake_task_log.rb +7 -7
- data/lib/rake-ui/version.rb +1 -1
- data/lib/rake-ui.rb +7 -0
- metadata +6 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a66b9b0231a472dbbfb3dae969eab443def70832d9f52ffc4b803be8c1123782
|
|
4
|
+
data.tar.gz: ebef2c3058517271dd4bab6a2b99f647f42795359a04c4325e15647576e4e8c4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c3688dbe3121f828132c8699d803100c0648ad10699ee22a80177606314797d46f336279d5dbd9cd8b92d44eb0dd138c91d8abc2f8a8c0177b707326000e7284
|
|
7
|
+
data.tar.gz: dd25fe11781e13cf75ca0d069ee17d40e08feb576ca42fbb038fcea9590058e2afcb4f0913681ddc859e469f61ee735098af31e348b2c7a84c50f07b2024801b
|
data/README.md
CHANGED
|
@@ -1,13 +1,23 @@
|
|
|
1
1
|
# RakeUi
|
|
2
2
|
Rake UI is a Rails engine that enables the discovery and execution rake tasks in a UI.
|
|
3
3
|
|
|
4
|
+

|
|
5
|
+
|
|
6
|
+
## Routes
|
|
7
|
+
|
|
8
|
+
NOTE: Relative to mountpoint in application
|
|
9
|
+
|
|
10
|
+
- GET /rake_tasks(.html/.json) - list all available rake tasks
|
|
11
|
+
- GET /rake_tasks/:id(.html/.json) - list info a single tasks
|
|
12
|
+
- POST /rake_tasks/:id/execute - execute a rake task
|
|
13
|
+
- GET /rake_task_logs(.html/.json) - list rake task history
|
|
14
|
+
- GET /rake_task_logs/:id(.html/.json) - list a single rake task history
|
|
15
|
+
|
|
4
16
|
## Installation
|
|
5
17
|
Add this line to your application's Gemfile:
|
|
6
18
|
|
|
7
19
|
```ruby
|
|
8
|
-
|
|
9
|
-
gem 'rake-ui'
|
|
10
|
-
end
|
|
20
|
+
gem 'rake-ui'
|
|
11
21
|
```
|
|
12
22
|
|
|
13
23
|
And then execute:
|
|
@@ -34,7 +44,13 @@ end
|
|
|
34
44
|
|
|
35
45
|
This tool is built to enable developer productivity in development. It exposes rake tasks through a UI.
|
|
36
46
|
|
|
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.
|
|
47
|
+
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. You may override this guard clause with the following configuration.
|
|
48
|
+
|
|
49
|
+
```rb
|
|
50
|
+
RakeUi.configuration do |config|
|
|
51
|
+
config.allow_production = true
|
|
52
|
+
end
|
|
53
|
+
```
|
|
38
54
|
|
|
39
55
|
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
56
|
|
|
@@ -53,7 +69,7 @@ nodemon -w ./app/models/* -e "rb" --exec "rake test TEST=test/rake_ui/rake_task
|
|
|
53
69
|
```
|
|
54
70
|
|
|
55
71
|
## Contributing
|
|
56
|
-
|
|
72
|
+
See [CONTRIBUTING](./CONTRIBUTING.md)
|
|
57
73
|
|
|
58
74
|
## License
|
|
59
75
|
The gem is available as open source under the terms of the [Apache 2.0 License](./LICENSE).
|
|
@@ -7,7 +7,9 @@ module RakeUi
|
|
|
7
7
|
private
|
|
8
8
|
|
|
9
9
|
def black_hole_production
|
|
10
|
-
|
|
10
|
+
return if Rails.env.test? || Rails.env.development? || RakeUi.configuration.allow_production
|
|
11
|
+
|
|
12
|
+
raise ActionController::RoutingError, "Not Found"
|
|
11
13
|
end
|
|
12
14
|
end
|
|
13
15
|
end
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require "shellwords"
|
|
4
|
+
|
|
3
5
|
module RakeUi
|
|
4
6
|
class RakeTask
|
|
5
7
|
def self.to_safe_identifier(id)
|
|
@@ -111,13 +113,34 @@ module RakeUi
|
|
|
111
113
|
command = ""
|
|
112
114
|
|
|
113
115
|
if environment
|
|
114
|
-
|
|
116
|
+
# Safely escape environment variables to prevent shell injection
|
|
117
|
+
# Only accept KEY=VALUE pairs; reject malicious tokens
|
|
118
|
+
#
|
|
119
|
+
# Shellwords.split raises ArgumentError on malformed input (e.g. an
|
|
120
|
+
# unbalanced quote like FOO="bar). Treat that as no usable env tokens
|
|
121
|
+
# rather than letting the exception bubble up as a 500.
|
|
122
|
+
tokens = begin
|
|
123
|
+
Shellwords.split(environment)
|
|
124
|
+
rescue ArgumentError
|
|
125
|
+
[]
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
escaped_env = tokens.map do |token|
|
|
129
|
+
next unless token.match?(/\A[A-Z_][A-Z0-9_]*=.*\z/i)
|
|
130
|
+
|
|
131
|
+
# Valid KEY=VALUE pattern - escape only the value
|
|
132
|
+
key, value = token.split("=", 2)
|
|
133
|
+
"#{key}=#{Shellwords.escape(value)}"
|
|
134
|
+
end.compact.join(" ")
|
|
135
|
+
|
|
136
|
+
command += "#{escaped_env} " if escaped_env.present?
|
|
115
137
|
end
|
|
116
138
|
|
|
117
139
|
command += "rake #{name}"
|
|
118
140
|
|
|
119
141
|
if args
|
|
120
|
-
|
|
142
|
+
# Escape args to prevent shell injection
|
|
143
|
+
command += "[#{Shellwords.escape(args)}]"
|
|
121
144
|
end
|
|
122
145
|
|
|
123
146
|
command
|
|
@@ -53,13 +53,13 @@ module RakeUi
|
|
|
53
53
|
end
|
|
54
54
|
|
|
55
55
|
new(id: id,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
63
|
end
|
|
64
64
|
|
|
65
65
|
def self.all
|
data/lib/rake-ui/version.rb
CHANGED
data/lib/rake-ui.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rake-ui
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Austin Story
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-07-20 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|
|
@@ -116,7 +116,7 @@ metadata:
|
|
|
116
116
|
homepage_uri: https://github.com/doximity/rake-ui
|
|
117
117
|
source_code_uri: https://github.com/doximity/rake-ui
|
|
118
118
|
changelog_uri: https://github.com/doximity/rake-ui/CHANGELOG.md
|
|
119
|
-
post_install_message:
|
|
119
|
+
post_install_message:
|
|
120
120
|
rdoc_options: []
|
|
121
121
|
require_paths:
|
|
122
122
|
- lib
|
|
@@ -131,8 +131,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
131
131
|
- !ruby/object:Gem::Version
|
|
132
132
|
version: '0'
|
|
133
133
|
requirements: []
|
|
134
|
-
rubygems_version: 3.1.
|
|
135
|
-
signing_key:
|
|
134
|
+
rubygems_version: 3.1.6
|
|
135
|
+
signing_key:
|
|
136
136
|
specification_version: 4
|
|
137
137
|
summary: A Mountable Rails Engine to manage Rake Tasks through a UI
|
|
138
138
|
test_files: []
|