the_mechanic_2 0.1.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.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +254 -0
- data/Rakefile +5 -0
- data/app/assets/javascripts/the_mechanic_2/application.js +426 -0
- data/app/assets/stylesheets/the_mechanic_2/application.css +666 -0
- data/app/controllers/the_mechanic_2/application_controller.rb +6 -0
- data/app/controllers/the_mechanic_2/benchmarks_controller.rb +174 -0
- data/app/helpers/the_mechanic_2/application_helper.rb +4 -0
- data/app/jobs/the_mechanic_2/application_job.rb +4 -0
- data/app/mailers/the_mechanic_2/application_mailer.rb +6 -0
- data/app/models/the_mechanic_2/application_record.rb +5 -0
- data/app/models/the_mechanic_2/benchmark_request.rb +79 -0
- data/app/models/the_mechanic_2/benchmark_result.rb +136 -0
- data/app/services/the_mechanic_2/benchmark_service.rb +115 -0
- data/app/services/the_mechanic_2/rails_runner_service.rb +235 -0
- data/app/services/the_mechanic_2/security_service.rb +128 -0
- data/app/views/layouts/the_mechanic_2/application.html.erb +17 -0
- data/app/views/the_mechanic_2/benchmarks/index.html.erb +266 -0
- data/config/routes.rb +7 -0
- data/lib/tasks/the_mechanic_tasks.rake +4 -0
- data/lib/the_mechanic_2/configuration.rb +45 -0
- data/lib/the_mechanic_2/engine.rb +18 -0
- data/lib/the_mechanic_2/version.rb +3 -0
- data/lib/the_mechanic_2.rb +7 -0
- metadata +157 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module TheMechanic2
|
|
4
|
+
# Configuration class for The Mechanic engine
|
|
5
|
+
# Allows customization of timeout, authentication, and other settings
|
|
6
|
+
class Configuration
|
|
7
|
+
# Maximum execution time for benchmarks in seconds
|
|
8
|
+
attr_accessor :timeout
|
|
9
|
+
|
|
10
|
+
# Whether to require authentication before allowing benchmark execution
|
|
11
|
+
attr_accessor :enable_authentication
|
|
12
|
+
|
|
13
|
+
# Proc/lambda to call for authentication check
|
|
14
|
+
# Should accept a controller instance and return true/false
|
|
15
|
+
attr_accessor :authentication_callback
|
|
16
|
+
|
|
17
|
+
def initialize
|
|
18
|
+
@timeout = 30 # seconds
|
|
19
|
+
@enable_authentication = false
|
|
20
|
+
@authentication_callback = nil
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
class << self
|
|
25
|
+
# Returns the global configuration instance
|
|
26
|
+
def configuration
|
|
27
|
+
@configuration ||= Configuration.new
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
# Yields the configuration instance for block-style configuration
|
|
31
|
+
# @example
|
|
32
|
+
# TheMechanic2.configure do |config|
|
|
33
|
+
# config.timeout = 60
|
|
34
|
+
# config.enable_authentication = true
|
|
35
|
+
# end
|
|
36
|
+
def configure
|
|
37
|
+
yield(configuration)
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# Resets configuration to defaults (useful for testing)
|
|
41
|
+
def reset_configuration!
|
|
42
|
+
@configuration = Configuration.new
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
module TheMechanic2
|
|
2
|
+
class Engine < ::Rails::Engine
|
|
3
|
+
isolate_namespace TheMechanic2
|
|
4
|
+
|
|
5
|
+
# Engine configuration
|
|
6
|
+
config.generators do |g|
|
|
7
|
+
g.test_framework :rspec
|
|
8
|
+
g.fixture_replacement :factory_bot
|
|
9
|
+
g.factory_bot dir: 'spec/factories'
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
# Ensure services are autoloaded
|
|
13
|
+
config.autoload_paths << File.expand_path('../../app/services', __dir__)
|
|
14
|
+
|
|
15
|
+
# Explicitly set view paths for the engine
|
|
16
|
+
config.paths["app/views"].unshift(File.expand_path('../../app/views', __dir__))
|
|
17
|
+
end
|
|
18
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: the_mechanic_2
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- mrpandapants
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: bin
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2025-10-16 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: rails
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '6.0'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '6.0'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: benchmark-ips
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '2.0'
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '2.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: memory_profiler
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '1.0'
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '1.0'
|
|
55
|
+
- !ruby/object:Gem::Dependency
|
|
56
|
+
name: rspec-rails
|
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
|
58
|
+
requirements:
|
|
59
|
+
- - "~>"
|
|
60
|
+
- !ruby/object:Gem::Version
|
|
61
|
+
version: '6.0'
|
|
62
|
+
type: :development
|
|
63
|
+
prerelease: false
|
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
65
|
+
requirements:
|
|
66
|
+
- - "~>"
|
|
67
|
+
- !ruby/object:Gem::Version
|
|
68
|
+
version: '6.0'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: sqlite3
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - "~>"
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '1.4'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "~>"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '1.4'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: rails-controller-testing
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - ">="
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '0'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - ">="
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '0'
|
|
97
|
+
description: The Mechanic 2 is a Rails Engine that provides Ruby code benchmarking
|
|
98
|
+
capabilities within any Rails application, with full access to your application's
|
|
99
|
+
classes and dependencies.
|
|
100
|
+
email:
|
|
101
|
+
- villanuevarandy237@gmail.com
|
|
102
|
+
executables: []
|
|
103
|
+
extensions: []
|
|
104
|
+
extra_rdoc_files: []
|
|
105
|
+
files:
|
|
106
|
+
- MIT-LICENSE
|
|
107
|
+
- README.md
|
|
108
|
+
- Rakefile
|
|
109
|
+
- app/assets/javascripts/the_mechanic_2/application.js
|
|
110
|
+
- app/assets/stylesheets/the_mechanic_2/application.css
|
|
111
|
+
- app/controllers/the_mechanic_2/application_controller.rb
|
|
112
|
+
- app/controllers/the_mechanic_2/benchmarks_controller.rb
|
|
113
|
+
- app/helpers/the_mechanic_2/application_helper.rb
|
|
114
|
+
- app/jobs/the_mechanic_2/application_job.rb
|
|
115
|
+
- app/mailers/the_mechanic_2/application_mailer.rb
|
|
116
|
+
- app/models/the_mechanic_2/application_record.rb
|
|
117
|
+
- app/models/the_mechanic_2/benchmark_request.rb
|
|
118
|
+
- app/models/the_mechanic_2/benchmark_result.rb
|
|
119
|
+
- app/services/the_mechanic_2/benchmark_service.rb
|
|
120
|
+
- app/services/the_mechanic_2/rails_runner_service.rb
|
|
121
|
+
- app/services/the_mechanic_2/security_service.rb
|
|
122
|
+
- app/views/layouts/the_mechanic_2/application.html.erb
|
|
123
|
+
- app/views/the_mechanic_2/benchmarks/index.html.erb
|
|
124
|
+
- config/routes.rb
|
|
125
|
+
- lib/tasks/the_mechanic_tasks.rake
|
|
126
|
+
- lib/the_mechanic_2.rb
|
|
127
|
+
- lib/the_mechanic_2/configuration.rb
|
|
128
|
+
- lib/the_mechanic_2/engine.rb
|
|
129
|
+
- lib/the_mechanic_2/version.rb
|
|
130
|
+
homepage: https://github.com/randyv128/the_mechanic_2
|
|
131
|
+
licenses:
|
|
132
|
+
- MIT
|
|
133
|
+
metadata:
|
|
134
|
+
allowed_push_host: https://rubygems.org
|
|
135
|
+
homepage_uri: https://github.com/randyv128/the_mechanic_2
|
|
136
|
+
source_code_uri: https://github.com/randyv128/the_mechanic_2
|
|
137
|
+
changelog_uri: https://github.com/randyv128/the_mechanic_2/blob/main/CHANGELOG.md
|
|
138
|
+
post_install_message:
|
|
139
|
+
rdoc_options: []
|
|
140
|
+
require_paths:
|
|
141
|
+
- lib
|
|
142
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
143
|
+
requirements:
|
|
144
|
+
- - ">="
|
|
145
|
+
- !ruby/object:Gem::Version
|
|
146
|
+
version: '0'
|
|
147
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
148
|
+
requirements:
|
|
149
|
+
- - ">="
|
|
150
|
+
- !ruby/object:Gem::Version
|
|
151
|
+
version: '0'
|
|
152
|
+
requirements: []
|
|
153
|
+
rubygems_version: 3.4.10
|
|
154
|
+
signing_key:
|
|
155
|
+
specification_version: 4
|
|
156
|
+
summary: Ruby code benchmarking engine for Rails applications
|
|
157
|
+
test_files: []
|