| 
42
 | 
     1 #!/usr/bin/env ruby
 | 
| 
214
 | 
     2 require "fileutils"
 | 
| 
42
 | 
     3 
 | 
| 
223
 | 
     4 APP_ROOT = File.expand_path("..", __dir__)
 | 
| 
254
 | 
     5 APP_NAME = "rsstweet"
 | 
| 
42
 | 
     6 
 | 
| 
72
 | 
     7 def system!(*args)
 | 
| 
254
 | 
     8   system(*args, exception: true)
 | 
| 
72
 | 
     9 end
 | 
| 
 | 
    10 
 | 
| 
185
 | 
    11 FileUtils.chdir APP_ROOT do
 | 
| 
214
 | 
    12   # This script is a way to set up or update your development environment automatically.
 | 
| 
 | 
    13   # This script is idempotent, so that you can run it at any time and get an expectable outcome.
 | 
| 
72
 | 
    14   # Add necessary setup steps to this file.
 | 
| 
42
 | 
    15 
 | 
| 
223
 | 
    16   puts "== Installing dependencies =="
 | 
| 
 | 
    17   system! "gem install bundler --conservative"
 | 
| 
 | 
    18   system("bundle check") || system!("bundle install")
 | 
| 
42
 | 
    19 
 | 
| 
 | 
    20   puts "\n== Removing old logs and tempfiles =="
 | 
| 
223
 | 
    21   system! "bin/rails log:clear tmp:clear"
 | 
| 
42
 | 
    22 
 | 
| 
 | 
    23   puts "\n== Restarting application server =="
 | 
| 
223
 | 
    24   system! "bin/rails restart"
 | 
| 
254
 | 
    25 
 | 
| 
 | 
    26   # puts "\n== Configuring puma-dev =="
 | 
| 
 | 
    27   # system "ln -nfs #{APP_ROOT} ~/.puma-dev/#{APP_NAME}"
 | 
| 
 | 
    28   # system "curl -Is https://#{APP_NAME}.test/up | head -n 1"
 | 
| 
42
 | 
    29 end
 |