class Warg::Script

Constants

REMOTE_DIRECTORY

Attributes

content[R]
name[R]
remote_path[R]

Public Class Methods

new(script_name, context, defaults_path: nil) click to toggle source
# File lib/warg.rb, line 2154
def initialize(script_name, context, defaults_path: nil)
  command_name = Command::Name.from_relative_script_path(script_name)
  @name = command_name.script
  @context = context

  local_path = Pathname.new(@name)

  # FIXME: search parent directories for a defaults script
  defaults_path ||= File.join(local_path.dirname, "_defaults")
  @defaults = Template.find(defaults_path, fail_if_missing: false)

  @template = Template.find(local_path.to_s)

  @remote_path = REMOTE_DIRECTORY.join(local_path)
end

Public Instance Methods

install_directory() click to toggle source
# File lib/warg.rb, line 2178
def install_directory
  @remote_path.dirname
end
install_path() click to toggle source
# File lib/warg.rb, line 2182
def install_path
  @remote_path.relative_path_from Pathname.new("$HOME")
end
to_s() click to toggle source
# File lib/warg.rb, line 2186
def to_s
  name.dup
end