Module: Gotta::Mod

Defined in:
lib/gotta/mod.rb,
lib/gotta/mod/hub.rb,
lib/gotta/mod/event.rb,
lib/gotta/mod/cli/new.rb,
lib/gotta/mod/version.rb,
lib/gotta/mod/listener.rb,
lib/gotta/mod/cli/watch.rb,
lib/gotta/mod/mod_builder.rb

Defined Under Namespace

Modules: CLI Classes: Error, Event, Hub, Listener, MissingDependencyError, ModBuilder

Constant Summary collapse

VERSION =
"0.1.2"

Class Method Summary collapse

Class Method Details

.hubObject



20
21
22
# File 'lib/gotta/mod.rb', line 20

def self.hub
  @@hub
end

.hub=(hub_instance) ⇒ Object



16
17
18
# File 'lib/gotta/mod.rb', line 16

def self.hub=(hub_instance)
  @@hub = hub_instance
end

.now(dir: Dir.pwd) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/gotta/mod.rb', line 24

def self.now(dir: Dir.pwd)
  project = Gotta::Project.new(dir)
  Gotta::Project.config = project
  listener = Listener.new(working_directory: dir)
  self.hub = Hub.new(listener.queue)
  hub_thread = Thread.new {hub.start} # Hub runs on a separate thread.
  # Now require all `main.rb` files inside the mods folder
  Dir.glob("#{project.mods_dir}/*") do |f|
    rbfile = "#{f}/#{File.basename(f)}.rb"
    ModBuilder.class_eval(File.read(rbfile), rbfile)
  end
  hub.check_dependencies
  listener.start
  puts "Ready for action."
  sleep
end