chrome_devtools_rails 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/CHANGELOG.md +14 -0
- data/MIT-LICENSE +20 -0
- data/README.md +64 -0
- data/Rakefile +8 -0
- data/app/controllers/chrome_devtools_rails/devtools_controller.rb +25 -0
- data/lib/chrome_devtools_rails/engine.rb +15 -0
- data/lib/chrome_devtools_rails/version.rb +3 -0
- data/lib/chrome_devtools_rails.rb +2 -0
- metadata +75 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c60e34e0904582d3e8c0531e9324d9bb6f8e6224fc58d3589b5f78cee5b4b596
|
4
|
+
data.tar.gz: 912ac8c111b3383eb7389397945069a4d7b070ab573936f2e3648cad5a841d1c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1380a9d09a80ee92e2743e012ee465513cea02daf18ad01edf6a4d881acb562dad539bdb4998f6da28759a43f726045318fd98676f2d445b82ecd54e6e5ec44a
|
7
|
+
data.tar.gz: 51de32faa41e403cb1cab7f6a666145f870c5adfdb8b6fd8cba01148f0dff8171974ad024e2bd53e5bd61062953dcad2a936d992f22072232a4dfbc847f99768
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
## [0.1.0] - 2023-05-19
|
9
|
+
|
10
|
+
### Added
|
11
|
+
- Initial release
|
12
|
+
- Automatic workspace mapping for Chrome DevTools
|
13
|
+
- Serves JSON file at `/.well-known/appspecific/com.chrome.devtools.json`
|
14
|
+
- UUID persistence in `tmp/chrome_devtools_uuid`
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright Daniel Lopez 👾
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
# ChromeDevtoolsRails
|
2
|
+
|
3
|
+
This gem provides a minimal Rails engine that automatically serves the Chrome DevTools workspace mapping file at:
|
4
|
+
|
5
|
+
```text
|
6
|
+
/.well-known/appspecific/com.chrome.devtools.json
|
7
|
+
```
|
8
|
+
|
9
|
+
When Chrome accesses this file from your local development server, it enables **automatic workspace folder mapping**, allowing you to edit and save source files (JS, CSS, etc.) directly from Chrome DevTools into your local Rails project.
|
10
|
+
|
11
|
+
This engine is **automatically mounted** and only active in **development mode**.
|
12
|
+
|
13
|
+
---
|
14
|
+
|
15
|
+
## 🚀 Usage
|
16
|
+
|
17
|
+
1. Visit your Rails app on `localhost`.
|
18
|
+
2. Open Chrome DevTools → **Sources** tab.
|
19
|
+
3. Chrome will auto-detect the `.well-known` file and prompt to map your local project.
|
20
|
+
4. Approve the mapping — changes made in DevTools will now be saved directly to disk.
|
21
|
+
|
22
|
+
---
|
23
|
+
|
24
|
+
## 🔧 Installation
|
25
|
+
|
26
|
+
Add this line to your application's `Gemfile`:
|
27
|
+
|
28
|
+
```ruby
|
29
|
+
gem "chrome_devtools_rails"
|
30
|
+
```
|
31
|
+
|
32
|
+
Then run:
|
33
|
+
|
34
|
+
```bash
|
35
|
+
bundle install
|
36
|
+
```
|
37
|
+
|
38
|
+
No route configuration is needed — the engine mounts itself automatically in development.
|
39
|
+
|
40
|
+
---
|
41
|
+
|
42
|
+
## ✅ Requirements
|
43
|
+
|
44
|
+
- Ruby ≥ 3.1
|
45
|
+
- Rails ≥ 8.0.2
|
46
|
+
- Google Chrome v89+ (with DevTools workspace support)
|
47
|
+
|
48
|
+
---
|
49
|
+
|
50
|
+
## 🤝 Contributing
|
51
|
+
|
52
|
+
Pull requests are welcome on GitHub at [https://github.com/6temes/chrome_devtools_rails](https://github.com/6temes/chrome_devtools_rails).
|
53
|
+
|
54
|
+
Ideas for improvement:
|
55
|
+
|
56
|
+
- Add support for regenerating the UUID
|
57
|
+
- Configurable root path
|
58
|
+
- Rake task or generator to inspect the current workspace config
|
59
|
+
|
60
|
+
---
|
61
|
+
|
62
|
+
## 📄 License
|
63
|
+
|
64
|
+
This gem is open source and released under the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
module ChromeDevtoolsRails
|
2
|
+
class DevtoolsController < ActionController::Base
|
3
|
+
def show
|
4
|
+
render json: {
|
5
|
+
workspace: {
|
6
|
+
root: Rails.root.to_s,
|
7
|
+
uuid: uuid
|
8
|
+
}
|
9
|
+
}
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def uuid
|
15
|
+
path = Rails.root.join("tmp", "chrome_devtools_uuid")
|
16
|
+
File.exist?(path) ? File.read(path).strip : persist_uuid(path)
|
17
|
+
end
|
18
|
+
|
19
|
+
def persist_uuid(path)
|
20
|
+
uuid = SecureRandom.uuid
|
21
|
+
File.write(path, uuid)
|
22
|
+
uuid
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module ChromeDevtoolsRails
|
2
|
+
class Engine < ::Rails::Engine
|
3
|
+
isolate_namespace ChromeDevtoolsRails
|
4
|
+
|
5
|
+
initializer "chrome_devtools_rails.append_route" do |app|
|
6
|
+
if Rails.env.development? || Rails.env.test?
|
7
|
+
app.routes.append do
|
8
|
+
get "/.well-known/appspecific/com.chrome.devtools.json",
|
9
|
+
to: "chrome_devtools_rails/devtools#show",
|
10
|
+
as: :chrome_devtools_json
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
metadata
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: chrome_devtools_rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- "Daniel Lopez \U0001F47E"
|
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: '8.0'
|
19
|
+
- - ">="
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 8.0.2
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - "~>"
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '8.0'
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 8.0.2
|
32
|
+
description: A Rails engine that automatically provides the /.well-known/appspecific/com.chrome.devtools.json
|
33
|
+
endpoint for enabling Chrome DevTools automatic workspace mapping in development
|
34
|
+
mode.
|
35
|
+
email:
|
36
|
+
- daniel@6temes.cat
|
37
|
+
executables: []
|
38
|
+
extensions: []
|
39
|
+
extra_rdoc_files: []
|
40
|
+
files:
|
41
|
+
- CHANGELOG.md
|
42
|
+
- MIT-LICENSE
|
43
|
+
- README.md
|
44
|
+
- Rakefile
|
45
|
+
- app/controllers/chrome_devtools_rails/devtools_controller.rb
|
46
|
+
- lib/chrome_devtools_rails.rb
|
47
|
+
- lib/chrome_devtools_rails/engine.rb
|
48
|
+
- lib/chrome_devtools_rails/version.rb
|
49
|
+
homepage: https://github.com/6temes/chrome_devtools_rails
|
50
|
+
licenses:
|
51
|
+
- MIT
|
52
|
+
metadata:
|
53
|
+
homepage_uri: https://github.com/6temes/chrome_devtools_rails
|
54
|
+
source_code_uri: https://github.com/6temes/chrome_devtools_rails/tree/main
|
55
|
+
documentation_uri: https://github.com/6temes/chrome_devtools_rails/blob/main/README.md
|
56
|
+
changelog_uri: https://github.com/6temes/chrome_devtools_rails/blob/main/CHANGELOG.md
|
57
|
+
allowed_push_host: https://rubygems.org
|
58
|
+
rdoc_options: []
|
59
|
+
require_paths:
|
60
|
+
- lib
|
61
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
62
|
+
requirements:
|
63
|
+
- - ">="
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '3.1'
|
66
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '0'
|
71
|
+
requirements: []
|
72
|
+
rubygems_version: 3.6.7
|
73
|
+
specification_version: 4
|
74
|
+
summary: Serve com.chrome.devtools.json for Chrome automatic workspace setup
|
75
|
+
test_files: []
|