class TabelogUsRecipe < Launcher::Recipes::Base
  include Launcher::Operation

  def run
    setup_ruby('2.0.0-p594')
    bundle_setup
    setup_database
    setup_solr
  end

  private

  def setup_database
    logger.info 'Setup database'
    `cd #{project_path} && bin/rake db:create`
    `cd #{project_path} && bin/rake db:migrate`
  end

  def bundle_setup
    logger.info 'Setup bundle'
    `gem install bundler`
    binding.pry
    `cd #{project_path} && bundle install`
  end

  def setup_solr
    logger.info 'Setup solr'
    `cd #{project_path} && bin/rake sunspot:solr:start`
    `cd #{project_path} && bin/rake dev:setup:init_solr_xml`
  end

  def project_path
    "$HOME/Projects/tabelog_us"
  end
end
