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



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

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
  @thin
end

Instance Method Details

#stopObject

Stop the server - only used in test



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

def stop
  @thin.stop
end