Class: Kharites::Base
- Inherits:
-
Object
- Object
- Kharites::Base
- Includes:
- SetupMixin
- Defined in:
- lib/kharites/base.rb
Instance Attribute Summary collapse
-
#current_page ⇒ Object
readonly
Returns the value of attribute current_page.
-
#site_dir ⇒ Object
readonly
Returns the value of attribute site_dir.
-
#src_dir ⇒ Object
readonly
Returns the value of attribute src_dir.
Instance Method Summary collapse
- #base_dir ⇒ Object
- #current_file ⇒ Object
-
#initialize(base_dir) ⇒ Base
constructor
A new instance of Base.
- #run(command) ⇒ Object
Methods included from SetupMixin
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_page ⇒ Object (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_dir ⇒ Object (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_dir ⇒ Object (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_dir ⇒ Object
21 22 23 |
# File 'lib/kharites/base.rb', line 21 def base_dir @base_dir end |
#current_file ⇒ Object
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 |