Class: Kharites::Base

Inherits:
Object
  • Object
show all
Includes:
SetupMixin
Defined in:
lib/kharites/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SetupMixin

#generate

Constructor Details

#initialize(base_dir) ⇒ Base

Returns a new instance of Base.



11
12
13
14
15
16
17
18
19
# File 'lib/kharites/base.rb', line 11

def initialize(base_dir)
  @current_page = nil
  @current_file_stack = []
  @base_dir = base_dir
  @src_dir = File.join(@base_dir, "views")
  @site_dir = File.join(@base_dir, "public")            
  @scope = Object.new
  @scope.instance_variable_set("@kharites", self)
end

Instance Attribute Details

#current_pageObject (readonly)

Returns the value of attribute current_page.



5
6
7
# File 'lib/kharites/base.rb', line 5

def current_page
  @current_page
end

#site_dirObject (readonly)

Returns the value of attribute site_dir.



5
6
7
# File 'lib/kharites/base.rb', line 5

def site_dir
  @site_dir
end

#src_dirObject (readonly)

Returns the value of attribute src_dir.



5
6
7
# File 'lib/kharites/base.rb', line 5

def src_dir
  @src_dir
end

Instance Method Details

#base_dirObject



21
22
23
# File 'lib/kharites/base.rb', line 21

def base_dir
  @base_dir
end

#current_fileObject



7
8
9
# File 'lib/kharites/base.rb', line 7

def current_file
  @current_file_stack[0] || ""
end

#run(command) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/kharites/base.rb', line 25

def run(command)
  puts "Article root is: #{@base_dir}"
  
  if %w(sync generate server console).include?(command)
    send(command)
  else
    puts "#{command} is not a valid Kharites command"
  end
end