Class: Jets::CLI::Main

Inherits:
Thor
  • Object
show all
Defined in:
lib/jets/cli/main.rb

Constant Summary collapse

RESERVED_COMMANDS =
%i[all generate gems engines].freeze

Class Method Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(engine_or_gem, *args) ⇒ Object



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/jets/cli/main.rb', line 57

def method_missing(engine_or_gem, *args)
  options =
    case engine_or_gem.to_s
    when "all"
      {all: true}
    when "all-gems"
      {all_gems: true}
    when "all-engines"
      {all_engines: true}
    when *engines
      {engine: engine_or_gem.to_s}
    when *gems
      {engine: engine_or_gem.to_s, gem: true}
    end

  return super if options.nil?

  self.class.start(args, class_options: options)
end

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/jets/cli/main.rb', line 13

def self.exit_on_failure?
  true
end

Instance Method Details

#bundle(*args) ⇒ Object



21
22
23
# File 'lib/jets/cli/main.rb', line 21

def bundle(*args)
  exec_command("bundle", *args)
end

#consoleObject



36
37
38
# File 'lib/jets/cli/main.rb', line 36

def console
  exec_command("./bin/console")
end

#rails(*args) ⇒ Object



45
46
47
# File 'lib/jets/cli/main.rb', line 45

def rails(*args)
  exec_command("./bin/rails", *args)
end

#respond_to_missing?(engine_or_gem, *args) ⇒ Boolean

Returns:

  • (Boolean)


77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/jets/cli/main.rb', line 77

def respond_to_missing?(engine_or_gem, *args)
  case engine_or_gem.to_s
  when "all"
    true
  when "all-gems"
    true
  when "all-engines"
    true
  when *engines
    true
  when *gems
    true
  else
    false
  end
end

#yarn(*args) ⇒ Object



53
54
55
# File 'lib/jets/cli/main.rb', line 53

def yarn(*args)
  exec_command("yarn", *args)
end