Class: Monoz::Application

Inherits:
Thor
  • Object
show all
Defined in:
lib/monoz/application.rb

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Application

Returns a new instance of Application.



12
13
14
15
# File 'lib/monoz/application.rb', line 12

def initialize(*args)
  super
  Monoz.app = self
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(action_name, *args) ⇒ Object



68
69
70
# File 'lib/monoz/application.rb', line 68

def method_missing(action_name, *args)
  Monoz::Services::ActionService.new(self).call(action_name)
end

Instance Method Details

#bundle(*command) ⇒ Object



23
24
25
26
27
28
29
30
# File 'lib/monoz/application.rb', line 23

def bundle(*command)
  return help("bundle") if command.nil? || command.first == "help"

  projects = Monoz.projects.order(:dependants)
  Monoz::Services::RunService.new(self).call(projects, "bundle", *command)

  say "The command ran successfully in all project directories without any errors.", [:green]
end

#init(path = ".") ⇒ Object



18
19
20
# File 'lib/monoz/application.rb', line 18

def init(path = ".")
  Monoz::Services::InitService.new(self).call(path)
end


33
34
35
36
37
38
39
40
41
42
43
# File 'lib/monoz/application.rb', line 33

def link
  say "Linking gems to local directories by setting the source directory in bundle config", [:blue, :bold]
  say "Please ensure you're not including ", :yellow
  say ".bundle/config ", [:yellow, :bold]
  say "file in your git repository by mistake", :yellow
  say ""

  Monoz::Services::BundleService.new(self).link_local_gems!(Monoz.projects)

  say "Successfully linked all gem directories without any errors.", [:green]
end

#projectsObject



46
47
48
# File 'lib/monoz/application.rb', line 46

def projects
  Monoz.projects.order(:name).to_table
end

#run_action(*command) ⇒ Object



52
53
54
55
56
57
58
59
# File 'lib/monoz/application.rb', line 52

def run_action(*command)
  return help("run") if command.empty? || command.first == "help"

  projects = Monoz.projects.order(:dependants)
  Monoz::Services::RunService.new(self).call(projects, *command)

  say "The command ran successfully in all project directories without any errors.", [:green]
end

#versionObject



62
63
64
# File 'lib/monoz/application.rb', line 62

def version
  say "Monoz version: #{Monoz::VERSION}"
end