Class: GrokCLI::Docker::Rails::Setup

Inherits:
Object
  • Object
show all
Defined in:
lib/grok_cli/docker/rails/setup.rb

Instance Method Summary collapse

Constructor Details

#initialize(config = GrokCLI::Docker::Configuration.new) ⇒ Setup

Returns a new instance of Setup.



3
4
5
# File 'lib/grok_cli/docker/rails/setup.rb', line 3

def initialize(config = GrokCLI::Docker::Configuration.new)
  @config = config
end

Instance Method Details

#executeObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/grok_cli/docker/rails/setup.rb', line 7

def execute
  system <<~CMD

    docker-machine create #{@config.machine_name} --driver virtualbox

    eval "$(docker-machine env #{@config.machine_name})"

    docker-compose build
    docker-compose run --rm web bundle install --jobs 16
    docker-compose run --rm web bundle exec rake db:create db:migrate db:populate
    docker-compose run --rm web bundle exec rake db:create db:migrate RAILS_ENV=test

  CMD
end