gloo-lang 0.9.6 → 0.9.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -1
- data/lib/VERSION +1 -1
- data/lib/gloo_lang/app/args.rb +3 -2
- data/lib/gloo_lang/app/engine.rb +25 -26
- data/lib/gloo_lang/app/help.rb +10 -9
- data/lib/gloo_lang/app/log.rb +5 -3
- data/lib/gloo_lang/app/settings.rb +10 -9
- data/lib/gloo_lang/convert/converter.rb +9 -2
- data/lib/gloo_lang/core/baseo.rb +2 -1
- data/lib/gloo_lang/core/dictionary.rb +16 -6
- data/lib/gloo_lang/core/event_manager.rb +9 -8
- data/lib/gloo_lang/core/factory.rb +11 -10
- data/lib/gloo_lang/core/gloo_system.rb +9 -8
- data/lib/gloo_lang/core/heap.rb +5 -4
- data/lib/gloo_lang/core/here.rb +2 -2
- data/lib/gloo_lang/core/obj.rb +9 -8
- data/lib/gloo_lang/core/obj_finder.rb +3 -3
- data/lib/gloo_lang/core/parser.rb +6 -5
- data/lib/gloo_lang/core/pn.rb +20 -16
- data/lib/gloo_lang/core/verb.rb +2 -1
- data/lib/gloo_lang/exec/dispatch.rb +8 -8
- data/lib/gloo_lang/exec/exec_env.rb +7 -6
- data/lib/gloo_lang/exec/runner.rb +10 -10
- data/lib/gloo_lang/exec/script.rb +6 -5
- data/lib/gloo_lang/exec/stack.rb +8 -7
- data/lib/gloo_lang/expr/expression.rb +3 -2
- data/lib/gloo_lang/objs/basic/alias.rb +4 -4
- data/lib/gloo_lang/objs/basic/boolean.rb +3 -3
- data/lib/gloo_lang/objs/basic/container.rb +2 -2
- data/lib/gloo_lang/objs/basic/decimal.rb +3 -3
- data/lib/gloo_lang/objs/basic/integer.rb +3 -3
- data/lib/gloo_lang/objs/basic/script.rb +1 -1
- data/lib/gloo_lang/objs/basic/string.rb +3 -3
- data/lib/gloo_lang/objs/basic/text.rb +2 -2
- data/lib/gloo_lang/objs/ctrl/each.rb +3 -3
- data/lib/gloo_lang/objs/ctrl/repeat.rb +2 -2
- data/lib/gloo_lang/objs/data/markdown.rb +2 -2
- data/lib/gloo_lang/objs/data/query.rb +4 -4
- data/lib/gloo_lang/objs/data/table.rb +3 -3
- data/lib/gloo_lang/objs/dt/date.rb +1 -1
- data/lib/gloo_lang/objs/dt/datetime.rb +2 -2
- data/lib/gloo_lang/objs/dt/time.rb +1 -1
- data/lib/gloo_lang/objs/ror/erb.rb +2 -2
- data/lib/gloo_lang/objs/ror/eval.rb +3 -3
- data/lib/gloo_lang/objs/web/http_get.rb +3 -3
- data/lib/gloo_lang/objs/web/http_post.rb +8 -8
- data/lib/gloo_lang/objs/web/json.rb +5 -5
- data/lib/gloo_lang/objs/web/slack.rb +1 -1
- data/lib/gloo_lang/objs/web/teams.rb +1 -1
- data/lib/gloo_lang/objs/web/uri.rb +6 -6
- data/lib/gloo_lang/persist/file_loader.rb +6 -5
- data/lib/gloo_lang/persist/file_saver.rb +2 -1
- data/lib/gloo_lang/persist/file_storage.rb +6 -5
- data/lib/gloo_lang/persist/persist_man.rb +9 -8
- data/lib/gloo_lang/utils/stats.rb +5 -4
- data/lib/gloo_lang/verbs/context.rb +4 -4
- data/lib/gloo_lang/verbs/create.rb +3 -3
- data/lib/gloo_lang/verbs/execute.rb +4 -4
- data/lib/gloo_lang/verbs/help.rb +23 -23
- data/lib/gloo_lang/verbs/if.rb +3 -3
- data/lib/gloo_lang/verbs/list.rb +7 -7
- data/lib/gloo_lang/verbs/load.rb +3 -3
- data/lib/gloo_lang/verbs/move.rb +6 -6
- data/lib/gloo_lang/verbs/put.rb +6 -6
- data/lib/gloo_lang/verbs/quit.rb +1 -1
- data/lib/gloo_lang/verbs/run.rb +5 -5
- data/lib/gloo_lang/verbs/save.rb +1 -1
- data/lib/gloo_lang/verbs/show.rb +5 -5
- data/lib/gloo_lang/verbs/tell.rb +5 -4
- data/lib/gloo_lang/verbs/unless.rb +3 -3
- data/lib/gloo_lang/verbs/version.rb +1 -1
- data/lib/gloo_lang/verbs/wait.rb +1 -1
- metadata +2 -4
- data/lib/gloo_lang/objs/data/mysql.rb +0 -192
- data/lib/gloo_lang/objs/data/sqlite.rb +0 -159
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 402d31f29ed04334fc22758dd7aaa7cc230f66ccf341e3cc5b1cedc42fdf998d
         | 
| 4 | 
            +
              data.tar.gz: 10d69c788bf1975b3beb2eb79eff6d18a919f2956678be2d6649b407b6b1ad9e
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 5887c6675f3ca5c7df494f351b7e25c06a118dcc73c84fe0e94242b59d1dcb3ce130216c4e164761a6e0a49855ce49ac88ede67f0a3434594069c8ac693fe937
         | 
| 7 | 
            +
              data.tar.gz: 7849d0fc9c9dabcdb70238b0b1d5b5108fc7c3ed6e41c9d3608ada059ed1d0c514fdcdb8ddb1cb24d8a616beef3933e84e5c6faac2d81bc6a8019bdb00bcf5e6
         | 
    
        data/Gemfile.lock
    CHANGED
    
    | @@ -1,11 +1,12 @@ | |
| 1 1 | 
             
            PATH
         | 
| 2 2 | 
             
              remote: .
         | 
| 3 3 | 
             
              specs:
         | 
| 4 | 
            -
                gloo-lang (0.9. | 
| 4 | 
            +
                gloo-lang (0.9.7)
         | 
| 5 5 | 
             
                  chronic (~> 0.10, >= 0.10.2)
         | 
| 6 6 | 
             
                  json (~> 2.1, >= 2.1.0)
         | 
| 7 7 | 
             
                  net-ssh (~> 6.1, >= 6.1.0)
         | 
| 8 8 | 
             
                  openssl (~> 2.1, >= 2.1.0)
         | 
| 9 | 
            +
                  tty-platform (~> 0.3, >= 0.3.0)
         | 
| 9 10 |  | 
| 10 11 | 
             
            GEM
         | 
| 11 12 | 
             
              remote: https://rubygems.org/
         | 
| @@ -37,6 +38,7 @@ GEM | |
| 37 38 | 
             
                rubocop-ast (1.16.0)
         | 
| 38 39 | 
             
                  parser (>= 3.1.1.0)
         | 
| 39 40 | 
             
                ruby-progressbar (1.11.0)
         | 
| 41 | 
            +
                tty-platform (0.3.0)
         | 
| 40 42 | 
             
                unicode-display_width (2.1.0)
         | 
| 41 43 |  | 
| 42 44 | 
             
            PLATFORMS
         | 
    
        data/lib/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            0.9. | 
| 1 | 
            +
            0.9.9
         | 
    
        data/lib/gloo_lang/app/args.rb
    CHANGED
    
    | @@ -19,7 +19,8 @@ module GlooLang | |
| 19 19 | 
             
                  #
         | 
| 20 20 | 
             
                  # Create arguments and setup.
         | 
| 21 21 | 
             
                  #
         | 
| 22 | 
            -
                  def initialize( params = [] )
         | 
| 22 | 
            +
                  def initialize( engine, params = [] )
         | 
| 23 | 
            +
                    @engine = engine
         | 
| 23 24 | 
             
                    @switches = []
         | 
| 24 25 | 
             
                    @files = []
         | 
| 25 26 |  | 
| @@ -84,7 +85,7 @@ module GlooLang | |
| 84 85 | 
             
                           else
         | 
| 85 86 | 
             
                             Mode.default_mode
         | 
| 86 87 | 
             
                           end
         | 
| 87 | 
            -
                     | 
| 88 | 
            +
                    @engine.log.debug "running in #{mode} mode"
         | 
| 88 89 |  | 
| 89 90 | 
             
                    return mode
         | 
| 90 91 | 
             
                  end
         | 
    
        data/lib/gloo_lang/app/engine.rb
    CHANGED
    
    | @@ -11,6 +11,7 @@ module GlooLang | |
| 11 11 | 
             
              module App
         | 
| 12 12 | 
             
                class Engine
         | 
| 13 13 |  | 
| 14 | 
            +
                  attr_reader :settings, :log
         | 
| 14 15 | 
             
                  attr_reader :args, :mode, :running, :platform,
         | 
| 15 16 | 
             
                              :dictionary, :parser, :heap, :factory
         | 
| 16 17 | 
             
                  attr_accessor :last_cmd, :persist_man, :event_manager,
         | 
| @@ -19,16 +20,14 @@ module GlooLang | |
| 19 20 | 
             
                  #
         | 
| 20 21 | 
             
                  # Set up the engine with basic elements.
         | 
| 21 22 | 
             
                  #
         | 
| 22 | 
            -
                  def initialize( params = [], platform= | 
| 23 | 
            -
                     | 
| 24 | 
            -
                    @ | 
| 25 | 
            -
                    $settings = Settings.new( ENV[ 'GLOO_ENV' ] )
         | 
| 23 | 
            +
                  def initialize( params = [], platform=Platform, log=Log )
         | 
| 24 | 
            +
                    @args = Args.new( self, params )
         | 
| 25 | 
            +
                    @settings = Settings.new( self, ENV[ 'GLOO_ENV' ] )
         | 
| 26 26 |  | 
| 27 | 
            -
                     | 
| 28 | 
            -
                     | 
| 27 | 
            +
                    @log = Log.new( self, @args.quiet? )
         | 
| 28 | 
            +
                    @platform = platform.new
         | 
| 29 29 |  | 
| 30 | 
            -
                    @ | 
| 31 | 
            -
                    $log.debug 'engine intialized...'
         | 
| 30 | 
            +
                    @log.debug 'engine intialized...'
         | 
| 32 31 | 
             
                  end
         | 
| 33 32 |  | 
| 34 33 | 
             
                  #
         | 
| @@ -36,24 +35,24 @@ module GlooLang | |
| 36 35 | 
             
                  # Load object and verb definitions and setup engine elements.
         | 
| 37 36 | 
             
                  #
         | 
| 38 37 | 
             
                  def start
         | 
| 39 | 
            -
                     | 
| 40 | 
            -
                     | 
| 38 | 
            +
                    @log.debug 'starting the engine...'
         | 
| 39 | 
            +
                    @log.debug Info.display_title
         | 
| 41 40 | 
             
                    @mode = @args.detect_mode
         | 
| 42 41 | 
             
                    @running = true
         | 
| 43 42 |  | 
| 44 | 
            -
                    @dictionary = GlooLang::Core::Dictionary. | 
| 45 | 
            -
                    @dictionary.init
         | 
| 46 | 
            -
                    @parser = GlooLang::Core::Parser.new
         | 
| 47 | 
            -
                    @heap = GlooLang::Core::Heap.new
         | 
| 48 | 
            -
                    @factory = GlooLang::Core::Factory.new
         | 
| 49 | 
            -
                    @persist_man = GlooLang::Persist::PersistMan.new
         | 
| 50 | 
            -
                    @event_manager = GlooLang::Core::EventManager.new
         | 
| 43 | 
            +
                    @dictionary = GlooLang::Core::Dictionary.get
         | 
| 51 44 |  | 
| 52 | 
            -
                    @ | 
| 53 | 
            -
                    @ | 
| 54 | 
            -
                    @ | 
| 45 | 
            +
                    @parser = GlooLang::Core::Parser.new( self )
         | 
| 46 | 
            +
                    @heap = GlooLang::Core::Heap.new( self )
         | 
| 47 | 
            +
                    @factory = GlooLang::Core::Factory.new( self )
         | 
| 48 | 
            +
                    @persist_man = GlooLang::Persist::PersistMan.new( self )
         | 
| 49 | 
            +
                    @event_manager = GlooLang::Core::EventManager.new( self )
         | 
| 55 50 |  | 
| 56 | 
            -
                     | 
| 51 | 
            +
                    @exec_env = GlooLang::Exec::ExecEnv.new( self )
         | 
| 52 | 
            +
                    @help = GlooLang::App::Help.new( self )
         | 
| 53 | 
            +
                    @converter = GlooLang::Convert::Converter.new( self )
         | 
| 54 | 
            +
             | 
| 55 | 
            +
                    @log.debug 'the engine has started'
         | 
| 57 56 | 
             
                    run_mode
         | 
| 58 57 | 
             
                  end
         | 
| 59 58 |  | 
| @@ -65,7 +64,7 @@ module GlooLang | |
| 65 64 | 
             
                  # Run gloo in the selected mode.
         | 
| 66 65 | 
             
                  #
         | 
| 67 66 | 
             
                  def run_mode
         | 
| 68 | 
            -
                     | 
| 67 | 
            +
                    @log.debug "running gloo in #{@mode} mode"
         | 
| 69 68 |  | 
| 70 69 | 
             
                    if @mode == Mode::VERSION
         | 
| 71 70 | 
             
                      run_version
         | 
| @@ -108,7 +107,7 @@ module GlooLang | |
| 108 107 | 
             
                  # Get the setting for the start_with file and open it.
         | 
| 109 108 | 
             
                  #
         | 
| 110 109 | 
             
                  def open_start_file
         | 
| 111 | 
            -
                    name =  | 
| 110 | 
            +
                    name = @settings.start_with
         | 
| 112 111 | 
             
                    @persist_man.load( name ) if name
         | 
| 113 112 | 
             
                  end
         | 
| 114 113 |  | 
| @@ -155,7 +154,7 @@ module GlooLang | |
| 155 154 | 
             
                  # Do any clean up and quit.
         | 
| 156 155 | 
             
                  #
         | 
| 157 156 | 
             
                  def quit
         | 
| 158 | 
            -
                     | 
| 157 | 
            +
                    @log.debug 'quitting...'
         | 
| 159 158 | 
             
                  end
         | 
| 160 159 |  | 
| 161 160 | 
             
                  # ---------------------------------------------------------------------
         | 
| @@ -194,8 +193,8 @@ module GlooLang | |
| 194 193 | 
             
                  # Write it to the log and set the heap error value.
         | 
| 195 194 | 
             
                  #
         | 
| 196 195 | 
             
                  def err( msg )
         | 
| 197 | 
            -
                     | 
| 198 | 
            -
                     | 
| 196 | 
            +
                    @log.error msg
         | 
| 197 | 
            +
                    @heap.error.set_to msg
         | 
| 199 198 | 
             
                  end
         | 
| 200 199 |  | 
| 201 200 | 
             
                end
         | 
    
        data/lib/gloo_lang/app/help.rb
    CHANGED
    
    | @@ -16,7 +16,8 @@ module GlooLang | |
| 16 16 | 
             
                  # Set up the help system.
         | 
| 17 17 | 
             
                  # We won't load help topics until we know we need them.
         | 
| 18 18 | 
             
                  #
         | 
| 19 | 
            -
                  def initialize
         | 
| 19 | 
            +
                  def initialize( engine )
         | 
| 20 | 
            +
                    @engine = engine
         | 
| 20 21 | 
             
                    @topics = nil
         | 
| 21 22 | 
             
                  end
         | 
| 22 23 |  | 
| @@ -25,7 +26,7 @@ module GlooLang | |
| 25 26 | 
             
                  # This is the what is shown when help is run from the CLI.
         | 
| 26 27 | 
             
                  #
         | 
| 27 28 | 
             
                  def show_app_help
         | 
| 28 | 
            -
                    puts Info.display_title unless  | 
| 29 | 
            +
                    puts Info.display_title unless @engine.args.quiet?
         | 
| 29 30 | 
             
                    self.show_topic APPLICATION
         | 
| 30 31 | 
             
                  end
         | 
| 31 32 |  | 
| @@ -54,21 +55,21 @@ module GlooLang | |
| 54 55 | 
             
                  # screen, it won't paginate.
         | 
| 55 56 | 
             
                  #
         | 
| 56 57 | 
             
                  def page_topic( topic )
         | 
| 57 | 
            -
                    return if  | 
| 58 | 
            +
                    return if @engine.args.quiet?
         | 
| 58 59 |  | 
| 59 60 | 
             
                    data = self.get_topic_data( topic )
         | 
| 60 | 
            -
                    page = data.lines.count > Settings.page_size
         | 
| 61 | 
            -
                     | 
| 61 | 
            +
                    page = data.lines.count > Settings.page_size( @engine )
         | 
| 62 | 
            +
                    @engine.platform.show( data, topic_is_md?( topic ), page )
         | 
| 62 63 | 
             
                  end
         | 
| 63 64 |  | 
| 64 65 | 
             
                  #
         | 
| 65 66 | 
             
                  # Show a help topic.
         | 
| 66 67 | 
             
                  #
         | 
| 67 68 | 
             
                  def show_topic( topic )
         | 
| 68 | 
            -
                    return if  | 
| 69 | 
            +
                    return if @engine.args.quiet?
         | 
| 69 70 |  | 
| 70 71 | 
             
                    data = self.get_topic_data( topic )
         | 
| 71 | 
            -
                     | 
| 72 | 
            +
                    @engine.platform.show( data, topic_is_md?( topic ), false )
         | 
| 72 73 | 
             
                  end
         | 
| 73 74 |  | 
| 74 75 | 
             
                  #
         | 
| @@ -92,7 +93,7 @@ module GlooLang | |
| 92 93 | 
             
                    return if @topics
         | 
| 93 94 |  | 
| 94 95 | 
             
                    @topics = {}
         | 
| 95 | 
            -
                     | 
| 96 | 
            +
                    @engine.log.debug 'loading help file index...'
         | 
| 96 97 |  | 
| 97 98 | 
             
                    pn = File.dirname( File.absolute_path( __FILE__ ) )
         | 
| 98 99 | 
             
                    pn = File.dirname( pn )
         | 
| @@ -109,7 +110,7 @@ module GlooLang | |
| 109 110 | 
             
                      @topics[ key ] = md_file
         | 
| 110 111 | 
             
                    end
         | 
| 111 112 |  | 
| 112 | 
            -
                     | 
| 113 | 
            +
                    @engine.log.debug "Found #{@topics.count} help files"
         | 
| 113 114 | 
             
                  end
         | 
| 114 115 |  | 
| 115 116 | 
             
                end
         | 
    
        data/lib/gloo_lang/app/log.rb
    CHANGED
    
    | @@ -9,18 +9,20 @@ module GlooLang | |
| 9 9 | 
             
              module App
         | 
| 10 10 | 
             
                class Log
         | 
| 11 11 |  | 
| 12 | 
            -
                  attr_reader :logger
         | 
| 13 12 | 
             
                  attr_accessor :quiet
         | 
| 13 | 
            +
                  attr_reader :logger
         | 
| 14 14 |  | 
| 15 15 | 
             
                  #
         | 
| 16 16 | 
             
                  # Set up a logger.
         | 
| 17 17 | 
             
                  # If quiet is true, then message are written to the log
         | 
| 18 18 | 
             
                  # but not to the console.
         | 
| 19 19 | 
             
                  #
         | 
| 20 | 
            -
                  def initialize( quiet=true )
         | 
| 21 | 
            -
                     | 
| 20 | 
            +
                  def initialize( engine, quiet=true )
         | 
| 21 | 
            +
                    @engine = engine
         | 
| 22 | 
            +
                    f = File.join( @engine.settings.log_path, 'gloo.log' )
         | 
| 22 23 | 
             
                    @logger = Logger.new( f )
         | 
| 23 24 | 
             
                    @logger.level = Logger::DEBUG
         | 
| 25 | 
            +
                    @quite = quiet
         | 
| 24 26 | 
             
                  end
         | 
| 25 27 |  | 
| 26 28 | 
             
                  #
         | 
| @@ -18,7 +18,8 @@ module GlooLang | |
| 18 18 | 
             
                  # Load setting from the yml file.
         | 
| 19 19 | 
             
                  # The mode parameter is used to determine if we are running in TEST.
         | 
| 20 20 | 
             
                  #
         | 
| 21 | 
            -
                  def initialize( mode )
         | 
| 21 | 
            +
                  def initialize( engine, mode )
         | 
| 22 | 
            +
                    @engine = engine
         | 
| 22 23 | 
             
                    @mode = mode
         | 
| 23 24 | 
             
                    init_root
         | 
| 24 25 | 
             
                    init_path_settings
         | 
| @@ -49,8 +50,8 @@ module GlooLang | |
| 49 50 | 
             
                    puts "\nApplication Settings:"
         | 
| 50 51 | 
             
                    puts '  Startup with:  ' + @start_with
         | 
| 51 52 | 
             
                    puts '  Indent in Listing:  ' + @list_indent.to_s
         | 
| 52 | 
            -
                    puts '  Screen Lines:  ' + GlooLang::App::Settings.lines.to_s
         | 
| 53 | 
            -
                    puts '  Page Size:  ' + GlooLang::App::Settings.page_size.to_s
         | 
| 53 | 
            +
                    puts '  Screen Lines:  ' + GlooLang::App::Settings.lines( @engine ).to_s
         | 
| 54 | 
            +
                    puts '  Page Size:  ' + GlooLang::App::Settings.page_size( @engine ).to_s
         | 
| 54 55 | 
             
                    puts ''
         | 
| 55 56 | 
             
                    self.show_paths
         | 
| 56 57 | 
             
                    puts ''
         | 
| @@ -94,23 +95,23 @@ module GlooLang | |
| 94 95 | 
             
                  #
         | 
| 95 96 | 
             
                  # Get the number of vertical lines on screen.
         | 
| 96 97 | 
             
                  #
         | 
| 97 | 
            -
                  def self.lines
         | 
| 98 | 
            -
                     | 
| 98 | 
            +
                  def self.lines engine
         | 
| 99 | 
            +
                    engine.platform.lines
         | 
| 99 100 | 
             
                  end
         | 
| 100 101 |  | 
| 101 102 | 
             
                  #
         | 
| 102 103 | 
             
                  # Get the number of horizontal columns on screen.
         | 
| 103 104 | 
             
                  #
         | 
| 104 | 
            -
                  def self.cols
         | 
| 105 | 
            -
                     | 
| 105 | 
            +
                  def self.cols engine
         | 
| 106 | 
            +
                    engine.platform.cols
         | 
| 106 107 | 
             
                  end
         | 
| 107 108 |  | 
| 108 109 | 
             
                  #
         | 
| 109 110 | 
             
                  # Get the default page size.
         | 
| 110 111 | 
             
                  # This is the number of lines of text we can show.
         | 
| 111 112 | 
             
                  #
         | 
| 112 | 
            -
                  def self.page_size
         | 
| 113 | 
            -
                    Settings.lines - 3
         | 
| 113 | 
            +
                  def self.page_size engine
         | 
| 114 | 
            +
                    Settings.lines( engine ) - 3
         | 
| 114 115 | 
             
                  end
         | 
| 115 116 |  | 
| 116 117 | 
             
                  #
         | 
| @@ -8,6 +8,13 @@ module GlooLang | |
| 8 8 | 
             
              module Convert
         | 
| 9 9 | 
             
                class Converter
         | 
| 10 10 |  | 
| 11 | 
            +
                  #
         | 
| 12 | 
            +
                  # Initializer.
         | 
| 13 | 
            +
                  #
         | 
| 14 | 
            +
                  def initialize( engine )
         | 
| 15 | 
            +
                    @engine = engine
         | 
| 16 | 
            +
                  end
         | 
| 17 | 
            +
             | 
| 11 18 | 
             
                  # ---------------------------------------------------------------------
         | 
| 12 19 | 
             
                  #    Convert
         | 
| 13 20 | 
             
                  # ---------------------------------------------------------------------
         | 
| @@ -23,8 +30,8 @@ module GlooLang | |
| 23 30 | 
             
                      o = clazz.new
         | 
| 24 31 | 
             
                      return o.convert( value )
         | 
| 25 32 | 
             
                    rescue => e
         | 
| 26 | 
            -
                       | 
| 27 | 
            -
                       | 
| 33 | 
            +
                      @engine.log.error e.message
         | 
| 34 | 
            +
                      @engine.heap.error.set_to e.message
         | 
| 28 35 | 
             
                    end
         | 
| 29 36 |  | 
| 30 37 | 
             
                    return default
         | 
    
        data/lib/gloo_lang/core/baseo.rb
    CHANGED
    
    
| @@ -24,6 +24,16 @@ module GlooLang | |
| 24 24 | 
             
                    @keywords = []
         | 
| 25 25 | 
             
                  end
         | 
| 26 26 |  | 
| 27 | 
            +
                  #
         | 
| 28 | 
            +
                  # Get the singleton Dictionary and Initialize
         | 
| 29 | 
            +
                  # if this is the first time.
         | 
| 30 | 
            +
                  #
         | 
| 31 | 
            +
                  def self.get
         | 
| 32 | 
            +
                    o = GlooLang::Core::Dictionary.instance
         | 
| 33 | 
            +
                    o.init if o.verbs.count == 0
         | 
| 34 | 
            +
                    return o
         | 
| 35 | 
            +
                  end
         | 
| 36 | 
            +
             | 
| 27 37 | 
             
                  #
         | 
| 28 38 | 
             
                  # Register a verb.
         | 
| 29 39 | 
             
                  #
         | 
| @@ -42,7 +52,7 @@ module GlooLang | |
| 42 52 | 
             
                  # Initialize verbs and objects in the dictionary.
         | 
| 43 53 | 
             
                  #
         | 
| 44 54 | 
             
                  def init
         | 
| 45 | 
            -
                     | 
| 55 | 
            +
                    # @engine.log.debug 'initializing dictionaries'
         | 
| 46 56 | 
             
                    init_verbs
         | 
| 47 57 | 
             
                    init_objs
         | 
| 48 58 | 
             
                  end
         | 
| @@ -140,7 +150,7 @@ module GlooLang | |
| 140 150 | 
             
                  #
         | 
| 141 151 | 
             
                  def add_key( keyword )
         | 
| 142 152 | 
             
                    if @keywords.include?( keyword )
         | 
| 143 | 
            -
                       | 
| 153 | 
            +
                      # @engine.log.error "duplicate keyword '#{keyword}'"
         | 
| 144 154 | 
             
                      return
         | 
| 145 155 | 
             
                    end
         | 
| 146 156 |  | 
| @@ -151,9 +161,9 @@ module GlooLang | |
| 151 161 | 
             
                  # Init the list of objects.
         | 
| 152 162 | 
             
                  #
         | 
| 153 163 | 
             
                  def init_objs
         | 
| 154 | 
            -
                     | 
| 164 | 
            +
                    # @engine.log.debug "initializing #{@obj_references.count} objects"
         | 
| 155 165 | 
             
                    @obj_references.each do |o|
         | 
| 156 | 
            -
                       | 
| 166 | 
            +
                      # @engine.log.debug o
         | 
| 157 167 | 
             
                      @objs[ o.typename ] = o
         | 
| 158 168 | 
             
                      @objs[ o.short_typename ] = o
         | 
| 159 169 | 
             
                      add_key o.typename
         | 
| @@ -165,9 +175,9 @@ module GlooLang | |
| 165 175 | 
             
                  # Init the list of verbs.
         | 
| 166 176 | 
             
                  #
         | 
| 167 177 | 
             
                  def init_verbs
         | 
| 168 | 
            -
                     | 
| 178 | 
            +
                    # @engine.log.debug "initializing #{@verb_references.count} verbs"
         | 
| 169 179 | 
             
                    @verb_references.each do |v|
         | 
| 170 | 
            -
                       | 
| 180 | 
            +
                      # @engine.log.debug v
         | 
| 171 181 | 
             
                      @verbs[ v.keyword ] = v
         | 
| 172 182 | 
             
                      @verbs[ v.keyword_shortcut ] = v
         | 
| 173 183 | 
             
                      # v.send( :new ).run
         | 
| @@ -12,8 +12,9 @@ module GlooLang | |
| 12 12 | 
             
                  #
         | 
| 13 13 | 
             
                  # Set up the event manager.
         | 
| 14 14 | 
             
                  #
         | 
| 15 | 
            -
                  def initialize
         | 
| 16 | 
            -
                     | 
| 15 | 
            +
                  def initialize( engine )
         | 
| 16 | 
            +
                    @engine = engine
         | 
| 17 | 
            +
                    @engine.log.debug 'event manager intialized...'
         | 
| 17 18 | 
             
                  end
         | 
| 18 19 |  | 
| 19 20 | 
             
                  #
         | 
| @@ -23,9 +24,9 @@ module GlooLang | |
| 23 24 | 
             
                  def on_load( obj = nil, in_heap = false )
         | 
| 24 25 | 
             
                    return unless obj || in_heap
         | 
| 25 26 |  | 
| 26 | 
            -
                     | 
| 27 | 
            -
                    arr = GlooLang::Core::ObjFinder.by_name 'on_load', obj
         | 
| 28 | 
            -
                    arr.each { |o| GlooLang::Exec::Dispatch.message 'run', o }
         | 
| 27 | 
            +
                    @engine.log.debug 'on_load event'
         | 
| 28 | 
            +
                    arr = GlooLang::Core::ObjFinder.by_name( @engine, 'on_load', obj )
         | 
| 29 | 
            +
                    arr.each { |o| GlooLang::Exec::Dispatch.message( @engine, 'run', o ) }
         | 
| 29 30 | 
             
                  end
         | 
| 30 31 |  | 
| 31 32 | 
             
                  #
         | 
| @@ -34,9 +35,9 @@ module GlooLang | |
| 34 35 | 
             
                  def on_unload( obj )
         | 
| 35 36 | 
             
                    return unless obj
         | 
| 36 37 |  | 
| 37 | 
            -
                     | 
| 38 | 
            -
                    arr = GlooLang::Core::ObjFinder.by_name 'on_unload', obj
         | 
| 39 | 
            -
                    arr.each { |o| GlooLang::Exec::Dispatch.message 'run', o }
         | 
| 38 | 
            +
                    @engine.log.debug 'on_unload event'
         | 
| 39 | 
            +
                    arr = GlooLang::Core::ObjFinder.by_name( @engine, 'on_unload', obj )
         | 
| 40 | 
            +
                    arr.each { |o| GlooLang::Exec::Dispatch.message( @engine, 'run', o ) }
         | 
| 40 41 | 
             
                  end
         | 
| 41 42 |  | 
| 42 43 | 
             
                end
         | 
| @@ -15,8 +15,9 @@ module GlooLang | |
| 15 15 | 
             
                  #
         | 
| 16 16 | 
             
                  # Set up the object factory.
         | 
| 17 17 | 
             
                  #
         | 
| 18 | 
            -
                  def initialize
         | 
| 19 | 
            -
                     | 
| 18 | 
            +
                  def initialize( engine )
         | 
| 19 | 
            +
                    @engine = engine
         | 
| 20 | 
            +
                    @engine.log.debug 'object factory intialized...'
         | 
| 20 21 | 
             
                  end
         | 
| 21 22 |  | 
| 22 23 | 
             
                  # ---------------------------------------------------------------------
         | 
| @@ -140,7 +141,7 @@ module GlooLang | |
| 140 141 | 
             
                    objtype = find_type params[ :type ]
         | 
| 141 142 | 
             
                    return nil unless objtype
         | 
| 142 143 |  | 
| 143 | 
            -
                    pn = GlooLang::Core::Pn.new params[ :name ]
         | 
| 144 | 
            +
                    pn = GlooLang::Core::Pn.new( @engine, params[ :name ] )
         | 
| 144 145 | 
             
                    parent = params[ :parent ]
         | 
| 145 146 | 
             
                    if parent.nil?
         | 
| 146 147 | 
             
                      parent = pn.get_parent
         | 
| @@ -150,11 +151,11 @@ module GlooLang | |
| 150 151 | 
             
                    end
         | 
| 151 152 |  | 
| 152 153 | 
             
                    if pn.exists? && params[ :squash_duplicates ]
         | 
| 153 | 
            -
                       | 
| 154 | 
            +
                      @engine.log.debug "Updating existing object: #{obj_name}"
         | 
| 154 155 | 
             
                      return self.update_existing pn, params[ :value ]
         | 
| 155 156 | 
             
                    end
         | 
| 156 157 |  | 
| 157 | 
            -
                     | 
| 158 | 
            +
                    @engine.log.debug "Creating new object: #{obj_name}"
         | 
| 158 159 | 
             
                    return create_new obj_name, params[ :value ], objtype, parent
         | 
| 159 160 | 
             
                  end
         | 
| 160 161 |  | 
| @@ -163,11 +164,11 @@ module GlooLang | |
| 163 164 | 
             
                  #
         | 
| 164 165 | 
             
                  def create_new( name, value, type, parent )
         | 
| 165 166 | 
             
                    unless parent
         | 
| 166 | 
            -
                       | 
| 167 | 
            +
                      @engine.log.error "Could not create object.  Bad path: #{name}"
         | 
| 167 168 | 
             
                      return nil
         | 
| 168 169 | 
             
                    end
         | 
| 169 170 |  | 
| 170 | 
            -
                    o = type.new
         | 
| 171 | 
            +
                    o = type.new( @engine )
         | 
| 171 172 | 
             
                    o.name = name
         | 
| 172 173 | 
             
                    o.set_value value
         | 
| 173 174 | 
             
                    parent.add_child( o )
         | 
| @@ -190,15 +191,15 @@ module GlooLang | |
| 190 191 | 
             
                  #
         | 
| 191 192 | 
             
                  def find_type( type_name )
         | 
| 192 193 | 
             
                    type_name = 'untyped' if type_name.nil? || type_name.strip.empty?
         | 
| 193 | 
            -
                    t =  | 
| 194 | 
            +
                    t = @engine.dictionary.find_obj( type_name )
         | 
| 194 195 |  | 
| 195 196 | 
             
                    if t.nil?
         | 
| 196 | 
            -
                       | 
| 197 | 
            +
                      @engine.log.warn "Could not find type, '#{type_name}'"
         | 
| 197 198 | 
             
                      return nil
         | 
| 198 199 | 
             
                    end
         | 
| 199 200 |  | 
| 200 201 | 
             
                    unless t.can_create?
         | 
| 201 | 
            -
                       | 
| 202 | 
            +
                      @engine.log.error "'#{type_name}' cannot be created."
         | 
| 202 203 | 
             
                      return nil
         | 
| 203 204 | 
             
                    end
         | 
| 204 205 |  | 
| @@ -18,7 +18,8 @@ module GlooLang | |
| 18 18 | 
             
                  attr_reader :pn
         | 
| 19 19 |  | 
| 20 20 | 
             
                  # Set up the object.
         | 
| 21 | 
            -
                  def initialize( pn )
         | 
| 21 | 
            +
                  def initialize( engine, pn )
         | 
| 22 | 
            +
                    @engine = engine
         | 
| 22 23 | 
             
                    @pn = pn
         | 
| 23 24 | 
             
                  end
         | 
| 24 25 |  | 
| @@ -137,7 +138,7 @@ module GlooLang | |
| 137 138 | 
             
                    o = "msg_#{msg}"
         | 
| 138 139 | 
             
                    return self.public_send( o ) if self.respond_to? o
         | 
| 139 140 |  | 
| 140 | 
            -
                     | 
| 141 | 
            +
                    @engine.log.error "Message #{msg} not implemented"
         | 
| 141 142 | 
             
                    return false
         | 
| 142 143 | 
             
                  end
         | 
| 143 144 |  | 
| @@ -163,22 +164,22 @@ module GlooLang | |
| 163 164 |  | 
| 164 165 | 
             
                  # Get the Gloo home directory
         | 
| 165 166 | 
             
                  def msg_gloo_home
         | 
| 166 | 
            -
                    return  | 
| 167 | 
            +
                    return @engine.settings.user_root
         | 
| 167 168 | 
             
                  end
         | 
| 168 169 |  | 
| 169 170 | 
             
                  # Get the Gloo configuration directory
         | 
| 170 171 | 
             
                  def msg_gloo_config
         | 
| 171 | 
            -
                    return  | 
| 172 | 
            +
                    return @engine.settings.config_path
         | 
| 172 173 | 
             
                  end
         | 
| 173 174 |  | 
| 174 175 | 
             
                  # Get the Gloo projects directory
         | 
| 175 176 | 
             
                  def msg_gloo_projects
         | 
| 176 | 
            -
                    return  | 
| 177 | 
            +
                    return @engine.settings.project_path
         | 
| 177 178 | 
             
                  end
         | 
| 178 179 |  | 
| 179 180 | 
             
                  # Get the Gloo log directory
         | 
| 180 181 | 
             
                  def msg_gloo_log
         | 
| 181 | 
            -
                    return  | 
| 182 | 
            +
                    return @engine.settings.log_path
         | 
| 182 183 | 
             
                  end
         | 
| 183 184 |  | 
| 184 185 | 
             
                  # ---------------------------------------------------------------------
         | 
| @@ -196,12 +197,12 @@ module GlooLang | |
| 196 197 |  | 
| 197 198 | 
             
                  # Get the number of lines on screen.
         | 
| 198 199 | 
             
                  def msg_screen_lines
         | 
| 199 | 
            -
                    return GlooLang::App::Settings.lines
         | 
| 200 | 
            +
                    return GlooLang::App::Settings.lines( @engine )
         | 
| 200 201 | 
             
                  end
         | 
| 201 202 |  | 
| 202 203 | 
             
                  # Get the number of columns on screen.
         | 
| 203 204 | 
             
                  def msg_screen_cols
         | 
| 204 | 
            -
                    return GlooLang::App::Settings.cols
         | 
| 205 | 
            +
                    return GlooLang::App::Settings.cols( @engine )
         | 
| 205 206 | 
             
                  end
         | 
| 206 207 |  | 
| 207 208 | 
             
                  # ---------------------------------------------------------------------
         | 
    
        data/lib/gloo_lang/core/heap.rb
    CHANGED
    
    | @@ -19,13 +19,14 @@ module GlooLang | |
| 19 19 | 
             
                  #
         | 
| 20 20 | 
             
                  # Set up the object heap.
         | 
| 21 21 | 
             
                  #
         | 
| 22 | 
            -
                  def initialize
         | 
| 23 | 
            -
                     | 
| 22 | 
            +
                  def initialize( engine )
         | 
| 23 | 
            +
                    @engine = engine
         | 
| 24 | 
            +
                    @engine.log.debug 'object heap intialized...'
         | 
| 24 25 |  | 
| 25 | 
            -
                    @root = GlooLang::Objs::Container.new
         | 
| 26 | 
            +
                    @root = GlooLang::Objs::Container.new( @engine)
         | 
| 26 27 | 
             
                    @root.name = 'root'
         | 
| 27 28 |  | 
| 28 | 
            -
                    @context = Pn.root
         | 
| 29 | 
            +
                    @context = Pn.root engine
         | 
| 29 30 | 
             
                    @it = It.new
         | 
| 30 31 | 
             
                    @error = Error.new
         | 
| 31 32 | 
             
                  end
         | 
    
        data/lib/gloo_lang/core/here.rb
    CHANGED
    
    | @@ -21,8 +21,8 @@ module GlooLang | |
| 21 21 | 
             
                  #
         | 
| 22 22 | 
             
                  # Expand here reference if present.
         | 
| 23 23 | 
             
                  #
         | 
| 24 | 
            -
                  def self.expand_here( pn )
         | 
| 25 | 
            -
                    target =  | 
| 24 | 
            +
                  def self.expand_here( engine, pn )
         | 
| 25 | 
            +
                    target = engine.exec_env.here_obj
         | 
| 26 26 |  | 
| 27 27 | 
             
                    here = pn.elements.first
         | 
| 28 28 | 
             
                    remainder = pn.elements[ 1..-1 ].join( '.' )
         | 
    
        data/lib/gloo_lang/core/obj.rb
    CHANGED
    
    | @@ -15,7 +15,8 @@ module GlooLang | |
| 15 15 | 
             
                  #
         | 
| 16 16 | 
             
                  # Set up the object.
         | 
| 17 17 | 
             
                  #
         | 
| 18 | 
            -
                  def initialize
         | 
| 18 | 
            +
                  def initialize( engine )
         | 
| 19 | 
            +
                    @engine = engine
         | 
| 19 20 | 
             
                    @value = ''
         | 
| 20 21 | 
             
                    @children = []
         | 
| 21 22 | 
             
                    @parent = nil
         | 
| @@ -152,7 +153,7 @@ module GlooLang | |
| 152 153 | 
             
                               :type => type,
         | 
| 153 154 | 
             
                               :value => nil,
         | 
| 154 155 | 
             
                               :parent => self }
         | 
| 155 | 
            -
                    return  | 
| 156 | 
            +
                    return @engine.factory.create params
         | 
| 156 157 | 
             
                  end
         | 
| 157 158 |  | 
| 158 159 | 
             
                  #
         | 
| @@ -193,7 +194,7 @@ module GlooLang | |
| 193 194 | 
             
                    end
         | 
| 194 195 |  | 
| 195 196 | 
             
                    if self.type_display == GlooLang::Objs::Alias.typename
         | 
| 196 | 
            -
                      ln = GlooLang::Core::Pn.new( self.value )
         | 
| 197 | 
            +
                      ln = GlooLang::Core::Pn.new( @engine, self.value )
         | 
| 197 198 | 
             
                      redirect = ln.resolve
         | 
| 198 199 | 
             
                      return redirect.find_child( name )
         | 
| 199 200 | 
             
                    end
         | 
| @@ -256,7 +257,7 @@ module GlooLang | |
| 256 257 | 
             
                    @params = params
         | 
| 257 258 | 
             
                    return self.dispatch msg if self.can_receive_message? msg
         | 
| 258 259 |  | 
| 259 | 
            -
                     | 
| 260 | 
            +
                    @engine.log.error "Object #{self.name} cannot receive message #{msg}"
         | 
| 260 261 | 
             
                    return false
         | 
| 261 262 | 
             
                  end
         | 
| 262 263 |  | 
| @@ -269,7 +270,7 @@ module GlooLang | |
| 269 270 | 
             
                      self.public_send( o )
         | 
| 270 271 | 
             
                      return true
         | 
| 271 272 | 
             
                    else
         | 
| 272 | 
            -
                       | 
| 273 | 
            +
                      @engine.log.error "Message #{msg} not implemented"
         | 
| 273 274 | 
             
                      return false
         | 
| 274 275 | 
             
                    end
         | 
| 275 276 | 
             
                  end
         | 
| @@ -279,12 +280,12 @@ module GlooLang | |
| 279 280 | 
             
                  #
         | 
| 280 281 | 
             
                  def msg_unload
         | 
| 281 282 | 
             
                    if self.root?
         | 
| 282 | 
            -
                       | 
| 283 | 
            +
                      @engine.log.error 'Cannot unload the root object.'
         | 
| 283 284 | 
             
                      return
         | 
| 284 285 | 
             
                    end
         | 
| 285 286 |  | 
| 286 | 
            -
                     | 
| 287 | 
            -
                     | 
| 287 | 
            +
                    @engine.event_manager.on_unload self
         | 
| 288 | 
            +
                    @engine.heap.unload self
         | 
| 288 289 | 
             
                  end
         | 
| 289 290 |  | 
| 290 291 | 
             
                  # ---------------------------------------------------------------------
         | 
| @@ -13,13 +13,13 @@ module GlooLang | |
| 13 13 | 
             
                  # the given name.
         | 
| 14 14 | 
             
                  # If the container isn't provided, root will be used.
         | 
| 15 15 | 
             
                  #
         | 
| 16 | 
            -
                  def self.by_name( name, container = nil )
         | 
| 17 | 
            -
                    container =  | 
| 16 | 
            +
                  def self.by_name( engine, name, container = nil )
         | 
| 17 | 
            +
                    container = engine.heap.root if container.nil?
         | 
| 18 18 | 
             
                    arr = []
         | 
| 19 19 |  | 
| 20 20 | 
             
                    container.children.each do |o|
         | 
| 21 21 | 
             
                      arr << o if o.name == name
         | 
| 22 | 
            -
                      arr += by_name( name, o ) if o.child_count.positive?
         | 
| 22 | 
            +
                      arr += by_name( engine, name, o ) if o.child_count.positive?
         | 
| 23 23 | 
             
                    end
         | 
| 24 24 |  | 
| 25 25 | 
             
                    return arr
         |