Module: UnderOs

Extended by:
__FILE__
Defined in:
lib/under_os.rb

Defined Under Namespace

Modules: Events, UI Classes: App, Color, Config, File, HTTP, History, Page, Parser, Point, Screen, Timer

Constant Summary collapse

VERSION =
'1.3.0'

Class Method Summary collapse

Class Method Details

.extend(__file__, &block) ⇒ Object

Generic ecosystem extension hook, for plugins and such

require('under-os')

UnderOs.extend __FILE__ do |app|
  app.extra_things..
end


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/under_os.rb', line 13

def self.extend(__file__, &block)
  UnderOs.setup_callbacks[__file__] = block
  UnderOs.setup_callbacks.size == 1 && Motion::Project::App.instance_eval do
    alias :setup_before_under_os :setup
    def setup(*args, &block)
      config.setup_blocks << proc do |app|
        UnderOs.setup_callbacks.each do |__file__, block|
          Dir.glob(File.dirname(__file__) + '/**/*.rb').reverse.each do |file|
            app.files.insert(0, file) if file != __file__
          end

          module_assets_folder = File.dirname(__file__) + "/assets"
          app.resources_dirs << module_assets_folder if File.exists?(module_assets_folder)

          block.call(app) if block
        end
      end

      setup_before_under_os *args, &block
    end
  end
end

.setup_callbacksObject



36
37
38
# File 'lib/under_os.rb', line 36

def self.setup_callbacks
  @callbacks ||= {}
end