Class: Zine::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/zine/server.rb

Overview

Local preview web server

Instance Method Summary collapse

Constructor Details

#initialize(rel_path_build, upload_options, delete_array, upload_array) ⇒ Server

Create a new instance of Server, used to preview the built site locally

Attributes

  • rel_path_build - string, relative path to the build folder

  • upload_options - hash created from the upload section of zine.yaml

  • delete_array - array of path strings of files to delete

  • upload_array - ditto for files to upload, both can include duplicates



21
22
23
24
25
26
27
28
# File 'lib/zine/server.rb', line 21

def initialize(rel_path_build, upload_options, delete_array, upload_array)
  @delete_array = delete_array
  @upload_array = upload_array
  @thin = create_server File.absolute_path(rel_path_build)
  motd unless upload_options['test']
  @thin.start
  possible_upload rel_path_build, upload_options
end

Instance Method Details

#stopObject

Stop the server - only used in test



31
32
33
# File 'lib/zine/server.rb', line 31

def stop
  @thin.stop
end