You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Rakefile 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. require 'dotenv/load'
  2. require 'sassc'
  3. require_relative './db/migrate'
  4. require_relative './db/scrape'
  5. task 'migrate' do
  6. migrate
  7. end
  8. task 'scrape' do
  9. should_log = ENV['APP_ENV'] == 'development' || ARGV.include?('--log')
  10. scraper = Scraper.new(log: should_log)
  11. scraper.scrape
  12. end
  13. task 'build' do
  14. scss = File.read('./web/assets/style.scss')
  15. css = SassC::Engine.new(scss, style: :compressed).render
  16. puts 'Writing web/public/style.css'
  17. File.write('./web/public/style.css', css)
  18. js = File.read('./web/assets/script.js')
  19. puts 'Writing web/public/script.js'
  20. File.write('./web/public/script.js', js)
  21. end
  22. task 'deploy' do
  23. username = ENV['PROD_USERNAME']
  24. hostname = ENV['PROD_HOSTNAME']
  25. puts `rsync -rv ./db/*.rb #{username}@#{hostname}:/var/www/vlv-search/`
  26. puts `rsync -rv ./lib #{username}@#{hostname}:/var/www/vlv-search/`
  27. puts `rsync -rv ./web #{username}@#{hostname}:/var/www/vlv-search/`
  28. puts `rsync -rv ./Rakefile #{username}@#{hostname}:/var/www/vlv-search/`
  29. puts `rsync -rv ./Gemfile #{username}@#{hostname}:/var/www/vlv-search/`
  30. puts `rsync -rv ./Gemfile.lock #{username}@#{hostname}:/var/www/vlv-search/`
  31. puts `ssh -t #{username}@#{hostname} 'bash -ic ". .profile; cd /var/www/vlv-search; rake build;"'`
  32. puts `ssh -t #{username}@#{hostname} 'bash -ic ". .profile; ~/restart-unicorn"'`
  33. end