lib/generators/dockerfile_generator.rb in dockerfile-rails-1.5.9 vs lib/generators/dockerfile_generator.rb in dockerfile-rails-1.5.10

- old
+ new

@@ -33,10 +33,11 @@ "redis" => false, "registry" => "", "rollbar" => false, "root" => false, "sqlite3" => false, + "sqlserver" => false, "sentry" => false, "sudo" => false, "swap" => nil, "variant" => "slim", "windows" => false, @@ -125,10 +126,13 @@ desc: "include redis libraries" class_option :sqlite3, aliases: "--sqlite", type: :boolean, default: OPTION_DEFAULTS.sqlite3, desc: "include sqlite3 libraries" + class_option :sqlserver, aliases: "--sqlserver", type: :boolean, default: OPTION_DEFAULTS.sqlserver, + desc: "include SQL server libraries" + class_option :litefs, type: :boolean, default: OPTION_DEFAULTS.litefs, desc: "replicate sqlite3 databases using litefs" class_option :postgresql, aliases: "--postgres", type: :boolean, default: OPTION_DEFAULTS.postgresql, desc: "include postgresql libraries" @@ -292,11 +296,11 @@ template "litefs.yml.erb", "config/litefs.yml" fly_attach_consul end - if File.exist?("fly.toml") && (fly_processes || !options.prepare || options.swap) + if File.exist?("fly.toml") && (fly_processes || !options.prepare || options.swap || deploy_database == "sqlite3") if File.stat("fly.toml").size > 0 template "fly.toml.erb", "fly.toml" else toml = fly_make_toml File.write "fly.toml", toml if toml != "" @@ -558,10 +562,11 @@ packages += %w(nodejs npm) if (node_version == "lts") && (not using_execjs?) # add databases: sqlite3, postgres, mysql packages << "pkg-config" if options.sqlite3? || @sqlite3 packages << "libpq-dev" if options.postgresql? || @postgresql + packages << "freetds-dev" if options.sqlserver? || @sqlserver if (options.mysql? || @mysql) && !using_trilogy? packages << "default-libmysqlclient-dev" end @@ -613,10 +618,11 @@ packages += @@packages["deploy"] if @@packages["deploy"] # start with databases: sqlite3, postgres, mysql packages << "postgresql-client" if options.postgresql? || @postgresql packages << "default-mysql-client" if options.mysql? || @mysql + packages << "freetds-bin" if options.sqlserver? || @sqlserver packages << "libjemalloc2" if options.jemalloc? && !options.fullstaq? if options.sqlite3? || @sqlite3 packages << "libsqlite3-0" unless packages.include? "sqlite3" end @@ -914,10 +920,12 @@ # use presence of "pg" or "mysql2" in the bundle as evidence of intent. if options.postgresql? || @postgresql || @gemfile.include?("pg") "postgresql" elsif options.mysql? || @mysql || has_mysql_gem? "mysql" + elsif options.sqlserver || @sqlserver + "sqlserver" else "sqlite3" end end @@ -1142,9 +1150,15 @@ deploy = "[deploy]\n release_command = #{dbprep_command.inspect}\n\n" if toml.include? "[deploy]" toml.sub!(/\[deploy\].*?(\n\n|\n?\z)/m, deploy) else toml += deploy + end + end + + if deploy_database == "sqlite3" + if not toml.include? "[mounts]" + toml += "[mounts]\n source=\"data\"\n destination=\"/data\"\n\n" end end if options.swap suffixes = {