gloo 0.7.6 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. checksums.yaml +4 -4
  2. data/.DS_Store +0 -0
  3. data/Gemfile.lock +46 -39
  4. data/LICENSE.txt +1 -1
  5. data/gloo.gemspec +12 -6
  6. data/lib/VERSION +1 -1
  7. data/lib/dependencies.rb +28 -0
  8. data/lib/gloo/app/info.rb +3 -1
  9. data/lib/gloo/app/log.rb +1 -29
  10. data/lib/gloo/app/platform.rb +142 -0
  11. data/lib/gloo/objs/cli/banner.rb +2 -2
  12. data/lib/gloo/objs/cli/bar.rb +4 -4
  13. data/lib/gloo/objs/cli/colorize.rb +3 -3
  14. data/lib/gloo/objs/cli/confirm.rb +3 -3
  15. data/lib/gloo/objs/cli/menu.rb +9 -9
  16. data/lib/gloo/objs/cli/menu_item.rb +2 -2
  17. data/lib/gloo/objs/cli/pastel.rb +2 -2
  18. data/lib/gloo/objs/cli/prompt.rb +4 -4
  19. data/lib/gloo/objs/cli/select.rb +4 -4
  20. data/lib/gloo/objs/dev/git.rb +7 -7
  21. data/lib/gloo/objs/dev/stats.rb +8 -5
  22. data/lib/gloo/objs/snd/play.rb +1 -1
  23. data/lib/gloo/objs/snd/say.rb +2 -2
  24. data/lib/gloo/objs/system/file_handle.rb +9 -9
  25. data/lib/gloo/objs/system/ssh_exec.rb +3 -3
  26. data/lib/gloo/objs/system/system.rb +2 -2
  27. data/lib/gloo/verbs/alert.rb +7 -7
  28. data/lib/gloo/verbs/beep.rb +1 -1
  29. data/lib/gloo/verbs/cls.rb +2 -2
  30. data/lib/gloo.rb +7 -7
  31. data/lib/run.rb +7 -5
  32. metadata +42 -147
  33. data/lib/gloo/app/args.rb +0 -112
  34. data/lib/gloo/app/engine.rb +0 -230
  35. data/lib/gloo/app/help.rb +0 -156
  36. data/lib/gloo/app/mode.rb +0 -27
  37. data/lib/gloo/app/settings.rb +0 -186
  38. data/lib/gloo/convert/converter.rb +0 -35
  39. data/lib/gloo/convert/string_to_datetime.rb +0 -21
  40. data/lib/gloo/convert/string_to_decimal.rb +0 -20
  41. data/lib/gloo/convert/string_to_integer.rb +0 -20
  42. data/lib/gloo/core/baseo.rb +0 -28
  43. data/lib/gloo/core/dictionary.rb +0 -181
  44. data/lib/gloo/core/error.rb +0 -61
  45. data/lib/gloo/core/event_manager.rb +0 -44
  46. data/lib/gloo/core/factory.rb +0 -210
  47. data/lib/gloo/core/gloo_system.rb +0 -266
  48. data/lib/gloo/core/heap.rb +0 -52
  49. data/lib/gloo/core/here.rb +0 -36
  50. data/lib/gloo/core/it.rb +0 -36
  51. data/lib/gloo/core/literal.rb +0 -30
  52. data/lib/gloo/core/obj.rb +0 -305
  53. data/lib/gloo/core/obj_finder.rb +0 -30
  54. data/lib/gloo/core/op.rb +0 -40
  55. data/lib/gloo/core/parser.rb +0 -59
  56. data/lib/gloo/core/pn.rb +0 -188
  57. data/lib/gloo/core/tokens.rb +0 -165
  58. data/lib/gloo/core/verb.rb +0 -86
  59. data/lib/gloo/exec/action.rb +0 -48
  60. data/lib/gloo/exec/dispatch.rb +0 -40
  61. data/lib/gloo/exec/exec_env.rb +0 -74
  62. data/lib/gloo/exec/runner.rb +0 -45
  63. data/lib/gloo/exec/script.rb +0 -49
  64. data/lib/gloo/exec/stack.rb +0 -78
  65. data/lib/gloo/expr/expression.rb +0 -118
  66. data/lib/gloo/expr/l_boolean.rb +0 -36
  67. data/lib/gloo/expr/l_decimal.rb +0 -39
  68. data/lib/gloo/expr/l_integer.rb +0 -37
  69. data/lib/gloo/expr/l_string.rb +0 -58
  70. data/lib/gloo/expr/op_div.rb +0 -22
  71. data/lib/gloo/expr/op_minus.rb +0 -22
  72. data/lib/gloo/expr/op_mult.rb +0 -22
  73. data/lib/gloo/expr/op_plus.rb +0 -24
  74. data/lib/gloo/objs/basic/alias.rb +0 -78
  75. data/lib/gloo/objs/basic/boolean.rb +0 -120
  76. data/lib/gloo/objs/basic/container.rb +0 -76
  77. data/lib/gloo/objs/basic/decimal.rb +0 -76
  78. data/lib/gloo/objs/basic/integer.rb +0 -73
  79. data/lib/gloo/objs/basic/script.rb +0 -99
  80. data/lib/gloo/objs/basic/string.rb +0 -77
  81. data/lib/gloo/objs/basic/text.rb +0 -87
  82. data/lib/gloo/objs/basic/untyped.rb +0 -41
  83. data/lib/gloo/objs/ctrl/each.rb +0 -279
  84. data/lib/gloo/objs/ctrl/repeat.rb +0 -108
  85. data/lib/gloo/objs/data/markdown.rb +0 -84
  86. data/lib/gloo/objs/data/mysql.rb +0 -192
  87. data/lib/gloo/objs/data/query.rb +0 -176
  88. data/lib/gloo/objs/data/sqlite.rb +0 -159
  89. data/lib/gloo/objs/data/table.rb +0 -140
  90. data/lib/gloo/objs/dt/date.rb +0 -50
  91. data/lib/gloo/objs/dt/datetime.rb +0 -62
  92. data/lib/gloo/objs/dt/time.rb +0 -50
  93. data/lib/gloo/objs/ror/erb.rb +0 -116
  94. data/lib/gloo/objs/ror/eval.rb +0 -107
  95. data/lib/gloo/objs/web/http_get.rb +0 -159
  96. data/lib/gloo/objs/web/http_post.rb +0 -183
  97. data/lib/gloo/objs/web/json.rb +0 -135
  98. data/lib/gloo/objs/web/slack.rb +0 -130
  99. data/lib/gloo/objs/web/teams.rb +0 -117
  100. data/lib/gloo/objs/web/uri.rb +0 -148
  101. data/lib/gloo/persist/file_loader.rb +0 -191
  102. data/lib/gloo/persist/file_saver.rb +0 -49
  103. data/lib/gloo/persist/file_storage.rb +0 -45
  104. data/lib/gloo/persist/line_splitter.rb +0 -81
  105. data/lib/gloo/persist/persist_man.rb +0 -120
  106. data/lib/gloo/utils/format.rb +0 -21
  107. data/lib/gloo/utils/stats.rb +0 -205
  108. data/lib/gloo/utils/words.rb +0 -19
  109. data/lib/gloo/verbs/context.rb +0 -62
  110. data/lib/gloo/verbs/create.rb +0 -68
  111. data/lib/gloo/verbs/execute.rb +0 -56
  112. data/lib/gloo/verbs/help.rb +0 -264
  113. data/lib/gloo/verbs/if.rb +0 -92
  114. data/lib/gloo/verbs/list.rb +0 -98
  115. data/lib/gloo/verbs/load.rb +0 -45
  116. data/lib/gloo/verbs/move.rb +0 -89
  117. data/lib/gloo/verbs/put.rb +0 -94
  118. data/lib/gloo/verbs/quit.rb +0 -40
  119. data/lib/gloo/verbs/run.rb +0 -75
  120. data/lib/gloo/verbs/save.rb +0 -39
  121. data/lib/gloo/verbs/show.rb +0 -64
  122. data/lib/gloo/verbs/tell.rb +0 -79
  123. data/lib/gloo/verbs/unless.rb +0 -92
  124. data/lib/gloo/verbs/version.rb +0 -37
  125. data/lib/gloo/verbs/wait.rb +0 -42
data/lib/gloo/app/help.rb DELETED
@@ -1,156 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
3
- #
4
- # Help system.
5
- #
6
-
7
- require 'tty-markdown'
8
- require 'tty-pager'
9
-
10
- module Gloo
11
- module App
12
- class Help
13
-
14
- APPLICATION = 'application'.freeze
15
-
16
- attr_accessor :topics
17
-
18
- #
19
- # Set up the help system.
20
- # We won't load help topics until we know we need them.
21
- #
22
- def initialize
23
- @topics = nil
24
- end
25
-
26
- #
27
- # Show application help.
28
- # This is the what is shown when help is run from the CLI.
29
- #
30
- def show_app_help
31
- puts Info.display_title unless $engine.args.quiet?
32
- self.show_topic APPLICATION
33
- end
34
-
35
- #
36
- # Check to see if there is a topic by the given name.
37
- #
38
- def topic?( name )
39
- lazy_load_index
40
-
41
- return @topics.key?( name )
42
- end
43
-
44
- #
45
- # Is the current topic Markdown?
46
- #
47
- def topic_is_md?( name )
48
- lazy_load_index
49
-
50
- topic_file = @topics[ name ]
51
- return topic_file.end_with? '.md'
52
- end
53
-
54
- #
55
- # Show a help topic, optionally paginaged.
56
- # If the content of the help page fits on a single
57
- # screen, it won't paginate.
58
- #
59
- def page_topic( topic )
60
- return if $engine.args.quiet?
61
-
62
- data = self.get_topic_data( topic )
63
- page = data.lines.count > Settings.page_size
64
- if topic_is_md?( topic )
65
- show_markdown_data( data, page )
66
- else
67
- show_text_data( data, page )
68
- end
69
- end
70
-
71
- #
72
- # Show a help topic.
73
- #
74
- def show_topic( topic )
75
- return if $engine.args.quiet?
76
-
77
- data = self.get_topic_data( topic )
78
- if topic_is_md?( topic )
79
- show_markdown_data data
80
- else
81
- show_text_data data
82
- end
83
- end
84
-
85
- #
86
- # Show the markdown data.
87
- #
88
- def show_text_data( data, page = false )
89
- if page
90
- pager = TTY::Pager.new
91
- pager.page( data )
92
- else
93
- puts data.white
94
- puts
95
- end
96
- end
97
-
98
- #
99
- # Show the markdown data.
100
- #
101
- def show_markdown_data( data, page = false )
102
- md = TTY::Markdown.parse data
103
-
104
- if page
105
- pager = TTY::Pager.new
106
- pager.page( md )
107
- else
108
- puts md
109
- puts
110
- end
111
- end
112
-
113
- #
114
- # Get topic data.
115
- #
116
- def get_topic_data( topic )
117
- lazy_load_index
118
-
119
- topic_file = @topics[ topic ]
120
- return nil unless topic_file
121
-
122
- File.read topic_file
123
- end
124
-
125
- #
126
- # Lazy load topic index.
127
- # We'll only load the index the first time a help topic
128
- # is requested. After that we'll use the cached index.
129
- #
130
- def lazy_load_index
131
- return if @topics
132
-
133
- @topics = {}
134
- $log.debug 'loading help file index...'
135
-
136
- pn = File.dirname( File.absolute_path( __FILE__ ) )
137
- pn = File.dirname( pn )
138
-
139
- root = File.join( pn, 'help', '**/*.txt' )
140
- Dir.glob( root ).each do |txt_file|
141
- key = File.basename( txt_file, '.txt' )
142
- @topics[ key ] = txt_file
143
- end
144
-
145
- root = File.join( pn, 'help', '**/*.md' )
146
- Dir.glob( root ).each do |md_file|
147
- key = File.basename( md_file, '.md' )
148
- @topics[ key ] = md_file
149
- end
150
-
151
- $log.debug "Found #{@topics.count} help files"
152
- end
153
-
154
- end
155
- end
156
- end
data/lib/gloo/app/mode.rb DELETED
@@ -1,27 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
3
- #
4
- # Mode the Application is running in.
5
- #
6
-
7
- module Gloo
8
- module App
9
- class Mode
10
-
11
- EMBED = :embed # Run as embedded script processor
12
- CLI = :cli # Run in interactive (CLI) mode
13
- SCRIPT = :script # Run a script
14
- VERSION = :version # Show version information
15
- HELP = :help # Show the help screen
16
- TEST = :test # Running in Unit Test mode.
17
-
18
- #
19
- # Get the default mode.
20
- #
21
- def self.default_mode
22
- return EMBED
23
- end
24
-
25
- end
26
- end
27
- end
@@ -1,186 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
3
- #
4
- # Application and user settings.
5
- #
6
-
7
- require 'yaml'
8
- require 'tty-screen'
9
- require 'colorize'
10
-
11
- module Gloo
12
- module App
13
- class Settings
14
-
15
- attr_reader :user_root, :log_path, :config_path, :project_path,
16
- :start_with, :list_indent, :tmp_path,
17
- :debug_path, :debug
18
-
19
- #
20
- # Load setting from the yml file.
21
- # The mode parameter is used to determine if we are running in TEST.
22
- #
23
- def initialize( mode )
24
- @mode = mode
25
- init_root
26
- init_path_settings
27
- init_user_settings
28
- end
29
-
30
- #
31
- # Are we in test mode?
32
- #
33
- def in_test_mode?
34
- return @mode == 'TEST'
35
- end
36
-
37
- #
38
- # Get the project path for the current mode.
39
- #
40
- def project_path_for_mode( settings )
41
- return File.join( @user_root, 'projects' ) if in_test_mode?
42
-
43
- return settings[ 'gloo' ][ 'project_path' ]
44
- end
45
-
46
- #
47
- # Show the current application settings.
48
- # Can be seen in app with 'help settings'
49
- #
50
- def show
51
- puts "\nApplication Settings:".blue
52
- puts ' Startup with: '.yellow + @start_with.white
53
- puts ' Indent in Listing: '.yellow + @list_indent.to_s.white
54
- puts ' Screen Lines: '.yellow + Gloo::App::Settings.lines.to_s.white
55
- puts ' Page Size: '.yellow + Gloo::App::Settings.page_size.to_s.white
56
- puts ''
57
- self.show_paths
58
- puts ''
59
- end
60
-
61
- #
62
- # Show path settings
63
- #
64
- def show_paths
65
- puts ' User Root Path is here: '.yellow + @user_root.white
66
- puts ' Projects Path: '.yellow + @project_path.white
67
- puts ' Tmp Path: '.yellow + @tmp_path.white
68
- puts ' Debug Path: '.yellow + @debug_path.white
69
- end
70
-
71
- #
72
- # Get the number of vertical lines on screen.
73
- #
74
- def self.lines
75
- TTY::Screen.rows
76
- end
77
-
78
- #
79
- # Get the number of horizontal columns on screen.
80
- #
81
- def self.cols
82
- TTY::Screen.cols
83
- end
84
-
85
- #
86
- # Get the default page size.
87
- # This is the number of lines of text we can show.
88
- #
89
- def self.page_size
90
- Settings.lines - 3
91
- end
92
-
93
- #
94
- # How many lines should we use for a preview?
95
- #
96
- def self.preview_lines
97
- return 7
98
- end
99
-
100
- # ---------------------------------------------------------------------
101
- # Private
102
- # ---------------------------------------------------------------------
103
-
104
- private
105
-
106
- #
107
- # Initialize gloo's root path.
108
- #
109
- def init_root
110
- if in_test_mode?
111
- path = File.dirname( File.dirname( File.absolute_path( __FILE__ ) ) )
112
- path = File.dirname( File.dirname( path ) )
113
- path = File.join( path, 'test', 'gloo' )
114
- @user_root = path
115
- else
116
- @user_root = File.join( Dir.home, 'gloo' )
117
- end
118
- end
119
-
120
- #
121
- # Get the app's required directories.
122
- #
123
- def init_path_settings
124
- Dir.mkdir( @user_root ) unless File.exist?( @user_root )
125
-
126
- @log_path = File.join( @user_root, 'logs' )
127
- Dir.mkdir( @log_path ) unless File.exist?( @log_path )
128
-
129
- @config_path = File.join( @user_root, 'config' )
130
- Dir.mkdir( @config_path ) unless File.exist?( @config_path )
131
-
132
- @tmp_path = File.join( @user_root, 'tmp' )
133
- Dir.mkdir( @tmp_path ) unless File.exist?( @tmp_path )
134
-
135
- @debug_path = File.join( @user_root, 'debug' )
136
- Dir.mkdir( @debug_path ) unless File.exist?( @debug_path )
137
- end
138
-
139
- #
140
- # Initialize the user settings for the currently
141
- # running environment.
142
- #
143
- def init_user_settings
144
- settings = get_settings
145
-
146
- @project_path = project_path_for_mode settings
147
- @start_with = settings[ 'gloo' ][ 'start_with' ]
148
- @list_indent = settings[ 'gloo' ][ 'list_indent' ]
149
-
150
- @debug = settings[ 'gloo' ][ 'debug' ]
151
- end
152
-
153
- #
154
- # Get the app's required directories.
155
- #
156
- def get_settings
157
- f = File.join( @config_path, 'gloo.yml' )
158
- create_settings( f ) unless File.exist?( f )
159
- return YAML.load_file f
160
- end
161
-
162
- #
163
- # Create settings file.
164
- #
165
- def create_settings( file )
166
- IO.write( file, get_default_settings )
167
- end
168
-
169
- #
170
- # Get the value for default settings.
171
- #
172
- def get_default_settings
173
- projects = File.join( @user_root, 'projects' )
174
- str = <<~TEXT
175
- gloo:
176
- project_path: #{projects}
177
- start_with:
178
- list_indent: 1
179
- debug: false
180
- TEXT
181
- return str
182
- end
183
-
184
- end
185
- end
186
- end
@@ -1,35 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2020 Eric Crane. All rights reserved.
3
- #
4
- # Data conversion manager.
5
- #
6
-
7
- module Gloo
8
- module Convert
9
- class Converter
10
-
11
- # ---------------------------------------------------------------------
12
- # Convert
13
- # ---------------------------------------------------------------------
14
-
15
- #
16
- # Convert the given value to the specified type,
17
- # or if no conversion is available, revert to default.
18
- #
19
- def convert( value, to_type, default = nil )
20
- begin
21
- name = "Gloo::Convert::#{value.class}To#{to_type}"
22
- clazz = name.split( '::' ).inject( Object ) { |o, c| o.const_get c }
23
- o = clazz.new
24
- return o.convert( value )
25
- rescue => e
26
- $log.error e.message
27
- $engine.heap.error.set_to e.message
28
- end
29
-
30
- return default
31
- end
32
-
33
- end
34
- end
35
- end
@@ -1,21 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2020 Eric Crane. All rights reserved.
3
- #
4
- # Conversion tool: String to Date Time.
5
- #
6
- require 'chronic'
7
-
8
- module Gloo
9
- module Convert
10
- class StringToDateTime
11
-
12
- #
13
- # Convert the given string value to a date and time.
14
- #
15
- def convert( value )
16
- return Chronic.parse( value )
17
- end
18
-
19
- end
20
- end
21
- end
@@ -1,20 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2020 Eric Crane. All rights reserved.
3
- #
4
- # Conversion tool: String to Decimal.
5
- #
6
-
7
- module Gloo
8
- module Convert
9
- class StringToDecimal
10
-
11
- #
12
- # Convert the given string value to an integer.
13
- #
14
- def convert( value )
15
- return value.to_f
16
- end
17
-
18
- end
19
- end
20
- end
@@ -1,20 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2020 Eric Crane. All rights reserved.
3
- #
4
- # Conversion tool: String to Integer.
5
- #
6
-
7
- module Gloo
8
- module Convert
9
- class StringToInteger
10
-
11
- #
12
- # Convert the given string value to an integer.
13
- #
14
- def convert( value )
15
- return value.to_i
16
- end
17
-
18
- end
19
- end
20
- end
@@ -1,28 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
3
- #
4
- # An abstract base object.
5
- # All objects and verbs derive from this.
6
- #
7
-
8
- module Gloo
9
- module Core
10
- class Baseo
11
-
12
- attr_accessor :name
13
-
14
- # Set up the object.
15
- def initialize
16
- @name = ''
17
- end
18
-
19
- #
20
- # The object type, suitable for display.
21
- #
22
- def type_display
23
- raise 'this method should be overriden'
24
- end
25
-
26
- end
27
- end
28
- end
@@ -1,181 +0,0 @@
1
- # Author:: Eric Crane (mailto:eric.crane@mac.com)
2
- # Copyright:: Copyright (c) 2019 Eric Crane. All rights reserved.
3
- #
4
- # A dictionary of Objects and Verbs.
5
- #
6
- require 'singleton'
7
-
8
- module Gloo
9
- module Core
10
- class Dictionary
11
-
12
- include Singleton
13
-
14
- attr_reader :verbs, :objs, :keywords
15
-
16
- #
17
- # Set up the object dictionary.
18
- #
19
- def initialize
20
- @verbs = {}
21
- @objs = {}
22
- @verb_references = []
23
- @obj_references = []
24
- @keywords = []
25
- end
26
-
27
- #
28
- # Register a verb.
29
- #
30
- def register_verb( subclass )
31
- @verb_references << subclass
32
- end
33
-
34
- #
35
- # Register an object type.
36
- #
37
- def register_obj( subclass )
38
- @obj_references << subclass
39
- end
40
-
41
- #
42
- # Initialize verbs and objects in the dictionary.
43
- #
44
- def init
45
- $log.debug 'initializing dictionaries'
46
- init_verbs
47
- init_objs
48
- end
49
-
50
- #
51
- # Is the given word an object type?
52
- #
53
- def obj?( word )
54
- return false unless word
55
-
56
- return @objs.key?( word.downcase )
57
- end
58
-
59
- #
60
- # Find the object type by name.
61
- #
62
- def find_obj( word )
63
- return nil unless word
64
- return nil unless obj?( word )
65
-
66
- return @objs[ word.downcase ]
67
- end
68
-
69
- #
70
- # Is the given word a verb?
71
- #
72
- def verb?( word )
73
- return false unless word
74
-
75
- return @verbs.key?( word.downcase )
76
- end
77
-
78
- #
79
- # Find the verb by name.
80
- #
81
- def find_verb( verb )
82
- return nil unless verb
83
- return nil unless verb?( verb )
84
-
85
- return @verbs[ verb.downcase ]
86
- end
87
-
88
- #
89
- # Get the list of verbs, sorted.
90
- #
91
- def get_obj_types
92
- return @obj_references.sort { |a, b| a.typename <=> b.typename }
93
- end
94
-
95
- #
96
- # Get the list of verbs, sorted.
97
- #
98
- def get_verbs
99
- return @verb_references.sort { |a, b| a.keyword <=> b.keyword }
100
- end
101
-
102
- #
103
- # Lookup the keyword by name or shortcut.
104
- # Return the keyword (name) or nil if it is not found.
105
- #
106
- def lookup_keyword( key )
107
- v = find_verb key
108
- return v.keyword if v
109
-
110
- o = find_obj key
111
- return o.typename if o
112
-
113
- return nil
114
- end
115
-
116
- #
117
- # Show a list of all keywords.
118
- # This includes verbs and objects, names and shortcuts.
119
- #
120
- def show_keywords
121
- str = ''
122
- @keywords.sort.each_with_index do |k, i|
123
- str << k.ljust( 20, ' ' )
124
- if ( ( i + 1 ) % 6 ).zero?
125
- puts str
126
- str = ''
127
- end
128
- end
129
- end
130
-
131
- # ---------------------------------------------------------------------
132
- # Private
133
- # ---------------------------------------------------------------------
134
-
135
- private
136
-
137
- #
138
- # Add a keyword to the keyword list.
139
- # Report an error if the keyword is already in the list.
140
- #
141
- def add_key( keyword )
142
- if @keywords.include?( keyword )
143
- $log.error "duplicate keyword '#{keyword}'"
144
- return
145
- end
146
-
147
- @keywords << keyword
148
- end
149
-
150
- #
151
- # Init the list of objects.
152
- #
153
- def init_objs
154
- $log.debug "initializing #{@obj_references.count} objects"
155
- @obj_references.each do |o|
156
- $log.debug o
157
- @objs[ o.typename ] = o
158
- @objs[ o.short_typename ] = o
159
- add_key o.typename
160
- add_key o.short_typename if o.typename != o.short_typename
161
- end
162
- end
163
-
164
- #
165
- # Init the list of verbs.
166
- #
167
- def init_verbs
168
- $log.debug "initializing #{@verb_references.count} verbs"
169
- @verb_references.each do |v|
170
- $log.debug v
171
- @verbs[ v.keyword ] = v
172
- @verbs[ v.keyword_shortcut ] = v
173
- # v.send( :new ).run
174
- add_key v.keyword
175
- add_key v.keyword_shortcut if v.keyword != v.keyword_shortcut
176
- end
177
- end
178
-
179
- end
180
- end
181
- end