Sha256: 30134230b8bf725a6e6f3e83d25317783cab50a5aaa1a4fc58879e0ef299a3fe

Contents?: true

Size: 714 Bytes

Versions: 1

Compression:

Stored size: 714 Bytes

Contents

# reload views and files

require_relative "../../lib/nyara"

if ENV['RELOAD_ROOT']
  configure do
    set :logger, false
  end
else
  puts "running outside spec, ENV['RELOAD_ROOT'] is nil, creating root dir"
  require 'tmpdir'
  require 'pry'
  ENV['RELOAD_ROOT'] = Dir.mktmpdir 'root'
  Dir.mkdir ENV['RELOAD_ROOT'] + '/views'
  File.open ENV['RELOAD_ROOT'] + '/reloadee.rb', 'w' do |f|
    f << "RELOADEE = 1"
  end
  File.open ENV['RELOAD_ROOT'] + '/views/index.slim', 'w' do |f|
    f << "== 1"
  end
end

configure do
  set :port, 3004
  set :root, ENV['RELOAD_ROOT']
  require project_path "reloadee.rb"
  set :watch, true
end

get '/views' do
  render 'index'
end

get '/app' do
  send_string RELOADEE
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nyara-0.1.pre.2 spec/apps/reload.rb