Class: Gloo::App::Settings

Inherits:
Object
  • Object
show all
Defined in:
lib/gloo/app/settings.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(engine, root = nil) ⇒ Settings

Load setting from the yml file. The mode parameter is used to determine if we are running in TEST.



22
23
24
25
26
27
28
29
# File 'lib/gloo/app/settings.rb', line 22

def initialize( engine, root=nil )
  @engine = engine
  # @mode = mode
  init_root( root )

  init_path_settings
  
end

Instance Attribute Details

#config_pathObject (readonly)

Returns the value of attribute config_path.



13
14
15
# File 'lib/gloo/app/settings.rb', line 13

def config_path
  @config_path
end

#debugObject (readonly)

Returns the value of attribute debug.



13
14
15
# File 'lib/gloo/app/settings.rb', line 13

def debug
  @debug
end

#debug_pathObject (readonly)

Returns the value of attribute debug_path.



13
14
15
# File 'lib/gloo/app/settings.rb', line 13

def debug_path
  @debug_path
end

#ext_pathObject (readonly)

Returns the value of attribute ext_path.



13
14
15
# File 'lib/gloo/app/settings.rb', line 13

def ext_path
  @ext_path
end

#list_indentObject (readonly)

Returns the value of attribute list_indent.



13
14
15
# File 'lib/gloo/app/settings.rb', line 13

def list_indent
  @list_indent
end

#list_levelsObject (readonly)

Returns the value of attribute list_levels.



13
14
15
# File 'lib/gloo/app/settings.rb', line 13

def list_levels
  @list_levels
end

#log_pathObject (readonly)

Returns the value of attribute log_path.



13
14
15
# File 'lib/gloo/app/settings.rb', line 13

def log_path
  @log_path
end

#project_pathObject (readonly)

Returns the value of attribute project_path.



13
14
15
# File 'lib/gloo/app/settings.rb', line 13

def project_path
  @project_path
end

#start_withObject (readonly)

Returns the value of attribute start_with.



13
14
15
# File 'lib/gloo/app/settings.rb', line 13

def start_with
  @start_with
end

#tmp_pathObject (readonly)

Returns the value of attribute tmp_path.



13
14
15
# File 'lib/gloo/app/settings.rb', line 13

def tmp_path
  @tmp_path
end

#user_rootObject (readonly)

Returns the value of attribute user_root.



13
14
15
# File 'lib/gloo/app/settings.rb', line 13

def user_root
  @user_root
end

Class Method Details

.cols(engine) ⇒ Object

Get the number of horizontal columns on screen.



69
70
71
# File 'lib/gloo/app/settings.rb', line 69

def self.cols engine
  engine.platform.cols
end

.lines(engine) ⇒ Object

Get the number of vertical lines on screen.



62
63
64
# File 'lib/gloo/app/settings.rb', line 62

def self.lines engine
  engine.platform.lines
end

.page_size(engine) ⇒ Object

Get the default page size. This is the number of lines of text we can show.



77
78
79
# File 'lib/gloo/app/settings.rb', line 77

def self.page_size engine
  Settings.lines( engine ) - 3
end

.preview_linesObject

How many lines should we use for a preview?



84
85
86
# File 'lib/gloo/app/settings.rb', line 84

def self.preview_lines
  return 7
end

Instance Method Details

#override_project_path(path) ⇒ Object

Running in app mode, so overriding the root project path.



95
96
97
98
99
# File 'lib/gloo/app/settings.rb', line 95

def override_project_path path
  @engine.log.debug "Root project path is #{path}"

  @project_path = path
end

#showObject

Show the current application settings. Can be seen in app with ‘help settings’



35
36
37
38
39
40
41
42
43
44
# File 'lib/gloo/app/settings.rb', line 35

def show
  puts "\n Application Settings:".blue
  puts '   Startup with:  '.yellow + @start_with.white
  puts '   Indent in Listing:  '.yellow + @list_indent.to_s.white
  puts '   List Levels:  '.yellow + @list_levels.to_s.white
  puts '   Debug?  '.yellow + @debug.to_s.white
  puts '   Screen Lines:  '.yellow + Gloo::App::Settings.lines( @engine ).to_s.white
  puts '   Page Size:  '.yellow + Gloo::App::Settings.page_size( @engine ).to_s.white
  self.show_paths
end

#show_pathsObject

Show path settings



49
50
51
52
53
54
55
56
57
# File 'lib/gloo/app/settings.rb', line 49

def show_paths
  puts "\n Application Paths:".blue
  puts '   User Root Path is here:  '.yellow + @user_root.white
  puts '   Projects Path:  '.yellow + @project_path.white
  puts '   Extensions Path:  '.yellow + @ext_path.white
  puts '   Tmp Path:  '.yellow + @tmp_path.white
  puts '   Debug Path:  '.yellow + @debug_path.white
  puts "\n"
end