Class: FeduxOrgStdlib::Rake::WebserverTask

Inherits:
Task
  • Object
show all
Defined in:
lib/fedux_org_stdlib/rake/webserver_task.rb

Overview

Webserver Task

See Also:

  • Rakefile

Instance Attribute Summary collapse

Attributes inherited from Task

#description, #name, #verbose, #verbose (true)

Instance Method Summary collapse

Methods inherited from Task

#include, #instance_binding

Constructor Details

#initialize(directory: File.expand_path('utils/server'), repository_url: 'https://github.com/dg-ratiodata/local_webserver', build_directory: Dir.mktmpdir('webserver'), build_script: 'build.sh', **args) ⇒ WebserverTask

Create a new webserver task

Examples:

Create new task

FeduxOrgStdlib::Rake::WebserverTask.new

Parameters:

  • directory (String) (defaults to: File.expand_path('utils/server'))

    The directory where the generated server should be stored

  • repository_url (String) (defaults to: 'https://github.com/dg-ratiodata/local_webserver')

    The url which should be used to fetch the remote repository

  • build_directory (Array) (defaults to: Dir.mktmpdir('webserver'))

    (/tmp/webserver.xxx) The directory where the executables should be build

  • build_script (Array) (defaults to: 'build.sh')

    (build.sh) The script which should be used to build the executables



32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/fedux_org_stdlib/rake/webserver_task.rb', line 32

def initialize(
  directory: File.expand_path('utils/server'),
  repository_url: 'https://github.com/dg-ratiodata/local_webserver',
  build_directory: Dir.mktmpdir('webserver'),
  build_script: 'build.sh',
  **args
)
  super(**args)

  @repository      = FeduxOrgStdlib::RemoteRepository.new(repository_url)
  @directory       = File.expand_path(directory)
  @build_directory = File.expand_path(build_directory)
  @build_script    = build_script
end

Instance Attribute Details

#build_directoryObject (readonly)

Returns the value of attribute build_directory.



17
18
19
# File 'lib/fedux_org_stdlib/rake/webserver_task.rb', line 17

def build_directory
  @build_directory
end

#directoryObject (readonly)

Returns the value of attribute directory.



17
18
19
# File 'lib/fedux_org_stdlib/rake/webserver_task.rb', line 17

def directory
  @directory
end

#reportObject (readonly)

The report to be generated



17
# File 'lib/fedux_org_stdlib/rake/webserver_task.rb', line 17

attr_reader :repository, :build_directory, :directory

#repositoryObject (readonly)

Returns the value of attribute repository.



17
18
19
# File 'lib/fedux_org_stdlib/rake/webserver_task.rb', line 17

def repository
  @repository
end

Instance Method Details

#run_task(_verbose) ⇒ Object



48
49
50
51
52
53
# File 'lib/fedux_org_stdlib/rake/webserver_task.rb', line 48

def run_task(_verbose)
  create_build_directory
  fetch_repository
  build_server
  copy_files_to_destination_directory
end