Class: MonkeysPaw::Application

Inherits:
Object
  • Object
show all
Defined in:
lib/monkeyspaw/application.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeApplication

Returns a new instance of Application.



8
9
10
11
12
13
14
15
# File 'lib/monkeyspaw/application.rb', line 8

def initialize
  @config = Config.new
  @root = Pathname.new(Dir.pwd)
  @server = nil
  @router = nil
  @prompt_manager = nil
  @cache_manager = nil
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



5
6
7
# File 'lib/monkeyspaw/application.rb', line 5

def config
  @config
end

#rootObject

Returns the value of attribute root.



6
7
8
# File 'lib/monkeyspaw/application.rb', line 6

def root
  @root
end

#routerObject

Returns the value of attribute router.



6
7
8
# File 'lib/monkeyspaw/application.rb', line 6

def router
  @router
end

Instance Method Details

#assets_dirObject



55
56
57
# File 'lib/monkeyspaw/application.rb', line 55

def assets_dir
  root.join(config.assets_dir || 'assets')
end

#cache_managerObject



21
22
23
# File 'lib/monkeyspaw/application.rb', line 21

def cache_manager
  @cache_manager ||= CacheManager.new(self)
end

#components_dirObject



51
52
53
# File 'lib/monkeyspaw/application.rb', line 51

def components_dir
  root.join(config.components_dir || 'components')
end

#configure {|config| ... } ⇒ Object

Yields:



25
26
27
28
# File 'lib/monkeyspaw/application.rb', line 25

def configure
  yield config if block_given?
  self
end

#get_component_prompt(path) ⇒ Object



63
64
65
# File 'lib/monkeyspaw/application.rb', line 63

def get_component_prompt(path)
  @prompt_manager.get_component_prompt(path)
end

#get_page_prompt(path) ⇒ Object



59
60
61
# File 'lib/monkeyspaw/application.rb', line 59

def get_page_prompt(path)
  @prompt_manager.get_page_prompt(path)
end

#pages_dirObject



47
48
49
# File 'lib/monkeyspaw/application.rb', line 47

def pages_dir
  root.join(config.pages_dir || 'wishes')
end

#pick_up!(**options) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/monkeyspaw/application.rb', line 34

def pick_up!(**options)
  setup_directories
  apply_ai_configuration

  @router ||= Router.new(self)

  # Initialize prompt manager
  prompt_manager

  @server ||= Server.new(self, **options)
  @server.start
end

#prompt_managerObject



17
18
19
# File 'lib/monkeyspaw/application.rb', line 17

def prompt_manager
  @prompt_manager ||= PromptManager.new(self)
end

#use(provider, **options) ⇒ Object



30
31
32
# File 'lib/monkeyspaw/application.rb', line 30

def use(provider, **options)
  puts "Use called"
end