ask-local-rails 0.1.2 → 0.1.3
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
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 477bf60af256b7f68fbaea653fd84a478dbd550afde9a575d09f6343cd887fa6
|
|
4
|
+
data.tar.gz: e1a214d30aa952fc67ae70bc4f05508b98b2b132cafb62a8fdb83b0f5041bbef
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e9d115a6a633cf8940775b15ee9499752d44c7c2ae2f214e4a62048aabcc7941e1c1a1bfd874c18e1585f089c6c3facc23f83e69932b82ddf626f26dada879b4
|
|
7
|
+
data.tar.gz: a1ac6831eb03b68438d1a6627e2c40d11b6963cf17e7d33501ca4ad93c893b030903a318ad52cfb2992ba02596ba7ee15c735adb2e6c27a95ccd3567bfa87562
|
data/README.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
> **DEPRECATED — fully superseded, nothing needed from this gem.**
|
|
2
|
+
>
|
|
3
|
+
> - ask-local core injects `RAILS_DEVELOPMENT_HOSTS` per process, so Rails
|
|
4
|
+
> apps boot behind ask-local with zero config — no hosts patch needed.
|
|
5
|
+
> - Action Cable works by default behind ask-local: Rails 7+
|
|
6
|
+
> `allow_same_origin_as_host` (default true) accepts the connection when
|
|
7
|
+
> the browser's Origin matches the proxied Host — no origins patch needed.
|
|
8
|
+
> - `ask-local init` already generates `config/local.yml` — no generator needed.
|
|
9
|
+
> - `Ask::Local::Rails.url` was only a wrapper around `ENV["ASK_LOCAL_URL"]`,
|
|
10
|
+
> which ask-local injects into every process.
|
|
11
|
+
>
|
|
12
|
+
> Archived at `deprecated/ask-local-rails` for history. No further
|
|
13
|
+
> development. Remove this gem from any Gemfile.
|
|
14
|
+
|
|
1
15
|
# ask-local-rails
|
|
2
16
|
|
|
3
17
|
[](https://badge.fury.io/rb/ask-local-rails)
|
|
@@ -7,7 +7,7 @@ module AskLocal
|
|
|
7
7
|
class InstallGenerator < ::Rails::Generators::Base
|
|
8
8
|
source_root File.expand_path("templates", __dir__)
|
|
9
9
|
|
|
10
|
-
desc "Wires a Rails app into ask-local:
|
|
10
|
+
desc "Wires a Rails app into ask-local: Cable origins, initializer, config/local.yml"
|
|
11
11
|
|
|
12
12
|
class_option :tld, type: :string, default: "localhost",
|
|
13
13
|
desc: "TLD ask-local serves this app under"
|
|
@@ -16,21 +16,6 @@ module AskLocal
|
|
|
16
16
|
template "initializer.rb", "config/initializers/ask_local.rb"
|
|
17
17
|
end
|
|
18
18
|
|
|
19
|
-
def patch_development_hosts
|
|
20
|
-
tld = options[:tld]
|
|
21
|
-
sentinel = "Ask::Local::Rails.host_patterns"
|
|
22
|
-
path = app_path("config/environments/development.rb")
|
|
23
|
-
return unless File.file?(path)
|
|
24
|
-
|
|
25
|
-
content = File.read(path)
|
|
26
|
-
return if content.include?(sentinel)
|
|
27
|
-
|
|
28
|
-
inject_into_file path,
|
|
29
|
-
"\n # ask-local: allow stable .#{tld} URLs (https://<app>.#{tld}).\n" \
|
|
30
|
-
" config.hosts.concat(Ask::Local::Rails.host_patterns(tlds: [#{tld.dump}]))\n",
|
|
31
|
-
after: "Rails.application.configure do\n"
|
|
32
|
-
end
|
|
33
|
-
|
|
34
19
|
def patch_action_cable
|
|
35
20
|
tld = options[:tld]
|
|
36
21
|
sentinel = "Ask::Local::Rails.cable_origins"
|
|
@@ -47,21 +32,30 @@ module AskLocal
|
|
|
47
32
|
after: "Rails.application.configure do\n"
|
|
48
33
|
end
|
|
49
34
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
35
|
+
# Emit config/local.yml — the mandatory Kamal-style config.
|
|
36
|
+
# web process boots the Rails app through puma on $PORT so
|
|
37
|
+
# ask-local can route to it. Only writes when absent.
|
|
38
|
+
def create_local_config
|
|
39
|
+
path = app_path("config/local.yml")
|
|
40
|
+
return if File.file?(path)
|
|
54
41
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
end
|
|
42
|
+
@service = app_service_name
|
|
43
|
+
@tld = options[:tld]
|
|
44
|
+
template "local.yml", "config/local.yml"
|
|
59
45
|
end
|
|
60
46
|
|
|
61
|
-
|
|
62
|
-
|
|
47
|
+
# Derive the service name from the app module when possible.
|
|
48
|
+
def app_service_name
|
|
49
|
+
return File.basename(destination_root).downcase.gsub(/[^a-z0-9-]/, "-") unless defined?(::Rails::Application)
|
|
63
50
|
|
|
64
|
-
|
|
51
|
+
app_const = ::Rails.application.class
|
|
52
|
+
if app_const.respond_to?(:module_parent_name) && app_const.module_parent_name
|
|
53
|
+
app_const.module_parent_name.underscore.dasherize
|
|
54
|
+
else
|
|
55
|
+
File.basename(destination_root).downcase.gsub(/[^a-z0-9-]/, "-")
|
|
56
|
+
end
|
|
57
|
+
rescue StandardError
|
|
58
|
+
File.basename(destination_root).downcase.gsub(/[^a-z0-9-]/, "-")
|
|
65
59
|
end
|
|
66
60
|
|
|
67
61
|
private
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# config/local.yml — ask-local configuration (Kamal-style).
|
|
2
|
+
# This is the only source of truth. Run `ask-local` to boot everything.
|
|
3
|
+
# Overlay variants with config/local.<variant>.yml.
|
|
4
|
+
|
|
5
|
+
service: <%= @service %>
|
|
6
|
+
|
|
7
|
+
proxy:
|
|
8
|
+
tld: <%= @tld %>
|
|
9
|
+
|
|
10
|
+
processes:
|
|
11
|
+
web:
|
|
12
|
+
cmd: bundle exec puma -b tcp://127.0.0.1:$PORT config.ru
|
|
13
|
+
proxy: true
|
|
14
|
+
# worker: # uncomment to run a background worker
|
|
15
|
+
# cmd: bundle exec sidekiq
|
|
16
|
+
# proxy: false
|
|
17
|
+
|
|
18
|
+
env:
|
|
19
|
+
clear:
|
|
20
|
+
RAILS_ENV: development
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: ask-local-rails
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kaka Ruto
|
|
@@ -98,6 +98,7 @@ files:
|
|
|
98
98
|
- lib/ask/local/rails/version.rb
|
|
99
99
|
- lib/generators/ask_local/install/install_generator.rb
|
|
100
100
|
- lib/generators/ask_local/install/templates/initializer.rb
|
|
101
|
+
- lib/generators/ask_local/install/templates/local.yml
|
|
101
102
|
homepage: https://github.com/ask-rb/ask-local-rails
|
|
102
103
|
licenses:
|
|
103
104
|
- MIT
|