diff --git a/Gemfile b/Gemfile index 12d280a..af379c3 100644 --- a/Gemfile +++ b/Gemfile @@ -7,3 +7,6 @@ gem 'capistrano-bundler' # ed25519 gem 'ed25519' gem 'bcrypt_pbkdf' + +# For previewing public directory locally with `bin/server` +gem 'webrick' diff --git a/Gemfile.lock b/Gemfile.lock index 8438f24..330b3f1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -34,6 +34,7 @@ GEM net-ssh (>= 2.8.0) ostruct stringio (3.1.2) + webrick (1.8.2) PLATFORMS ruby @@ -44,3 +45,7 @@ DEPENDENCIES capistrano-bundler ed25519 rdoc (>= 6.0.0.beta2) + webrick + +BUNDLED WITH + 2.5.17 diff --git a/README.md b/README.md index 060a9f9..6cdff93 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,15 @@ * https://github.com/ruby/rurema-search * https://github.com/rurema/generated-documents +## Previewing `public` directory locally + +1. Install dependencies: `bundle install` +2. Run: + ``` + bin/server + ``` +3. Open http://localhost:8000/ + ## Production Environment ### Capstrano diff --git a/bin/server b/bin/server new file mode 100755 index 0000000..a14c031 --- /dev/null +++ b/bin/server @@ -0,0 +1,6 @@ +#!/usr/bin/env ruby + +require "webrick" + +server = WEBrick::HTTPServer.new(Port: 8000, DocumentRoot: 'public') +server.start