Class: DockerizeRails

Inherits:
Thor
  • Object
show all
Includes:
Thor::Actions
Defined in:
lib/rails/dockerize_rails.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#databaseObject

Returns the value of attribute database.



5
6
7
# File 'lib/rails/dockerize_rails.rb', line 5

def database
  @database
end

#ruby_versionObject

Returns the value of attribute ruby_version.



5
6
7
# File 'lib/rails/dockerize_rails.rb', line 5

def ruby_version
  @ruby_version
end

Class Method Details

.source_rootObject



7
8
9
# File 'lib/rails/dockerize_rails.rb', line 7

def self.source_root
  File.dirname(__FILE__)
end

Instance Method Details

#generate_filesObject



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/rails/dockerize_rails.rb', line 12

def generate_files
  @ruby_version = ask("Ruby Version (default 2.4.3):")
  @ruby_version = "2.4.3" if @ruby_version == ""
  @database     = ask("What is your Database?", limited_to: ["mysql", "postgresql"])

  template "templates/Dockerfile.erb", "docker/development/Dockerfile"
  template "templates/entrypoint.sh", "docker/development/entrypoint.sh"
  template "templates/docker-compose.yml.erb", "docker-compose.yml"
  template "templates/database-docker.yml.erb", "config/database-docker.yml"
  template "templates/dockerignore", ".dockerignore"
  append_to_file '.gitignore', "
volumes"
end