solid_bro 0.1.2
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 +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +133 -0
- data/Rakefile +15 -0
- data/app/assets/javascripts/solid_bro/application.js +25 -0
- data/app/assets/stylesheets/solid_bro/application.css +636 -0
- data/app/assets/stylesheets/solid_bro/core.css +0 -0
- data/app/controllers/solid_bro/application_controller.rb +29 -0
- data/app/controllers/solid_bro/jobs_controller.rb +99 -0
- data/app/controllers/solid_bro/processes_controller.rb +7 -0
- data/app/controllers/solid_bro/queues_controller.rb +25 -0
- data/app/controllers/solid_bro/recurring_tasks_controller.rb +9 -0
- data/app/helpers/solid_bro/application_helper.rb +38 -0
- data/app/jobs/solid_bro/application_job.rb +4 -0
- data/app/mailers/solid_bro/application_mailer.rb +6 -0
- data/app/models/solid_bro/application_record.rb +5 -0
- data/app/views/layouts/solid_bro/application.html.erb +56 -0
- data/app/views/solid_bro/jobs/index.html.erb +139 -0
- data/app/views/solid_bro/jobs/show.html.erb +73 -0
- data/app/views/solid_bro/processes/index.html.erb +37 -0
- data/app/views/solid_bro/queues/index.html.erb +44 -0
- data/app/views/solid_bro/recurring_tasks/index.html.erb +35 -0
- data/config/initializers/pagy.rb +15 -0
- data/config/routes.rb +21 -0
- data/lib/generators/solid_bro/install/install_generator.rb +56 -0
- data/lib/solid_bro/engine.rb +42 -0
- data/lib/solid_bro/version.rb +3 -0
- data/lib/solid_bro.rb +8 -0
- data/lib/tasks/solid_bro_tasks.rake +53 -0
- metadata +130 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module SolidBro
|
|
4
|
+
module Generators
|
|
5
|
+
class InstallGenerator < Rails::Generators::Base
|
|
6
|
+
source_root File.expand_path("templates", __dir__)
|
|
7
|
+
|
|
8
|
+
desc "Installs SolidBro and adds asset manifest entries"
|
|
9
|
+
|
|
10
|
+
def add_assets_to_manifest
|
|
11
|
+
manifest_path = Rails.root.join("app/assets/config/manifest.js")
|
|
12
|
+
|
|
13
|
+
if manifest_path.exist?
|
|
14
|
+
manifest_content = File.read(manifest_path)
|
|
15
|
+
|
|
16
|
+
unless manifest_content.include?("solid_bro/application.css")
|
|
17
|
+
append_file manifest_path, "\n//= link solid_bro/application.css"
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
unless manifest_content.include?("solid_bro/application.js")
|
|
21
|
+
append_file manifest_path, "\n//= link solid_bro/application.js"
|
|
22
|
+
end
|
|
23
|
+
else
|
|
24
|
+
# Create manifest.js if it doesn't exist (for Sprockets)
|
|
25
|
+
create_file manifest_path, <<~MANIFEST
|
|
26
|
+
//= link_tree ../images
|
|
27
|
+
//= link_directory ../stylesheets .css
|
|
28
|
+
//= link_directory ../javascripts .js
|
|
29
|
+
//= link solid_bro/application.css
|
|
30
|
+
//= link solid_bro/application.js
|
|
31
|
+
MANIFEST
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def add_sprockets_precompile
|
|
36
|
+
return unless defined?(Sprockets)
|
|
37
|
+
|
|
38
|
+
application_config_path = Rails.root.join("config/application.rb")
|
|
39
|
+
|
|
40
|
+
if application_config_path.exist?
|
|
41
|
+
application_content = File.read(application_config_path)
|
|
42
|
+
|
|
43
|
+
unless application_content.include?("solid_bro")
|
|
44
|
+
inject_into_file application_config_path,
|
|
45
|
+
after: "class Application < Rails::Application\n" do
|
|
46
|
+
<<~RUBY
|
|
47
|
+
# SolidBro assets
|
|
48
|
+
config.assets.precompile += %w[solid_bro/application.css solid_bro/application.js]
|
|
49
|
+
RUBY
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
module SolidBro
|
|
2
|
+
class Engine < ::Rails::Engine
|
|
3
|
+
isolate_namespace SolidBro
|
|
4
|
+
|
|
5
|
+
# Automatically precompile engine assets for Sprockets
|
|
6
|
+
initializer "solid_bro.assets.precompile", group: :all do |app|
|
|
7
|
+
if app.config.respond_to?(:assets) && app.config.assets.respond_to?(:precompile)
|
|
8
|
+
app.config.assets.precompile += %w[solid_bro/application.css solid_bro/application.js]
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# For Propshaft: automatically add assets to manifest in development/test
|
|
13
|
+
# This ensures assets work without manual setup in development
|
|
14
|
+
config.after_initialize do |app|
|
|
15
|
+
if (Rails.env.development? || Rails.env.test?) && defined?(Propshaft)
|
|
16
|
+
manifest_path = Rails.root.join("app/assets/config/manifest.js")
|
|
17
|
+
|
|
18
|
+
if manifest_path.exist?
|
|
19
|
+
manifest_content = File.read(manifest_path)
|
|
20
|
+
|
|
21
|
+
needs_update = false
|
|
22
|
+
updated_content = manifest_content.dup
|
|
23
|
+
|
|
24
|
+
unless manifest_content.include?("solid_bro/application.css")
|
|
25
|
+
updated_content += "\n//= link solid_bro/application.css"
|
|
26
|
+
needs_update = true
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
unless manifest_content.include?("solid_bro/application.js")
|
|
30
|
+
updated_content += "\n//= link solid_bro/application.js"
|
|
31
|
+
needs_update = true
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
if needs_update
|
|
35
|
+
File.write(manifest_path, updated_content)
|
|
36
|
+
Rails.logger.info "SolidBro: Automatically added assets to manifest.js"
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
data/lib/solid_bro.rb
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
require "securerandom"
|
|
2
|
+
|
|
3
|
+
namespace :solid_bro do
|
|
4
|
+
desc "Seed SolidQueue jobs in various statuses for UI testing"
|
|
5
|
+
task seed_jobs: :environment do
|
|
6
|
+
puts "Creating demo SolidQueue jobs..."
|
|
7
|
+
|
|
8
|
+
# Helper to build a base job payload
|
|
9
|
+
def build_job_attrs(index, overrides = {})
|
|
10
|
+
{
|
|
11
|
+
queue_name: overrides[:queue_name] || "default",
|
|
12
|
+
class_name: overrides[:class_name] || "DemoJob",
|
|
13
|
+
arguments: [{ "job_class" => overrides[:class_name] || "DemoJob", "index" => index }],
|
|
14
|
+
priority: overrides.fetch(:priority, 0),
|
|
15
|
+
scheduled_at: overrides[:scheduled_at] || Time.current
|
|
16
|
+
}.merge(overrides.except(:queue_name, :class_name, :priority, :scheduled_at))
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Ready jobs (Solid Queue will create ready executions automatically)
|
|
20
|
+
10.times do |i|
|
|
21
|
+
SolidQueue::Job.create!(build_job_attrs(i, class_name: "ReadyDemoJob"))
|
|
22
|
+
end
|
|
23
|
+
puts "Created 10 ready jobs"
|
|
24
|
+
|
|
25
|
+
# Failed jobs (remove ready execution so status resolves to failed)
|
|
26
|
+
10.times do |i|
|
|
27
|
+
job = SolidQueue::Job.create!(build_job_attrs(i, class_name: "FailedDemoJob", queue_name: "mailers"))
|
|
28
|
+
job.ready_execution&.destroy! if job.respond_to?(:ready_execution)
|
|
29
|
+
SolidQueue::FailedExecution.create!(job: job, error: { message: "boom ##{i}" })
|
|
30
|
+
end
|
|
31
|
+
puts "Created 10 failed jobs"
|
|
32
|
+
|
|
33
|
+
# Finished jobs
|
|
34
|
+
10.times do |i|
|
|
35
|
+
finished_at = (i + 1).minutes.ago
|
|
36
|
+
SolidQueue::Job.create!(
|
|
37
|
+
build_job_attrs(i, class_name: "FinishedDemoJob", queue_name: "finisher", scheduled_at: finished_at, finished_at: finished_at)
|
|
38
|
+
)
|
|
39
|
+
end
|
|
40
|
+
puts "Created 10 finished jobs"
|
|
41
|
+
|
|
42
|
+
# Scheduled jobs (in the future; Solid Queue will track them as scheduled)
|
|
43
|
+
10.times do |i|
|
|
44
|
+
scheduled_at = (i + 1).minutes.from_now
|
|
45
|
+
SolidQueue::Job.create!(
|
|
46
|
+
build_job_attrs(i, class_name: "ScheduledDemoJob", queue_name: "scheduled", scheduled_at: scheduled_at, priority: 5)
|
|
47
|
+
)
|
|
48
|
+
end
|
|
49
|
+
puts "Created 10 scheduled jobs"
|
|
50
|
+
|
|
51
|
+
puts "Done seeding SolidQueue demo jobs."
|
|
52
|
+
end
|
|
53
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: solid_bro
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.2
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Emanuel Comsa
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: rails
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '7.0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '7.0'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: pagy
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '5.0'
|
|
33
|
+
type: :runtime
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '5.0'
|
|
40
|
+
- !ruby/object:Gem::Dependency
|
|
41
|
+
name: solid_queue
|
|
42
|
+
requirement: !ruby/object:Gem::Requirement
|
|
43
|
+
requirements:
|
|
44
|
+
- - ">="
|
|
45
|
+
- !ruby/object:Gem::Version
|
|
46
|
+
version: '0'
|
|
47
|
+
type: :runtime
|
|
48
|
+
prerelease: false
|
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
50
|
+
requirements:
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '0'
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: rspec-rails
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
59
|
+
- !ruby/object:Gem::Version
|
|
60
|
+
version: '0'
|
|
61
|
+
type: :development
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - ">="
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: '0'
|
|
68
|
+
description: A web UI dashboard for managing SolidQueue jobs, queues, workers, and
|
|
69
|
+
recurring tasks in Rails applications.
|
|
70
|
+
email:
|
|
71
|
+
- office@rubydev.ro
|
|
72
|
+
executables: []
|
|
73
|
+
extensions: []
|
|
74
|
+
extra_rdoc_files: []
|
|
75
|
+
files:
|
|
76
|
+
- MIT-LICENSE
|
|
77
|
+
- README.md
|
|
78
|
+
- Rakefile
|
|
79
|
+
- app/assets/javascripts/solid_bro/application.js
|
|
80
|
+
- app/assets/stylesheets/solid_bro/application.css
|
|
81
|
+
- app/assets/stylesheets/solid_bro/core.css
|
|
82
|
+
- app/controllers/solid_bro/application_controller.rb
|
|
83
|
+
- app/controllers/solid_bro/jobs_controller.rb
|
|
84
|
+
- app/controllers/solid_bro/processes_controller.rb
|
|
85
|
+
- app/controllers/solid_bro/queues_controller.rb
|
|
86
|
+
- app/controllers/solid_bro/recurring_tasks_controller.rb
|
|
87
|
+
- app/helpers/solid_bro/application_helper.rb
|
|
88
|
+
- app/jobs/solid_bro/application_job.rb
|
|
89
|
+
- app/mailers/solid_bro/application_mailer.rb
|
|
90
|
+
- app/models/solid_bro/application_record.rb
|
|
91
|
+
- app/views/layouts/solid_bro/application.html.erb
|
|
92
|
+
- app/views/solid_bro/jobs/index.html.erb
|
|
93
|
+
- app/views/solid_bro/jobs/show.html.erb
|
|
94
|
+
- app/views/solid_bro/processes/index.html.erb
|
|
95
|
+
- app/views/solid_bro/queues/index.html.erb
|
|
96
|
+
- app/views/solid_bro/recurring_tasks/index.html.erb
|
|
97
|
+
- config/initializers/pagy.rb
|
|
98
|
+
- config/routes.rb
|
|
99
|
+
- lib/generators/solid_bro/install/install_generator.rb
|
|
100
|
+
- lib/solid_bro.rb
|
|
101
|
+
- lib/solid_bro/engine.rb
|
|
102
|
+
- lib/solid_bro/version.rb
|
|
103
|
+
- lib/tasks/solid_bro_tasks.rake
|
|
104
|
+
homepage: https://www.rubydev.ro
|
|
105
|
+
licenses:
|
|
106
|
+
- MIT
|
|
107
|
+
metadata:
|
|
108
|
+
allowed_push_host: https://rubygems.org
|
|
109
|
+
homepage_uri: https://www.rubydev.ro
|
|
110
|
+
source_code_uri: https://github.com/rubydevro/solid_bro
|
|
111
|
+
changelog_uri: https://github.com/rubydevro/solid_bro/blob/main/CHANGELOG.md
|
|
112
|
+
rdoc_options: []
|
|
113
|
+
require_paths:
|
|
114
|
+
- lib
|
|
115
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
116
|
+
requirements:
|
|
117
|
+
- - ">="
|
|
118
|
+
- !ruby/object:Gem::Version
|
|
119
|
+
version: '0'
|
|
120
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - ">="
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: '0'
|
|
125
|
+
requirements: []
|
|
126
|
+
rubygems_version: 4.0.3
|
|
127
|
+
specification_version: 4
|
|
128
|
+
summary: A web UI dashboard for managing SolidQueue jobs, queues, workers, and recurring
|
|
129
|
+
tasks in Rails applications.
|
|
130
|
+
test_files: []
|