dockerfile-rails 1.5.0 → 1.5.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1aca228134c031de432e9c059c2451da36827f11334c25498506e1dc1a5f7819
|
4
|
+
data.tar.gz: b661bfc9e1d9a3aafa0a10181a33927616e06162bb4ea24f960d33ff5598337c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b432aedcdafad7b3aea076ad4501252aa2dc51f3cd980be1e6d4761d43b57773ec76ebc862d4f9cdd8526f1d5e3cf77c5f24b48d615fe558e0055b54aabd0803
|
7
|
+
data.tar.gz: c20b0900280252cef4eab686b3f0b2718e99e46779504174fd4898d86ec68868607acc1cc5179d5c815334c2d911e0bd587169dfe6ca023af40e2caa743f66fc
|
@@ -44,7 +44,7 @@ module DockerfileRails
|
|
44
44
|
@sqlite3 = true
|
45
45
|
elsif database == "postgresql"
|
46
46
|
@postgresql = true
|
47
|
-
elsif (database == "mysql") || (database == "mysql2")
|
47
|
+
elsif (database == "mysql") || (database == "mysql2") || (database == "trilogy")
|
48
48
|
@mysql = true
|
49
49
|
elsif database == "sqlserver"
|
50
50
|
@sqlserver = true
|
@@ -52,7 +52,7 @@ module DockerfileRails
|
|
52
52
|
|
53
53
|
@sqlite3 = true if @gemfile.include? "sqlite3"
|
54
54
|
@postgresql = true if @gemfile.include? "pg"
|
55
|
-
@mysql = true if @gemfile.include?
|
55
|
+
@mysql = true if @gemfile.include?("mysql2") || using_trilogy?
|
56
56
|
|
57
57
|
### node modules ###
|
58
58
|
|
@@ -81,5 +81,9 @@ module DockerfileRails
|
|
81
81
|
|
82
82
|
@redis = @redis_cable || @redis_cache
|
83
83
|
end
|
84
|
+
|
85
|
+
def using_trilogy?
|
86
|
+
@gemfile.include?("trilogy") || @gemfile.include?("activerecord-trilogy-adapter")
|
87
|
+
end
|
84
88
|
end
|
85
89
|
end
|
@@ -38,7 +38,7 @@ class DockerfileGenerator < Rails::Generators::Base
|
|
38
38
|
"variant" => "slim",
|
39
39
|
"windows" => false,
|
40
40
|
"yjit" => false,
|
41
|
-
}.
|
41
|
+
}.yield_self { |hash| Struct.new(*hash.keys.map(&:to_sym)).new(*hash.values) }
|
42
42
|
|
43
43
|
OPTION_DEFAULTS = BASE_DEFAULTS.dup
|
44
44
|
|
@@ -282,14 +282,12 @@ class DockerfileGenerator < Rails::Generators::Base
|
|
282
282
|
fly_attach_consul
|
283
283
|
end
|
284
284
|
|
285
|
-
if
|
285
|
+
if File.exist?("fly.toml") && (fly_processes || !options.prepare)
|
286
286
|
if File.stat("fly.toml").size > 0
|
287
287
|
template "fly.toml.erb", "fly.toml"
|
288
288
|
else
|
289
|
-
toml =
|
290
|
-
if toml !=
|
291
|
-
File.write "fly.toml", toml
|
292
|
-
end
|
289
|
+
toml = fly_make_toml
|
290
|
+
File.write "fly.toml", toml if toml != ""
|
293
291
|
end
|
294
292
|
end
|
295
293
|
|
@@ -321,7 +319,7 @@ private
|
|
321
319
|
scope = (Class.new do
|
322
320
|
def initialize(obj, locals)
|
323
321
|
@_obj = obj
|
324
|
-
@_locals = locals.
|
322
|
+
@_locals = locals.yield_self do |hash|
|
325
323
|
return nil if hash.empty?
|
326
324
|
Struct.new(*hash.keys.map(&:to_sym)).new(*hash.values)
|
327
325
|
end
|
@@ -400,6 +398,14 @@ private
|
|
400
398
|
using_node? && options.parallel
|
401
399
|
end
|
402
400
|
|
401
|
+
def has_mysql_gem?
|
402
|
+
@gemfile.include? "mysql2" or using_trilogy?
|
403
|
+
end
|
404
|
+
|
405
|
+
def using_trilogy?
|
406
|
+
@gemfile.include?("trilogy") || @gemfile.include?("activerecord-trilogy-adapter")
|
407
|
+
end
|
408
|
+
|
403
409
|
def keeps?
|
404
410
|
return @keeps if @keeps != nil
|
405
411
|
@keeps = !!Dir["**/.keep"]
|
@@ -419,7 +425,7 @@ private
|
|
419
425
|
end
|
420
426
|
|
421
427
|
if options.mysql? || @mysql
|
422
|
-
system "bundle add mysql2 --skip-install" unless
|
428
|
+
system "bundle add mysql2 --skip-install" unless has_mysql_gem?
|
423
429
|
end
|
424
430
|
|
425
431
|
if options.redis? || using_redis?
|
@@ -511,7 +517,10 @@ private
|
|
511
517
|
# add databases: sqlite3, postgres, mysql
|
512
518
|
packages << "pkg-config" if options.sqlite3? || @sqlite3
|
513
519
|
packages << "libpq-dev" if options.postgresql? || @postgresql
|
514
|
-
|
520
|
+
|
521
|
+
if (options.mysql? || @mysql) && !using_trilogy?
|
522
|
+
packages << "default-libmysqlclient-dev"
|
523
|
+
end
|
515
524
|
|
516
525
|
# add git if needed to install gems
|
517
526
|
packages << "git" if @git
|
@@ -857,7 +866,7 @@ private
|
|
857
866
|
# use presence of "pg" or "mysql2" in the bundle as evidence of intent.
|
858
867
|
if options.postgresql? || @postgresql || @gemfile.include?("pg")
|
859
868
|
"postgresql"
|
860
|
-
elsif options.mysql? || @mysql ||
|
869
|
+
elsif options.mysql? || @mysql || has_mysql_gem?
|
861
870
|
"mysql"
|
862
871
|
else
|
863
872
|
"sqlite3"
|
@@ -1042,19 +1051,31 @@ private
|
|
1042
1051
|
system "#{flyctl} consul attach"
|
1043
1052
|
end
|
1044
1053
|
|
1045
|
-
def
|
1054
|
+
def fly_make_toml
|
1046
1055
|
toml = File.read("fly.toml")
|
1047
1056
|
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1057
|
+
list = fly_processes
|
1058
|
+
if list
|
1059
|
+
if toml.include? "[processes]"
|
1060
|
+
toml.sub!(/\[processes\].*?(\n\n|\n?\z)/m, "[processes]\n" +
|
1061
|
+
list.map { |name, cmd| " #{name} = #{cmd.inspect}" }.join("\n") + '\1')
|
1062
|
+
else
|
1063
|
+
toml += "\n[processes]\n" +
|
1064
|
+
list.map { |name, cmd| " #{name} = #{cmd.inspect}\n" }.join
|
1054
1065
|
|
1055
|
-
|
1066
|
+
app = list.has_key?("app") ? "app" : list.keys.first
|
1056
1067
|
|
1057
|
-
|
1068
|
+
toml.sub! "[http_service]\n", "\\0 processes = [#{app.inspect}]\n"
|
1069
|
+
end
|
1070
|
+
end
|
1071
|
+
|
1072
|
+
if options.prepare == false
|
1073
|
+
deploy = "[deploy]\n release_command = #{dbprep_command.inspect}\n\n"
|
1074
|
+
if toml.include? "[deploy]"
|
1075
|
+
toml.sub!(/\[deploy\].*?(\n\n|\n?\z)/m, deploy)
|
1076
|
+
else
|
1077
|
+
toml += deploy
|
1078
|
+
end
|
1058
1079
|
end
|
1059
1080
|
|
1060
1081
|
toml
|
@@ -20,7 +20,7 @@ RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz
|
|
20
20
|
<% if yarn_version < '2' -%>
|
21
21
|
<% if node_version -%> <% else %>RUN<% end %> npm install -g yarn@$YARN_VERSION<% if node_version -%> && \<% end %>
|
22
22
|
<% else -%>
|
23
|
-
<% if (node_version.split('.').map(&:to_i) <=> [16,10,0]) < 0 -%>
|
23
|
+
<% if node_version && (node_version.split('.').map(&:to_i) <=> [16,10,0]) < 0 -%>
|
24
24
|
npm i -g corepack && \
|
25
25
|
<% else -%>
|
26
26
|
corepack enable && \
|
@@ -21,8 +21,12 @@ services:
|
|
21
21
|
<% if deploy_database == 'postgresql' -%>
|
22
22
|
- DATABASE_URL=postgres://root:password@postgres-db/
|
23
23
|
<% elsif deploy_database == 'mysql' -%>
|
24
|
+
<% if using_trilogy? -%>
|
25
|
+
- DATABASE_URL=trilogy://root:password@mysql-db/
|
26
|
+
<% else -%>
|
24
27
|
- DATABASE_URL=mysql2://root:password@mysql-db/
|
25
28
|
<% end -%>
|
29
|
+
<% end -%>
|
26
30
|
<% if deploy_database == 'sqlite3' -%>
|
27
31
|
volumes:
|
28
32
|
- ./db:/rails/db
|
@@ -89,7 +93,11 @@ services:
|
|
89
93
|
<% if deploy_database == 'postgresql' -%>
|
90
94
|
- DATABASE_URL=postgres://root:password@postgres-db/
|
91
95
|
<% elsif deploy_database == 'mysql' -%>
|
96
|
+
<% if using_trilogy? -%>
|
97
|
+
- DATABASE_URL=trilogy://root:password@mysql-db/
|
98
|
+
<% else -%>
|
92
99
|
- DATABASE_URL=mysql2://root:password@mysql-db/
|
100
|
+
<% end -%>
|
93
101
|
<% end -%>
|
94
102
|
depends_on:
|
95
103
|
redis-db:
|
@@ -1 +1 @@
|
|
1
|
-
<%=
|
1
|
+
<%= fly_make_toml -%>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dockerfile-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.5.
|
4
|
+
version: 1.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Ruby
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -65,7 +65,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 2.6.0
|
69
69
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
71
|
- - ">="
|