Sha256: 14df04ca197c0b5dd2d1003dc275433fbffdd4ae57f236224c80b2678287a012

Contents?: true

Size: 1.72 KB

Versions: 4

Compression:

Stored size: 1.72 KB

Contents

#!/usr/bin/env ruby
require 'pathname'

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

def run(name, file_which_must_not_exist = nil)
  unless file_which_must_not_exist && File.exist?(file_which_must_not_exist)
    puts "== #{name} =="
    yield
    puts
  end
end

def install_or_update_gem(gem)
  if ENV['UPDATE']
    system "gem install #{gem}"
  else
    system "which #{gem.gsub('_', '-')} || gem install #{gem}"
  end
end

Dir.chdir APP_ROOT do
  run 'Installing dependencies' do
    system 'gem install bundler --conservative'
    system 'bundle check || bundle install --jobs=3 --retry=3'
    install_or_update_gem('pry')
    install_or_update_gem('rubocop')
    install_or_update_gem('reek')
    install_or_update_gem('filewatcher')
  end

  run 'Installing JS dependencies' do
    system 'which coffeelint || npm install -g coffeelint'
    system 'which tsc || npm install -g typescript'
    system 'which tslint || npm install -g tslint'
  end

  run 'Copying config/application.yml', 'config/application.yml' do
    system 'cp config/application.example.yml config/application.yml'
  end

  run('Preparing database') do
    system 'bin/rake db:version >> /dev/null 2>&1 || bin/rake db:create:all && bin/rake db:setup'
  end

  run 'Removing old logs and tempfiles' do
    system 'rm -f log/*'
    system 'rm -rf tmp/cache'
  end

  run 'Creating pre-commit hook link', '.git/hooks/pre-commit' do
    system 'ln -s ../../bin/check .git/hooks/pre-commit'
  end

  run('Setting dev host in /etc/hosts') do
    system 'grep \'<appname>.dev\' /etc/hosts || echo \'127.0.0.1 <appname>.dev\' | sudo tee -a /etc/hosts'
  end

  run('Running checks') { abort('bin/check failed') unless system('bin/check') }
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
renuo-bin-check-1.0.0.beta2 bin/setup
renuo-bin-check-1.0.0.beta1 bin/setup
renuo-bin-check-0.2.1 bin/setup
renuo-bin-check-0.2.0 bin/setup