datarockets / rails_apps_composer

A gem with recipes to create Rails application templates for Rails starter apps.
http://railsapps.github.io/rails_apps_composer/
0 stars 0 forks source link

Setup and Update scripts #19

Closed AleksSenkou closed 7 years ago

AleksSenkou commented 7 years ago

Main Idea

Scripts for setup and update of current projects' state.

Purpose

Changes

#!/usr/bin/env ruby
require "pathname"
require "fileutils"
include FileUtils

# path to your application root.
APP_ROOT = Pathname.new File.expand_path("../../", __FILE__)

def system!(*args)
  system(*args) || abort("\n== Command #{args} failed ==")
end

chdir APP_ROOT do
  puts "== Installing dependencies =="
  system! "gem install bundler --conservative"
  system("bundle check") || system!("bundle install --path vendor/bundle")

  puts "\n== Preparing database =="
  system! "bin/rails db:setup"

  puts "\n== DONE =="
end
#!/usr/bin/env ruby
require 'pathname'
require 'fileutils'
include FileUtils

# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)

def system!(*args)
  system(*args) || abort("\n== Command #{args} failed ==")
end

chdir APP_ROOT do
  puts "== Installing dependencies =="
  system! "gem install bundler --conservative"
  system("bundle check") || system!("bundle install --path vendor/bundle")

  puts "\n== Updating database =="
  system! 'bin/rails db:migrate'

  puts "\n== Removing old logs and tempfiles =="
  system! 'bin/rails log:clear tmp:clear'

  puts "\n== DONE =="
end

Examples

P.S. Ping me if you are not agree, or have better idea.
roman-dubrovsky commented 7 years ago

@AleksSenkou 👍

MProG commented 7 years ago

@AleksSenkou Whats problem with current version? I see only --path vendor/bundle. clean logs in setup normal

AleksSenkou commented 7 years ago

I see only --path vendor/bundle, clean logs in setup normal

@MProG yeah, lets change it

AleksSenkou commented 7 years ago

@MProG Seems like you've finished here