Module: Isomorfeus::Puppetmaster

Defined in:
lib/isomorfeus/puppetmaster.rb,
lib/isomorfeus/puppetmaster/dsl.rb,
lib/isomorfeus/puppetmaster/node.rb,
lib/isomorfeus/puppetmaster/cookie.rb,
lib/isomorfeus/puppetmaster/errors.rb,
lib/isomorfeus/puppetmaster/iframe.rb,
lib/isomorfeus/puppetmaster/server.rb,
lib/isomorfeus/puppetmaster/request.rb,
lib/isomorfeus/puppetmaster/document.rb,
lib/isomorfeus/puppetmaster/response.rb,
lib/isomorfeus/puppetmaster/node/input.rb,
lib/isomorfeus/puppetmaster/node/select.rb,
lib/isomorfeus/puppetmaster/node/checkbox.rb,
lib/isomorfeus/puppetmaster/node/textarea.rb,
lib/isomorfeus/puppetmaster/server/checker.rb,
lib/isomorfeus/puppetmaster/console_message.rb,
lib/isomorfeus/puppetmaster/driver/puppeteer.rb,
lib/isomorfeus/puppetmaster/node/filechooser.rb,
lib/isomorfeus/puppetmaster/node/radiobutton.rb,
lib/isomorfeus/puppetmaster/self_forwardable.rb,
lib/isomorfeus/puppetmaster/server/middleware.rb,
lib/isomorfeus/puppetmaster/driver/puppeteer_node.rb,
lib/isomorfeus/puppetmaster/node/content_editable.rb,
lib/isomorfeus/puppetmaster/driver/puppeteer_document.rb,
lib/isomorfeus/puppetmaster/server/executor_middleware.rb

Defined Under Namespace

Modules: DSL, Driver, SelfForwardable Classes: CertificateError, Checkbox, ClientError, ConsoleMessage, ContentEditable, Cookie, DNSError, DOMException, Document, ElementNotFound, Error, ExecutionContextError, Filechooser, FrameNotFound, FrozenInTime, Iframe, Input, InvalidSelector, JavaScriptError, KeyError, MouseEventFailed, NoModalError, Node, NodeError, NotSupported, ObsoleteNode, Radiobutton, Request, Response, Select, Server, Textarea

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.appObject

Returns the value of attribute app.



4
5
6
# File 'lib/isomorfeus/puppetmaster.rb', line 4

def app
  @app
end

.download_pathObject



42
43
44
# File 'lib/isomorfeus/puppetmaster.rb', line 42

def download_path
  @download_path ||= Dir.pwd
end

.server_hostObject



66
67
68
# File 'lib/isomorfeus/puppetmaster.rb', line 66

def server_host
  @server_host ||= '127.0.0.1'
end

.server_portObject

Returns the value of attribute server_port.



4
5
6
# File 'lib/isomorfeus/puppetmaster.rb', line 4

def server_port
  @server_port
end

.server_schemeObject



70
71
72
# File 'lib/isomorfeus/puppetmaster.rb', line 70

def server_scheme
  @server_scheme ||= 'http'
end

.sessionObject

Returns the value of attribute session.



4
5
6
# File 'lib/isomorfeus/puppetmaster.rb', line 4

def session
  @session
end

Class Method Details

.block_source_code(&block) ⇒ Object



11
12
13
14
15
# File 'lib/isomorfeus/puppetmaster.rb', line 11

def block_source_code(&block)
  source_block = Parser::CurrentRuby.parse(block.source).children.last
  source_block = source_block.children.last if source_block.type == :block
  Unparser.unparse(source_block)
end

.boot_appObject



7
8
9
# File 'lib/isomorfeus/puppetmaster.rb', line 7

def boot_app
  @served_app = Isomorfeus::Puppetmaster::Server.new(app, port: server_port, host: server_host).boot
end

.driverObject



17
18
19
# File 'lib/isomorfeus/puppetmaster.rb', line 17

def driver
  @driver ||= :chromium
end

.driver=(drvr) ⇒ Object



21
22
23
24
# File 'lib/isomorfeus/puppetmaster.rb', line 21

def driver=(drvr)
  raise "#{drvr}: no such driver registered! Available drivers: #{drivers.keys.join(', ')}." unless drivers.key?(drvr)
  @driver = drvr
end

.driversObject



26
27
28
# File 'lib/isomorfeus/puppetmaster.rb', line 26

def drivers
  @drivers ||= {}
end

.opal_preludeObject



30
31
32
# File 'lib/isomorfeus/puppetmaster.rb', line 30

def opal_prelude
  @opal_prelude ||= build_opal_prelude
end

.register_driver(name, &block) ⇒ Object



34
35
36
# File 'lib/isomorfeus/puppetmaster.rb', line 34

def register_driver(name, &block)
  drivers[name.to_sym] = block
end

.register_server(name, &block) ⇒ Object



38
39
40
# File 'lib/isomorfeus/puppetmaster.rb', line 38

def register_server(name, &block)
  servers[name.to_sym] = block
end

.served_appObject



46
47
48
# File 'lib/isomorfeus/puppetmaster.rb', line 46

def served_app
  @served_app ||= boot_app
end

.serverObject



50
51
52
# File 'lib/isomorfeus/puppetmaster.rb', line 50

def server
  @server ||= :iodine
end

.server=(name) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/isomorfeus/puppetmaster.rb', line 54

def server=(name)
  raise "#{name}: no such server registered! Available drivers: #{servers.keys.join(', ')}." unless servers.key?(name)
  name, options = *name if name.is_a? Array
  @server = if name.respond_to? :call
              name
            elsif options
              proc { |app, port, host| servers[name.to_sym].call(app, port, host, options) }
            else
              servers[name.to_sym]
            end
end

.serversObject



74
75
76
# File 'lib/isomorfeus/puppetmaster.rb', line 74

def servers
  @servers ||= {}
end