Class: Dockman::Dockify::SkeletonGenerator

Inherits:
Rails::Generators::NamedBase
  • Object
show all
Defined in:
lib/generators/dockman/dockify/skeleton/skeleton_generator.rb

Instance Method Summary collapse

Instance Method Details


19
20
21
22
23
24
25
26
# File 'lib/generators/dockman/dockify/skeleton/skeleton_generator.rb', line 19

def copy_docker_related
  copy_file 'docker-compose.yml'
  copy_file 'docker-compose.dbs.yml'
  copy_file 'Dockerfile'
  copy_file 'docker-sync.yml'
  copy_file '.dockerignore'
  template 'envrc.erb', '.env.development'
end

#copy_infraObject


11
12
13
14
15
16
17
# File 'lib/generators/dockman/dockify/skeleton/skeleton_generator.rb', line 11

def copy_infra
  directory 'infra'
  if File.exist?('config/database.yml')
    File.rename('config/database.yml',"config/database.#{Time.now.to_i}.yml")
  end
  copy_file 'config/database.yml'
end

#copy_warehouseObject


7
8
9
# File 'lib/generators/dockman/dockify/skeleton/skeleton_generator.rb', line 7

def copy_warehouse
  directory 'warehouse'
end

#create_docker_volumes_and_networksObject


37
38
39
40
41
# File 'lib/generators/dockman/dockify/skeleton/skeleton_generator.rb', line 37

def create_docker_volumes_and_networks
  system "docker volume create #{file_name}-web-sync"
  system "docker volume create #{file_name}-bundle-sync"
  system "docker network create #{file_name}-nginx-proxy"
end

#ignore_responsiblyObject


28
29
30
31
32
33
34
35
# File 'lib/generators/dockman/dockify/skeleton/skeleton_generator.rb', line 28

def ignore_responsibly
  append_to_file '.gitignore' do <<-IGN
/warehouse/
/.docker-sync/
/.envrc
  IGN
  end
end