Sha256: 76c939257b015107f5d19a11b0c57a1a2e25242199d981dc5cfb936cda292462

Contents?: true

Size: 1.13 KB

Versions: 6

Compression:

Stored size: 1.13 KB

Contents

require 'erb'
module Dockman
  module Dockify
    class SkeletonGenerator < Rails::Generators::NamedBase
      source_root File.expand_path('../templates', __FILE__)

      def copy_warehouse
        directory 'warehouse'
      end

      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

      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

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

      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

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
dockman-0.1.12 lib/generators/dockman/dockify/skeleton/skeleton_generator.rb
dockman-0.1.11 lib/generators/dockman/dockify/skeleton/skeleton_generator.rb
dockman-0.1.9 lib/generators/dockman/dockify/skeleton/skeleton_generator.rb
dockman-0.1.8 lib/generators/dockman/dockify/skeleton/skeleton_generator.rb
dockman-0.1.7 lib/generators/dockman/dockify/skeleton/skeleton_generator.rb
dockman-0.1.3 lib/generators/dockman/dockify/skeleton/skeleton_generator.rb