Class: Cult::CLI::ConsoleContext

Inherits:
ProjectContext show all
Defined in:
lib/cult/cli/console_cmd.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ProjectContext

#method_missing

Constructor Details

#initialize(project, argv) ⇒ ConsoleContext

Returns a new instance of ConsoleContext.



15
16
17
18
19
20
21
# File 'lib/cult/cli/console_cmd.rb', line 15

def initialize(project, argv)
  @project = project
  # super(project)

  @original_argv = [$0, *argv]
  ENV['CULT_PROJECT'] = self.path
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Cult::ProjectContext

Instance Attribute Details

#original_argvObject

Returns the value of attribute original_argv.



12
13
14
# File 'lib/cult/cli/console_cmd.rb', line 12

def original_argv
  @original_argv
end

#projectObject (readonly)

Returns the value of attribute project.



14
15
16
# File 'lib/cult/cli/console_cmd.rb', line 14

def project
  @project
end

Instance Method Details

#cult(*argv) ⇒ Object



40
41
42
# File 'lib/cult/cli/console_cmd.rb', line 40

def cult(*argv)
  system $0, *argv
end

#load_rcObject



27
28
29
30
31
32
# File 'lib/cult/cli/console_cmd.rb', line 27

def load_rc
  consolerc = project.location_of(".cultconsolerc")

  # We don't `load' so the rc file has a more convenient context.
  eval File.read(consolerc) if File.exist?(consolerc)
end

#pathObject



23
24
25
# File 'lib/cult/cli/console_cmd.rb', line 23

def path
  project.path
end