Sha256: eb359a6090e2d929f98c986431c3b9ff32e71d8035aa9426056e7c97ecdee734

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

module Roro

  class CLI < Thor
    
    desc "greenfield::rails", "Greenfield a new, dockerized rails app with
    either MySQL or PostgreSQL in a separate container."
  
    method_option :env_vars, type: :hash, default: {}, desc: "Pass a list of environment variables like so: env:var", banner: "key1:value1 key2:value2"
    method_option :interactive, desc: "Set up your environment variables as you go."
    method_option :force, desc: "force over-write of existing files"

    map "greenfield::rails" => "greenfield_rails"
    
    def greenfield_rails(*args) 
      confirm_directory_empty
      configure_for_rollon
      copy_greenfield_files
      run_greenfield_commands
      rollon_rails(*args)
    end
        
    no_commands do
    
      def copy_greenfield_files
        @config.app['force'] = true
        src = 'rails/Dockerfile.greenfield.tt'
        dest = 'roro/containers/app/Dockerfile'
        template src, dest, @config.app
      end
      
      def run_greenfield_commands
        system "DOCKER_BUILDKIT=1 docker build --file roro/containers/app/Dockerfile --output . ."
      end      
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
roro-0.3.17 lib/roro/cli/greenfield/rails.rb
roro-0.3.16 lib/roro/cli/greenfield/rails.rb