class Replr::Stack::Node::REPLMaker

Creates a Ruby REPL using docker for a stack and libraries combo

Private Instance Methods

library_file_with(libraries) click to toggle source
# File lib/replr/stack/node/repl_maker.rb, line 32
def library_file_with(libraries)
  package_file = {
    name: "@#{docker_image_tag}",
    version: '1.0.0',
    description: 'Replr for Node',
    author: 'Vishnu Gopal <vishnugopal@users.noreply.github.com>',
    repository: 'https://github.com/vishnugopal/replr',
    license: 'MIT',
    scripts: {
      start: 'node replr-bootstrap.js'
    }
  }
  dependencies = {}
  libraries.each do |library|
    if library.include?(':')
      library, version = library.split(':')
      dependencies[library] = version
    else
      dependencies[library] = '*'
    end
  end
  package_file[:dependencies] = dependencies
  package_file.to_json
end
set_bootstrap_file_name() click to toggle source

It's optional to set a bootstrap file

# File lib/replr/stack/node/repl_maker.rb, line 19
def set_bootstrap_file_name
  @bootstrap_file_name = 'replr-bootstrap.js'
end
set_filter_lines_for_install() click to toggle source
# File lib/replr/stack/node/repl_maker.rb, line 27
def set_filter_lines_for_install
  @filter_matching_lines_for_install = [/packages/i, /download/i]
  @filter_not_matching_lines_for_install = []
end
set_library_file_name() click to toggle source
# File lib/replr/stack/node/repl_maker.rb, line 14
def set_library_file_name
  @library_file_name = 'package.json'
end
set_template_dir() click to toggle source
# File lib/replr/stack/node/repl_maker.rb, line 23
def set_template_dir
  @template_dir = __dir__
end